diff options
author | Josh Matthews <josh@joshmatthews.net> | 2024-10-07 21:51:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-08 01:51:58 +0000 |
commit | 7d931e673af2780f3f62d52cb17324ec2cc68c71 (patch) | |
tree | 450d534196e9eb8d0e04db37203b414f5d92420d /components/script/dom/extendableevent.rs | |
parent | 946fa9cdee68bb834a3b75821e8e7f94cf86d31c (diff) | |
download | servo-7d931e673af2780f3f62d52cb17324ec2cc68c71.tar.gz servo-7d931e673af2780f3f62d52cb17324ec2cc68c71.zip |
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>
Diffstat (limited to 'components/script/dom/extendableevent.rs')
-rw-r--r-- | components/script/dom/extendableevent.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/components/script/dom/extendableevent.rs b/components/script/dom/extendableevent.rs index 2f9cd001dc0..925b1cb76f4 100644 --- a/components/script/dom/extendableevent.rs +++ b/components/script/dom/extendableevent.rs @@ -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() } |