diff options
author | New Tobin Paradigm <email@mattatobin.com> | 2018-04-12 10:49:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-12 10:49:23 -0400 |
commit | 4c2e77404f43040ce7a9f0d9052448b3f23a8c28 (patch) | |
tree | d7161a645a98f38dd18797cc80581446929f99c7 /dom/base | |
parent | a0968fc6a86c8ab1abfa83d3c1986fadf3ec2766 (diff) | |
parent | 9f7f0f1172d67ab29e4f72eb1b34ab6f4bb231b1 (diff) | |
download | UXP-4c2e77404f43040ce7a9f0d9052448b3f23a8c28.tar UXP-4c2e77404f43040ce7a9f0d9052448b3f23a8c28.tar.gz UXP-4c2e77404f43040ce7a9f0d9052448b3f23a8c28.tar.lz UXP-4c2e77404f43040ce7a9f0d9052448b3f23a8c28.tar.xz UXP-4c2e77404f43040ce7a9f0d9052448b3f23a8c28.zip |
Merge pull request #126 from janekptacijarabaci/js_X-Content-Type-Options_nosniff_json_1
Align XCTO: nosniff allowed script MIME types with the spec
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/nsContentUtils.cpp | 20 | ||||
-rw-r--r-- | dom/base/nsContentUtils.h | 7 |
2 files changed, 7 insertions, 20 deletions
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 02c6bf1de..ef87a250e 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -3717,11 +3717,15 @@ nsContentUtils::IsChildOfSameType(nsIDocument* aDoc) } bool -nsContentUtils::IsScriptType(const nsACString& aContentType) +nsContentUtils::IsPlainTextType(const nsACString& aContentType) { // NOTE: if you add a type here, add it to the CONTENTDLF_CATEGORIES // define in nsContentDLF.h as well. - return aContentType.EqualsLiteral(APPLICATION_JAVASCRIPT) || + return aContentType.EqualsLiteral(TEXT_PLAIN) || + aContentType.EqualsLiteral(TEXT_CSS) || + aContentType.EqualsLiteral(TEXT_CACHE_MANIFEST) || + aContentType.EqualsLiteral(TEXT_VTT) || + aContentType.EqualsLiteral(APPLICATION_JAVASCRIPT) || aContentType.EqualsLiteral(APPLICATION_XJAVASCRIPT) || aContentType.EqualsLiteral(TEXT_ECMASCRIPT) || aContentType.EqualsLiteral(APPLICATION_ECMASCRIPT) || @@ -3731,18 +3735,6 @@ nsContentUtils::IsScriptType(const nsACString& aContentType) } bool -nsContentUtils::IsPlainTextType(const nsACString& aContentType) -{ - // NOTE: if you add a type here, add it to the CONTENTDLF_CATEGORIES - // define in nsContentDLF.h as well. - return aContentType.EqualsLiteral(TEXT_PLAIN) || - aContentType.EqualsLiteral(TEXT_CSS) || - aContentType.EqualsLiteral(TEXT_CACHE_MANIFEST) || - aContentType.EqualsLiteral(TEXT_VTT) || - IsScriptType(aContentType); -} - -bool nsContentUtils::GetWrapperSafeScriptFilename(nsIDocument* aDocument, nsIURI* aURI, nsACString& aScriptURI, diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 0a293d73e..0932f451e 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -1018,12 +1018,7 @@ public: static bool IsChildOfSameType(nsIDocument* aDoc); /** - '* Returns true if the content-type is any of the supported script types. - */ - static bool IsScriptType(const nsACString& aContentType); - - /** - '* Returns true if the content-type will be rendered as plain-text. + * Returns true if the content-type will be rendered as plain-text. */ static bool IsPlainTextType(const nsACString& aContentType); |