Bug 1802173: Worklet.AddModule should return AbortError if fails to fetch the script. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D162867
This commit is contained in:
Yoshi Cheng-Hao Huang 2022-11-23 17:20:06 +00:00
Родитель c6b7ac16e0
Коммит 2c1867b493
2 изменённых файлов: 5 добавлений и 12 удалений

Просмотреть файл

@ -261,7 +261,11 @@ class WorkletFetchHandler final : public PromiseNativeHandler,
virtual void RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue,
ErrorResult& aRv) override {
MOZ_ASSERT(NS_IsMainThread());
RejectPromises(NS_ERROR_DOM_NETWORK_ERR);
// https://html.spec.whatwg.org/multipage/worklets.html#dom-worklet-addmodule
// Step 6.4.1. If script is null, then:
// Step 1.1.2. Reject promise with an "AbortError" DOMException.
RejectPromises(NS_ERROR_DOM_ABORT_ERR);
}
const nsCString& URL() const { return mURL; }

Просмотреть файл

@ -10,15 +10,6 @@
[Importing an invalid URL should reject the given promise with a SyntaxError.]
expected: FAIL
[Importing a file:// URL should reject the given promise.]
expected: FAIL
[Importing about:blank should reject the given promise.]
expected: FAIL
[Importing a cross origin resource without the Access-Control-Allow-Origin header should reject the given promise]
expected: FAIL
[Importing a script that has a syntax error should reject the given promise.]
expected: FAIL
@ -28,5 +19,3 @@
[Importing a script that imports an invalid identifier should reject the given promise.]
expected: FAIL
[Importing a cross-origin-redirected resource without the Access-Control-Allow-Origin header should reject the given promise]
expected: FAIL