Title: [291644] branches/safari-613-branch
- Revision
- 291644
- Author
- [email protected]
- Date
- 2022-03-22 10:55:18 -0700 (Tue, 22 Mar 2022)
Log Message
Cherry-pick r290830. rdar://problem/89081463
CSP report does not get sent to the document in the case of a detached element
https://bugs.webkit.org/show_bug.cgi?id=237440
<rdar://problem/89081463>
Reviewed by Chris Dumez.
Source/WebCore:
Test: http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached.html
Only send a violation report to the element if it is connected. Check
right before dispatching in case the element gets detached after the
security policy violation has been created. If the element is not
connected in this case, we send the report to the document.
* dom/Element.cpp:
(WebCore::Element::enqueueSecurityPolicyViolationEvent):
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::reportViolation const):
Also sets the composed value on the violation event as per the spec.
LayoutTests:
* http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-613-branch/LayoutTests/ChangeLog (291643 => 291644)
--- branches/safari-613-branch/LayoutTests/ChangeLog 2022-03-22 17:55:14 UTC (rev 291643)
+++ branches/safari-613-branch/LayoutTests/ChangeLog 2022-03-22 17:55:18 UTC (rev 291644)
@@ -1,5 +1,49 @@
2022-03-21 Alan Coon <[email protected]>
+ Cherry-pick r290830. rdar://problem/89081463
+
+ CSP report does not get sent to the document in the case of a detached element
+ https://bugs.webkit.org/show_bug.cgi?id=237440
+ <rdar://problem/89081463>
+
+ Reviewed by Chris Dumez.
+
+ Source/WebCore:
+
+ Test: http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached.html
+
+ Only send a violation report to the element if it is connected. Check
+ right before dispatching in case the element gets detached after the
+ security policy violation has been created. If the element is not
+ connected in this case, we send the report to the document.
+
+ * dom/Element.cpp:
+ (WebCore::Element::enqueueSecurityPolicyViolationEvent):
+ * page/csp/ContentSecurityPolicy.cpp:
+ (WebCore::ContentSecurityPolicy::reportViolation const):
+ Also sets the composed value on the violation event as per the spec.
+
+ LayoutTests:
+
+ * http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached-expected.txt: Added.
+ * http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-03-04 Kate Cheney <[email protected]>
+
+ CSP report does not get sent to the document in the case of a detached element
+ https://bugs.webkit.org/show_bug.cgi?id=237440
+ <rdar://problem/89081463>
+
+ Reviewed by Chris Dumez.
+
+ * http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached-expected.txt: Added.
+ * http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached.html: Added.
+
+2022-03-21 Alan Coon <[email protected]>
+
Cherry-pick r290676. rdar://problem/83831093
[Cocoa] HLS stream currentTime sometimes jumps backwards
Added: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached-expected.txt (0 => 291644)
--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached-expected.txt (rev 0)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached-expected.txt 2022-03-22 17:55:18 UTC (rev 291644)
@@ -0,0 +1,11 @@
+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.
+Tests that a detached element sends a CSP violation report to its document
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Successfully received violation event
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached.html (0 => 291644)
--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached.html (rev 0)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached.html 2022-03-22 17:55:18 UTC (rev 291644)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'nonce-test' 'unsafe-eval'">
+ <script src=""
+</head>
+<body>
+ <script nonce="test">
+ jsTestIsAsync = true;
+
+ description("Tests that a detached element sends a CSP violation report to its document");
+
+ document.addEventListener('securitypolicyviolation', e => {
+ if (e.composed)
+ testPassed("Successfully received violation event");
+ else
+ testFailed("composed value not set on security policy violation");
+
+ finishJSTest();
+ });
+
+ let inlineScript = document.createElement("script");
+ inlineScript.append("alert(FAIL)");
+ (document.head || document.documentElement).appendChild(inlineScript);
+ inlineScript.remove();
+ </script>
+</body>
+</html>
Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (291643 => 291644)
--- branches/safari-613-branch/Source/WebCore/ChangeLog 2022-03-22 17:55:14 UTC (rev 291643)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog 2022-03-22 17:55:18 UTC (rev 291644)
@@ -1,5 +1,59 @@
2022-03-21 Alan Coon <[email protected]>
+ Cherry-pick r290830. rdar://problem/89081463
+
+ CSP report does not get sent to the document in the case of a detached element
+ https://bugs.webkit.org/show_bug.cgi?id=237440
+ <rdar://problem/89081463>
+
+ Reviewed by Chris Dumez.
+
+ Source/WebCore:
+
+ Test: http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached.html
+
+ Only send a violation report to the element if it is connected. Check
+ right before dispatching in case the element gets detached after the
+ security policy violation has been created. If the element is not
+ connected in this case, we send the report to the document.
+
+ * dom/Element.cpp:
+ (WebCore::Element::enqueueSecurityPolicyViolationEvent):
+ * page/csp/ContentSecurityPolicy.cpp:
+ (WebCore::ContentSecurityPolicy::reportViolation const):
+ Also sets the composed value on the violation event as per the spec.
+
+ LayoutTests:
+
+ * http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached-expected.txt: Added.
+ * http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached.html: Added.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-03-04 Kate Cheney <[email protected]>
+
+ CSP report does not get sent to the document in the case of a detached element
+ https://bugs.webkit.org/show_bug.cgi?id=237440
+ <rdar://problem/89081463>
+
+ Reviewed by Chris Dumez.
+
+ Test: http/tests/security/contentSecurityPolicy/report-violation-to-document-after-element-has-been-detached.html
+
+ Only send a violation report to the element if it is connected. Check
+ right before dispatching in case the element gets detached after the
+ security policy violation has been created. If the element is not
+ connected in this case, we send the report to the document.
+
+ * dom/Element.cpp:
+ (WebCore::Element::enqueueSecurityPolicyViolationEvent):
+ * page/csp/ContentSecurityPolicy.cpp:
+ (WebCore::ContentSecurityPolicy::reportViolation const):
+ Also sets the composed value on the violation event as per the spec.
+
+2022-03-21 Alan Coon <[email protected]>
+
Cherry-pick r290820. rdar://problem/88301613
AVVideoCaptureSource should reuse CaptureDevice label
Modified: branches/safari-613-branch/Source/WebCore/dom/Element.cpp (291643 => 291644)
--- branches/safari-613-branch/Source/WebCore/dom/Element.cpp 2022-03-22 17:55:14 UTC (rev 291643)
+++ branches/safari-613-branch/Source/WebCore/dom/Element.cpp 2022-03-22 17:55:18 UTC (rev 291644)
@@ -3243,7 +3243,10 @@
void Element::enqueueSecurityPolicyViolationEvent(SecurityPolicyViolationEventInit&& eventInit)
{
document().eventLoop().queueTask(TaskSource::DOMManipulation, [this, protectedThis = Ref { *this }, event = SecurityPolicyViolationEvent::create(eventNames().securitypolicyviolationEvent, WTFMove(eventInit), Event::IsTrusted::Yes)] {
- dispatchEvent(event);
+ if (!isConnected())
+ document().dispatchEvent(event);
+ else
+ dispatchEvent(event);
});
}
Modified: branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (291643 => 291644)
--- branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2022-03-22 17:55:14 UTC (rev 291643)
+++ branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2022-03-22 17:55:18 UTC (rev 291644)
@@ -820,6 +820,7 @@
violationEventInit.columnNumber = info.columnNumber;
violationEventInit.sample = info.sample;
violationEventInit.bubbles = true;
+ violationEventInit.composed = true;
if (m_client)
m_client->enqueueSecurityPolicyViolationEvent(WTFMove(violationEventInit));
else {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes