Bug 228245

Summary: [BigSur wk1 Release arm64] imported/w3c/web-platform-tests/workers/modules/shared-worker-import-csp.html is a flaky failure
Product: WebKit Reporter: Eric Hutchison <ehutchison>
Component: Service WorkersAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, cdumez, ehutchison, webkit-bot-watchers-bugzilla, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Eric Hutchison 2021-07-23 13:52:42 PDT
imported/w3c/web-platform-tests/workers/modules/shared-worker-import-csp.html 

is a flaky failure on BigSur wk1 Release arm64 since test release on platform.

History: https://results.webkit.org/?suite=layout-tests&test=imported%2Fw3c%2Fweb-platform-tests%2Fworkers%2Fmodules%2Fshared-worker-import-csp.html&platform=ios&platform=mac

Diff: 

--- /Volumes/Data/worker/bigsur-release-applesilicon-tests-wk1/build/layout-test-results/imported/w3c/web-platform-tests/workers/modules/shared-worker-import-csp-expected.txt
+++ /Volumes/Data/worker/bigsur-release-applesilicon-tests-wk1/build/layout-test-results/imported/w3c/web-platform-tests/workers/modules/shared-worker-import-csp-actual.txt
@@ -14,15 +14,4 @@
 CONSOLE MESSAGE: ReferenceError: Can't find variable: SharedWorker
 CONSOLE MESSAGE: ReferenceError: Can't find variable: SharedWorker
 CONSOLE MESSAGE: ReferenceError: Can't find variable: SharedWorker
-CONSOLE MESSAGE: ReferenceError: Can't find variable: SharedWorker
 
-FAIL worker-src 'self' directive should disallow cross origin static import. assert_array_equals: value is object "[object Object]", expected array
-FAIL worker-src * directive should allow cross origin static import. assert_array_equals: value is object "[object Object]", expected array
-FAIL script-src 'self' directive should disallow cross origin static import. assert_array_equals: value is object "[object Object]", expected array
-FAIL script-src * directive should allow cross origin static import. assert_array_equals: value is object "[object Object]", expected array
-FAIL worker-src * directive should override script-src 'self' directive and allow cross origin static import. assert_array_equals: value is object "[object Object]", expected array
-FAIL worker-src 'self' directive should override script-src * directive and disallow cross origin static import. assert_array_equals: value is object "[object Object]", expected array
-FAIL script-src 'self' directive should disallow cross origin dynamic import. assert_array_equals: value is object "[object Object]", expected array
-FAIL script-src * directive should allow cross origin dynamic import. assert_array_equals: value is object "[object Object]", expected array
-FAIL worker-src 'self' directive should not take effect on dynamic import. assert_array_equals: value is object "[object Object]", expected array
-

Reproduced using run-webkit-tests -1 --iterations 500 --exit-after-n-failures 2 -f imported/w3c/web-platform-tests/workers/modules/shared-worker-import-csp.html on r280247
Comment 1 Radar WebKit Bug Importer 2021-07-23 13:53:37 PDT
<rdar://problem/81034895>
Comment 2 Eric Hutchison 2021-07-23 14:01:18 PDT
Updated test expectations on https://trac.webkit.org/changeset/280257/webkit.
Comment 3 Chris Dumez 2021-09-15 12:13:12 PDT
Seems to have to do with the following code in LayoutTests/resources/testharnessreport.js:

```
// Wait for any other completion callbacks, which may eliminate test elements
// from the page and therefore reduce the output.
setTimeout(function () {
    testRunner.forceImmediateCompletion();
}, 0);
```

The 0 timer here seems to sometimes cause the test to finish before all the windows have closed (Test relies on `add_result_callback(() => win.close());`) and it affects the output.