Skip to content

Commit cd4782c

Browse files
committed
Worklet.addModule() should reject promise with an AbortError when the network load fails
https://bugs.webkit.org/show_bug.cgi?id=219135 Reviewed by Geoffrey Garen. LayoutTests/imported/w3c: Rebaseline WPT tests now that more checks are passing (or keep failing with slighly different output). * web-platform-tests/worklets/audio-worklet-credentials.https-expected.txt: * web-platform-tests/worklets/audio-worklet-import.https-expected.txt: Source/WebCore: Worklet.addModule() should reject promise with an AbortError when the network load fails: - https://html.spec.whatwg.org/multipage/worklets.html#dom-worklet-addmodule This also aligns our behavior with Blink. No new tests, rebaselined existing tests. * worklets/WorkletGlobalScope.cpp: (WebCore::WorkletGlobalScope::notifyFinished): LayoutTests: Update existing tests to reflect behavior change. * http/wpt/webaudio/audioworklet-addModule-cors.sub.https.html: * webaudio/audioworklet-addModule-failure-expected.txt: * webaudio/audioworklet-addModule-failure.html: Canonical link: https://commits.webkit.org/231774@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270033 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent cc8d11f commit cd4782c

9 files changed

Lines changed: 58 additions & 15 deletions

File tree

LayoutTests/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2020-11-19 Chris Dumez <cdumez@apple.com>
2+
3+
Worklet.addModule() should reject promise with an AbortError when the network load fails
4+
https://bugs.webkit.org/show_bug.cgi?id=219135
5+
6+
Reviewed by Geoffrey Garen.
7+
8+
Update existing tests to reflect behavior change.
9+
10+
* http/wpt/webaudio/audioworklet-addModule-cors.sub.https.html:
11+
* webaudio/audioworklet-addModule-failure-expected.txt:
12+
* webaudio/audioworklet-addModule-failure.html:
13+
114
2020-11-19 Commit Queue <commit-queue@webkit.org>
215

316
Unreviewed, reverting r270009.

LayoutTests/http/wpt/webaudio/audioworklet-addModule-cors.sub.https.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
promise_test((t) => {
1818
const context = new OfflineAudioContext(2, 100, 44100);
19-
return promise_rejects_dom(t, "NetworkError", context.audioWorklet.addModule("https://{{hosts[alt][]}}:{{ports[https][0]}}/WebKit/webaudio/resources/dummy-worklet.py"));
19+
return promise_rejects_dom(t, "AbortError", context.audioWorklet.addModule("https://{{hosts[alt][]}}:{{ports[https][0]}}/WebKit/webaudio/resources/dummy-worklet.py"));
2020
}, "cross origin fails without CORS headers");
2121

