mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
pass in realm to controller signal abort
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
parent
002a7f4572
commit
9dc8fa36bb
3 changed files with 15 additions and 9 deletions
|
@ -10,6 +10,7 @@ use crate::dom::bindings::codegen::Bindings::AbortControllerBinding::AbortContro
|
||||||
use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto};
|
use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_proto};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
|
use crate::realms::InRealm;
|
||||||
use crate::script_runtime::{CanGc, JSContext};
|
use crate::script_runtime::{CanGc, JSContext};
|
||||||
|
|
||||||
/// <https://dom.spec.whatwg.org/#abortcontroller>
|
/// <https://dom.spec.whatwg.org/#abortcontroller>
|
||||||
|
@ -47,9 +48,9 @@ impl AbortController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://dom.spec.whatwg.org/#abortcontroller-signal-abort>
|
/// <https://dom.spec.whatwg.org/#abortcontroller-signal-abort>
|
||||||
fn signal_abort(&self, cx: JSContext, reason: HandleValue, can_gc: CanGc) {
|
fn signal_abort(&self, cx: JSContext, reason: HandleValue, realm: InRealm, can_gc: CanGc) {
|
||||||
// signal abort on controller’s signal with reason if it is given.
|
// signal abort on controller’s signal with reason if it is given.
|
||||||
self.signal.signal_abort(cx, reason, can_gc);
|
self.signal.signal_abort(cx, reason, realm, can_gc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,10 +65,10 @@ impl AbortControllerMethods<crate::DomTypeHolder> for AbortController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://dom.spec.whatwg.org/#dom-abortcontroller-abort>
|
/// <https://dom.spec.whatwg.org/#dom-abortcontroller-abort>
|
||||||
fn Abort(&self, cx: JSContext, reason: HandleValue, can_gc: CanGc) {
|
fn Abort(&self, cx: JSContext, reason: HandleValue, realm: InRealm, can_gc: CanGc) {
|
||||||
// The abort(reason) method steps are
|
// The abort(reason) method steps are
|
||||||
// to signal abort on this with reason if it is given.
|
// to signal abort on this with reason if it is given.
|
||||||
self.signal_abort(cx, reason, can_gc);
|
self.signal_abort(cx, reason, realm, can_gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://dom.spec.whatwg.org/#dom-abortcontroller-signal>
|
/// <https://dom.spec.whatwg.org/#dom-abortcontroller-signal>
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::eventtarget::EventTarget;
|
use crate::dom::eventtarget::EventTarget;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::readablestream::PipeTo;
|
use crate::dom::readablestream::PipeTo;
|
||||||
use crate::realms::{InRealm, enter_realm};
|
use crate::realms::InRealm;
|
||||||
use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
|
use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
|
||||||
|
|
||||||
impl js::gc::Rootable for AbortAlgorithm {}
|
impl js::gc::Rootable for AbortAlgorithm {}
|
||||||
|
@ -74,10 +74,14 @@ impl AbortSignal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://dom.spec.whatwg.org/#abortsignal-signal-abort>
|
/// <https://dom.spec.whatwg.org/#abortsignal-signal-abort>
|
||||||
pub(crate) fn signal_abort(&self, cx: SafeJSContext, reason: HandleValue, can_gc: CanGc) {
|
pub(crate) fn signal_abort(
|
||||||
|
&self,
|
||||||
|
cx: SafeJSContext,
|
||||||
|
reason: HandleValue,
|
||||||
|
realm: InRealm,
|
||||||
|
can_gc: CanGc,
|
||||||
|
) {
|
||||||
let global = self.global();
|
let global = self.global();
|
||||||
let realm = enter_realm(&*global);
|
|
||||||
let comp = InRealm::Entered(&realm);
|
|
||||||
|
|
||||||
// If signal is aborted, then return.
|
// If signal is aborted, then return.
|
||||||
if self.Aborted() {
|
if self.Aborted() {
|
||||||
|
@ -101,7 +105,7 @@ impl AbortSignal {
|
||||||
// TODO: #36936
|
// TODO: #36936
|
||||||
|
|
||||||
// Run the abort steps for signal.
|
// Run the abort steps for signal.
|
||||||
self.run_the_abort_steps(cx, &global, comp, can_gc);
|
self.run_the_abort_steps(cx, &global, realm, can_gc);
|
||||||
|
|
||||||
// For each dependentSignal of dependentSignalsToAbort, run the abort steps for dependentSignal.
|
// For each dependentSignal of dependentSignalsToAbort, run the abort steps for dependentSignal.
|
||||||
// TODO: #36936
|
// TODO: #36936
|
||||||
|
|
|
@ -16,6 +16,7 @@ DOMInterfaces = {
|
||||||
|
|
||||||
'AbortController': {
|
'AbortController': {
|
||||||
'canGc':['Abort'],
|
'canGc':['Abort'],
|
||||||
|
'inRealms': ['Abort'],
|
||||||
},
|
},
|
||||||
|
|
||||||
'AbstractRange': {
|
'AbstractRange': {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue