Title: [291918] branches/safari-613-branch
Revision
291918
Author
[email protected]
Date
2022-03-25 18:51:26 -0700 (Fri, 25 Mar 2022)

Log Message

Cherry-pick r290550. rdar://problem/88675827

    Update CSP handling of _javascript_ URLs
    https://bugs.webkit.org/show_bug.cgi?id=236351
    <rdar://problem/88675827>

    Reviewed by Brent Fulgham.

    LayoutTests/imported/w3c:

    * web-platform-tests/content-security-policy/navigation/to-_javascript_-parent-initiated-parent-csp-disallow-expected.txt:
    * web-platform-tests/content-security-policy/navigation/to-_javascript_-url-script-src-expected.txt:

    Source/WebCore:

    * bindings/js/ScriptController.cpp:
    (WebCore::ScriptController::executeJavaScriptURL):
    * loader/FrameLoader.cpp:
    (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
    (WebCore::createWindow):
    * loader/SubframeLoader.cpp:
    (WebCore::FrameLoader::SubframeLoader::requestFrame):
    * page/DOMWindow.cpp:
    (WebCore::DOMWindow::setLocation):
    * page/csp/ContentSecurityPolicy.cpp:
    (WebCore::ContentSecurityPolicy::allowJavaScriptURLs const):
    * page/csp/ContentSecurityPolicy.h:

    LayoutTests:

    * TestExpectations:
    * http/tests/security/contentSecurityPolicy/inline-script-blocked-_javascript_-url-expected.txt:
    * http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-by-default-src-star-expected.txt:
    * http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-expected.txt:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290550 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (291917 => 291918)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-26 01:51:26 UTC (rev 291918)
@@ -1,5 +1,57 @@
 2022-03-23  Alan Coon  <[email protected]>
 
+        Cherry-pick r290550. rdar://problem/88675827
+
+    Update CSP handling of _javascript_ URLs
+    https://bugs.webkit.org/show_bug.cgi?id=236351
+    <rdar://problem/88675827>
+    
+    Reviewed by Brent Fulgham.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/content-security-policy/navigation/to-_javascript_-parent-initiated-parent-csp-disallow-expected.txt:
+    * web-platform-tests/content-security-policy/navigation/to-_javascript_-url-script-src-expected.txt:
+    
+    Source/WebCore:
+    
+    * bindings/js/ScriptController.cpp:
+    (WebCore::ScriptController::executeJavaScriptURL):
+    * loader/FrameLoader.cpp:
+    (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
+    (WebCore::createWindow):
+    * loader/SubframeLoader.cpp:
+    (WebCore::FrameLoader::SubframeLoader::requestFrame):
+    * page/DOMWindow.cpp:
+    (WebCore::DOMWindow::setLocation):
+    * page/csp/ContentSecurityPolicy.cpp:
+    (WebCore::ContentSecurityPolicy::allowJavaScriptURLs const):
+    * page/csp/ContentSecurityPolicy.h:
+    
+    LayoutTests:
+    
+    * TestExpectations:
+    * http/tests/security/contentSecurityPolicy/inline-script-blocked-_javascript_-url-expected.txt:
+    * http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-by-default-src-star-expected.txt:
+    * http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-expected.txt:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290550 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-26  Kate Cheney  <[email protected]>
+
+            Update CSP handling of _javascript_ URLs
+            https://bugs.webkit.org/show_bug.cgi?id=236351
+            <rdar://problem/88675827>
+
+            Reviewed by Brent Fulgham.
+
+            * TestExpectations:
+            * http/tests/security/contentSecurityPolicy/inline-script-blocked-_javascript_-url-expected.txt:
+            * http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-by-default-src-star-expected.txt:
+            * http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-expected.txt:
+
+2022-03-23  Alan Coon  <[email protected]>
+
         Cherry-pick r290443. rdar://problem/89322580
 
     Update CSP console logging

Modified: branches/safari-613-branch/LayoutTests/TestExpectations (291917 => 291918)


--- branches/safari-613-branch/LayoutTests/TestExpectations	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/LayoutTests/TestExpectations	2022-03-26 01:51:26 UTC (rev 291918)
@@ -941,7 +941,6 @@
 imported/w3c/web-platform-tests/content-security-policy/prefetch-src/prefetch-header-allowed.html [ Skip ]
 imported/w3c/web-platform-tests/content-security-policy/prefetch-src/prefetch-blocked.html [ Skip ]
 imported/w3c/web-platform-tests/content-security-policy/prefetch-src/prefetch-allowed.html [ Skip ]
-imported/w3c/web-platform-tests/content-security-policy/navigation/to-_javascript_-url-script-src.html [ Skip ]
 imported/w3c/web-platform-tests/content-security-policy/navigate-to/spv-only-sent-to-initiator.sub.html [ Skip ]
 imported/w3c/web-platform-tests/content-security-policy/navigate-to/meta-refresh-redirected-blocked.sub.html [ Skip ]
 imported/w3c/web-platform-tests/content-security-policy/navigate-to/meta-refresh-cross-origin-blocked.sub.html [ Skip ]

Modified: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/inline-script-blocked-_javascript_-url-expected.txt (291917 => 291918)


--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/inline-script-blocked-_javascript_-url-expected.txt	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/inline-script-blocked-_javascript_-url-expected.txt	2022-03-26 01:51:26 UTC (rev 291918)
@@ -1,5 +1,5 @@
 CONSOLE MESSAGE: The 'options' directive has been replaced with 'unsafe-inline' and 'unsafe-eval' source expressions for the 'script-src' and 'style-src' directives. Please use those directives instead, as 'options' has no effect.
+CONSOLE MESSAGE: Refused to execute a script because its hash or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
 CONSOLE MESSAGE: The 'options' directive has been replaced with 'unsafe-inline' and 'unsafe-eval' source expressions for the 'script-src' and 'style-src' directives. Please use those directives instead, as 'options' has no effect.
 CONSOLE MESSAGE: The 'options' directive has been replaced with 'unsafe-inline' and 'unsafe-eval' source expressions for the 'script-src' and 'style-src' directives. Please use those directives instead, as 'options' has no effect.
-CONSOLE MESSAGE: Refused to execute a script because its hash or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
 This test passes if it doesn't alert fail.

Modified: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-by-default-src-star-expected.txt (291917 => 291918)


--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-by-default-src-star-expected.txt	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-by-default-src-star-expected.txt	2022-03-26 01:51:26 UTC (rev 291918)
@@ -1,4 +1,4 @@
+CONSOLE MESSAGE: Refused to execute a script because its hash or 'unsafe-inline' appears in neither the script-src directive nor the default-src directive of the Content Security Policy.
 CONSOLE MESSAGE: Refused to load _javascript_:alert('FAIL'); because it appears in neither the object-src directive nor the default-src directive of the Content Security Policy.
 CONSOLE MESSAGE: Refused to load _javascript_:alert('FAIL'); because it appears in neither the object-src directive nor the default-src directive of the Content Security Policy.
-CONSOLE MESSAGE: Refused to execute a script because its hash or 'unsafe-inline' appears in neither the script-src directive nor the default-src directive of the Content Security Policy.
 

Modified: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-expected.txt (291917 => 291918)


--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-expected.txt	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-expected.txt	2022-03-26 01:51:26 UTC (rev 291918)
@@ -1,5 +1,5 @@
 CONSOLE MESSAGE: The 'allow' directive has been replaced with 'default-src'. Please use that directive instead, as 'allow' has no effect.
+CONSOLE MESSAGE: Refused to execute a script because its hash or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
 CONSOLE MESSAGE: The 'allow' directive has been replaced with 'default-src'. Please use that directive instead, as 'allow' has no effect.
 CONSOLE MESSAGE: The 'allow' directive has been replaced with 'default-src'. Please use that directive instead, as 'allow' has no effect.
-CONSOLE MESSAGE: Refused to execute a script because its hash or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
 

Modified: branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog (291917 => 291918)


--- branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog	2022-03-26 01:51:26 UTC (rev 291918)
@@ -1,3 +1,53 @@
+2022-03-23  Alan Coon  <[email protected]>
+
+        Cherry-pick r290550. rdar://problem/88675827
+
+    Update CSP handling of _javascript_ URLs
+    https://bugs.webkit.org/show_bug.cgi?id=236351
+    <rdar://problem/88675827>
+    
+    Reviewed by Brent Fulgham.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/content-security-policy/navigation/to-_javascript_-parent-initiated-parent-csp-disallow-expected.txt:
+    * web-platform-tests/content-security-policy/navigation/to-_javascript_-url-script-src-expected.txt:
+    
+    Source/WebCore:
+    
+    * bindings/js/ScriptController.cpp:
+    (WebCore::ScriptController::executeJavaScriptURL):
+    * loader/FrameLoader.cpp:
+    (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
+    (WebCore::createWindow):
+    * loader/SubframeLoader.cpp:
+    (WebCore::FrameLoader::SubframeLoader::requestFrame):
+    * page/DOMWindow.cpp:
+    (WebCore::DOMWindow::setLocation):
+    * page/csp/ContentSecurityPolicy.cpp:
+    (WebCore::ContentSecurityPolicy::allowJavaScriptURLs const):
+    * page/csp/ContentSecurityPolicy.h:
+    
+    LayoutTests:
+    
+    * TestExpectations:
+    * http/tests/security/contentSecurityPolicy/inline-script-blocked-_javascript_-url-expected.txt:
+    * http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-by-default-src-star-expected.txt:
+    * http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-expected.txt:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290550 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-26  Kate Cheney  <[email protected]>
+
+            Update CSP handling of _javascript_ URLs
+            https://bugs.webkit.org/show_bug.cgi?id=236351
+            <rdar://problem/88675827>
+
+            Reviewed by Brent Fulgham.
+
+            * web-platform-tests/content-security-policy/navigation/to-_javascript_-parent-initiated-parent-csp-disallow-expected.txt:
+            * web-platform-tests/content-security-policy/navigation/to-_javascript_-url-script-src-expected.txt:
+
 2022-03-22  Alan Coon  <[email protected]>
 
         Cherry-pick r288792. rdar://problem/88227274

Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/navigation/to-_javascript_-parent-initiated-parent-csp-disallow-expected.txt (291917 => 291918)


--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/navigation/to-_javascript_-parent-initiated-parent-csp-disallow-expected.txt	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/navigation/to-_javascript_-parent-initiated-parent-csp-disallow-expected.txt	2022-03-26 01:51:26 UTC (rev 291918)
@@ -1,4 +1,4 @@
 
 
-FAIL Should not have executed the _javascript_ url assert_true: _javascript_ url executed expected true got false
+PASS Should not have executed the _javascript_ url
 

Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/navigation/to-_javascript_-url-script-src-expected.txt (291917 => 291918)


--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/navigation/to-_javascript_-url-script-src-expected.txt	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/navigation/to-_javascript_-url-script-src-expected.txt	2022-03-26 01:51:26 UTC (rev 291918)
@@ -1,12 +1,6 @@
-CONSOLE MESSAGE: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
-CONSOLE MESSAGE: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
-CONSOLE MESSAGE: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
 
+PASS <iframe src=''> blocked without 'unsafe-inline'.
+PASS <iframe> navigated to '_javascript_:' blocked without 'unsafe-inline'.
+PASS <iframe src=''> with 'unsafe-inline' navigated to '_javascript_:' blocked in this document
+PASS <iframe src=''> without 'unsafe-inline' navigated to '_javascript_:' blocked in this document.
 
-Harness Error (TIMEOUT), message = null
-
-TIMEOUT <iframe src=''> blocked without 'unsafe-inline'. Test timed out
-FAIL <iframe> navigated to '_javascript_:' blocked without 'unsafe-inline'. assert_unreached: The CSP event should be fired in the embedding document, not in the embedee. Reached unreachable code
-TIMEOUT <iframe src=''> with 'unsafe-inline' navigated to '_javascript_:' blocked in this document Test timed out
-FAIL <iframe src=''> without 'unsafe-inline' navigated to '_javascript_:' blocked in this document. assert_unreached: The CSP event should be fired in the embedding document, not in the embedee. Reached unreachable code
-

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (291917 => 291918)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-26 01:51:26 UTC (rev 291918)
@@ -1,5 +1,65 @@
 2022-03-23  Alan Coon  <[email protected]>
 
+        Cherry-pick r290550. rdar://problem/88675827
+
+    Update CSP handling of _javascript_ URLs
+    https://bugs.webkit.org/show_bug.cgi?id=236351
+    <rdar://problem/88675827>
+    
+    Reviewed by Brent Fulgham.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/content-security-policy/navigation/to-_javascript_-parent-initiated-parent-csp-disallow-expected.txt:
+    * web-platform-tests/content-security-policy/navigation/to-_javascript_-url-script-src-expected.txt:
+    
+    Source/WebCore:
+    
+    * bindings/js/ScriptController.cpp:
+    (WebCore::ScriptController::executeJavaScriptURL):
+    * loader/FrameLoader.cpp:
+    (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
+    (WebCore::createWindow):
+    * loader/SubframeLoader.cpp:
+    (WebCore::FrameLoader::SubframeLoader::requestFrame):
+    * page/DOMWindow.cpp:
+    (WebCore::DOMWindow::setLocation):
+    * page/csp/ContentSecurityPolicy.cpp:
+    (WebCore::ContentSecurityPolicy::allowJavaScriptURLs const):
+    * page/csp/ContentSecurityPolicy.h:
+    
+    LayoutTests:
+    
+    * TestExpectations:
+    * http/tests/security/contentSecurityPolicy/inline-script-blocked-_javascript_-url-expected.txt:
+    * http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-by-default-src-star-expected.txt:
+    * http/tests/security/contentSecurityPolicy/_javascript_-url-blocked-expected.txt:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290550 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-26  Kate Cheney  <[email protected]>
+
+            Update CSP handling of _javascript_ URLs
+            https://bugs.webkit.org/show_bug.cgi?id=236351
+            <rdar://problem/88675827>
+
+            Reviewed by Brent Fulgham.
+
+            * bindings/js/ScriptController.cpp:
+            (WebCore::ScriptController::executeJavaScriptURL):
+            * loader/FrameLoader.cpp:
+            (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
+            (WebCore::createWindow):
+            * loader/SubframeLoader.cpp:
+            (WebCore::FrameLoader::SubframeLoader::requestFrame):
+            * page/DOMWindow.cpp:
+            (WebCore::DOMWindow::setLocation):
+            * page/csp/ContentSecurityPolicy.cpp:
+            (WebCore::ContentSecurityPolicy::allowJavaScriptURLs const):
+            * page/csp/ContentSecurityPolicy.h:
+
+2022-03-23  Alan Coon  <[email protected]>
+
         Cherry-pick r290443. rdar://problem/89322580
 
     Update CSP console logging

Modified: branches/safari-613-branch/Source/WebCore/bindings/js/ScriptController.cpp (291917 => 291918)


--- branches/safari-613-branch/Source/WebCore/bindings/js/ScriptController.cpp	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/Source/WebCore/bindings/js/ScriptController.cpp	2022-03-26 01:51:26 UTC (rev 291918)
@@ -778,7 +778,7 @@
     if (requesterSecurityOrigin && !requesterSecurityOrigin->isSameOriginDomain(m_frame.document()->securityOrigin()))
         return;
 
-    if (!m_frame.page() || !m_frame.document()->contentSecurityPolicy()->allowJavaScriptURLs(m_frame.document()->url().string(), eventHandlerPosition().m_line, url.string()))
+    if (!m_frame.page() || !m_frame.document()->contentSecurityPolicy()->allowJavaScriptURLs(m_frame.document()->url().string(), eventHandlerPosition().m_line, url.string(), nullptr))
         return;
 
     // We need to hold onto the Frame here because executing script can

Modified: branches/safari-613-branch/Source/WebCore/loader/FrameLoader.cpp (291917 => 291918)


--- branches/safari-613-branch/Source/WebCore/loader/FrameLoader.cpp	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/Source/WebCore/loader/FrameLoader.cpp	2022-03-26 01:51:26 UTC (rev 291918)
@@ -3577,7 +3577,7 @@
 
     Ref<Frame> frame(m_frame);
 
-    if (request.url().protocolIsJavaScript() && !frame->document()->contentSecurityPolicy()->allowJavaScriptURLs(frame->document()->url().string(), { }, request.url().string()))
+    if (request.url().protocolIsJavaScript() && !frame->document()->contentSecurityPolicy()->allowJavaScriptURLs(frame->document()->url().string(), { }, request.url().string(), nullptr))
         return;
 
     RefPtr<Frame> mainFrame = m_client->dispatchCreatePage(action, openerPolicy);
@@ -4117,7 +4117,7 @@
     created = false;
 
     // FIXME: Provide line number information with respect to the opener's document.
-    if (request.resourceRequest().url().protocolIsJavaScript() && !openerFrame.document()->contentSecurityPolicy()->allowJavaScriptURLs(openerFrame.document()->url().string(), { }, request.resourceRequest().url().string()))
+    if (request.resourceRequest().url().protocolIsJavaScript() && !openerFrame.document()->contentSecurityPolicy()->allowJavaScriptURLs(openerFrame.document()->url().string(), { }, request.resourceRequest().url().string(), nullptr))
         return nullptr;
 
     if (!request.frameName().isEmpty() && !isBlankTargetFrameName(request.frameName())) {

Modified: branches/safari-613-branch/Source/WebCore/loader/SubframeLoader.cpp (291917 => 291918)


--- branches/safari-613-branch/Source/WebCore/loader/SubframeLoader.cpp	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/Source/WebCore/loader/SubframeLoader.cpp	2022-03-26 01:51:26 UTC (rev 291918)
@@ -85,6 +85,10 @@
     if (shouldConvertInvalidURLsToBlank() && !url.isValid())
         url = ""
 
+    // Check the CSP of the embedder to determine if we allow execution of _javascript_: URLs via child frame navigation.
+    if (!scriptURL.isEmpty() && !ownerElement.document().contentSecurityPolicy()->allowJavaScriptURLs(aboutBlankURL().string(), { }, scriptURL.string(), &ownerElement))
+        scriptURL = URL();
+
     // If we will schedule a _javascript_ URL load, we need to delay the firing of the load event at least until we've run the _javascript_ in the URL.
     CompletionHandlerCallingScope stopDelayingLoadEvent;
     if (!scriptURL.isEmpty()) {

Modified: branches/safari-613-branch/Source/WebCore/page/DOMWindow.cpp (291917 => 291918)


--- branches/safari-613-branch/Source/WebCore/page/DOMWindow.cpp	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/Source/WebCore/page/DOMWindow.cpp	2022-03-26 01:51:26 UTC (rev 291918)
@@ -2402,6 +2402,10 @@
     if (isInsecureScriptAccess(activeWindow, completedURL.string()))
         return;
 
+    // Check the CSP of the embedder to determine if we allow execution of _javascript_: URLs via child frame navigation.
+    if (completedURL.protocolIsJavaScript() && frameElement() && !frameElement()->document().contentSecurityPolicy()->allowJavaScriptURLs(aboutBlankURL().string(), { }, completedURL.string(), frameElement()))
+        return;
+
     // We want a new history item if we are processing a user gesture.
     LockHistory lockHistory = (locking != LockHistoryBasedOnGestureState || !UserGestureIndicator::processingUserGesture()) ? LockHistory::Yes : LockHistory::No;
     LockBackForwardList lockBackForwardList = (locking != LockHistoryBasedOnGestureState) ? LockBackForwardList::Yes : LockBackForwardList::No;

Modified: branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (291917 => 291918)


--- branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicy.cpp	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicy.cpp	2022-03-26 01:51:26 UTC (rev 291918)
@@ -363,15 +363,13 @@
     return hashes;
 }
 
-bool ContentSecurityPolicy::allowJavaScriptURLs(const String& contextURL, const OrdinalNumber& contextLine, const String& source, bool overrideContentSecurityPolicy) const
+bool ContentSecurityPolicy::allowJavaScriptURLs(const String& contextURL, const OrdinalNumber& contextLine, const String& source, Element* element) const
 {
-    if (overrideContentSecurityPolicy)
-        return true;
     bool didNotifyInspector = false;
     auto handleViolatedDirective = [&] (const ContentSecurityPolicyDirective& violatedDirective) {
         String consoleMessage = consoleMessageForViolation(ContentSecurityPolicyDirectiveNames::scriptSrc, violatedDirective, URL(), "Refused to execute a script", "its hash or 'unsafe-inline'");
         // FIXME (rdar://83332874) implement scriptSrcElem properly.
-        reportViolation(ContentSecurityPolicyDirectiveNames::scriptSrcElem, violatedDirective, "inline"_s, consoleMessage, contextURL, source, TextPosition(contextLine, OrdinalNumber()));
+        reportViolation(ContentSecurityPolicyDirectiveNames::scriptSrcElem, violatedDirective, "inline"_s, consoleMessage, contextURL, source, TextPosition(contextLine, OrdinalNumber()), URL(), nullptr, element);
         if (!didNotifyInspector && violatedDirective.directiveList().isReportOnly()) {
             reportBlockedScriptExecutionToInspector(violatedDirective.text());
             didNotifyInspector = true;

Modified: branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicy.h (291917 => 291918)


--- branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicy.h	2022-03-26 01:51:20 UTC (rev 291917)
+++ branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicy.h	2022-03-26 01:51:26 UTC (rev 291918)
@@ -98,7 +98,7 @@
     bool allowScriptWithNonce(const String& nonce, bool overrideContentSecurityPolicy = false) const;
     bool allowStyleWithNonce(const String& nonce, bool overrideContentSecurityPolicy = false) const;
 
-    bool allowJavaScriptURLs(const String& contextURL, const OrdinalNumber& contextLine, const String& code, bool overrideContentSecurityPolicy = false) const;
+    bool allowJavaScriptURLs(const String& contextURL, const OrdinalNumber& contextLine, const String& code, Element*) const;
     bool allowInlineEventHandlers(const String& contextURL, const OrdinalNumber& contextLine, const String& code, Element*, bool overrideContentSecurityPolicy = false) const;
     bool allowInlineScript(const String& contextURL, const OrdinalNumber& contextLine, StringView scriptContent, Element&, const String& nonce, bool overrideContentSecurityPolicy = false) const;
     bool allowNonParserInsertedScripts(const URL& sourceURL, const URL& contextURL, const OrdinalNumber&, const String& nonce, const StringView&, ParserInserted) const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to