mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
script: Add stub interface for AbortController. (#34519)
Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: syvb <me@iter.ca>
This commit is contained in:
parent
2f64dde623
commit
bc2def0582
5 changed files with 72 additions and 0 deletions
|
@ -247,6 +247,10 @@ mod gen {
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
abort_controller: {
|
||||||
|
/// Whether to expose the AbortControll/AbortSignal DOM interfaces.
|
||||||
|
enabled: bool,
|
||||||
|
},
|
||||||
allow_scripts_to_close_windows: bool,
|
allow_scripts_to_close_windows: bool,
|
||||||
canvas_capture: {
|
canvas_capture: {
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
|
|
53
components/script/dom/abortcontroller.rs
Normal file
53
components/script/dom/abortcontroller.rs
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* 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/. */
|
||||||
|
|
||||||
|
use dom_struct::dom_struct;
|
||||||
|
use js::jsapi::Value;
|
||||||
|
use js::rust::{Handle, HandleObject};
|
||||||
|
|
||||||
|
use crate::dom::bindings::codegen::Bindings::AbortControllerBinding::AbortControllerMethods;
|
||||||
|
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, Reflector};
|
||||||
|
use crate::dom::bindings::root::DomRoot;
|
||||||
|
use crate::dom::globalscope::GlobalScope;
|
||||||
|
use crate::script_runtime::{CanGc, JSContext};
|
||||||
|
|
||||||
|
#[dom_struct]
|
||||||
|
pub struct AbortController {
|
||||||
|
reflector_: Reflector,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AbortController {
|
||||||
|
fn new_inherited() -> AbortController {
|
||||||
|
AbortController {
|
||||||
|
reflector_: Reflector::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
can_gc: CanGc,
|
||||||
|
) -> DomRoot<AbortController> {
|
||||||
|
reflect_dom_object_with_proto(
|
||||||
|
Box::new(AbortController::new_inherited()),
|
||||||
|
global,
|
||||||
|
proto,
|
||||||
|
can_gc,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AbortControllerMethods<crate::DomTypeHolder> for AbortController {
|
||||||
|
/// <https://dom.spec.whatwg.org/#dom-abortcontroller-abortcontroller>
|
||||||
|
fn Constructor(
|
||||||
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
can_gc: CanGc,
|
||||||
|
) -> DomRoot<AbortController> {
|
||||||
|
AbortController::new_with_proto(global, proto, can_gc)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://dom.spec.whatwg.org/#dom-abortcontroller-abort>
|
||||||
|
fn Abort(&self, _cx: JSContext, _reason: Handle<'_, Value>) {}
|
||||||
|
}
|
|
@ -209,6 +209,7 @@ pub mod types {
|
||||||
include!(concat!(env!("OUT_DIR"), "/InterfaceTypes.rs"));
|
include!(concat!(env!("OUT_DIR"), "/InterfaceTypes.rs"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub mod abortcontroller;
|
||||||
pub mod abstractrange;
|
pub mod abstractrange;
|
||||||
pub mod abstractworker;
|
pub mod abstractworker;
|
||||||
pub mod abstractworkerglobalscope;
|
pub mod abstractworkerglobalscope;
|
||||||
|
|
13
components/script/dom/webidls/AbortController.webidl
Normal file
13
components/script/dom/webidls/AbortController.webidl
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* 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/. */
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#interface-abortcontroller
|
||||||
|
[Exposed=*, Pref="dom.abort_controller.enabled"]
|
||||||
|
interface AbortController {
|
||||||
|
constructor();
|
||||||
|
|
||||||
|
//[SameObject] readonly attribute AbortSignal signal;
|
||||||
|
|
||||||
|
undefined abort(optional any reason);
|
||||||
|
};
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"devtools.server.enabled": false,
|
"devtools.server.enabled": false,
|
||||||
"devtools.server.port": 0,
|
"devtools.server.port": 0,
|
||||||
|
"dom.abort_controller.enabled": false,
|
||||||
"dom.allow_scripts_to_close_windows": false,
|
"dom.allow_scripts_to_close_windows": false,
|
||||||
"dom.bluetooth.enabled": false,
|
"dom.bluetooth.enabled": false,
|
||||||
"dom.bluetooth.testing.enabled": false,
|
"dom.bluetooth.testing.enabled": false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue