mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
bindings: Convert certain Exceptions into Promise rejections (#32923)
* Impl promise exception to rejection for methods Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Impl promise exception to rejection for getters Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Impl promise exception to rejection for static methods Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Add tests for exception to rejection Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Expectations Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
fd83281657
commit
f3bec0aed3
11 changed files with 291 additions and 20 deletions
|
@ -72,7 +72,6 @@
|
|||
expected: FAIL
|
||||
|
||||
[Window interface: calling fetch(RequestInfo, optional RequestInit) on window with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[Window interface: operation fetch(RequestInfo, optional RequestInit)]
|
||||
expected: FAIL
|
||||
|
@ -170,7 +169,6 @@
|
|||
expected: FAIL
|
||||
|
||||
[WorkerGlobalScope interface: calling fetch(RequestInfo, optional RequestInit) on self with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[WorkerGlobalScope interface: operation fetch(RequestInfo, optional RequestInit)]
|
||||
expected: FAIL
|
||||
|
|
|
@ -69,7 +69,6 @@
|
|||
expected: FAIL
|
||||
|
||||
[WorkerGlobalScope interface: calling fetch(RequestInfo, optional RequestInit) on self with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[Request interface: operation bytes()]
|
||||
expected: FAIL
|
||||
|
@ -158,7 +157,6 @@
|
|||
expected: FAIL
|
||||
|
||||
[Window interface: calling fetch(RequestInfo, optional RequestInit) on window with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[Request interface: operation bytes()]
|
||||
expected: FAIL
|
||||
|
|
7
tests/wpt/mozilla/meta-legacy-layout/mozilla/exceptionToRejection.any.js.ini
vendored
Normal file
7
tests/wpt/mozilla/meta-legacy-layout/mozilla/exceptionToRejection.any.js.ini
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
[exceptionToRejection.any.html]
|
||||
type: testharness
|
||||
prefs: [dom.testbinding.enabled:true]
|
||||
|
||||
[exceptionToRejection.any.worker.html]
|
||||
type: testharness
|
||||
prefs: [dom.testbinding.enabled:true]
|
25
tests/wpt/mozilla/meta/MANIFEST.json
vendored
25
tests/wpt/mozilla/meta/MANIFEST.json
vendored
|
@ -13130,6 +13130,31 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"exceptionToRejection.any.js": [
|
||||
"738a8bedbcfe83a6f110bc6e6d133e31f80ea9ad",
|
||||
[
|
||||
"mozilla/exceptionToRejection.any.html",
|
||||
{
|
||||
"script_metadata": [
|
||||
[
|
||||
"title",
|
||||
"Test that promise exception are converted to rejections"
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
"mozilla/exceptionToRejection.any.worker.html",
|
||||
{
|
||||
"script_metadata": [
|
||||
[
|
||||
"title",
|
||||
"Test that promise exception are converted to rejections"
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"fetch_cannot_overwhelm_system.window.js": [
|
||||
"989231e9caedd099f5212bd2f9d377c83f929a22",
|
||||
[
|
||||
|
|
7
tests/wpt/mozilla/meta/mozilla/exceptionToRejection.any.js.ini
vendored
Normal file
7
tests/wpt/mozilla/meta/mozilla/exceptionToRejection.any.js.ini
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
[exceptionToRejection.any.html]
|
||||
type: testharness
|
||||
prefs: [dom.testbinding.enabled:true]
|
||||
|
||||
[exceptionToRejection.any.worker.html]
|
||||
type: testharness
|
||||
prefs: [dom.testbinding.enabled:true]
|
32
tests/wpt/mozilla/tests/mozilla/exceptionToRejection.any.js
vendored
Normal file
32
tests/wpt/mozilla/tests/mozilla/exceptionToRejection.any.js
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
// META: title=Test that promise exception are converted to rejections
|
||||
|
||||
var binding = new TestBinding();
|
||||
|
||||
/*
|
||||
static Promise<any> staticThrowToRejectPromise();
|
||||
Promise<any> methodThrowToRejectPromise();
|
||||
readonly attribute Promise<any> getterThrowToRejectPromise;
|
||||
|
||||
static Promise<any> staticInternalThrowToRejectPromise([EnforceRange] unsigned long long arg);
|
||||
Promise<any> methodInternalThrowToRejectPromise([EnforceRange] unsigned long long arg);
|
||||
*/
|
||||
|
||||
promise_test((t) => {
|
||||
return promise_rejects_js(t, TypeError, TestBinding.staticThrowToRejectPromise());
|
||||
}, "staticThrowToRejectPromise");
|
||||
|
||||
promise_test((t) => {
|
||||
return promise_rejects_js(t, TypeError, binding.methodThrowToRejectPromise());
|
||||
}, "methodThrowToRejectPromise");
|
||||
|
||||
promise_test((t) => {
|
||||
return promise_rejects_js(t, TypeError, binding.getterThrowToRejectPromise);
|
||||
}, "getterThrowToRejectPromise");
|
||||
|
||||
promise_test((t) => {
|
||||
return promise_rejects_js(t, TypeError, TestBinding.staticInternalThrowToRejectPromise(Number.MAX_SAFE_INTEGER + 1));
|
||||
}, "staticInternalThrowToRejectPromise");
|
||||
|
||||
promise_test((t) => {
|
||||
return promise_rejects_js(t, TypeError, binding.methodInternalThrowToRejectPromise(Number.MAX_SAFE_INTEGER + 1));
|
||||
}, "methodInternalThrowToRejectPromise");
|
Loading…
Add table
Add a link
Reference in a new issue