From 4383b3053b40cebaaef8bfbfd32152a22c313bf1 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Mon, 9 Apr 2018 16:27:20 -0700 Subject: [PATCH 1/5] Add a new RPC call for getting a child browsing context ID --- components/constellation/constellation.rs | 9 +++++++++ components/script_traits/script_msg.rs | 2 ++ 2 files changed, 11 insertions(+) diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 77305b4e153..a3086b50d93 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -1231,6 +1231,15 @@ impl Constellation warn!("Sending reply to get parent info failed ({:?}).", e); } } + FromScriptMsg::GetChildBrowsingContextId(browsing_context_id, index, sender) => { + // We increment here because the 0th element is the parent browsing context itself + let result = self.all_descendant_browsing_contexts_iter(browsing_context_id) + .nth(index + 1) + .map(|bc| bc.id); + if let Err(e) = sender.send(result) { + warn!("Sending reply to get child browsing context ID failed ({:?}).", e); + } + } FromScriptMsg::RegisterServiceWorker(scope_things, scope) => { debug!("constellation got store registration scope message"); self.handle_register_serviceworker(scope_things, scope); diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index efc368e0761..b3075c082bc 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -90,6 +90,8 @@ pub enum ScriptMsg { GetBrowsingContextId(PipelineId, IpcSender>), /// Get the parent info for a given pipeline. GetParentInfo(PipelineId, IpcSender>), + /// Get the nth child browsing context ID for a given browsing context, sorted in tree order. + GetChildBrowsingContextId(BrowsingContextId, usize, IpcSender>), /// tag finished parsing HeadParsed, /// All pending loads are complete, and the `load` event for this pipeline From 080600003ce1704164a816e7fbf6b1c05f46376e Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Tue, 10 Apr 2018 11:52:48 -0700 Subject: [PATCH 2/5] Return window proxy properly for indexed window getter --- .../script/dom/dissimilaroriginwindow.rs | 10 ++-- components/script/dom/window.rs | 5 -- components/script/dom/windowproxy.rs | 49 +++++++++++++++---- 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/components/script/dom/dissimilaroriginwindow.rs b/components/script/dom/dissimilaroriginwindow.rs index 846ce9ca0c4..68b4ca894cf 100644 --- a/components/script/dom/dissimilaroriginwindow.rs +++ b/components/script/dom/dissimilaroriginwindow.rs @@ -77,22 +77,26 @@ impl DissimilarOriginWindow { pub fn origin(&self) -> &MutableOrigin { self.upcast::().origin() } + + pub fn window_proxy(&self) -> DomRoot { + DomRoot::from_ref(&*self.window_proxy) + } } impl DissimilarOriginWindowMethods for DissimilarOriginWindow { // https://html.spec.whatwg.org/multipage/#dom-window fn Window(&self) -> DomRoot { - DomRoot::from_ref(&*self.window_proxy) + self.window_proxy() } // https://html.spec.whatwg.org/multipage/#dom-self fn Self_(&self) -> DomRoot { - DomRoot::from_ref(&*self.window_proxy) + self.window_proxy() } // https://html.spec.whatwg.org/multipage/#dom-frames fn Frames(&self) -> DomRoot { - DomRoot::from_ref(&*self.window_proxy) + self.window_proxy() } // https://html.spec.whatwg.org/multipage/#dom-parent diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 3a672291e8d..d8fd391860e 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -1634,11 +1634,6 @@ impl Window { had_clip_rect } - // https://html.spec.whatwg.org/multipage/#accessing-other-browsing-contexts - pub fn IndexedGetter(&self, _index: u32, _found: &mut bool) -> Option> { - None - } - pub fn suspend(&self) { // Suspend timer events. self.upcast::().suspend(); diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index e1df10646d6..e93c51acc01 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -17,6 +17,7 @@ use dom::element::Element; use dom::globalscope::GlobalScope; use dom::window::Window; use dom_struct::dom_struct; +use ipc_channel::ipc; use js::JSCLASS_IS_GLOBAL; use js::glue::{CreateWrapperProxyHandler, ProxyTraps}; use js::glue::{GetProxyPrivate, SetProxyExtra, GetProxyExtra}; @@ -40,6 +41,8 @@ use js::rust::wrappers::{NewWindowProxy, SetWindowProxy, JS_TransplantObject}; use msg::constellation_msg::BrowsingContextId; use msg::constellation_msg::PipelineId; use msg::constellation_msg::TopLevelBrowsingContextId; +use script_thread::ScriptThread; +use script_traits::ScriptMsg; use std::cell::Cell; use std::ptr; @@ -301,17 +304,43 @@ impl WindowProxy { // This is only called from extern functions, // there's no use using the lifetimed handles here. +// https://html.spec.whatwg.org/multipage/#accessing-other-browsing-contexts #[allow(unsafe_code)] -unsafe fn GetSubframeWindow(cx: *mut JSContext, - proxy: RawHandleObject, - id: RawHandleId) - -> Option> { +unsafe fn GetSubframeWindowProxy( + cx: *mut JSContext, + proxy: RawHandleObject, + id: RawHandleId +) -> Option> { let index = get_array_index_from_id(cx, Handle::from_raw(id)); if let Some(index) = index { rooted!(in(cx) let target = GetProxyPrivate(*proxy).to_object()); - let win = root_from_handleobject::(target.handle()).unwrap(); - let mut found = false; - return win.IndexedGetter(index, &mut found); + if let Ok(win) = root_from_handleobject::(target.handle()) { + let browsing_context_id = win.window_proxy().browsing_context_id(); + let (result_sender, result_receiver) = ipc::channel().unwrap(); + + let _ = win.upcast::().script_to_constellation_chan().send( + ScriptMsg::GetChildBrowsingContextId( + browsing_context_id, + index as usize, + result_sender + ) + ); + return result_receiver.recv().ok() + .and_then(|maybe_bcid| maybe_bcid) + .and_then(ScriptThread::find_window_proxy); + } else if let Ok(win) = root_from_handleobject::(target.handle()) { + let browsing_context_id = win.window_proxy().browsing_context_id(); + let (result_sender, result_receiver) = ipc::channel().unwrap(); + + let _ = win.global().script_to_constellation_chan().send(ScriptMsg::GetChildBrowsingContextId( + browsing_context_id, + index as usize, + result_sender + )); + return result_receiver.recv().ok() + .and_then(|maybe_bcid| maybe_bcid) + .and_then(ScriptThread::find_window_proxy); + } } None @@ -323,7 +352,7 @@ unsafe extern "C" fn getOwnPropertyDescriptor(cx: *mut JSContext, id: RawHandleId, mut desc: RawMutableHandle) -> bool { - let window = GetSubframeWindow(cx, proxy, id); + let window = GetSubframeWindowProxy(cx, proxy, id); if let Some(window) = window { rooted!(in(cx) let mut val = UndefinedValue()); window.to_jsval(cx, val.handle_mut()); @@ -372,7 +401,7 @@ unsafe extern "C" fn has(cx: *mut JSContext, id: RawHandleId, bp: *mut bool) -> bool { - let window = GetSubframeWindow(cx, proxy, id); + let window = GetSubframeWindowProxy(cx, proxy, id); if window.is_some() { *bp = true; return true; @@ -395,7 +424,7 @@ unsafe extern "C" fn get(cx: *mut JSContext, id: RawHandleId, vp: RawMutableHandleValue) -> bool { - let window = GetSubframeWindow(cx, proxy, id); + let window = GetSubframeWindowProxy(cx, proxy, id); if let Some(window) = window { window.to_jsval(cx, MutableHandle::from_raw(vp)); return true; From 249e8a575f258cbc57ab9655b7cbaf2eca21e3ad Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Sun, 29 Apr 2018 00:32:15 -0700 Subject: [PATCH 3/5] Set the proper attributes for the WindowProxy property descriptor --- components/script/dom/windowproxy.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index e93c51acc01..bfd75f879dc 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -22,7 +22,7 @@ use js::JSCLASS_IS_GLOBAL; use js::glue::{CreateWrapperProxyHandler, ProxyTraps}; use js::glue::{GetProxyPrivate, SetProxyExtra, GetProxyExtra}; use js::jsapi::{JSAutoCompartment, JSContext, JSErrNum, JSFreeOp, JSObject}; -use js::jsapi::{JSPROP_READONLY, JSTracer, JS_DefinePropertyById}; +use js::jsapi::{JSPROP_ENUMERATE, JSPROP_READONLY, JSTracer, JS_DefinePropertyById}; use js::jsapi::{JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo}; use js::jsapi::{JS_HasPropertyById, JS_HasOwnPropertyById}; use js::jsapi::{JS_IsExceptionPending, JS_GetOwnPropertyDescriptorById}; @@ -310,7 +310,7 @@ unsafe fn GetSubframeWindowProxy( cx: *mut JSContext, proxy: RawHandleObject, id: RawHandleId -) -> Option> { +) -> Option<(DomRoot, u32)> { let index = get_array_index_from_id(cx, Handle::from_raw(id)); if let Some(index) = index { rooted!(in(cx) let target = GetProxyPrivate(*proxy).to_object()); @@ -327,7 +327,8 @@ unsafe fn GetSubframeWindowProxy( ); return result_receiver.recv().ok() .and_then(|maybe_bcid| maybe_bcid) - .and_then(ScriptThread::find_window_proxy); + .and_then(ScriptThread::find_window_proxy) + .map(|proxy| (proxy, JSPROP_ENUMERATE | JSPROP_READONLY)); } else if let Ok(win) = root_from_handleobject::(target.handle()) { let browsing_context_id = win.window_proxy().browsing_context_id(); let (result_sender, result_receiver) = ipc::channel().unwrap(); @@ -339,7 +340,8 @@ unsafe fn GetSubframeWindowProxy( )); return result_receiver.recv().ok() .and_then(|maybe_bcid| maybe_bcid) - .and_then(ScriptThread::find_window_proxy); + .and_then(ScriptThread::find_window_proxy) + .map(|proxy| (proxy, JSPROP_READONLY)); } } @@ -353,11 +355,11 @@ unsafe extern "C" fn getOwnPropertyDescriptor(cx: *mut JSContext, mut desc: RawMutableHandle) -> bool { let window = GetSubframeWindowProxy(cx, proxy, id); - if let Some(window) = window { + if let Some((window, attrs)) = window { rooted!(in(cx) let mut val = UndefinedValue()); window.to_jsval(cx, val.handle_mut()); desc.value = val.get(); - fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), JSPROP_READONLY); + fill_property_descriptor(MutableHandle::from_raw(desc), proxy.get(), attrs); return true; } @@ -425,7 +427,7 @@ unsafe extern "C" fn get(cx: *mut JSContext, vp: RawMutableHandleValue) -> bool { let window = GetSubframeWindowProxy(cx, proxy, id); - if let Some(window) = window { + if let Some((window, _attrs)) = window { window.to_jsval(cx, MutableHandle::from_raw(vp)); return true; } From acd4e215abb23124a6ba5e06b00ada52a0b000db Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Mon, 30 Apr 2018 02:54:44 -0700 Subject: [PATCH 4/5] Update test expectations --- ...i-global-origin-serialization.sub.html.ini | 5 -- .../metadata/WebIDL/current-realm.html.ini | 75 ------------------- .../css/cssom-view/elementFromPoint.html.ini | 3 - .../css/cssom-view/elementsFromPoint.html.ini | 13 +--- .../css/cssom-view/matchMedia.xht.ini | 12 ++- .../dom/nodes/Node-appendChild.html.ini | 11 --- .../dom/nodes/Node-removeChild.html.ini | 29 ------- ...ource-constructor-url-multi-window.htm.ini | 5 -- .../eventsource-onmessage-realm.htm.ini | 5 -- .../history-traversal/same-url.html.ini | 3 +- ...ion-pathname-setter-question-mark.html.ini | 5 -- ...e-setting-cross-origin-domain.sub.html.ini | 12 ++- ...rototype-setting-cross-origin.sub.html.ini | 14 +++- ...ting-goes-cross-origin-domain.sub.html.ini | 18 ++++- ...pe-setting-same-origin-domain.sub.html.ini | 8 +- .../window-indexed-properties.html.ini | 4 - ...e-setting-cross-origin-domain.sub.html.ini | 3 - ...rototype-setting-cross-origin.sub.html.ini | 3 - ...ting-goes-cross-origin-domain.sub.html.ini | 14 +++- ...pe-setting-same-origin-domain.sub.html.ini | 6 +- .../iframe-marginwidth-marginheight.html.ini | 5 -- .../iframe_sandbox_popups_escaping-2.html.ini | 2 +- ...rame_sandbox_popups_nonescaping-2.html.ini | 2 +- .../execution-timing/035.html.ini | 5 -- .../execution-timing/083.html.ini | 1 + .../events/eventhandler-cancellation.html.ini | 3 +- ...ith-cross-frame-event-listeners-2.html.ini | 6 -- ...ith-cross-frame-event-listeners-3.html.ini | 6 -- .../multi-globals/message-received.html.ini | 8 -- .../webstorage/document-domain.html.ini | 4 +- .../workers/semantics/navigation/001.html.ini | 3 - .../xhr/open-url-multi-window-4.htm.ini | 3 +- .../xhr/open-url-multi-window-5.htm.ini | 5 -- .../xhr/open-url-multi-window.htm.ini | 5 -- 34 files changed, 89 insertions(+), 217 deletions(-) delete mode 100644 tests/wpt/metadata/FileAPI/url/multi-global-origin-serialization.sub.html.ini delete mode 100644 tests/wpt/metadata/dom/nodes/Node-appendChild.html.ini delete mode 100644 tests/wpt/metadata/dom/nodes/Node-removeChild.html.ini delete mode 100644 tests/wpt/metadata/eventsource/eventsource-constructor-url-multi-window.htm.ini delete mode 100644 tests/wpt/metadata/eventsource/eventsource-onmessage-realm.htm.ini delete mode 100644 tests/wpt/metadata/html/browsers/history/the-location-interface/location-pathname-setter-question-mark.html.ini delete mode 100644 tests/wpt/metadata/html/rendering/non-replaced-elements/the-page/iframe-marginwidth-marginheight.html.ini delete mode 100644 tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/035.html.ini delete mode 100644 tests/wpt/metadata/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html.ini delete mode 100644 tests/wpt/metadata/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html.ini delete mode 100644 tests/wpt/metadata/websockets/multi-globals/message-received.html.ini delete mode 100644 tests/wpt/metadata/workers/semantics/navigation/001.html.ini delete mode 100644 tests/wpt/metadata/xhr/open-url-multi-window-5.htm.ini delete mode 100644 tests/wpt/metadata/xhr/open-url-multi-window.htm.ini diff --git a/tests/wpt/metadata/FileAPI/url/multi-global-origin-serialization.sub.html.ini b/tests/wpt/metadata/FileAPI/url/multi-global-origin-serialization.sub.html.ini deleted file mode 100644 index 1dcce78d004..00000000000 --- a/tests/wpt/metadata/FileAPI/url/multi-global-origin-serialization.sub.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[multi-global-origin-serialization.sub.html] - type: testharness - [Blob URL serialization (specifically the origin) in multi-global situations] - expected: FAIL - diff --git a/tests/wpt/metadata/WebIDL/current-realm.html.ini b/tests/wpt/metadata/WebIDL/current-realm.html.ini index f1c9625cf74..9695e33b235 100644 --- a/tests/wpt/metadata/WebIDL/current-realm.html.ini +++ b/tests/wpt/metadata/WebIDL/current-realm.html.ini @@ -1,62 +1,5 @@ [current-realm.html] type: testharness - [querySelectorAll] - expected: FAIL - - [createElement] - expected: FAIL - - [createElementNS] - expected: FAIL - - [createDocumentFragment] - expected: FAIL - - [createTextNode] - expected: FAIL - - [createComment] - expected: FAIL - - [createProcessingInstruction] - expected: FAIL - - [createAttribute] - expected: FAIL - - [createAttributeNS] - expected: FAIL - - [createEvent] - expected: FAIL - - [createRange] - expected: FAIL - - [createNodeIterator] - expected: FAIL - - [createTreeWalker] - expected: FAIL - - [getElementsByTagName] - expected: FAIL - - [getElementsByTagNameNS] - expected: FAIL - - [getElementsByClassName] - expected: FAIL - - [createDocumentType] - expected: FAIL - - [createDocument] - expected: FAIL - - [createHTMLDocument] - expected: FAIL - [NamedNodeMap item] expected: FAIL @@ -66,24 +9,6 @@ [NamedNodeMap getNamedItemNS] expected: FAIL - [splitText] - expected: FAIL - - [extractContents] - expected: FAIL - - [cloneContents] - expected: FAIL - - [cloneRange] - expected: FAIL - - [getContext 2d] - expected: FAIL - - [getContext webgl] - expected: FAIL - [createImageData] expected: FAIL diff --git a/tests/wpt/metadata/css/cssom-view/elementFromPoint.html.ini b/tests/wpt/metadata/css/cssom-view/elementFromPoint.html.ini index bba001a2b78..8cdaf367d7c 100644 --- a/tests/wpt/metadata/css/cssom-view/elementFromPoint.html.ini +++ b/tests/wpt/metadata/css/cssom-view/elementFromPoint.html.ini @@ -1,7 +1,4 @@ [elementFromPoint.html] - [co-ordinates larger than the viewport from in iframe] - expected: FAIL - [SVG element at x,y] expected: FAIL diff --git a/tests/wpt/metadata/css/cssom-view/elementsFromPoint.html.ini b/tests/wpt/metadata/css/cssom-view/elementsFromPoint.html.ini index 6a7c6141401..11f4b5d5c7a 100644 --- a/tests/wpt/metadata/css/cssom-view/elementsFromPoint.html.ini +++ b/tests/wpt/metadata/css/cssom-view/elementsFromPoint.html.ini @@ -1,13 +1,4 @@ [elementsFromPoint.html] - [co-ordinates larger than the viewport from in iframe] - expected: FAIL - - [SVG element at x,y] - expected: FAIL - - [transformed element at x,y] - expected: FAIL - - [no hit target at x,y] - expected: FAIL + type: testharness + expected: CRASH diff --git a/tests/wpt/metadata/css/cssom-view/matchMedia.xht.ini b/tests/wpt/metadata/css/cssom-view/matchMedia.xht.ini index 350909ce17f..1cab6bdeac0 100644 --- a/tests/wpt/metadata/css/cssom-view/matchMedia.xht.ini +++ b/tests/wpt/metadata/css/cssom-view/matchMedia.xht.ini @@ -1,5 +1,15 @@ [matchMedia.xht] type: testharness - [CSS Test: CSSOM View matchMedia and MediaQueryList] + [window.matchMedia exists] + expected: FAIL + [MediaQueryList.matches for "(max-width: 199px), all and (min-width: 200px)"] + expected: FAIL + [MediaQueryList.matches for "(min-aspect-ratio: 1/1)"] + expected: FAIL + [MediaQueryList.matches for "(width: 200px)"] + expected: FAIL + [MediaQueryList.matches for "(min-width: 150px)"] + expected: FAIL + [Resize iframe from 200x100 to 200x50, then to 100x50] expected: FAIL diff --git a/tests/wpt/metadata/dom/nodes/Node-appendChild.html.ini b/tests/wpt/metadata/dom/nodes/Node-appendChild.html.ini deleted file mode 100644 index a07fb23c845..00000000000 --- a/tests/wpt/metadata/dom/nodes/Node-appendChild.html.ini +++ /dev/null @@ -1,11 +0,0 @@ -[Node-appendChild.html] - type: testharness - [Appending a document] - expected: FAIL - - [Adopting an orphan] - expected: FAIL - - [Adopting a non-orphan] - expected: FAIL - diff --git a/tests/wpt/metadata/dom/nodes/Node-removeChild.html.ini b/tests/wpt/metadata/dom/nodes/Node-removeChild.html.ini deleted file mode 100644 index dd30deca55e..00000000000 --- a/tests/wpt/metadata/dom/nodes/Node-removeChild.html.ini +++ /dev/null @@ -1,29 +0,0 @@ -[Node-removeChild.html] - type: testharness - [Passing a detached element from a frame document to removeChild should not affect it.] - expected: FAIL - - [Passing a non-detached element from a frame document to removeChild should not affect it.] - expected: FAIL - - [Calling removeChild on a element from a frame document with no children should throw NOT_FOUND_ERR.] - expected: FAIL - - [Passing a detached text from a frame document to removeChild should not affect it.] - expected: FAIL - - [Passing a non-detached text from a frame document to removeChild should not affect it.] - expected: FAIL - - [Calling removeChild on a text from a frame document with no children should throw NOT_FOUND_ERR.] - expected: FAIL - - [Passing a detached comment from a frame document to removeChild should not affect it.] - expected: FAIL - - [Passing a non-detached comment from a frame document to removeChild should not affect it.] - expected: FAIL - - [Calling removeChild on a comment from a frame document with no children should throw NOT_FOUND_ERR.] - expected: FAIL - diff --git a/tests/wpt/metadata/eventsource/eventsource-constructor-url-multi-window.htm.ini b/tests/wpt/metadata/eventsource/eventsource-constructor-url-multi-window.htm.ini deleted file mode 100644 index 2aea8ac967e..00000000000 --- a/tests/wpt/metadata/eventsource/eventsource-constructor-url-multi-window.htm.ini +++ /dev/null @@ -1,5 +0,0 @@ -[eventsource-constructor-url-multi-window.htm] - type: testharness - [EventSource: resolving URLs] - expected: FAIL - diff --git a/tests/wpt/metadata/eventsource/eventsource-onmessage-realm.htm.ini b/tests/wpt/metadata/eventsource/eventsource-onmessage-realm.htm.ini deleted file mode 100644 index 852a78fd8ce..00000000000 --- a/tests/wpt/metadata/eventsource/eventsource-onmessage-realm.htm.ini +++ /dev/null @@ -1,5 +0,0 @@ -[eventsource-onmessage-realm.htm] - type: testharness - [the MessageEvent must be created in the Realm of the EventSource] - expected: FAIL - diff --git a/tests/wpt/metadata/html/browsers/browsing-the-web/history-traversal/same-url.html.ini b/tests/wpt/metadata/html/browsers/browsing-the-web/history-traversal/same-url.html.ini index e5063d4a991..e39702f2143 100644 --- a/tests/wpt/metadata/html/browsers/browsing-the-web/history-traversal/same-url.html.ini +++ b/tests/wpt/metadata/html/browsers/browsing-the-web/history-traversal/same-url.html.ini @@ -1,5 +1,6 @@ [same-url.html] type: testharness + expected: TIMEOUT [Test same-URL navigation and its effects on history] - expected: FAIL + expected: TIMEOUT diff --git a/tests/wpt/metadata/html/browsers/history/the-location-interface/location-pathname-setter-question-mark.html.ini b/tests/wpt/metadata/html/browsers/history/the-location-interface/location-pathname-setter-question-mark.html.ini deleted file mode 100644 index a0dcf9be3a9..00000000000 --- a/tests/wpt/metadata/html/browsers/history/the-location-interface/location-pathname-setter-question-mark.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[location-pathname-setter-question-mark.html] - type: testharness - [Set location.pathname to ?] - expected: FAIL - diff --git a/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin-domain.sub.html.ini b/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin-domain.sub.html.ini index c84b8cbc586..7dabdca2634 100644 --- a/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin-domain.sub.html.ini +++ b/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin-domain.sub.html.ini @@ -1,5 +1,15 @@ [location-prototype-setting-cross-origin-domain.sub.html] type: testharness - [[[SetPrototypeOf\]\] on a Location object should not allow changing its value: cross-origin via document.domain] + [Cross-origin via document.domain: the prototype is null] + expected: FAIL + [Cross-origin via document.domain: setting the prototype to an empty object via __proto__ should throw a "SecurityError" DOMException] + expected: FAIL + [Cross-origin via document.domain: setting the prototype to an empty object via Reflect.setPrototypeOf should return false] + expected: FAIL + [Cross-origin via document.domain: setting the prototype to its original value via Object.setPrototypeOf should not throw] + expected: FAIL + [Cross-origin via document.domain: setting the prototype to its original value via __proto__ should throw a "SecurityError" since it ends up in CrossOriginGetOwnProperty] + expected: FAIL + [Cross-origin via document.domain: setting the prototype to its original value via Reflect.setPrototypeOf should return true] expected: FAIL diff --git a/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin.sub.html.ini b/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin.sub.html.ini index 41e105baf5d..2f57f0ed51e 100644 --- a/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin.sub.html.ini +++ b/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin.sub.html.ini @@ -1,5 +1,17 @@ [location-prototype-setting-cross-origin.sub.html] type: testharness - [[[SetPrototypeOf\]\] on a Location object should not allow changing its value: cross-origin] + [Cross-origin: the prototype is null] + expected: FAIL + [Cross-origin: setting the prototype to an empty object via __proto__ should throw a "SecurityError" DOMException] + expected: FAIL + [Cross-origin: setting the prototype to an empty object via Reflect.setPrototypeOf should return false] + expected: FAIL + [Cross-origin: the prototype must still be null] + expected: FAIL + [Cross-origin: setting the prototype to null via Object.setPrototypeOf should not throw] + expected: FAIL + [Cross-origin: setting the prototype to null via __proto__ should throw a "SecurityError" since it ends up in CrossOriginGetOwnProperty] + expected: FAIL + [Cross-origin: setting the prototype to null via Reflect.setPrototypeOf should return true] expected: FAIL diff --git a/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-goes-cross-origin-domain.sub.html.ini b/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-goes-cross-origin-domain.sub.html.ini index f8c37fbb02f..075dd1b38f7 100644 --- a/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-goes-cross-origin-domain.sub.html.ini +++ b/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-goes-cross-origin-domain.sub.html.ini @@ -1,5 +1,21 @@ [location-prototype-setting-goes-cross-origin-domain.sub.html] type: testharness - [[[SetPrototypeOf\]\] on a Location object should not allow changing its value: cross-origin via document.domain after initially getting the object] + [Became cross-origin via document.domain: the prototype is now null] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to an empty object via __proto__ should throw a "SecurityError" DOMException] + expected: FAIL + [Became cross-origin via document.domain: the prototype must still be null] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to null via Object.setPrototypeOf should not throw] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to null via __proto__ should throw a "SecurityError" since it ends up in CrossOriginGetOwnProperty] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to an empty object via Reflect.setPrototypeOf should return false] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to null via Reflect.setPrototypeOf should return true] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to the original value from before going cross-origin via __proto__ should throw a "SecurityError" DOMException] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to the original value from before going cross-origin via Reflect.setPrototypeOf should return false] expected: FAIL diff --git a/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-same-origin-domain.sub.html.ini b/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-same-origin-domain.sub.html.ini index 46fcd9c782e..dcfb3fb08d2 100644 --- a/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-same-origin-domain.sub.html.ini +++ b/tests/wpt/metadata/html/browsers/history/the-location-interface/location-prototype-setting-same-origin-domain.sub.html.ini @@ -1,5 +1,11 @@ [location-prototype-setting-same-origin-domain.sub.html] type: testharness - [[[SetPrototypeOf\]\] on a Location object should not allow changing its value: cross-origin, but same-origin-domain] + [Same-origin-domain: setting the prototype to an empty object via Reflect.setPrototypeOf should return false] + expected: FAIL + [Same-origin-domain: setting the prototype to its original value via Object.setPrototypeOf should not throw] + expected: FAIL + [Same-origin-domain: setting the prototype to its original value via __proto__ should not throw] + expected: FAIL + [Same-origin-domain: setting the prototype to its original value via Reflect.setPrototypeOf should return true] expected: FAIL diff --git a/tests/wpt/metadata/html/browsers/the-window-object/window-indexed-properties.html.ini b/tests/wpt/metadata/html/browsers/the-window-object/window-indexed-properties.html.ini index fcb46bc7250..498ea7d0b6f 100644 --- a/tests/wpt/metadata/html/browsers/the-window-object/window-indexed-properties.html.ini +++ b/tests/wpt/metadata/html/browsers/the-window-object/window-indexed-properties.html.ini @@ -2,7 +2,3 @@ type: testharness [Indexed properties of the window object (non-strict mode) 1] expected: FAIL - - [Ensure indexed properties have the correct configuration] - expected: FAIL - diff --git a/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin-domain.sub.html.ini b/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin-domain.sub.html.ini index cbc16ca3232..c2af8deed7c 100644 --- a/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin-domain.sub.html.ini +++ b/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin-domain.sub.html.ini @@ -6,9 +6,6 @@ [Cross-origin via document.domain: setting the prototype to an empty object via __proto__ should throw a "SecurityError" DOMException] expected: FAIL - [Cross-origin via document.domain: setting the prototype to an empty object via Reflect.setPrototypeOf should return false] - expected: FAIL - [Cross-origin via document.domain: the prototype must still be null] expected: FAIL diff --git a/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin.sub.html.ini b/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin.sub.html.ini index ded86c5dd7e..8ebba129f26 100644 --- a/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin.sub.html.ini +++ b/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin.sub.html.ini @@ -6,9 +6,6 @@ [Cross-origin: setting the prototype to an empty object via __proto__ should throw a "SecurityError" DOMException] expected: FAIL - [Cross-origin: setting the prototype to an empty object via Reflect.setPrototypeOf should return false] - expected: FAIL - [Cross-origin: the prototype must still be null] expected: FAIL diff --git a/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-goes-cross-origin-domain.sub.html.ini b/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-goes-cross-origin-domain.sub.html.ini index 4dc03495cff..7e0cc84a7f0 100644 --- a/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-goes-cross-origin-domain.sub.html.ini +++ b/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-goes-cross-origin-domain.sub.html.ini @@ -1,5 +1,17 @@ [windowproxy-prototype-setting-goes-cross-origin-domain.sub.html] type: testharness - [[[SetPrototypeOf\]\] on a WindowProxy object should not allow changing its value: cross-origin via document.domain after initially getting the object] + [Became cross-origin via document.domain: the prototype is now null] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to an empty object via __proto__ should throw a "SecurityError" DOMException] + expected: FAIL + [Became cross-origin via document.domain: the prototype must still be null] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to null via Object.setPrototypeOf should not throw] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to null via __proto__ should throw a "SecurityError" since it ends up in CrossOriginGetOwnProperty] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to null via Reflect.setPrototypeOf should return true] + expected: FAIL + [Became cross-origin via document.domain: setting the prototype to the original value from before going cross-origin via __proto__ should throw a "SecurityError" DOMException] expected: FAIL diff --git a/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin-domain.sub.html.ini b/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin-domain.sub.html.ini index eac8cfd1c72..658e31e4897 100644 --- a/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin-domain.sub.html.ini +++ b/tests/wpt/metadata/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin-domain.sub.html.ini @@ -1,5 +1,9 @@ [windowproxy-prototype-setting-same-origin-domain.sub.html] type: testharness - [[[SetPrototypeOf\]\] on a WindowProxy object should not allow changing its value: cross-origin, but same-origin-domain] + [Same-origin-domain: setting the prototype to its original value via Object.setPrototypeOf should not throw] + expected: FAIL + [Same-origin-domain: setting the prototype to its original value via __proto__ should not throw] + expected: FAIL + [Same-origin-domain: setting the prototype to its original value via Reflect.setPrototypeOf should return true] expected: FAIL diff --git a/tests/wpt/metadata/html/rendering/non-replaced-elements/the-page/iframe-marginwidth-marginheight.html.ini b/tests/wpt/metadata/html/rendering/non-replaced-elements/the-page/iframe-marginwidth-marginheight.html.ini deleted file mode 100644 index fc6329beb34..00000000000 --- a/tests/wpt/metadata/html/rendering/non-replaced-elements/the-page/iframe-marginwidth-marginheight.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[iframe-marginwidth-marginheight.html] - type: testharness - [iframe marginwidth and marginheight] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html.ini index 96bbb277115..b21a85689bf 100644 --- a/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html.ini +++ b/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html.ini @@ -1,6 +1,6 @@ [iframe_sandbox_popups_escaping-2.html] type: testharness - expected: ERROR + expected: TIMEOUT [Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used] expected: TIMEOUT diff --git a/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html.ini b/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html.ini index 80a6d970279..d43f38b40cd 100644 --- a/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html.ini +++ b/tests/wpt/metadata/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html.ini @@ -1,6 +1,6 @@ [iframe_sandbox_popups_nonescaping-2.html] type: testharness - expected: ERROR + expected: TIMEOUT [Check that popups from a sandboxed iframe do not escape the sandbox] expected: NOTRUN diff --git a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/035.html.ini b/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/035.html.ini deleted file mode 100644 index 1f668433485..00000000000 --- a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/035.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[035.html] - type: testharness - [ scheduler: innerHTML adding frames with JS in and moving scripts] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/083.html.ini b/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/083.html.ini index 9272fa0716d..242251f7104 100644 --- a/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/083.html.ini +++ b/tests/wpt/metadata/html/semantics/scripting-1/the-script-element/execution-timing/083.html.ini @@ -1,5 +1,6 @@ [083.html] type: testharness + expected: ERROR [ scheduler: event listener defined by script in a document in history] expected: FAIL diff --git a/tests/wpt/metadata/html/webappapis/scripting/events/eventhandler-cancellation.html.ini b/tests/wpt/metadata/html/webappapis/scripting/events/eventhandler-cancellation.html.ini index 900931d8675..3bf042ffda3 100644 --- a/tests/wpt/metadata/html/webappapis/scripting/events/eventhandler-cancellation.html.ini +++ b/tests/wpt/metadata/html/webappapis/scripting/events/eventhandler-cancellation.html.ini @@ -1,5 +1,4 @@ [eventhandler-cancellation.html] type: testharness - [event handler cancellation behavior] - expected: FAIL + expected: ERROR diff --git a/tests/wpt/metadata/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html.ini b/tests/wpt/metadata/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html.ini deleted file mode 100644 index 3d72563832c..00000000000 --- a/tests/wpt/metadata/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[window-onerror-with-cross-frame-event-listeners-2.html] - type: testharness - bug: https://github.com/servo/servo/issues/3311 - [The error event from an event listener should fire on that listener's global] - expected: FAIL - diff --git a/tests/wpt/metadata/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html.ini b/tests/wpt/metadata/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html.ini deleted file mode 100644 index 10f8529a133..00000000000 --- a/tests/wpt/metadata/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[window-onerror-with-cross-frame-event-listeners-3.html] - type: testharness - bug: https://github.com/servo/servo/issues/3311 - [The error event from an event listener should fire on that listener's global] - expected: FAIL - diff --git a/tests/wpt/metadata/websockets/multi-globals/message-received.html.ini b/tests/wpt/metadata/websockets/multi-globals/message-received.html.ini deleted file mode 100644 index 7c5c35722cf..00000000000 --- a/tests/wpt/metadata/websockets/multi-globals/message-received.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[message-received.html] - type: testharness - [ArrayBuffer should be created in the relevant realm of the WebSocket] - expected: FAIL - - [Blob should be created in the relevant realm of the WebSocket] - expected: FAIL - diff --git a/tests/wpt/metadata/webstorage/document-domain.html.ini b/tests/wpt/metadata/webstorage/document-domain.html.ini index 25c7df4ba92..0db522a25ed 100644 --- a/tests/wpt/metadata/webstorage/document-domain.html.ini +++ b/tests/wpt/metadata/webstorage/document-domain.html.ini @@ -1,6 +1,6 @@ [document-domain.html] type: testharness - bug: https://github.com/servo/servo/issues/934 + expected: TIMEOUT [localStorage and document.domain] - expected: FAIL + expected: TIMEOUT diff --git a/tests/wpt/metadata/workers/semantics/navigation/001.html.ini b/tests/wpt/metadata/workers/semantics/navigation/001.html.ini deleted file mode 100644 index b3538369e2e..00000000000 --- a/tests/wpt/metadata/workers/semantics/navigation/001.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[001.html] - type: testharness - expected: TIMEOUT diff --git a/tests/wpt/metadata/xhr/open-url-multi-window-4.htm.ini b/tests/wpt/metadata/xhr/open-url-multi-window-4.htm.ini index 1245e6adfa6..b047b0c8581 100644 --- a/tests/wpt/metadata/xhr/open-url-multi-window-4.htm.ini +++ b/tests/wpt/metadata/xhr/open-url-multi-window-4.htm.ini @@ -1,5 +1,6 @@ [open-url-multi-window-4.htm] type: testharness + expected: TIMEOUT [XMLHttpRequest: open() resolving URLs (multi-Window; 4; evil)] - expected: FAIL + expected: TIMEOUT diff --git a/tests/wpt/metadata/xhr/open-url-multi-window-5.htm.ini b/tests/wpt/metadata/xhr/open-url-multi-window-5.htm.ini deleted file mode 100644 index b10f258a87b..00000000000 --- a/tests/wpt/metadata/xhr/open-url-multi-window-5.htm.ini +++ /dev/null @@ -1,5 +0,0 @@ -[open-url-multi-window-5.htm] - type: testharness - [XMLHttpRequest: open() resolving URLs (multi-Window; 5)] - expected: FAIL - diff --git a/tests/wpt/metadata/xhr/open-url-multi-window.htm.ini b/tests/wpt/metadata/xhr/open-url-multi-window.htm.ini deleted file mode 100644 index be47fe69bab..00000000000 --- a/tests/wpt/metadata/xhr/open-url-multi-window.htm.ini +++ /dev/null @@ -1,5 +0,0 @@ -[open-url-multi-window.htm] - type: testharness - [XMLHttpRequest: open() resolving URLs (multi-Window; 1)] - expected: FAIL - From df23f909cdf0460186776e43f451233985150eab Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Mon, 7 May 2018 23:25:09 -0700 Subject: [PATCH 5/5] Do not unwrap in element{,s}FromPoint --- components/script/dom/document.rs | 7 +++++-- .../wpt/metadata/css/cssom-view/elementsFromPoint.html.ini | 5 ++++- tests/wpt/metadata/css/cssom-view/matchMedia.xht.ini | 7 ++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 5c9cd57b128..70caff31e17 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -3624,7 +3624,7 @@ impl DocumentMethods for Document { let y = *y as f32; let point = &Point2D::new(x, y); let window = window_from_node(self); - let viewport = window.window_size().unwrap().initial_viewport; + let viewport = window.window_size()?.initial_viewport; if self.browsing_context().is_none() { return None; @@ -3658,7 +3658,10 @@ impl DocumentMethods for Document { let y = *y as f32; let point = &Point2D::new(x, y); let window = window_from_node(self); - let viewport = window.window_size().unwrap().initial_viewport; + let viewport = match window.window_size() { + Some(size) => size.initial_viewport, + None => return vec![] + }; if self.browsing_context().is_none() { return vec!(); diff --git a/tests/wpt/metadata/css/cssom-view/elementsFromPoint.html.ini b/tests/wpt/metadata/css/cssom-view/elementsFromPoint.html.ini index 11f4b5d5c7a..046b2acda84 100644 --- a/tests/wpt/metadata/css/cssom-view/elementsFromPoint.html.ini +++ b/tests/wpt/metadata/css/cssom-view/elementsFromPoint.html.ini @@ -1,4 +1,7 @@ [elementsFromPoint.html] type: testharness - expected: CRASH + [SVG element at x,y] + expected: FAIL + [transformed element at x,y] + expected: FAIL diff --git a/tests/wpt/metadata/css/cssom-view/matchMedia.xht.ini b/tests/wpt/metadata/css/cssom-view/matchMedia.xht.ini index 1cab6bdeac0..ed947e81e1e 100644 --- a/tests/wpt/metadata/css/cssom-view/matchMedia.xht.ini +++ b/tests/wpt/metadata/css/cssom-view/matchMedia.xht.ini @@ -1,5 +1,6 @@ [matchMedia.xht] type: testharness + expected: TIMEOUT [window.matchMedia exists] expected: FAIL [MediaQueryList.matches for "(max-width: 199px), all and (min-width: 200px)"] @@ -11,5 +12,9 @@ [MediaQueryList.matches for "(min-width: 150px)"] expected: FAIL [Resize iframe from 200x100 to 200x50, then to 100x50] - expected: FAIL + expected: NOTRUN + [Listeners are called in the order which they have been added] + expected: NOTRUN + [Listener added twice is only called once.] + expected: NOTRUN