Add exception to rejection logic in generic_call (#32950)

* exception in JS Promise

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* EXCEPTION_TO_REJECTION on generic_call

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* PromiseRejectionEvent should handle promise as object

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:
Samson 2024-08-06 19:12:31 +02:00 committed by GitHub
parent 1d464a576a
commit 68f4b359c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 62 additions and 76 deletions

View file

@ -1870,13 +1870,17 @@ class MethodDefiner(PropertyDefiner):
else: else:
selfHostedName = "0 as *const libc::c_char" selfHostedName = "0 as *const libc::c_char"
if m.get("methodInfo", True): if m.get("methodInfo", True):
if m.get("returnsPromise", False):
exceptionToRejection = "true"
else:
exceptionToRejection = "false"
identifier = m.get("nativeName", m["name"]) identifier = m.get("nativeName", m["name"])
# Go through an intermediate type here, because it's not # Go through an intermediate type here, because it's not
# easy to tell whether the methodinfo is a JSJitInfo or # easy to tell whether the methodinfo is a JSJitInfo or
# a JSTypedMethodJitInfo here. The compiler knows, though, # a JSTypedMethodJitInfo here. The compiler knows, though,
# so let it do the work. # so let it do the work.
jitinfo = "&%s_methodinfo as *const _ as *const JSJitInfo" % identifier jitinfo = "&%s_methodinfo as *const _ as *const JSJitInfo" % identifier
accessor = "Some(generic_method)" accessor = f"Some(generic_method::<{exceptionToRejection}>)"
else: else:
if m.get("returnsPromise", False): if m.get("returnsPromise", False):
jitinfo = "&%s_methodinfo" % m.get("nativeName", m["name"]) jitinfo = "&%s_methodinfo" % m.get("nativeName", m["name"])
@ -1977,10 +1981,14 @@ class AttrDefiner(PropertyDefiner):
accessor = 'get_' + self.descriptor.internalNameFor(attr.identifier.name) accessor = 'get_' + self.descriptor.internalNameFor(attr.identifier.name)
jitinfo = "0 as *const JSJitInfo" jitinfo = "0 as *const JSJitInfo"
else: else:
if attr.hasLegacyLenientThis(): if attr.type.isPromise():
accessor = "generic_lenient_getter" exceptionToRejection = "true"
else: else:
accessor = "generic_getter" exceptionToRejection = "false"
if attr.hasLegacyLenientThis():
accessor = f"generic_lenient_getter::<{exceptionToRejection}>"
else:
accessor = f"generic_getter::<{exceptionToRejection}>"
jitinfo = "&%s_getterinfo" % self.descriptor.internalNameFor(attr.identifier.name) jitinfo = "&%s_getterinfo" % self.descriptor.internalNameFor(attr.identifier.name)
return ("JSNativeWrapper { op: Some(%(native)s), info: %(info)s }" return ("JSNativeWrapper { op: Some(%(native)s), info: %(info)s }"

View file

@ -466,7 +466,7 @@ pub unsafe fn delete_property_by_id(
JS_DeletePropertyById(cx, object, id, bp) JS_DeletePropertyById(cx, object, id, bp)
} }
unsafe fn generic_call( unsafe fn generic_call<const EXCEPTION_TO_REJECTION: bool>(
cx: *mut JSContext, cx: *mut JSContext,
argc: libc::c_uint, argc: libc::c_uint,
vp: *mut JSVal, vp: *mut JSVal,
@ -488,7 +488,11 @@ unsafe fn generic_call(
let thisobj = args.thisv(); let thisobj = args.thisv();
if !thisobj.get().is_null_or_undefined() && !thisobj.get().is_object() { if !thisobj.get().is_null_or_undefined() && !thisobj.get().is_object() {
throw_invalid_this(cx, proto_id); throw_invalid_this(cx, proto_id);
return false; return if EXCEPTION_TO_REJECTION {
exception_to_promise(cx, args.rval())
} else {
false
};
} }
rooted!(in(cx) let obj = if thisobj.get().is_object() { rooted!(in(cx) let obj = if thisobj.get().is_object() {
@ -507,7 +511,11 @@ unsafe fn generic_call(
return true; return true;
} else { } else {
throw_invalid_this(cx, proto_id); throw_invalid_this(cx, proto_id);
return false; return if EXCEPTION_TO_REJECTION {
exception_to_promise(cx, args.rval())
} else {
false
};
} }
}, },
}; };
@ -522,30 +530,30 @@ unsafe fn generic_call(
} }
/// Generic method of IDL interface. /// Generic method of IDL interface.
pub unsafe extern "C" fn generic_method( pub unsafe extern "C" fn generic_method<const EXCEPTION_TO_REJECTION: bool>(
cx: *mut JSContext, cx: *mut JSContext,
argc: libc::c_uint, argc: libc::c_uint,
vp: *mut JSVal, vp: *mut JSVal,
) -> bool { ) -> bool {
generic_call(cx, argc, vp, false, CallJitMethodOp) generic_call::<EXCEPTION_TO_REJECTION>(cx, argc, vp, false, CallJitMethodOp)
} }
/// Generic getter of IDL interface. /// Generic getter of IDL interface.
pub unsafe extern "C" fn generic_getter( pub unsafe extern "C" fn generic_getter<const EXCEPTION_TO_REJECTION: bool>(
cx: *mut JSContext, cx: *mut JSContext,
argc: libc::c_uint, argc: libc::c_uint,
vp: *mut JSVal, vp: *mut JSVal,
) -> bool { ) -> bool {
generic_call(cx, argc, vp, false, CallJitGetterOp) generic_call::<EXCEPTION_TO_REJECTION>(cx, argc, vp, false, CallJitGetterOp)
} }
/// Generic lenient getter of IDL interface. /// Generic lenient getter of IDL interface.
pub unsafe extern "C" fn generic_lenient_getter( pub unsafe extern "C" fn generic_lenient_getter<const EXCEPTION_TO_REJECTION: bool>(
cx: *mut JSContext, cx: *mut JSContext,
argc: libc::c_uint, argc: libc::c_uint,
vp: *mut JSVal, vp: *mut JSVal,
) -> bool { ) -> bool {
generic_call(cx, argc, vp, true, CallJitGetterOp) generic_call::<EXCEPTION_TO_REJECTION>(cx, argc, vp, true, CallJitGetterOp)
} }
unsafe extern "C" fn call_setter( unsafe extern "C" fn call_setter(
@ -569,7 +577,7 @@ pub unsafe extern "C" fn generic_setter(
argc: libc::c_uint, argc: libc::c_uint,
vp: *mut JSVal, vp: *mut JSVal,
) -> bool { ) -> bool {
generic_call(cx, argc, vp, false, call_setter) generic_call::<false>(cx, argc, vp, false, call_setter)
} }
/// Generic lenient setter of IDL interface. /// Generic lenient setter of IDL interface.
@ -578,7 +586,7 @@ pub unsafe extern "C" fn generic_lenient_setter(
argc: libc::c_uint, argc: libc::c_uint,
vp: *mut JSVal, vp: *mut JSVal,
) -> bool { ) -> bool {
generic_call(cx, argc, vp, true, call_setter) generic_call::<false>(cx, argc, vp, true, call_setter)
} }
unsafe extern "C" fn instance_class_has_proto_at_depth( unsafe extern "C" fn instance_class_has_proto_at_depth(

View file

@ -2,10 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::ptr::NonNull;
use std::rc::Rc; use std::rc::Rc;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use js::jsapi::Heap; use js::jsapi::{Heap, JSObject};
use js::jsval::JSVal; use js::jsval::JSVal;
use js::rust::{HandleObject, HandleValue}; use js::rust::{HandleObject, HandleValue};
use servo_atoms::Atom; use servo_atoms::Atom;
@ -27,18 +28,18 @@ use crate::script_runtime::JSContext;
#[dom_struct] #[dom_struct]
pub struct PromiseRejectionEvent { pub struct PromiseRejectionEvent {
event: Event, event: Event,
#[ignore_malloc_size_of = "Rc"] #[ignore_malloc_size_of = "Defined in mozjs"]
promise: Rc<Promise>, promise: Heap<*mut JSObject>,
#[ignore_malloc_size_of = "Defined in rust-mozjs"] #[ignore_malloc_size_of = "Defined in mozjs"]
reason: Heap<JSVal>, reason: Heap<JSVal>,
} }
impl PromiseRejectionEvent { impl PromiseRejectionEvent {
#[allow(crown::unrooted_must_root)] #[allow(crown::unrooted_must_root)]
fn new_inherited(promise: Rc<Promise>) -> Self { fn new_inherited() -> Self {
PromiseRejectionEvent { PromiseRejectionEvent {
event: Event::new_inherited(), event: Event::new_inherited(),
promise, promise: Heap::default(),
reason: Heap::default(), reason: Heap::default(),
} }
} }
@ -51,7 +52,15 @@ impl PromiseRejectionEvent {
promise: Rc<Promise>, promise: Rc<Promise>,
reason: HandleValue, reason: HandleValue,
) -> DomRoot<Self> { ) -> DomRoot<Self> {
Self::new_with_proto(global, None, type_, bubbles, cancelable, promise, reason) Self::new_with_proto(
global,
None,
type_,
bubbles,
cancelable,
promise.promise_obj(),
reason,
)
} }
#[allow(crown::unrooted_must_root)] #[allow(crown::unrooted_must_root)]
@ -61,14 +70,15 @@ impl PromiseRejectionEvent {
type_: Atom, type_: Atom,
bubbles: EventBubbles, bubbles: EventBubbles,
cancelable: EventCancelable, cancelable: EventCancelable,
promise: Rc<Promise>, promise: HandleObject,
reason: HandleValue, reason: HandleValue,
) -> DomRoot<Self> { ) -> DomRoot<Self> {
let ev = reflect_dom_object_with_proto( let ev = reflect_dom_object_with_proto(
Box::new(PromiseRejectionEvent::new_inherited(promise)), Box::new(PromiseRejectionEvent::new_inherited()),
global, global,
proto, proto,
); );
ev.promise.set(promise.get());
{ {
let event = ev.upcast::<Event>(); let event = ev.upcast::<Event>();
@ -87,7 +97,6 @@ impl PromiseRejectionEvent {
init: RootedTraceableBox<PromiseRejectionEventBinding::PromiseRejectionEventInit>, init: RootedTraceableBox<PromiseRejectionEventBinding::PromiseRejectionEventInit>,
) -> Fallible<DomRoot<Self>> { ) -> Fallible<DomRoot<Self>> {
let reason = init.reason.handle(); let reason = init.reason.handle();
let promise = init.promise.clone();
let bubbles = EventBubbles::from(init.parent.bubbles); let bubbles = EventBubbles::from(init.parent.bubbles);
let cancelable = EventCancelable::from(init.parent.cancelable); let cancelable = EventCancelable::from(init.parent.cancelable);
@ -97,7 +106,7 @@ impl PromiseRejectionEvent {
Atom::from(type_), Atom::from(type_),
bubbles, bubbles,
cancelable, cancelable,
promise, init.promise.handle(),
reason, reason,
); );
Ok(event) Ok(event)
@ -106,8 +115,8 @@ impl PromiseRejectionEvent {
impl PromiseRejectionEventMethods for PromiseRejectionEvent { impl PromiseRejectionEventMethods for PromiseRejectionEvent {
// https://html.spec.whatwg.org/multipage/#dom-promiserejectionevent-promise // https://html.spec.whatwg.org/multipage/#dom-promiserejectionevent-promise
fn Promise(&self) -> Rc<Promise> { fn Promise(&self, _cx: JSContext) -> NonNull<JSObject> {
self.promise.clone() NonNull::new(self.promise.get()).unwrap()
} }
// https://html.spec.whatwg.org/multipage/#dom-promiserejectionevent-reason // https://html.spec.whatwg.org/multipage/#dom-promiserejectionevent-reason

View file

@ -7,11 +7,11 @@
[Exposed=(Window,Worker)] [Exposed=(Window,Worker)]
interface PromiseRejectionEvent : Event { interface PromiseRejectionEvent : Event {
[Throws] constructor(DOMString type, PromiseRejectionEventInit eventInitDict); [Throws] constructor(DOMString type, PromiseRejectionEventInit eventInitDict);
readonly attribute Promise<any> promise; readonly attribute object promise;
readonly attribute any reason; readonly attribute any reason;
}; };
dictionary PromiseRejectionEventInit : EventInit { dictionary PromiseRejectionEventInit : EventInit {
required Promise<any> promise; required object promise;
any reason; any reason;
}; };

View file

@ -1,9 +1,7 @@
[idlharness.any.html] [idlharness.any.html]
[Blob interface: operation text()] [Blob interface: operation text()]
expected: FAIL
[Blob interface: operation arrayBuffer()] [Blob interface: operation arrayBuffer()]
expected: FAIL
[FileReader interface: operation readAsBinaryString(Blob)] [FileReader interface: operation readAsBinaryString(Blob)]
expected: FAIL expected: FAIL
@ -26,10 +24,8 @@
[idlharness.any.worker.html] [idlharness.any.worker.html]
[Blob interface: operation text()] [Blob interface: operation text()]
expected: FAIL
[Blob interface: operation arrayBuffer()] [Blob interface: operation arrayBuffer()]
expected: FAIL
[FileReader interface: operation readAsBinaryString(Blob)] [FileReader interface: operation readAsBinaryString(Blob)]
expected: FAIL expected: FAIL

View file

@ -1,9 +1,7 @@
[idlharness.html] [idlharness.html]
[Blob interface: operation text()] [Blob interface: operation text()]
expected: FAIL
[Blob interface: operation arrayBuffer()] [Blob interface: operation arrayBuffer()]
expected: FAIL
[FileReader interface: operation readAsBinaryString(Blob)] [FileReader interface: operation readAsBinaryString(Blob)]
expected: FAIL expected: FAIL

View file

@ -1,9 +1,7 @@
[idlharness.worker.html] [idlharness.worker.html]
[Blob interface: operation text()] [Blob interface: operation text()]
expected: FAIL
[Blob interface: operation arrayBuffer()] [Blob interface: operation arrayBuffer()]
expected: FAIL
[FileReader interface: operation readAsBinaryString(Blob)] [FileReader interface: operation readAsBinaryString(Blob)]
expected: FAIL expected: FAIL

View file

@ -686,7 +686,6 @@
expected: FAIL expected: FAIL
[Document interface: operation exitFullscreen()] [Document interface: operation exitFullscreen()]
expected: FAIL
[Document interface: attribute fullscreenElement] [Document interface: attribute fullscreenElement]
expected: FAIL expected: FAIL
@ -695,7 +694,6 @@
expected: FAIL expected: FAIL
[Element interface: operation requestFullscreen(optional FullscreenOptions)] [Element interface: operation requestFullscreen(optional FullscreenOptions)]
expected: FAIL
[Element interface: attribute onfullscreenchange] [Element interface: attribute onfullscreenchange]
expected: FAIL expected: FAIL

View file

@ -15,19 +15,14 @@
expected: FAIL expected: FAIL
[Request interface: operation arrayBuffer()] [Request interface: operation arrayBuffer()]
expected: FAIL
[Request interface: operation blob()] [Request interface: operation blob()]
expected: FAIL
[Request interface: operation formData()] [Request interface: operation formData()]
expected: FAIL
[Request interface: operation json()] [Request interface: operation json()]
expected: FAIL
[Request interface: operation text()] [Request interface: operation text()]
expected: FAIL
[Request interface: new Request('about:blank') must inherit property "keepalive" with the proper type] [Request interface: new Request('about:blank') must inherit property "keepalive" with the proper type]
expected: FAIL expected: FAIL
@ -48,25 +43,19 @@
expected: FAIL expected: FAIL
[Response interface: operation arrayBuffer()] [Response interface: operation arrayBuffer()]
expected: FAIL
[Response interface: operation blob()] [Response interface: operation blob()]
expected: FAIL
[Response interface: operation formData()] [Response interface: operation formData()]
expected: FAIL
[Response interface: operation json()] [Response interface: operation json()]
expected: FAIL
[Response interface: operation text()] [Response interface: operation text()]
expected: FAIL
[Response interface: calling json(any, optional ResponseInit) on new Response() with too few arguments must throw TypeError] [Response interface: calling json(any, optional ResponseInit) on new Response() with too few arguments must throw TypeError]
expected: FAIL expected: FAIL
[WorkerGlobalScope interface: operation fetch(RequestInfo, optional RequestInit)] [WorkerGlobalScope interface: operation fetch(RequestInfo, optional RequestInit)]
expected: FAIL
[WorkerGlobalScope interface: calling fetch(RequestInfo, optional RequestInit) on self with too few arguments must throw TypeError] [WorkerGlobalScope interface: calling fetch(RequestInfo, optional RequestInit) on self with too few arguments must throw TypeError]
@ -103,19 +92,14 @@
expected: FAIL expected: FAIL
[Request interface: operation arrayBuffer()] [Request interface: operation arrayBuffer()]
expected: FAIL
[Request interface: operation blob()] [Request interface: operation blob()]
expected: FAIL
[Request interface: operation formData()] [Request interface: operation formData()]
expected: FAIL
[Request interface: operation json()] [Request interface: operation json()]
expected: FAIL
[Request interface: operation text()] [Request interface: operation text()]
expected: FAIL
[Request interface: new Request('about:blank') must inherit property "keepalive" with the proper type] [Request interface: new Request('about:blank') must inherit property "keepalive" with the proper type]
expected: FAIL expected: FAIL
@ -136,25 +120,19 @@
expected: FAIL expected: FAIL
[Response interface: operation arrayBuffer()] [Response interface: operation arrayBuffer()]
expected: FAIL
[Response interface: operation blob()] [Response interface: operation blob()]
expected: FAIL
[Response interface: operation formData()] [Response interface: operation formData()]
expected: FAIL
[Response interface: operation json()] [Response interface: operation json()]
expected: FAIL
[Response interface: operation text()] [Response interface: operation text()]
expected: FAIL
[Response interface: calling json(any, optional ResponseInit) on new Response() with too few arguments must throw TypeError] [Response interface: calling json(any, optional ResponseInit) on new Response() with too few arguments must throw TypeError]
expected: FAIL expected: FAIL
[Window interface: operation fetch(RequestInfo, optional RequestInit)] [Window interface: operation fetch(RequestInfo, optional RequestInit)]
expected: FAIL
[Window interface: calling fetch(RequestInfo, optional RequestInit) on window with too few arguments must throw TypeError] [Window interface: calling fetch(RequestInfo, optional RequestInit) on window with too few arguments must throw TypeError]

View file

@ -6,7 +6,6 @@
expected: FAIL expected: FAIL
[Document interface: operation exitFullscreen()] [Document interface: operation exitFullscreen()]
expected: FAIL
[Document interface: attribute fullscreenElement] [Document interface: attribute fullscreenElement]
expected: FAIL expected: FAIL
@ -15,7 +14,6 @@
expected: FAIL expected: FAIL
[Element interface: operation requestFullscreen(optional FullscreenOptions)] [Element interface: operation requestFullscreen(optional FullscreenOptions)]
expected: FAIL
[Element interface: attribute onfullscreenchange] [Element interface: attribute onfullscreenchange]
expected: FAIL expected: FAIL

View file

@ -1,9 +1,7 @@
[idlharness.window.html] [idlharness.window.html]
[GamepadHapticActuator interface: operation playEffect(GamepadHapticEffectType, optional GamepadEffectParameters)] [GamepadHapticActuator interface: operation playEffect(GamepadHapticEffectType, optional GamepadEffectParameters)]
expected: FAIL
[GamepadHapticActuator interface: operation reset()] [GamepadHapticActuator interface: operation reset()]
expected: FAIL
[GamepadEvent must be primary interface of new GamepadEvent("gamepad")] [GamepadEvent must be primary interface of new GamepadEvent("gamepad")]
expected: FAIL expected: FAIL

View file

@ -780,7 +780,6 @@
expected: FAIL expected: FAIL
[CustomElementRegistry interface: operation whenDefined(DOMString)] [CustomElementRegistry interface: operation whenDefined(DOMString)]
expected: FAIL
[DragEvent interface: existence and properties of interface object] [DragEvent interface: existence and properties of interface object]
expected: FAIL expected: FAIL
@ -2950,7 +2949,6 @@
expected: FAIL expected: FAIL
[HTMLMediaElement interface: operation play()] [HTMLMediaElement interface: operation play()]
expected: FAIL
[HTMLMarqueeElement interface: document.createElement("marquee") must inherit property "hspace" with the proper type] [HTMLMarqueeElement interface: document.createElement("marquee") must inherit property "hspace" with the proper type]
expected: FAIL expected: FAIL
@ -3196,7 +3194,6 @@
expected: FAIL expected: FAIL
[HTMLImageElement interface: operation decode()] [HTMLImageElement interface: operation decode()]
expected: FAIL
[HTMLTableRowElement interface: document.createElement("tr") must inherit property "vAlign" with the proper type] [HTMLTableRowElement interface: document.createElement("tr") must inherit property "vAlign" with the proper type]
expected: FAIL expected: FAIL

View file

@ -6,7 +6,6 @@
expected: FAIL expected: FAIL
[XRSession interface: operation requestHitTestSource(XRHitTestOptionsInit)] [XRSession interface: operation requestHitTestSource(XRHitTestOptionsInit)]
expected: FAIL
[XRTransientInputHitTestResult interface: existence and properties of interface prototype object] [XRTransientInputHitTestResult interface: existence and properties of interface prototype object]
expected: FAIL expected: FAIL

View file

@ -6,7 +6,6 @@
expected: FAIL expected: FAIL
[XRSystem interface: operation isSessionSupported(XRSessionMode)] [XRSystem interface: operation isSessionSupported(XRSessionMode)]
expected: FAIL
[XRReferenceSpaceEvent interface: existence and properties of interface prototype object's @@unscopables property] [XRReferenceSpaceEvent interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL expected: FAIL
@ -75,7 +74,6 @@
expected: FAIL expected: FAIL
[XRSystem interface: operation requestSession(XRSessionMode, optional XRSessionInit)] [XRSystem interface: operation requestSession(XRSessionMode, optional XRSessionInit)]
expected: FAIL
[XRReferenceSpaceEvent interface object name] [XRReferenceSpaceEvent interface object name]
expected: FAIL expected: FAIL
@ -213,7 +211,6 @@
expected: FAIL expected: FAIL
[XRSession interface: operation requestReferenceSpace(XRReferenceSpaceType)] [XRSession interface: operation requestReferenceSpace(XRReferenceSpaceType)]
expected: FAIL
[XRWebGLLayer interface: xrWebGLLayer must inherit property "framebufferWidth" with the proper type] [XRWebGLLayer interface: xrWebGLLayer must inherit property "framebufferWidth" with the proper type]
expected: FAIL expected: FAIL
@ -264,7 +261,6 @@
expected: FAIL expected: FAIL
[XRSession interface: operation end()] [XRSession interface: operation end()]
expected: FAIL
[XRSession interface: xrSession must inherit property "cancelAnimationFrame(unsigned long)" with the proper type] [XRSession interface: xrSession must inherit property "cancelAnimationFrame(unsigned long)" with the proper type]
expected: FAIL expected: FAIL
@ -321,7 +317,6 @@
expected: FAIL expected: FAIL
[WebGLRenderingContext interface: operation makeXRCompatible()] [WebGLRenderingContext interface: operation makeXRCompatible()]
expected: FAIL
[XRSession interface: attribute enabledFeatures] [XRSession interface: attribute enabledFeatures]
expected: FAIL expected: FAIL

View file

@ -13131,7 +13131,7 @@
] ]
], ],
"exceptionToRejection.any.js": [ "exceptionToRejection.any.js": [
"738a8bedbcfe83a6f110bc6e6d133e31f80ea9ad", "5d892832c29a4075751b313b3ba5c57d51cc19f3",
[ [
"mozilla/exceptionToRejection.any.html", "mozilla/exceptionToRejection.any.html",
{ {

View file

@ -30,3 +30,9 @@ promise_test((t) => {
promise_test((t) => { promise_test((t) => {
return promise_rejects_js(t, TypeError, binding.methodInternalThrowToRejectPromise(Number.MAX_SAFE_INTEGER + 1)); return promise_rejects_js(t, TypeError, binding.methodInternalThrowToRejectPromise(Number.MAX_SAFE_INTEGER + 1));
}, "methodInternalThrowToRejectPromise"); }, "methodInternalThrowToRejectPromise");
promise_test((t) => {
return promise_rejects_js(t, TypeError, new Promise(() => {
throw new TypeError();
}));
}, "exception in JS Promise");