2222
promise_test((t) => {

LayoutTests/imported/w3c/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2020-11-19 Chris Dumez <cdumez@apple.com>
2+
3+
Worklet.addModule() should reject promise with an AbortError when the network load fails
4+
https://bugs.webkit.org/show_bug.cgi?id=219135
5+
6+
Reviewed by Geoffrey Garen.
7+
8+
Rebaseline WPT tests now that more checks are passing (or keep failing with slighly different
9+
output).
10+
11+
* web-platform-tests/worklets/audio-worklet-credentials.https-expected.txt:
12+
* web-platform-tests/worklets/audio-worklet-import.https-expected.txt:
13+
114
2020-11-19 Chris Dumez <cdumez@apple.com>
215

316
Resync web-platform-tests/beacon tests from upstream
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
CONSOLE MESSAGE: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin.
22

3-
FAIL Importing a same-origin script with the default WorkletOptions should send the credentials promise_test: Unhandled rejection with value: object "NetworkError: Failed to fetch module, error: Response is not 2xx"
3+
FAIL Importing a same-origin script with the default WorkletOptions should send the credentials promise_test: Unhandled rejection with value: object "AbortError: Failed to fetch module, error: Response is not 2xx"
44
PASS Importing a remote-origin script with the default WorkletOptions should not send the credentials
5-
FAIL Importing a same-origin script with credentials=omit should not send the credentials promise_test: Unhandled rejection with value: object "NetworkError: Failed to fetch module, error: Response is not 2xx"
5+
FAIL Importing a same-origin script with credentials=omit should not send the credentials promise_test: Unhandled rejection with value: object "AbortError: Failed to fetch module, error: Response is not 2xx"
66
PASS Importing a remote-origin script with credentials=omit should not send the credentials
7-
FAIL Importing a same-origin script with credentials=same-origin should send the credentials promise_test: Unhandled rejection with value: object "NetworkError: Failed to fetch module, error: Response is not 2xx"
7+
FAIL Importing a same-origin script with credentials=same-origin should send the credentials promise_test: Unhandled rejection with value: object "AbortError: Failed to fetch module, error: Response is not 2xx"
88
PASS Importing a remote-origin script with credentials=same-origin should not send the credentials
9-
FAIL Importing a same-origin script with credentials=include should send the credentials promise_test: Unhandled rejection with value: object "NetworkError: Failed to fetch module, error: Response is not 2xx"
10-
FAIL Importing a remote-origin script with credentials=include should send the credentials promise_test: Unhandled rejection with value: object "NetworkError: Failed to fetch module, error: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
9+
FAIL Importing a same-origin script with credentials=include should send the credentials promise_test: Unhandled rejection with value: object "AbortError: Failed to fetch module, error: Response is not 2xx"
10+
FAIL Importing a remote-origin script with credentials=include should send the credentials promise_test: Unhandled rejection with value: object "AbortError: Failed to fetch module, error: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin."
1111

LayoutTests/imported/w3c/web-platform-tests/worklets/audio-worklet-import.https-expected.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ PASS Importing scripts resolves all the given promises.
66
PASS Importing nested scripts resolves the given promise
77
PASS Importing cyclic scripts resolves the given promise
88
PASS Importing a script which throws should still resolve the given promise.
9-
FAIL Importing a non-existent script rejects the given promise with an AbortError. promise_rejects_dom: function "function () { throw e }" threw object "NetworkError: Failed to fetch module, error: Response is not 2xx" that is not a DOMException AbortError: property "code" is equal to 19, expected 20
9+
PASS Importing a non-existent script rejects the given promise with an AbortError.
1010
PASS Importing an invalid URL should reject the given promise with a SyntaxError.
1111
PASS Importing a blob URL should resolve the given promise.
12-
FAIL Importing a file:// URL should reject the given promise. promise_rejects_dom: function "function () { throw e }" threw object "NetworkError: Failed to fetch module, error: Cross origin requests are only supported for HTTP." that is not a DOMException AbortError: property "code" is equal to 19, expected 20
13-
FAIL Importing a data URL should resolve the given promise. promise_test: Unhandled rejection with value: object "NetworkError: Failed to fetch module, error: Cross origin requests are only supported for HTTP."
14-
FAIL Importing about:blank should reject the given promise. promise_rejects_dom: function "function () { throw e }" threw object "NetworkError: Failed to fetch module, error: Cross origin requests are only supported for HTTP." that is not a DOMException AbortError: property "code" is equal to 19, expected 20
12+
PASS Importing a file:// URL should reject the given promise.
13+
FAIL Importing a data URL should resolve the given promise. promise_test: Unhandled rejection with value: object "AbortError: Failed to fetch module, error: Cross origin requests are only supported for HTTP."
14+
PASS Importing about:blank should reject the given promise.
1515
PASS Importing a cross origin resource with the Access-Control-Allow-Origin header should resolve the given promise
16-
FAIL Importing a cross origin resource without the Access-Control-Allow-Origin header should reject the given promise promise_rejects_dom: function "function () { throw e }" threw object "NetworkError: Failed to fetch module, error: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin." that is not a DOMException AbortError: property "code" is equal to 19, expected 20
16+
PASS Importing a cross origin resource without the Access-Control-Allow-Origin header should reject the given promise
1717
PASS Importing a cross-origin-redirected resource with the Access-Control-Allow-Origin header should resolve the given promise
18-
FAIL Importing a cross-origin-redirected resource without the Access-Control-Allow-Origin header should reject the given promise promise_rejects_dom: function "function () { throw e }" threw object "NetworkError: Failed to fetch module, error: Origin https://localhost:9443 is not allowed by Access-Control-Allow-Origin." that is not a DOMException AbortError: property "code" is equal to 19, expected 20
18+
PASS Importing a cross-origin-redirected resource without the Access-Control-Allow-Origin header should reject the given promise
1919
FAIL Importing a script that has a syntax error should reject the given promise. assert_unreached: Should have rejected: undefined Reached unreachable code
2020
FAIL Importing a nested script that has a syntax error should reject the given promise. assert_unreached: Should have rejected: undefined Reached unreachable code
2121
FAIL Importing a script that imports an invalid identifier should reject the given promise. assert_unreached: Should have rejected: undefined Reached unreachable code

LayoutTests/webaudio/audioworklet-addModule-failure-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
44

55

66
PASS context.audioWorklet.addModule(invalidURL); rejected promise with SyntaxError: Module URL is invalid.
7-
PASS context.audioWorklet.addModule('doesnotExist.js'); rejected promise with NetworkError: Failed to fetch module, error: The requested URL was not found on this server..
7+
PASS context.audioWorklet.addModule('doesnotExist.js'); rejected promise with AbortError: Failed to fetch module, error: The requested URL was not found on this server..
88
PASS successfullyParsed is true
99

1010
TEST COMPLETE

LayoutTests/webaudio/audioworklet-addModule-failure.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
async function test() {
1212
context = new OfflineAudioContext(2, 100, 44100);
1313
await shouldRejectWithErrorName("context.audioWorklet.addModule(invalidURL);", "SyntaxError");
14-
await shouldRejectWithErrorName("context.audioWorklet.addModule('doesnotExist.js');", "NetworkError");
14+
await shouldRejectWithErrorName("context.audioWorklet.addModule('doesnotExist.js');", "AbortError");
1515
finishJSTest();
1616
}
1717

Source/WebCore/ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2020-11-19 Chris Dumez <cdumez@apple.com>
2+
3+
Worklet.addModule() should reject promise with an AbortError when the network load fails
4+
https://bugs.webkit.org/show_bug.cgi?id=219135
5+
6+
Reviewed by Geoffrey Garen.
7+
8+
Worklet.addModule() should reject promise with an AbortError when the network load fails:
9+
- https://html.spec.whatwg.org/multipage/worklets.html#dom-worklet-addmodule
10+
11+
This also aligns our behavior with Blink.
12+
13+
No new tests, rebaselined existing tests.
14+
15+
* worklets/WorkletGlobalScope.cpp:
16+
(WebCore::WorkletGlobalScope::notifyFinished):
17+
118
2020-11-19 Antti Koivisto <antti@apple.com>
219

320
[LFC][Integration] Use inline iterator in CompositeEditCommand::deleteInsignificantText

Source/WebCore/worklets/WorkletGlobalScope.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void WorkletGlobalScope::notifyFinished()
198198
auto completedJob = m_scriptFetchJobs.takeFirst();
199199

200200
if (m_scriptLoader->failed()) {
201-
didCompleteScriptFetchJob(WTFMove(completedJob), Exception { NetworkError, makeString("Failed to fetch module, error: ", m_scriptLoader->error().localizedDescription()) });
201+
didCompleteScriptFetchJob(WTFMove(completedJob), Exception { AbortError, makeString("Failed to fetch module, error: ", m_scriptLoader->error().localizedDescription()) });
202202
return;
203203
}
204204

0 commit comments

Comments
 (0)