WebKit Bugzilla
Attachment 358460 Details for
Bug 193178
: LayoutTests/http/wpt/fetch/csp-reports-bypass-csp-checks.html is flaky
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193178-20190106105527.patch (text/plain), 3.04 KB, created by
youenn fablet
on 2019-01-06 10:55:28 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-01-06 10:55:28 PST
Size:
3.04 KB
patch
obsolete
>Subversion Revision: 239660 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 65764df88628876104a623240c9e5a95e475028f..afb0c30bb0ba5faefa84d0ad6109e40bfbd3f7aa 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,18 @@ >+2019-01-06 Youenn Fablet <youenn@apple.com> >+ >+ LayoutTests/http/wpt/fetch/csp-reports-bypass-csp-checks.html is flaky >+ https://bugs.webkit.org/show_bug.cgi?id=193178 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test was flaky as the ping load CSP report request might be sent after the >+ fetch that grabs the report. >+ To overcome that issue, fetch the report several times until receiving a report. >+ >+ * http/wpt/fetch/csp-reports-bypass-csp-checks.html: >+ * http/wpt/fetch/resources/store-csp-report.py: >+ (main): >+ > 2019-01-05 Youenn Fablet <youenn@apple.com> > > service worker fetch handler results in bad referrer >diff --git a/LayoutTests/http/wpt/fetch/csp-reports-bypass-csp-checks.html b/LayoutTests/http/wpt/fetch/csp-reports-bypass-csp-checks.html >index db52182f813ecc63b6e206aa195e85b912385a86..c8642877ed3ac53c2ccce917e1afea4575931463 100644 >--- a/LayoutTests/http/wpt/fetch/csp-reports-bypass-csp-checks.html >+++ b/LayoutTests/http/wpt/fetch/csp-reports-bypass-csp-checks.html >@@ -5,9 +5,17 @@ > <body> > <script> > document.addEventListener("securitypolicyviolation", async () => { >- const response = await fetch("/WebKit/fetch/resources/store-csp-report.py?retrieve=true&file=reports-bypass-csp-checks"); >- let results = await response.json(); >- >+ let counter = 0; >+ let text; >+ while (++counter <= 20) { >+ const response = await fetch("/WebKit/fetch/resources/store-csp-report.py?retrieve=true&file=reports-bypass-csp-checks"); >+ text = await response.text(); >+ // Let's check whether we have a CSP report. >+ if (text.startsWith("{")) >+ break; >+ await new Promise(resolve => setTimeout(resolve, 50)); >+ } >+ let results = JSON.parse(text); > const report = results["csp-report"]; > if (report["effective-directive"] === "connect-src") { > assert_equals(report["blocked-uri"], "http://localhost:8888"); >diff --git a/LayoutTests/http/wpt/fetch/resources/store-csp-report.py b/LayoutTests/http/wpt/fetch/resources/store-csp-report.py >index 75ce221e72b59e6f00b2a9604882f8257300be68..373a5453c17bc22b9065a60b068b9568ddf010ab 100644 >--- a/LayoutTests/http/wpt/fetch/resources/store-csp-report.py >+++ b/LayoutTests/http/wpt/fetch/resources/store-csp-report.py >@@ -23,6 +23,11 @@ def main(request, response): > value = request.server.stash.take(testId) > response.writer.write(value) > except (KeyError, ValueError) as e: >+ response.headers.set("Access-Control-Allow-Origin", "*") >+ response.headers.set("Cache-Control", "no-cache, no-store, must-revalidate") >+ response.headers.set("Pragma", "no-cache") >+ response.headers.set("Expires", "0") >+ response.writer.end_headers() > response.writer.write("No report has been recorded " + str(e)) > pass >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193178
: 358460