diff --git a/content/base/src/nsCSPParser.cpp b/content/base/src/nsCSPParser.cpp index 718e724cf6e5..3fe7207492e8 100644 --- a/content/base/src/nsCSPParser.cpp +++ b/content/base/src/nsCSPParser.cpp @@ -822,13 +822,6 @@ nsCSPParser::directive() return; } - if (mCurDir.Length() < 2) { - const char16_t* params[] = { mCurToken.get() }; - logWarningErrorToConsole(nsIScriptError::warningFlag, "failedToParseUnrecognizedSource", - params, ArrayLength(params)); - return; - } - // Try to create a new CSPDirective nsCSPDirective* cspDir = directiveName(); if (!cspDir) { @@ -840,13 +833,11 @@ nsCSPParser::directive() nsTArray srcs; directiveValue(srcs); - // If we can not parse any srcs; it's not worth having a directive; delete and return + // If we can not parse any srcs; we let the source expression be the empty set ('none') + // see, http://www.w3.org/TR/CSP11/#source-list-parsing if (srcs.Length() == 0) { - const char16_t* params[] = { mCurToken.get() }; - logWarningErrorToConsole(nsIScriptError::warningFlag, "failedToParseUnrecognizedSource", - params, ArrayLength(params)); - delete cspDir; - return; + nsCSPKeywordSrc *keyword = new nsCSPKeywordSrc(CSP_NONE); + srcs.AppendElement(keyword); } // Add the newly created srcs to the directive and add the directive to the policy