mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
script: Include constructors and static methods in generated DOM traits (#33665)
* Add all constructors, special operations, and static methods to generated DOM interface traits. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Move all constructors and static methods defined in bare impl blocks inside FooMethods trait impls. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Add missing doc links. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
946fa9cdee
commit
7d931e673a
133 changed files with 1479 additions and 1438 deletions
|
@ -7,7 +7,9 @@ use js::rust::{HandleObject, HandleValue};
|
|||
use servo_atoms::Atom;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::ExtendableEventBinding;
|
||||
use crate::dom::bindings::codegen::Bindings::ExtendableEventBinding::{
|
||||
ExtendableEventInit, ExtendableEventMethods,
|
||||
};
|
||||
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
|
||||
|
@ -62,13 +64,16 @@ impl ExtendableEvent {
|
|||
}
|
||||
ev
|
||||
}
|
||||
}
|
||||
|
||||
pub fn Constructor(
|
||||
impl ExtendableEventMethods for ExtendableEvent {
|
||||
// https://w3c.github.io/ServiceWorker/#dom-extendableevent-extendableevent
|
||||
fn Constructor(
|
||||
worker: &ServiceWorkerGlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
can_gc: CanGc,
|
||||
type_: DOMString,
|
||||
init: &ExtendableEventBinding::ExtendableEventInit,
|
||||
init: &ExtendableEventInit,
|
||||
) -> Fallible<DomRoot<ExtendableEvent>> {
|
||||
Ok(ExtendableEvent::new_with_proto(
|
||||
worker,
|
||||
|
@ -81,7 +86,7 @@ impl ExtendableEvent {
|
|||
}
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#wait-until-method
|
||||
pub fn WaitUntil(&self, _cx: JSContext, _val: HandleValue) -> ErrorResult {
|
||||
fn WaitUntil(&self, _cx: JSContext, _val: HandleValue) -> ErrorResult {
|
||||
// Step 1
|
||||
if !self.extensions_allowed {
|
||||
return Err(Error::InvalidState);
|
||||
|
@ -92,12 +97,12 @@ impl ExtendableEvent {
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-istrusted
|
||||
pub fn IsTrusted(&self) -> bool {
|
||||
fn IsTrusted(&self) -> bool {
|
||||
self.event.IsTrusted()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ExtendableEventBinding::ExtendableEventInit {
|
||||
impl Default for ExtendableEventInit {
|
||||
fn default() -> Self {
|
||||
Self::empty()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue