diff options
author | Bogdan Cuza <bogdan.cuza@hotmail.com> | 2015-07-21 18:53:01 +0300 |
---|---|---|
committer | Bogdan <boghison22@gmail.com> | 2015-07-28 13:28:41 +0200 |
commit | 233a769c67738942a0ac47c15465e36891883c3b (patch) | |
tree | f271b64c29addb4826feb098a03a0c6ce07eb4b3 /components/script | |
parent | f039827dcd618d1731f9cc0d91202690c28f10d1 (diff) | |
download | servo-233a769c67738942a0ac47c15465e36891883c3b.tar.gz servo-233a769c67738942a0ac47c15465e36891883c3b.zip |
Add spec links
Diffstat (limited to 'components/script')
61 files changed, 284 insertions, 87 deletions
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 7e2d539d163..1ba7b929eaf 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -98,7 +98,7 @@ impl<'a> BlobHelpers for &'a Blob { } impl<'a> BlobMethods for &'a Blob { - // http://dev.w3.org/2006/webapi/FileAPI/#dfn-size + // https://dev.w3.org/2006/webapi/FileAPI/#dfn-size fn Size(self) -> u64{ match self.bytes { None => 0, @@ -106,12 +106,12 @@ impl<'a> BlobMethods for &'a Blob { } } - // http://dev.w3.org/2006/webapi/FileAPI/#dfn-type + // https://dev.w3.org/2006/webapi/FileAPI/#dfn-type fn Type(self) -> DOMString { self.typeString.clone() } - // http://dev.w3.org/2006/webapi/FileAPI/#slice-method-algo + // https://dev.w3.org/2006/webapi/FileAPI/#slice-method-algo fn Slice(self, start: Option<i64>, end: Option<i64>, contentType: Option<DOMString>) -> Root<Blob> { let size: i64 = self.Size().to_i64().unwrap(); diff --git a/components/script/dom/closeevent.rs b/components/script/dom/closeevent.rs index cedbd61703e..b4c6a955500 100644 --- a/components/script/dom/closeevent.rs +++ b/components/script/dom/closeevent.rs @@ -69,14 +69,17 @@ impl CloseEvent { } impl<'a> CloseEventMethods for &'a CloseEvent { + // https://html.spec.whatwg.org/multipage/#dom-closeevent-wasclean fn WasClean(self) -> bool { self.wasClean } + // https://html.spec.whatwg.org/multipage/#dom-closeevent-code fn Code(self) -> u16 { self.code } + // https://html.spec.whatwg.org/multipage/#dom-closeevent-reason fn Reason(self) -> DOMString { self.reason.clone() } diff --git a/components/script/dom/console.rs b/components/script/dom/console.rs index ba46f5b3ab9..41b21b7e12f 100644 --- a/components/script/dom/console.rs +++ b/components/script/dom/console.rs @@ -40,6 +40,7 @@ impl<'a> ConsoleMethods for &'a Console { } } + // https://developer.mozilla.org/en-US/docs/Web/API/Console fn Debug(self, messages: Vec<DOMString>) { for message in messages { println!("{}", message); diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs index aedf1aa0c26..ef7bc62c9d9 100644 --- a/components/script/dom/crypto.rs +++ b/components/script/dom/crypto.rs @@ -41,8 +41,8 @@ impl Crypto { } impl<'a> CryptoMethods for &'a Crypto { - // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#Crypto-method-getRandomValues #[allow(unsafe_code)] + // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#Crypto-method-getRandomValues fn GetRandomValues(self, _cx: *mut JSContext, input: *mut JSObject) -> Fallible<*mut JSObject> { let mut length = 0; diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index 5251c889ff0..d3c1af656d4 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -92,7 +92,7 @@ impl<'a> PrivateCSSStyleDeclarationHelpers for &'a CSSStyleDeclaration { } impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration { - // http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-length + // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-length fn Length(self) -> u32 { let owner = self.owner.root(); let elem = ElementCast::from_ref(owner.r()); @@ -103,7 +103,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration { len as u32 } - // http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-item + // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-item fn Item(self, index: u32) -> DOMString { let index = index as usize; let owner = self.owner.root(); @@ -124,7 +124,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration { result.unwrap_or("".to_owned()) } - // http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue + // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue fn GetPropertyValue(self, property: DOMString) -> DOMString { // Step 1 let property = Atom::from_slice(&property.to_ascii_lowercase()); @@ -159,7 +159,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration { } } - // http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertypriority + // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertypriority fn GetPropertyPriority(self, property: DOMString) -> DOMString { // Step 1 let property = Atom::from_slice(&property.to_ascii_lowercase()); @@ -183,7 +183,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration { "".to_owned() } - // http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setproperty + // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setproperty fn SetProperty(self, property: DOMString, value: DOMString, priority: DOMString) -> ErrorResult { // Step 1 @@ -244,7 +244,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration { Ok(()) } - // http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertypriority + // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertypriority fn SetPropertyPriority(self, property: DOMString, priority: DOMString) -> ErrorResult { // Step 1 if self.readonly { @@ -287,12 +287,12 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration { Ok(()) } - // http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertyvalue + // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertyvalue fn SetPropertyValue(self, property: DOMString, value: DOMString) -> ErrorResult { self.SetProperty(property, value, "".to_owned()) } - // http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty + // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty fn RemoveProperty(self, property: DOMString) -> Fallible<DOMString> { // Step 1 if self.readonly { @@ -326,17 +326,17 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration { Ok(value) } - // http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat + // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat fn CssFloat(self) -> DOMString { self.GetPropertyValue("float".to_owned()) } - // http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat + // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat fn SetCssFloat(self, value: DOMString) -> ErrorResult { self.SetPropertyValue("float".to_owned(), value) } - // http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface + // https://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface fn IndexedGetter(self, index: u32, found: &mut bool) -> DOMString { let rval = self.Item(index); *found = index < self.Length(); diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 0e494b79a89..082b0dafe86 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -1738,10 +1738,12 @@ impl<'a> DocumentMethods for &'a Document { Ok(()) } + // https://html.spec.whatwg.org/multipage/#dom-document-bgcolor fn BgColor(self) -> DOMString { self.get_body_attribute(&atom!("bgcolor")) } + // https://html.spec.whatwg.org/multipage/#dom-document-bgcolor fn SetBgColor(self, value: DOMString) { self.set_body_attribute(&atom!("bgcolor"), value) } diff --git a/components/script/dom/dompoint.rs b/components/script/dom/dompoint.rs index 9e392da03db..a0cfcf09776 100644 --- a/components/script/dom/dompoint.rs +++ b/components/script/dom/dompoint.rs @@ -34,34 +34,42 @@ impl DOMPoint { } impl<'a> DOMPointMethods for &'a DOMPoint { - // http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x fn X(self) -> f64 { self.point.X() } + + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x fn SetX(self, value: f64) { self.point.SetX(value); } - // http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y fn Y(self) -> f64 { self.point.Y() } + + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y fn SetY(self, value: f64) { self.point.SetY(value); } - // http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z fn Z(self) -> f64 { self.point.Z() } + + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z fn SetZ(self, value: f64) { self.point.SetZ(value); } - // http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w fn W(self) -> f64 { self.point.W() } + + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w fn SetW(self, value: f64) { self.point.SetW(value); } diff --git a/components/script/dom/dompointreadonly.rs b/components/script/dom/dompointreadonly.rs index c6f40dfa7ef..b0a3d33f5e1 100644 --- a/components/script/dom/dompointreadonly.rs +++ b/components/script/dom/dompointreadonly.rs @@ -41,22 +41,22 @@ impl DOMPointReadOnly { } impl<'a> DOMPointReadOnlyMethods for &'a DOMPointReadOnly { - // http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x fn X(self) -> f64 { self.x.get() } - // http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y fn Y(self) -> f64 { self.y.get() } - // http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z fn Z(self) -> f64 { self.z.get() } - // http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w + // https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w fn W(self) -> f64 { self.w.get() } diff --git a/components/script/dom/domrect.rs b/components/script/dom/domrect.rs index c1870c18cc9..8d54301e39e 100644 --- a/components/script/dom/domrect.rs +++ b/components/script/dom/domrect.rs @@ -41,27 +41,33 @@ impl DOMRect { } impl<'a> DOMRectMethods for &'a DOMRect { + // https://drafts.fxtf.org/geometry/#dom-domrectreadonly-top fn Top(self) -> Finite<f32> { Finite::wrap(self.top) } + // https://drafts.fxtf.org/geometry/#dom-domrectreadonly-bottom fn Bottom(self) -> Finite<f32> { Finite::wrap(self.bottom) } + // https://drafts.fxtf.org/geometry/#dom-domrectreadonly-left fn Left(self) -> Finite<f32> { Finite::wrap(self.left) } + // https://drafts.fxtf.org/geometry/#dom-domrectreadonly-right fn Right(self) -> Finite<f32> { Finite::wrap(self.right) } + // https://drafts.fxtf.org/geometry/#dom-domrectreadonly-width fn Width(self) -> Finite<f32> { let result = (self.right - self.left).abs(); Finite::wrap(result) } + // https://drafts.fxtf.org/geometry/#dom-domrectreadonly-height fn Height(self) -> Finite<f32> { let result = (self.bottom - self.top).abs(); Finite::wrap(result) diff --git a/components/script/dom/domrectlist.rs b/components/script/dom/domrectlist.rs index eeb95cd9e3f..c016e2354f1 100644 --- a/components/script/dom/domrectlist.rs +++ b/components/script/dom/domrectlist.rs @@ -33,10 +33,12 @@ impl DOMRectList { } impl<'a> DOMRectListMethods for &'a DOMRectList { + // https://drafts.fxtf.org/geometry/#dom-domrectlist-length fn Length(self) -> u32 { self.rects.len() as u32 } + // https://drafts.fxtf.org/geometry/#dom-domrectlist-item fn Item(self, index: u32) -> Option<Root<DOMRect>> { let rects = &self.rects; if index < rects.len() as u32 { @@ -46,6 +48,7 @@ impl<'a> DOMRectListMethods for &'a DOMRectList { } } + // check-tidy: no specs after this line fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<DOMRect>> { *found = index < self.rects.len() as u32; self.Item(index) diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs index 625d261b686..254bdccaf5e 100644 --- a/components/script/dom/domstringmap.rs +++ b/components/script/dom/domstringmap.rs @@ -35,20 +35,24 @@ impl DOMStringMap { // https://html.spec.whatwg.org/#domstringmap impl<'a> DOMStringMapMethods for &'a DOMStringMap { + // https://html.spec.whatwg.org/multipage/#dom-domstringmap-additem fn NamedCreator(self, name: DOMString, value: DOMString) -> ErrorResult { self.NamedSetter(name, value) } + // https://html.spec.whatwg.org/multipage/#dom-domstringmap-removeitem fn NamedDeleter(self, name: DOMString) { let element = self.element.root(); element.r().delete_custom_attr(name) } + // https://html.spec.whatwg.org/multipage/#dom-domstringmap-setitem fn NamedSetter(self, name: DOMString, value: DOMString) -> ErrorResult { let element = self.element.root(); element.r().set_custom_attr(name, value) } + // https://html.spec.whatwg.org/multipage/#dom-domstringmap-nameditem fn NamedGetter(self, name: DOMString, found: &mut bool) -> DOMString { let element = self.element.root(); match element.r().get_custom_attr(name) { diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index f7a02cdf572..b77b34cf743 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -82,12 +82,6 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList { }) } - fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<DOMString> { - let item = self.Item(index); - *found = item.is_some(); - item - } - // https://dom.spec.whatwg.org/#dom-domtokenlist-contains fn Contains(self, token: DOMString) -> Fallible<bool> { self.check_token_exceptions(&token).map(|token| { @@ -160,4 +154,11 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList { let tokenlist = self.element.root().r().get_tokenlist_attribute(&self.local_name); str_join(&tokenlist, "\x20") } + + // check-tidy: no specs after this line + fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<DOMString> { + let item = self.Item(index); + *found = item.is_some(); + item + } } diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 10b7950f82e..1edc4947a8a 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -1291,7 +1291,7 @@ impl<'a> ElementMethods for &'a Element { HTMLCollection::by_class_name(window.r(), NodeCast::from_ref(self), classes) } - // http://dev.w3.org/csswg/cssom-view/#dom-element-getclientrects + // https://drafts.csswg.org/cssom-view/#dom-element-getclientrects fn GetClientRects(self) -> Root<DOMRectList> { let win = window_from_node(self); let node = NodeCast::from_ref(self); @@ -1304,7 +1304,7 @@ impl<'a> ElementMethods for &'a Element { DOMRectList::new(win.r(), rects) } - // http://dev.w3.org/csswg/cssom-view/#dom-element-getboundingclientrect + // https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect fn GetBoundingClientRect(self) -> Root<DOMRect> { let win = window_from_node(self); let node = NodeCast::from_ref(self); @@ -1317,21 +1317,25 @@ impl<'a> ElementMethods for &'a Element { rect.origin.x + rect.size.width) } + // https://drafts.csswg.org/cssom-view/#dom-element-clienttop fn ClientTop(self) -> i32 { let node = NodeCast::from_ref(self); node.get_client_rect().origin.y } + // https://drafts.csswg.org/cssom-view/#dom-element-clientleft fn ClientLeft(self) -> i32 { let node = NodeCast::from_ref(self); node.get_client_rect().origin.x } + // https://drafts.csswg.org/cssom-view/#dom-element-clientwidth fn ClientWidth(self) -> i32 { let node = NodeCast::from_ref(self); node.get_client_rect().size.width } + // https://drafts.csswg.org/cssom-view/#dom-element-clientheight fn ClientHeight(self) -> i32 { let node = NodeCast::from_ref(self); node.get_client_rect().size.height diff --git a/components/script/dom/errorevent.rs b/components/script/dom/errorevent.rs index 39741f48c8c..4efc449b364 100644 --- a/components/script/dom/errorevent.rs +++ b/components/script/dom/errorevent.rs @@ -114,22 +114,27 @@ impl ErrorEvent { } impl<'a> ErrorEventMethods for &'a ErrorEvent { + // https://html.spec.whatwg.org/multipage/#dom-errorevent-lineno fn Lineno(self) -> u32 { self.lineno.get() } + // https://html.spec.whatwg.org/multipage/#dom-errorevent-colno fn Colno(self) -> u32 { self.colno.get() } + // https://html.spec.whatwg.org/multipage/#dom-errorevent-message fn Message(self) -> DOMString { self.message.borrow().clone() } + // https://html.spec.whatwg.org/multipage/#dom-errorevent-filename fn Filename(self) -> DOMString { self.filename.borrow().clone() } + // https://html.spec.whatwg.org/multipage/#dom-errorevent-error fn Error(self, _cx: *mut JSContext) -> JSVal { self.error.get() } diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs index d6de3f39617..dfeae4ff08f 100644 --- a/components/script/dom/eventtarget.rs +++ b/components/script/dom/eventtarget.rs @@ -288,6 +288,7 @@ impl<'a> EventTargetHelpers for &'a EventTarget { } impl<'a> EventTargetMethods for &'a EventTarget { + // https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener fn AddEventListener(self, ty: DOMString, listener: Option<Rc<EventListener>>, @@ -313,6 +314,7 @@ impl<'a> EventTargetMethods for &'a EventTarget { } } + // https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener fn RemoveEventListener(self, ty: DOMString, listener: Option<Rc<EventListener>>, @@ -336,6 +338,7 @@ impl<'a> EventTargetMethods for &'a EventTarget { } } + // https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent fn DispatchEvent(self, event: &Event) -> Fallible<bool> { if event.dispatching() || !event.initialized() { return Err(InvalidState); diff --git a/components/script/dom/file.rs b/components/script/dom/file.rs index b95072b841c..f5cc0806c64 100644 --- a/components/script/dom/file.rs +++ b/components/script/dom/file.rs @@ -40,6 +40,7 @@ impl File { } impl<'a> FileMethods for &'a File { + // https://w3c.github.io/FileAPI/#dfn-name fn Name(self) -> DOMString { self.name.clone() } diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs index 3c89875ff09..09f6c83a99e 100644 --- a/components/script/dom/filereader.rs +++ b/components/script/dom/filereader.rs @@ -280,7 +280,7 @@ impl<'a> FileReaderMethods for &'a FileReader { event_handler!(loadend, GetOnloadend, SetOnloadend); //TODO https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer - //https://w3c.github.io/FileAPI/#dfn-readAsDataURL + // https://w3c.github.io/FileAPI/#dfn-readAsDataURL fn ReadAsDataURL(self, blob: &Blob) -> ErrorResult { let global = self.global.root(); // Step 1 @@ -340,14 +340,17 @@ impl<'a> FileReaderMethods for &'a FileReader { self.dispatch_progress_event("loadend".to_owned(), 0, None); } + // https://w3c.github.io/FileAPI/#dfn-error fn GetError(self) -> Option<Root<DOMException>> { self.error.get().map(|error| error.root()) } + // https://w3c.github.io/FileAPI/#dfn-result fn GetResult(self) -> Option<DOMString> { self.result.borrow().clone() } + // https://w3c.github.io/FileAPI/#dfn-readyState fn ReadyState(self) -> u16 { self.ready_state.get() as u16 } diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 843dd515d8c..5b7f497b8f3 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -58,6 +58,7 @@ impl FormData { impl<'a> FormDataMethods for &'a FormData { #[allow(unrooted_must_root)] + // https://xhr.spec.whatwg.org/#dom-formdata-append fn Append(self, name: DOMString, value: &Blob, filename: Option<DOMString>) { let file = FormDatum::FileData(JS::from_rooted(&self.get_file_from_blob(value, filename))); let mut data = self.data.borrow_mut(); @@ -69,6 +70,7 @@ impl<'a> FormDataMethods for &'a FormData { } } + // https://xhr.spec.whatwg.org/#dom-formdata-append fn Append_(self, name: DOMString, value: DOMString) { let mut data = self.data.borrow_mut(); match data.entry(name) { @@ -77,11 +79,13 @@ impl<'a> FormDataMethods for &'a FormData { } } + // https://xhr.spec.whatwg.org/#dom-formdata-delete fn Delete(self, name: DOMString) { self.data.borrow_mut().remove(&name); } #[allow(unsafe_code)] + // https://xhr.spec.whatwg.org/#dom-formdata-get fn Get(self, name: DOMString) -> Option<FileOrString> { // FIXME(https://github.com/rust-lang/rust/issues/23338) let data = self.data.borrow(); @@ -97,18 +101,22 @@ impl<'a> FormDataMethods for &'a FormData { } } + // https://xhr.spec.whatwg.org/#dom-formdata-has fn Has(self, name: DOMString) -> bool { self.data.borrow().contains_key(&name) } + + // https://xhr.spec.whatwg.org/#dom-formdata-set + fn Set_(self, name: DOMString, value: DOMString) { + self.data.borrow_mut().insert(name, vec!(FormDatum::StringData(value))); + } + #[allow(unrooted_must_root)] + // https://xhr.spec.whatwg.org/#dom-formdata-set fn Set(self, name: DOMString, value: &Blob, filename: Option<DOMString>) { let file = FormDatum::FileData(JS::from_rooted(&self.get_file_from_blob(value, filename))); self.data.borrow_mut().insert(name, vec!(file)); } - - fn Set_(self, name: DOMString, value: DOMString) { - self.data.borrow_mut().insert(name, vec!(FormDatum::StringData(value))); - } } trait PrivateFormDataHelpers{ diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index afe10ed7157..bace18798ed 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -78,16 +78,19 @@ impl<'a> VirtualMethods for &'a HTMLAnchorElement { } impl<'a> HTMLAnchorElementMethods for &'a HTMLAnchorElement { + // https://html.spec.whatwg.org/multipage/#dom-a-text fn Text(self) -> DOMString { let node = NodeCast::from_ref(self); node.GetTextContent().unwrap() } + // https://html.spec.whatwg.org/multipage/#dom-a-text fn SetText(self, value: DOMString) { let node = NodeCast::from_ref(self); node.SetTextContent(Some(value)) } + // https://html.spec.whatwg.org/multipage/#dom-a-rellist fn RelList(self) -> Root<DOMTokenList> { self.rel_list.or_init(|| { DOMTokenList::new(ElementCast::from_ref(self), &atom!("rel")) diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs index 6229abaf686..3af940f5d8b 100644 --- a/components/script/dom/htmlareaelement.rs +++ b/components/script/dom/htmlareaelement.rs @@ -67,6 +67,7 @@ impl<'a> VirtualMethods for &'a HTMLAreaElement { } impl<'a> HTMLAreaElementMethods for &'a HTMLAreaElement { + // https://html.spec.whatwg.org/multipage/#dom-area-rellist fn RelList(self) -> Root<DOMTokenList> { self.rel_list.or_init(|| { DOMTokenList::new(ElementCast::from_ref(self), &atom!("rel")) diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index a7a71b49233..7703440c924 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -66,16 +66,17 @@ impl HTMLBodyElement { } impl<'a> HTMLBodyElementMethods for &'a HTMLBodyElement { - - // https://html.spec.whatwg.org/#dom-body-bgcolor + // https://html.spec.whatwg.org/multipage#dom-body-bgcolor make_getter!(BgColor, "bgcolor"); make_setter!(SetBgColor, "bgcolor"); + // https://html.spec.whatwg.org/multipage/#the-body-element fn GetOnunload(self) -> Option<Rc<EventHandlerNonNull>> { let win = window_from_node(self); win.r().GetOnunload() } + // https://html.spec.whatwg.org/multipage/#the-body-element fn SetOnunload(self, listener: Option<Rc<EventHandlerNonNull>>) { let win = window_from_node(self); win.r().SetOnunload(listener) diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 0ba1cb740e4..1cbf331e098 100644 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -72,6 +72,7 @@ impl HTMLButtonElement { } impl<'a> HTMLButtonElementMethods for &'a HTMLButtonElement { + // https://html.spec.whatwg.org/multipage/#dom-cva-validity fn Validity(self) -> Root<ValidityState> { let window = window_from_node(self); ValidityState::new(window.r()) diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index 3c52d99ea4f..85adf1b625f 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -215,24 +215,29 @@ impl<'a> HTMLCanvasElementHelpers for &'a HTMLCanvasElement { } impl<'a> HTMLCanvasElementMethods for &'a HTMLCanvasElement { + // https://html.spec.whatwg.org/multipage/#dom-canvas-width fn Width(self) -> u32 { self.width.get() } + // https://html.spec.whatwg.org/multipage/#dom-canvas-width fn SetWidth(self, width: u32) { let elem = ElementCast::from_ref(self); elem.set_uint_attribute(&atom!("width"), width) } + // https://html.spec.whatwg.org/multipage/#dom-canvas-height fn Height(self) -> u32 { self.height.get() } + // https://html.spec.whatwg.org/multipage/#dom-canvas-height fn SetHeight(self, height: u32) { let elem = ElementCast::from_ref(self); elem.set_uint_attribute(&atom!("height"), height) } + // https://html.spec.whatwg.org/multipage/#dom-canvas-getcontext fn GetContext(self, cx: *mut JSContext, id: DOMString, diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index b47ba2578c5..226c3d58d9f 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -229,12 +229,14 @@ impl<'a> HTMLCollectionMethods for &'a HTMLCollection { } } + // https://dom.spec.whatwg.org/#dom-htmlcollection-item fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<Element>> { let maybe_elem = self.Item(index); *found = maybe_elem.is_some(); maybe_elem } + // check-tidy: no specs after this line fn NamedGetter(self, name: DOMString, found: &mut bool) -> Option<Root<Element>> { let maybe_elem = self.NamedItem(name); *found = maybe_elem.is_some(); diff --git a/components/script/dom/htmldatalistelement.rs b/components/script/dom/htmldatalistelement.rs index 88cfe433270..ee8615edc3b 100644 --- a/components/script/dom/htmldatalistelement.rs +++ b/components/script/dom/htmldatalistelement.rs @@ -49,6 +49,7 @@ impl HTMLDataListElement { } impl<'a> HTMLDataListElementMethods for &'a HTMLDataListElement { + // https://html.spec.whatwg.org/multipage/#dom-datalist-options fn Options(self) -> Root<HTMLCollection> { #[derive(JSTraceable)] struct HTMLDataListOptionsFilter; diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 97d7aa0e755..85574373c30 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -131,6 +131,7 @@ impl<'a> PrivateHTMLElementHelpers for &'a HTMLElement { } impl<'a> HTMLElementMethods for &'a HTMLElement { + // https://html.spec.whatwg.org/multipage/#the-style-attribute fn Style(self) -> Root<CSSStyleDeclaration> { self.style_decl.or_init(|| { let global = window_from_node(self); @@ -155,6 +156,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement { self.dataset.or_init(|| DOMStringMap::new(self)) } + // https://html.spec.whatwg.org/multipage/#handler-onload fn GetOnload(self) -> Option<Rc<EventHandlerNonNull>> { if self.is_body_or_frameset() { let win = window_from_node(self); @@ -165,6 +167,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement { } } + // https://html.spec.whatwg.org/multipage/#handler-onload fn SetOnload(self, listener: Option<Rc<EventHandlerNonNull>>) { if self.is_body_or_frameset() { let win = window_from_node(self); diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs index 706f892c07b..0736a0e33c2 100644 --- a/components/script/dom/htmlfieldsetelement.rs +++ b/components/script/dom/htmlfieldsetelement.rs @@ -71,6 +71,7 @@ impl<'a> HTMLFieldSetElementMethods for &'a HTMLFieldSetElement { HTMLCollection::create(window.r(), node, filter) } + // https://html.spec.whatwg.org/multipage/#dom-cva-validity fn Validity(self) -> Root<ValidityState> { let window = window_from_node(self); ValidityState::new(window.r()) diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 99af406790b..c7c8a240772 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -254,26 +254,31 @@ pub fn Navigate(iframe: &HTMLIFrameElement, direction: NavigationDirection) -> F } impl<'a> HTMLIFrameElementMethods for &'a HTMLIFrameElement { + // https://html.spec.whatwg.org/multipage/#dom-iframe-src fn Src(self) -> DOMString { let element = ElementCast::from_ref(self); element.get_string_attribute(&atom!("src")) } + // https://html.spec.whatwg.org/multipage/#dom-iframe-src fn SetSrc(self, src: DOMString) { let element = ElementCast::from_ref(self); element.set_url_attribute(&atom!("src"), src) } + // https://html.spec.whatwg.org/multipage/#dom-iframe-sandbox fn Sandbox(self) -> DOMString { let element = ElementCast::from_ref(self); element.get_string_attribute(&atom!("sandbox")) } + // https://html.spec.whatwg.org/multipage/#dom-iframe-sandbox fn SetSandbox(self, sandbox: DOMString) { let element = ElementCast::from_ref(self); element.set_tokenlist_attribute(&atom!("sandbox"), sandbox); } + // https://html.spec.whatwg.org/multipage/#dom-iframe-contentwindow fn GetContentWindow(self) -> Option<Root<Window>> { self.subpage_id.get().and_then(|subpage_id| { let window = window_from_node(self); @@ -286,6 +291,7 @@ impl<'a> HTMLIFrameElementMethods for &'a HTMLIFrameElement { }) } + // https://html.spec.whatwg.org/multipage/#dom-iframe-contentdocument fn GetContentDocument(self) -> Option<Root<Document>> { self.GetContentWindow().and_then(|window| { let self_url = match self.get_url() { @@ -319,6 +325,7 @@ impl<'a> HTMLIFrameElementMethods for &'a HTMLIFrameElement { } } + // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser fn SetMozbrowser(self, value: bool) -> ErrorResult { if opts::experimental_enabled() { let element = ElementCast::from_ref(self); diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index e98aa2110f5..82caf25c4f3 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -220,33 +220,39 @@ impl<'a> HTMLImageElementMethods for &'a HTMLImageElement { make_bool_getter!(IsMap); + // https://html.spec.whatwg.org/multipage/#dom-img-ismap fn SetIsMap(self, is_map: bool) { let element = ElementCast::from_ref(self); element.set_string_attribute(&atom!("ismap"), is_map.to_string()) } + // https://html.spec.whatwg.org/multipage/#dom-img-width fn Width(self) -> u32 { let node = NodeCast::from_ref(self); let rect = node.get_bounding_content_box(); rect.size.width.to_px() as u32 } + // https://html.spec.whatwg.org/multipage/#dom-img-width fn SetWidth(self, width: u32) { let elem = ElementCast::from_ref(self); elem.set_uint_attribute(&atom!("width"), width) } + // https://html.spec.whatwg.org/multipage/#dom-img-height fn Height(self) -> u32 { let node = NodeCast::from_ref(self); let rect = node.get_bounding_content_box(); rect.size.height.to_px() as u32 } + // https://html.spec.whatwg.org/multipage/#dom-img-height fn SetHeight(self, height: u32) { let elem = ElementCast::from_ref(self); elem.set_uint_attribute(&atom!("height"), height) } + // https://html.spec.whatwg.org/multipage/#dom-img-naturalwidth fn NaturalWidth(self) -> u32 { let image = self.image.borrow(); @@ -256,6 +262,7 @@ impl<'a> HTMLImageElementMethods for &'a HTMLImageElement { } } + // https://html.spec.whatwg.org/multipage/#dom-img-naturalheight fn NaturalHeight(self) -> u32 { let image = self.image.borrow(); @@ -265,6 +272,7 @@ impl<'a> HTMLImageElementMethods for &'a HTMLImageElement { } } + // https://html.spec.whatwg.org/multipage/#dom-img-complete fn Complete(self) -> bool { let image = self.image.borrow(); image.is_some() diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index 0389cd85de4..03c69584d0f 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -231,6 +231,7 @@ impl<'a> HTMLLinkElementMethods for &'a HTMLLinkElement { make_getter!(Type); make_setter!(SetType, "type"); + // https://html.spec.whatwg.org/multipage/#dom-link-rellist fn RelList(self) -> Root<DOMTokenList> { self.rel_list.or_init(|| { DOMTokenList::new(ElementCast::from_ref(self), &atom!("rel")) diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index 3ea6db1bd4e..745b7821c55 100644 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -85,6 +85,7 @@ pub fn is_image_data(uri: &str) -> bool { } impl<'a> HTMLObjectElementMethods for &'a HTMLObjectElement { + // https://html.spec.whatwg.org/multipage/#dom-cva-validity fn Validity(self) -> Root<ValidityState> { let window = window_from_node(self); ValidityState::new(window.r()) diff --git a/components/script/dom/htmloutputelement.rs b/components/script/dom/htmloutputelement.rs index 9b6ac86e365..ad7f64e1b75 100644 --- a/components/script/dom/htmloutputelement.rs +++ b/components/script/dom/htmloutputelement.rs @@ -47,6 +47,7 @@ impl HTMLOutputElement { } impl<'a> HTMLOutputElementMethods for &'a HTMLOutputElement { + // https://html.spec.whatwg.org/multipage/#dom-cva-validity fn Validity(self) -> Root<ValidityState> { let window = window_from_node(self); ValidityState::new(window.r()) diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index a33e8d419ba..a24c892335a 100644 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -59,12 +59,14 @@ impl HTMLSelectElement { } impl<'a> HTMLSelectElementMethods for &'a HTMLSelectElement { + // https://html.spec.whatwg.org/multipage/#dom-cva-validity fn Validity(self) -> Root<ValidityState> { let window = window_from_node(self); ValidityState::new(window.r()) } // Note: this function currently only exists for test_union.html. + // https://html.spec.whatwg.org/multipage/#dom-select-add fn Add(self, _element: HTMLOptionElementOrHTMLOptGroupElement, _before: Option<HTMLElementOrLong>) { } diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index 2ff2d69a0b5..41f0af855e7 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -65,7 +65,7 @@ impl HTMLTableElement { } impl<'a> HTMLTableElementMethods for &'a HTMLTableElement { - // https://www.whatwg.org/html/#dom-table-caption + // https://html.spec.whatwg.org/multipage/#dom-table-caption fn GetCaption(self) -> Option<Root<HTMLTableCaptionElement>> { let node = NodeCast::from_ref(self); node.children() @@ -75,7 +75,7 @@ impl<'a> HTMLTableElementMethods for &'a HTMLTableElement { .next() } - // https://www.whatwg.org/html/#dom-table-caption + // https://html.spec.whatwg.org/multipage/#dom-table-caption fn SetCaption(self, new_caption: Option<&HTMLTableCaptionElement>) { let node = NodeCast::from_ref(self); diff --git a/components/script/dom/keyboardevent.rs b/components/script/dom/keyboardevent.rs index 156ab99e899..0153ad214be 100644 --- a/components/script/dom/keyboardevent.rs +++ b/components/script/dom/keyboardevent.rs @@ -761,6 +761,7 @@ impl KeyEventProperties { } impl<'a> KeyboardEventMethods for &'a KeyboardEvent { + // https://w3c.github.io/uievents/#widl-KeyboardEvent-initKeyboardEvent fn InitKeyboardEvent(self, typeArg: DOMString, canBubbleArg: bool, @@ -783,38 +784,47 @@ impl<'a> KeyboardEventMethods for &'a KeyboardEvent { self.repeat.set(repeat); } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-key fn Key(self) -> DOMString { self.key_string.borrow().clone() } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-code fn Code(self) -> DOMString { self.code.borrow().clone() } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-location fn Location(self) -> u32 { self.location.get() } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-ctrlKey fn CtrlKey(self) -> bool { self.ctrl.get() } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-shiftKey fn ShiftKey(self) -> bool { self.shift.get() } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-altKey fn AltKey(self) -> bool { self.alt.get() } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-metaKey fn MetaKey(self) -> bool { self.meta.get() } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-repeat fn Repeat(self) -> bool { self.repeat.get() } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-isComposing fn IsComposing(self) -> bool { self.is_composing.get() } @@ -832,14 +842,17 @@ impl<'a> KeyboardEventMethods for &'a KeyboardEvent { } } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-charCode fn CharCode(self) -> u32 { self.char_code.get().unwrap_or(0) } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-keyCode fn KeyCode(self) -> u32 { self.key_code.get() } + // https://w3c.github.io/uievents/#widl-KeyboardEvent-which fn Which(self) -> u32 { self.char_code.get().unwrap_or(self.KeyCode()) } diff --git a/components/script/dom/messageevent.rs b/components/script/dom/messageevent.rs index 6ba929b1ce4..5d5c2d5112d 100644 --- a/components/script/dom/messageevent.rs +++ b/components/script/dom/messageevent.rs @@ -90,14 +90,17 @@ impl MessageEvent { } impl<'a> MessageEventMethods for &'a MessageEvent { + // https://html.spec.whatwg.org/multipage/#dom-messageevent-data fn Data(self, _cx: *mut JSContext) -> JSVal { self.data.get() } + // https://html.spec.whatwg.org/multipage/#dom-messageevent-origin fn Origin(self) -> DOMString { self.origin.clone() } + // https://html.spec.whatwg.org/multipage/#dom-messageevent-lasteventid fn LastEventId(self) -> DOMString { self.lastEventId.clone() } diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs index e51b8391ee0..fdd34ea0e96 100644 --- a/components/script/dom/mouseevent.rs +++ b/components/script/dom/mouseevent.rs @@ -116,42 +116,52 @@ impl MouseEvent { } impl<'a> MouseEventMethods for &'a MouseEvent { + // https://w3c.github.io/uievents/#widl-MouseEvent-screenX fn ScreenX(self) -> i32 { self.screen_x.get() } + // https://w3c.github.io/uievents/#widl-MouseEvent-screenY fn ScreenY(self) -> i32 { self.screen_y.get() } + // https://w3c.github.io/uievents/#widl-MouseEvent-clientX fn ClientX(self) -> i32 { self.client_x.get() } + // https://w3c.github.io/uievents/#widl-MouseEvent-clientY fn ClientY(self) -> i32 { self.client_y.get() } + // https://w3c.github.io/uievents/#widl-MouseEvent-ctrlKey fn CtrlKey(self) -> bool { self.ctrl_key.get() } + // https://w3c.github.io/uievents/#widl-MouseEvent-shiftKey fn ShiftKey(self) -> bool { self.shift_key.get() } + // https://w3c.github.io/uievents/#widl-MouseEvent-altKey fn AltKey(self) -> bool { self.alt_key.get() } + // https://w3c.github.io/uievents/#widl-MouseEvent-metaKey fn MetaKey(self) -> bool { self.meta_key.get() } + // https://w3c.github.io/uievents/#widl-MouseEvent-button fn Button(self) -> i16 { self.button.get() } + // https://w3c.github.io/uievents/#widl-MouseEvent-relatedTarget fn GetRelatedTarget(self) -> Option<Root<EventTarget>> { self.related_target.get().map(Root::from_rooted) } @@ -160,6 +170,7 @@ impl<'a> MouseEventMethods for &'a MouseEvent { // - https://github.com/servo/servo/issues/6643 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1186125 // This returns the same result as current gecko. + // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/which fn Which(self) -> i32 { if opts::experimental_enabled() { (self.button.get() + 1) as i32 @@ -168,6 +179,7 @@ impl<'a> MouseEventMethods for &'a MouseEvent { } } + // https://w3c.github.io/uievents/#widl-MouseEvent-initMouseEvent fn InitMouseEvent(self, typeArg: DOMString, canBubbleArg: bool, diff --git a/components/script/dom/namednodemap.rs b/components/script/dom/namednodemap.rs index c301ae087b3..5f5462c3542 100644 --- a/components/script/dom/namednodemap.rs +++ b/components/script/dom/namednodemap.rs @@ -91,12 +91,14 @@ impl<'a> NamedNodeMapMethods for &'a NamedNodeMap { owner.remove_attribute(&ns, &Atom::from_slice(&local_name)).ok_or(Error::NotFound) } + // https://dom.spec.whatwg.org/#dom-namednodemap-item fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<Attr>> { let item = self.Item(index); *found = item.is_some(); item } + // check-tidy: no specs after this line fn NamedGetter(self, name: DOMString, found: &mut bool) -> Option<Root<Attr>> { let item = self.GetNamedItem(name); *found = item.is_some(); diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs index 1fa30b66b04..825ccfdf2e5 100644 --- a/components/script/dom/navigator.rs +++ b/components/script/dom/navigator.rs @@ -31,30 +31,37 @@ impl Navigator { } impl<'a> NavigatorMethods for &'a Navigator { + // https://html.spec.whatwg.org/multipage/#dom-navigator-product fn Product(self) -> DOMString { navigatorinfo::Product() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-taintenabled fn TaintEnabled(self) -> bool { navigatorinfo::TaintEnabled() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-appname fn AppName(self) -> DOMString { navigatorinfo::AppName() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-appcodename fn AppCodeName(self) -> DOMString { navigatorinfo::AppCodeName() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-platform fn Platform(self) -> DOMString { navigatorinfo::Platform() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-useragent fn UserAgent(self) -> DOMString { navigatorinfo::UserAgent() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-appversion fn AppVersion(self) -> DOMString { navigatorinfo::AppVersion() } diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index f879eb57c85..35ed6861459 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -73,6 +73,7 @@ impl<'a> NodeListMethods for &'a NodeList { } } + // https://dom.spec.whatwg.org/#dom-nodelist-item fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<Node>> { let item = self.Item(index); *found = item.is_some(); diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs index 95efff68a44..b566d4308fd 100644 --- a/components/script/dom/performance.rs +++ b/components/script/dom/performance.rs @@ -44,6 +44,7 @@ impl Performance { } impl<'a> PerformanceMethods for &'a Performance { + // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html#performance-timing-attribute fn Timing(self) -> Root<PerformanceTiming> { self.timing.root() } diff --git a/components/script/dom/performancetiming.rs b/components/script/dom/performancetiming.rs index f75b1031963..9e3a7151f14 100644 --- a/components/script/dom/performancetiming.rs +++ b/components/script/dom/performancetiming.rs @@ -39,6 +39,8 @@ impl PerformanceTiming { } impl<'a> PerformanceTimingMethods for &'a PerformanceTiming { + // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ + // NavigationTiming/Overview.html#dom-performancetiming-navigationstart fn NavigationStart(self) -> u64 { self.navigationStart } diff --git a/components/script/dom/progressevent.rs b/components/script/dom/progressevent.rs index 05531d3c10d..a181ba0c6d6 100644 --- a/components/script/dom/progressevent.rs +++ b/components/script/dom/progressevent.rs @@ -62,12 +62,17 @@ impl ProgressEvent { } impl<'a> ProgressEventMethods for &'a ProgressEvent { + // https://xhr.spec.whatwg.org/#dom-progressevent-lengthcomputable fn LengthComputable(self) -> bool { self.length_computable } + + // https://xhr.spec.whatwg.org/#dom-progressevent-loaded fn Loaded(self) -> u64{ self.loaded } + + // https://xhr.spec.whatwg.org/#dom-progressevent-total fn Total(self) -> u64 { self.total } diff --git a/components/script/dom/range.rs b/components/script/dom/range.rs index b9598a496dc..3b084dac2d1 100644 --- a/components/script/dom/range.rs +++ b/components/script/dom/range.rs @@ -95,22 +95,22 @@ impl<'a> RangeHelpers<'a> for &'a Range { } impl<'a> RangeMethods for &'a Range { - // http://dom.spec.whatwg.org/#dom-range-startcontainer + // https://dom.spec.whatwg.org/#dom-range-startcontainer fn StartContainer(self) -> Root<Node> { self.inner().borrow().start.node() } - /// http://dom.spec.whatwg.org/#dom-range-startoffset + // https://dom.spec.whatwg.org/#dom-range-startoffset fn StartOffset(self) -> u32 { self.inner().borrow().start.offset } - /// http://dom.spec.whatwg.org/#dom-range-endcontainer + // https://dom.spec.whatwg.org/#dom-range-endcontainer fn EndContainer(self) -> Root<Node> { self.inner().borrow().end.node() } - /// http://dom.spec.whatwg.org/#dom-range-endoffset + // https://dom.spec.whatwg.org/#dom-range-endoffset fn EndOffset(self) -> u32 { self.inner().borrow().end.offset } @@ -448,7 +448,7 @@ impl<'a> RangeMethods for &'a Range { Ok(fragment) } - // http://dom.spec.whatwg.org/#dom-range-detach + // https://dom.spec.whatwg.org/#dom-range-detach fn Detach(self) { // This method intentionally left blank. } diff --git a/components/script/dom/screen.rs b/components/script/dom/screen.rs index 8c185ae77f1..ff0be321c0c 100644 --- a/components/script/dom/screen.rs +++ b/components/script/dom/screen.rs @@ -29,10 +29,12 @@ impl Screen { } impl<'a> ScreenMethods for &'a Screen { + // https://drafts.csswg.org/cssom-view/#dom-screen-colordepth fn ColorDepth(self) -> u32 { 24 } + // https://drafts.csswg.org/cssom-view/#dom-screen-pixeldepth fn PixelDepth(self) -> u32 { 24 } diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs index 518d3c9c8f8..636ceb5fb12 100644 --- a/components/script/dom/storage.rs +++ b/components/script/dom/storage.rs @@ -58,6 +58,7 @@ impl Storage { } impl<'a> StorageMethods for &'a Storage { + // https://html.spec.whatwg.org/multipage/#dom-storage-length fn Length(self) -> u32 { let (sender, receiver) = ipc::channel().unwrap(); @@ -65,6 +66,7 @@ impl<'a> StorageMethods for &'a Storage { receiver.recv().unwrap() as u32 } + // https://html.spec.whatwg.org/multipage/#dom-storage-key fn Key(self, index: u32) -> Option<DOMString> { let (sender, receiver) = ipc::channel().unwrap(); @@ -72,6 +74,7 @@ impl<'a> StorageMethods for &'a Storage { receiver.recv().unwrap() } + // https://html.spec.whatwg.org/multipage/#dom-storage-getitem fn GetItem(self, name: DOMString) -> Option<DOMString> { let (sender, receiver) = ipc::channel().unwrap(); @@ -80,12 +83,7 @@ impl<'a> StorageMethods for &'a Storage { receiver.recv().unwrap() } - fn NamedGetter(self, name: DOMString, found: &mut bool) -> Option<DOMString> { - let item = self.GetItem(name); - *found = item.is_some(); - item - } - + // https://html.spec.whatwg.org/multipage/#dom-storage-setitem fn SetItem(self, name: DOMString, value: DOMString) { let (sender, receiver) = ipc::channel().unwrap(); @@ -97,14 +95,7 @@ impl<'a> StorageMethods for &'a Storage { } } - fn NamedSetter(self, name: DOMString, value: DOMString) { - self.SetItem(name, value); - } - - fn NamedCreator(self, name: DOMString, value: DOMString) { - self.SetItem(name, value); - } - + // https://html.spec.whatwg.org/multipage/#dom-storage-removeitem fn RemoveItem(self, name: DOMString) { let (sender, receiver) = ipc::channel().unwrap(); @@ -115,10 +106,7 @@ impl<'a> StorageMethods for &'a Storage { } } - fn NamedDeleter(self, name: DOMString) { - self.RemoveItem(name); - } - + // https://html.spec.whatwg.org/multipage/#dom-storage-clear fn Clear(self) { let (sender, receiver) = ipc::channel().unwrap(); @@ -127,6 +115,25 @@ impl<'a> StorageMethods for &'a Storage { self.broadcast_change_notification(None, None, None); } } + + // check-tidy: no specs after this line + fn NamedGetter(self, name: DOMString, found: &mut bool) -> Option<DOMString> { + let item = self.GetItem(name); + *found = item.is_some(); + item + } + + fn NamedSetter(self, name: DOMString, value: DOMString) { + self.SetItem(name, value); + } + + fn NamedCreator(self, name: DOMString, value: DOMString) { + self.SetItem(name, value); + } + + fn NamedDeleter(self, name: DOMString) { + self.RemoveItem(name); + } } trait PrivateStorageHelpers { diff --git a/components/script/dom/storageevent.rs b/components/script/dom/storageevent.rs index ce2c352630d..8f722ece866 100644 --- a/components/script/dom/storageevent.rs +++ b/components/script/dom/storageevent.rs @@ -88,24 +88,28 @@ impl StorageEvent { } impl<'a> StorageEventMethods for &'a StorageEvent { + // https://html.spec.whatwg.org/multipage/#dom-storageevent-key fn GetKey(self) -> Option<DOMString> { self.key.borrow().clone() } + // https://html.spec.whatwg.org/multipage/#dom-storageevent-oldvalue fn GetOldValue(self) -> Option<DOMString> { self.oldValue.borrow().clone() } + // https://html.spec.whatwg.org/multipage/#dom-storageevent-newvalue fn GetNewValue(self) -> Option<DOMString> { self.newValue.borrow().clone() } + // https://html.spec.whatwg.org/multipage/#dom-storageevent-url fn Url(self) -> DOMString { self.url.borrow().clone() } + // https://html.spec.whatwg.org/multipage/#dom-storageevent-storagearea fn GetStorageArea(self) -> Option<Root<Storage>> { self.storageArea.get().map(Root::from_rooted) } - } diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 563fe59f280..567bf7f9bee 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -2,6 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// check-tidy: no specs after this line + use dom::bindings::codegen::Bindings::TestBindingBinding::TestBindingMethods; use dom::bindings::codegen::Bindings::TestBindingBinding::TestEnum; use dom::bindings::codegen::Bindings::TestBindingBinding::TestEnum::_empty; diff --git a/components/script/dom/testbindingproxy.rs b/components/script/dom/testbindingproxy.rs index a0bbb0612dc..26d9e6e6611 100644 --- a/components/script/dom/testbindingproxy.rs +++ b/components/script/dom/testbindingproxy.rs @@ -1,6 +1,9 @@ /* 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 http://mozilla.org/MPL/2.0/. */ + +// check-tidy: no specs after this line + use dom::bindings::codegen::Bindings::TestBindingProxyBinding::TestBindingProxyMethods; use dom::bindings::utils::Reflector; use util::str::DOMString; diff --git a/components/script/dom/textdecoder.rs b/components/script/dom/textdecoder.rs index 308ca30527c..4b8756afba7 100644 --- a/components/script/dom/textdecoder.rs +++ b/components/script/dom/textdecoder.rs @@ -73,15 +73,18 @@ impl TextDecoder { impl<'a> TextDecoderMethods for &'a TextDecoder { + // https://encoding.spec.whatwg.org/#dom-textdecoder-encoding fn Encoding(self) -> DOMString { self.encoding.whatwg_name().unwrap().to_owned() } + // https://encoding.spec.whatwg.org/#dom-textdecoder-fatal fn Fatal(self) -> bool { self.fatal } #[allow(unsafe_code)] + // https://encoding.spec.whatwg.org/#dom-textdecoder-decode fn Decode(self, _cx: *mut JSContext, input: Option<*mut JSObject>) -> Fallible<USVString> { let input = match input { @@ -108,5 +111,4 @@ impl<'a> TextDecoderMethods for &'a TextDecoder { Err(_) => Err(Error::Type("Decoding failed".to_owned())), } } - } diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs index 9ca40bbd7a0..7fc7370ebdc 100644 --- a/components/script/dom/textencoder.rs +++ b/components/script/dom/textencoder.rs @@ -75,8 +75,8 @@ impl<'a> TextEncoderMethods for &'a TextEncoder { self.encoding.clone() } - // https://encoding.spec.whatwg.org/#dom-textencoder-encode #[allow(unsafe_code)] + // https://encoding.spec.whatwg.org/#dom-textencoder-encode fn Encode(self, cx: *mut JSContext, input: USVString) -> *mut JSObject { unsafe { let encoded = self.encoder.encode(&input.0, EncoderTrap::Strict).unwrap(); diff --git a/components/script/dom/uievent.rs b/components/script/dom/uievent.rs index 70ac7e31fac..e3411f35cb8 100644 --- a/components/script/dom/uievent.rs +++ b/components/script/dom/uievent.rs @@ -77,16 +77,17 @@ impl UIEvent { } impl<'a> UIEventMethods for &'a UIEvent { - // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-UIEvent-view + // https://w3c.github.io/uievents/#widl-UIEvent-view fn GetView(self) -> Option<Root<Window>> { self.view.get().map(Root::from_rooted) } - // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-UIEvent-detail + // https://w3c.github.io/uievents/#widl-UIEvent-detail fn Detail(self) -> i32 { self.detail.get() } + // https://w3c.github.io/uievents/#widl-UIEvent-initUIEvent fn InitUIEvent(self, type_: DOMString, can_bubble: bool, diff --git a/components/script/dom/webglactiveinfo.rs b/components/script/dom/webglactiveinfo.rs index 8f96b98ed9c..0e20e230829 100644 --- a/components/script/dom/webglactiveinfo.rs +++ b/components/script/dom/webglactiveinfo.rs @@ -35,14 +35,17 @@ impl WebGLActiveInfo { } impl<'a> WebGLActiveInfoMethods for &'a WebGLActiveInfo { + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.11.1 fn Size(self) -> i32 { self.size } + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.11.1 fn Type(self) -> u32 { self.ty } + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.11.1 fn Name(self) -> DOMString { self.name.clone() } diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 4dcd1705782..78a2567cbd2 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -276,8 +276,8 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext { } } - // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5 #[allow(unsafe_code)] + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5 fn BufferData(self, _cx: *mut JSContext, target: u32, data: Option<*mut JSObject>, usage: u32) { let data = match data { Some(data) => data, @@ -345,9 +345,9 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext { WebGLProgram::maybe_new(self.global.root().r(), self.ipc_renderer.clone()) } - // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 // TODO(ecoal95): Check if constants are cross-platform or if we must make a translation // between WebGL constants and native ones. + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 fn CreateShader(self, shader_type: u32) -> Option<Root<WebGLShader>> { WebGLShader::maybe_new(self.global.root().r(), self.ipc_renderer.clone(), shader_type) } @@ -474,8 +474,8 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext { } } - // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform4fv(self, _cx: *mut JSContext, uniform: Option<&WebGLUniformLocation>, diff --git a/components/script/dom/webglshaderprecisionformat.rs b/components/script/dom/webglshaderprecisionformat.rs index 91b12883731..b5d89d735ee 100644 --- a/components/script/dom/webglshaderprecisionformat.rs +++ b/components/script/dom/webglshaderprecisionformat.rs @@ -39,14 +39,17 @@ impl WebGLShaderPrecisionFormat { } impl<'a> WebGLShaderPrecisionFormatMethods for &'a WebGLShaderPrecisionFormat { + // https://www.khronos.org/registry/webgl/specs/1.0/#5.12.1 fn RangeMin(self) -> i32 { self.range_min } + // https://www.khronos.org/registry/webgl/specs/1.0/#5.12.1 fn RangeMax(self) -> i32 { self.range_max } + // https://www.khronos.org/registry/webgl/specs/1.0/#5.12.1 fn Precision(self) -> i32 { self.precision } diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs index 1573720da57..78e66e8335e 100644 --- a/components/script/dom/websocket.rs +++ b/components/script/dom/websocket.rs @@ -172,14 +172,17 @@ impl<'a> WebSocketMethods for &'a WebSocket { event_handler!(close, GetOnclose, SetOnclose); event_handler!(error, GetOnerror, SetOnerror); + // https://html.spec.whatwg.org/multipage/#dom-websocket-url fn Url(self) -> DOMString { self.url.serialize() } + // https://html.spec.whatwg.org/multipage/#dom-websocket-readystate fn ReadyState(self) -> u16 { self.ready_state.get() as u16 } + // https://html.spec.whatwg.org/multipage/#dom-websocket-send fn Send(self, data: Option<USVString>) -> Fallible<()> { match self.ready_state.get() { WebSocketRequestState::Connecting => { @@ -206,6 +209,7 @@ impl<'a> WebSocketMethods for &'a WebSocket { return Ok(()) } + // https://html.spec.whatwg.org/multipage/#dom-websocket-close fn Close(self, code: Option<u16>, reason: Option<USVString>) -> Fallible<()>{ fn send_close(this: &WebSocket) { this.ready_state.set(WebSocketRequestState::Closing); diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 7bea165b46d..e00164d3c93 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -339,10 +339,12 @@ impl<'a> WindowMethods for &'a Window { println!("ALERT: {}", s); } + // https://html.spec.whatwg.org/multipage/#dom-window-close fn Close(self) { self.script_chan.send(ScriptMsg::ExitWindow(self.id.clone())).unwrap(); } + // https://html.spec.whatwg.org/multipage/#dom-document-0 fn Document(self) -> Root<Document> { self.browsing_context().as_ref().unwrap().active_document() } @@ -362,10 +364,12 @@ impl<'a> WindowMethods for &'a Window { self.local_storage.or_init(|| Storage::new(&GlobalRef::Window(self), StorageType::Local)) } + // https://developer.mozilla.org/en-US/docs/Web/API/Console fn Console(self) -> Root<Console> { self.console.or_init(|| Console::new(GlobalRef::Window(self))) } + // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#dfn-GlobalCrypto fn Crypto(self) -> Root<Crypto> { self.crypto.or_init(|| Crypto::new(GlobalRef::Window(self))) } @@ -430,10 +434,12 @@ impl<'a> WindowMethods for &'a Window { self.ClearTimeout(handle); } + // https://html.spec.whatwg.org/multipage/#dom-window fn Window(self) -> Root<Window> { Root::from_ref(self) } + // https://html.spec.whatwg.org/multipage/#dom-self fn Self_(self) -> Root<Window> { self.Window() } @@ -457,6 +463,8 @@ impl<'a> WindowMethods for &'a Window { window } + // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ + // NavigationTiming/Overview.html#sec-window.performance-attribute fn Performance(self) -> Root<Performance> { self.performance.or_init(|| { Performance::new(self, self.navigation_start, @@ -468,29 +476,17 @@ impl<'a> WindowMethods for &'a Window { event_handler!(unload, GetOnunload, SetOnunload); error_event_handler!(error, GetOnerror, SetOnerror); + // https://developer.mozilla.org/en-US/docs/Web/API/Window/screen fn Screen(self) -> Root<Screen> { self.screen.or_init(|| Screen::new(self)) } - fn Debug(self, message: DOMString) { - debug!("{}", message); - } - - #[allow(unsafe_code)] - fn Gc(self) { - unsafe { - JS_GC(JS_GetRuntime(self.get_cx())); - } - } - - fn Trap(self) { - breakpoint(); - } - + // https://html.spec.whatwg.org/multipage/#dom-windowbase64-btoa fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> { base64_btoa(btoa) } + // https://html.spec.whatwg.org/multipage/#dom-windowbase64-atob fn Atob(self, atob: DOMString) -> Fallible<DOMString> { base64_atob(atob) } @@ -513,6 +509,22 @@ impl<'a> WindowMethods for &'a Window { doc.r().cancel_animation_frame(ident); } + // check-tidy: no specs after this line + fn Debug(self, message: DOMString) { + debug!("{}", message); + } + + #[allow(unsafe_code)] + fn Gc(self) { + unsafe { + JS_GC(JS_GetRuntime(self.get_cx())); + } + } + + fn Trap(self) { + breakpoint(); + } + fn WebdriverCallback(self, cx: *mut JSContext, val: HandleValue) { let rv = jsval_to_webdriver(cx, val); let opt_chan = self.webdriver_script_chan.borrow_mut().take(); diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs index 6a12b6e3571..e536200fb43 100644 --- a/components/script/dom/worker.rs +++ b/components/script/dom/worker.rs @@ -138,6 +138,7 @@ impl Worker { } impl<'a> WorkerMethods for &'a Worker { + // https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage fn PostMessage(self, cx: *mut JSContext, message: HandleValue) -> ErrorResult { let data = try!(StructuredCloneData::write(cx, message)); let address = Trusted::new(cx, self, self.global.root().r().script_chan().clone()); diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 483298ff319..ebdb35a0fde 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -173,22 +173,27 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope { self.navigator.or_init(|| WorkerNavigator::new(self)) } + // https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/console fn Console(self) -> Root<Console> { self.console.or_init(|| Console::new(GlobalRef::Worker(self))) } + // https://html.spec.whatwg.org/multipage/#dfn-Crypto fn Crypto(self) -> Root<Crypto> { self.crypto.or_init(|| Crypto::new(GlobalRef::Worker(self))) } + // https://html.spec.whatwg.org/multipage/#dom-windowbase64-btoa fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> { base64_btoa(btoa) } + // https://html.spec.whatwg.org/multipage/#dom-windowbase64-atob fn Atob(self, atob: DOMString) -> Fallible<DOMString> { base64_atob(atob) } + // https://html.spec.whatwg.org/multipage/#dom-windowtimers-setinterval fn SetTimeout(self, _cx: *mut JSContext, callback: Rc<Function>, timeout: i32, args: Vec<HandleValue>) -> i32 { self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback), args, @@ -198,6 +203,7 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope { self.script_chan()) } + // https://html.spec.whatwg.org/multipage/#dom-windowtimers-setinterval fn SetTimeout_(self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<HandleValue>) -> i32 { self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback), args, @@ -207,10 +213,12 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope { self.script_chan()) } + // https://html.spec.whatwg.org/multipage/#dom-windowtimers-clearinterval fn ClearTimeout(self, handle: i32) { self.timers.clear_timeout_or_interval(handle); } + // https://html.spec.whatwg.org/multipage/#dom-windowtimers-setinterval fn SetInterval(self, _cx: *mut JSContext, callback: Rc<Function>, timeout: i32, args: Vec<HandleValue>) -> i32 { self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback), args, @@ -220,6 +228,7 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope { self.script_chan()) } + // https://html.spec.whatwg.org/multipage/#dom-windowtimers-setinterval fn SetInterval_(self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<HandleValue>) -> i32 { self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback), args, @@ -229,6 +238,7 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope { self.script_chan()) } + // https://html.spec.whatwg.org/multipage/#dom-windowtimers-clearinterval fn ClearInterval(self, handle: i32) { self.ClearTimeout(handle); } diff --git a/components/script/dom/workernavigator.rs b/components/script/dom/workernavigator.rs index 0decb060cb3..cf7a106034b 100644 --- a/components/script/dom/workernavigator.rs +++ b/components/script/dom/workernavigator.rs @@ -32,30 +32,37 @@ impl WorkerNavigator { } impl<'a> WorkerNavigatorMethods for &'a WorkerNavigator { + // https://html.spec.whatwg.org/multipage/#dom-navigator-product fn Product(self) -> DOMString { navigatorinfo::Product() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-taintenabled fn TaintEnabled(self) -> bool { navigatorinfo::TaintEnabled() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-appname fn AppName(self) -> DOMString { navigatorinfo::AppName() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-appcodename fn AppCodeName(self) -> DOMString { navigatorinfo::AppCodeName() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-platform fn Platform(self) -> DOMString { navigatorinfo::Platform() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-useragent fn UserAgent(self) -> DOMString { navigatorinfo::UserAgent() } + // https://html.spec.whatwg.org/multipage/#dom-navigator-appversion fn AppVersion(self) -> DOMString { navigatorinfo::AppVersion() } diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 10ad71ab2f2..9ec68cb0fd2 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -662,8 +662,8 @@ impl<'a> XMLHttpRequestMethods for &'a XMLHttpRequest { } } - // https://xhr.spec.whatwg.org/#the-response-attribute #[allow(unsafe_code)] + // https://xhr.spec.whatwg.org/#the-response-attribute fn Response(self, cx: *mut JSContext) -> JSVal { let mut rval = RootedValue::new(cx, UndefinedValue()); match self.response_type.get() { |