diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/bindings/trace.rs | 4 | ||||
-rw-r--r-- | components/script/dom/dedicatedworkerglobalscope.rs | 8 | ||||
-rw-r--r-- | components/script/dom/dissimilaroriginwindow.rs | 4 | ||||
-rw-r--r-- | components/script/dom/document.rs | 6 | ||||
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 32 | ||||
-rw-r--r-- | components/script/dom/node.rs | 8 | ||||
-rw-r--r-- | components/script/dom/windowproxy.rs | 24 | ||||
-rw-r--r-- | components/script/layout_wrapper.rs | 6 | ||||
-rw-r--r-- | components/script/script_thread.rs | 124 | ||||
-rw-r--r-- | components/script/webdriver_handlers.rs | 8 |
10 files changed, 118 insertions, 106 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index a0f26d12c23..2b3bfceceb2 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -58,7 +58,7 @@ use js::glue::{CallObjectTracer, CallValueTracer}; use js::jsapi::{GCTraceKindToAscii, Heap, JSObject, JSTracer, TraceKind}; use js::jsval::JSVal; use js::rust::Runtime; -use msg::constellation_msg::{FrameId, FrameType, PipelineId}; +use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId}; use net_traits::{Metadata, NetworkError, ReferrerPolicy, ResourceThreads}; use net_traits::filemanager_thread::RelativePos; use net_traits::image::base::{Image, ImageMetadata}; @@ -336,7 +336,7 @@ unsafe_no_jsmanaged_fields!(TrustedPromise); unsafe_no_jsmanaged_fields!(PropertyDeclarationBlock); // These three are interdependent, if you plan to put jsmanaged data // in one of these make sure it is propagated properly to containing structs -unsafe_no_jsmanaged_fields!(DocumentActivity, FrameId, FrameType, WindowSizeData, WindowSizeType, PipelineId); +unsafe_no_jsmanaged_fields!(DocumentActivity, BrowsingContextId, FrameType, WindowSizeData, WindowSizeType, PipelineId); unsafe_no_jsmanaged_fields!(TimerEventId, TimerSource); unsafe_no_jsmanaged_fields!(TimelineMarkerType); unsafe_no_jsmanaged_fields!(WorkerId); diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs index 14dd070f44d..6b73df12dfc 100644 --- a/components/script/dom/dedicatedworkerglobalscope.rs +++ b/components/script/dom/dedicatedworkerglobalscope.rs @@ -27,7 +27,7 @@ use js::jsapi::{HandleValue, JS_SetInterruptCallback}; use js::jsapi::{JSAutoCompartment, JSContext}; use js::jsval::UndefinedValue; use js::rust::Runtime; -use msg::constellation_msg::FrameId; +use msg::constellation_msg::BrowsingContextId; use net_traits::{IpcSend, load_whole_resource}; use net_traits::request::{CredentialsMode, Destination, RequestInit, Type as RequestType}; use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, StackRootTLS, get_reports, new_rt_and_cx}; @@ -159,13 +159,13 @@ impl DedicatedWorkerGlobalScope { closing: Arc<AtomicBool>) { let serialized_worker_url = worker_url.to_string(); let name = format!("WebWorker for {}", serialized_worker_url); - let top_level_frame_id = FrameId::installed(); + let top_level_browsing_context_id = BrowsingContextId::installed(); thread::Builder::new().name(name).spawn(move || { thread_state::initialize(thread_state::SCRIPT | thread_state::IN_WORKER); - if let Some(top_level_frame_id) = top_level_frame_id { - FrameId::install(top_level_frame_id); + if let Some(top_level_browsing_context_id) = top_level_browsing_context_id { + BrowsingContextId::install(top_level_browsing_context_id); } let roots = RootCollection::new(); diff --git a/components/script/dom/dissimilaroriginwindow.rs b/components/script/dom/dissimilaroriginwindow.rs index 7d5bef36344..a4e230e90a2 100644 --- a/components/script/dom/dissimilaroriginwindow.rs +++ b/components/script/dom/dissimilaroriginwindow.rs @@ -184,7 +184,9 @@ impl DissimilarOriginWindowMethods for DissimilarOriginWindow { impl DissimilarOriginWindow { pub fn post_message(&self, origin: Option<ImmutableOrigin>, data: StructuredCloneData) { - let msg = ConstellationMsg::PostMessage(self.window_proxy.frame_id(), origin, data.move_to_arraybuffer()); + let msg = ConstellationMsg::PostMessage(self.window_proxy.browsing_context_id(), + origin, + data.move_to_arraybuffer()); let _ = self.upcast::<GlobalScope>().constellation_chan().send(msg); } } diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index bce898e6347..0037915ae03 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -100,7 +100,7 @@ use ipc_channel::ipc::{self, IpcSender}; use js::jsapi::{JSContext, JSObject, JSRuntime}; use js::jsapi::JS_GetRuntime; use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER}; -use msg::constellation_msg::{FrameId, Key, KeyModifiers, KeyState}; +use msg::constellation_msg::{BrowsingContextId, Key, KeyModifiers, KeyState}; use net_traits::{FetchResponseMsg, IpcSend, ReferrerPolicy}; use net_traits::CookieSource::NonHTTP; use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl}; @@ -1897,9 +1897,9 @@ impl Document { } /// Find an iframe element in the document. - pub fn find_iframe(&self, frame_id: FrameId) -> Option<Root<HTMLIFrameElement>> { + pub fn find_iframe(&self, browsing_context_id: BrowsingContextId) -> Option<Root<HTMLIFrameElement>> { self.iter_iframes() - .find(|node| node.frame_id() == frame_id) + .find(|node| node.browsing_context_id() == browsing_context_id) } pub fn get_dom_loading(&self) -> u64 { diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 1e6615ce36a..8334b4cb421 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -40,7 +40,7 @@ use html5ever::{LocalName, Prefix}; use ipc_channel::ipc; use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue}; use js::jsval::{NullValue, UndefinedValue}; -use msg::constellation_msg::{FrameType, FrameId, PipelineId, TraversalDirection}; +use msg::constellation_msg::{FrameType, BrowsingContextId, PipelineId, TraversalDirection}; use net_traits::response::HttpsState; use script_layout_interface::message::ReflowQueryType; use script_thread::{ScriptThread, Runnable}; @@ -84,7 +84,7 @@ enum ProcessingMode { #[dom_struct] pub struct HTMLIFrameElement { htmlelement: HTMLElement, - frame_id: FrameId, + browsing_context_id: BrowsingContextId, pipeline_id: Cell<Option<PipelineId>>, pending_pipeline_id: Cell<Option<PipelineId>>, sandbox: MutNullableJS<DOMTokenList>, @@ -115,7 +115,7 @@ impl HTMLIFrameElement { pub fn generate_new_pipeline_id(&self) -> (Option<PipelineId>, PipelineId) { let old_pipeline_id = self.pipeline_id.get(); let new_pipeline_id = PipelineId::new(); - debug!("Frame {} created pipeline {}.", self.frame_id, new_pipeline_id); + debug!("Frame {} created pipeline {}.", self.browsing_context_id, new_pipeline_id); (old_pipeline_id, new_pipeline_id) } @@ -152,7 +152,7 @@ impl HTMLIFrameElement { let global_scope = window.upcast::<GlobalScope>(); let load_info = IFrameLoadInfo { parent_pipeline_id: global_scope.pipeline_id(), - frame_id: self.frame_id, + browsing_context_id: self.browsing_context_id, new_pipeline_id: new_pipeline_id, is_private: private_iframe, frame_type: frame_type, @@ -171,7 +171,7 @@ impl HTMLIFrameElement { let new_layout_info = NewLayoutInfo { parent_info: Some((global_scope.pipeline_id(), frame_type)), new_pipeline_id: new_pipeline_id, - frame_id: self.frame_id, + browsing_context_id: self.browsing_context_id, load_data: load_data.unwrap(), pipeline_port: pipeline_receiver, content_process_shutdown_chan: None, @@ -277,7 +277,7 @@ impl HTMLIFrameElement { document: &Document) -> HTMLIFrameElement { HTMLIFrameElement { htmlelement: HTMLElement::new_inherited(local_name, prefix, document), - frame_id: FrameId::new(), + browsing_context_id: BrowsingContextId::new(), pipeline_id: Cell::new(None), pending_pipeline_id: Cell::new(None), sandbox: Default::default(), @@ -302,8 +302,8 @@ impl HTMLIFrameElement { } #[inline] - pub fn frame_id(&self) -> FrameId { - self.frame_id + pub fn browsing_context_id(&self) -> BrowsingContextId { + self.browsing_context_id } pub fn change_visibility_status(&self, visibility: bool) { @@ -364,7 +364,7 @@ impl HTMLIFrameElement { pub trait HTMLIFrameElementLayoutMethods { fn pipeline_id(&self) -> Option<PipelineId>; - fn frame_id(&self) -> FrameId; + fn browsing_context_id(&self) -> BrowsingContextId; fn get_width(&self) -> LengthOrPercentageOrAuto; fn get_height(&self) -> LengthOrPercentageOrAuto; } @@ -380,9 +380,9 @@ impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> { #[inline] #[allow(unsafe_code)] - fn frame_id(&self) -> FrameId { + fn browsing_context_id(&self) -> BrowsingContextId { unsafe { - (*self.unsafe_get()).frame_id + (*self.unsafe_get()).browsing_context_id } } @@ -541,7 +541,7 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement { // https://html.spec.whatwg.org/multipage/#dom-iframe-contentwindow fn GetContentWindow(&self) -> Option<Root<WindowProxy>> { - self.pipeline_id.get().and_then(|_| ScriptThread::find_window_proxy(self.frame_id)) + self.pipeline_id.get().and_then(|_| ScriptThread::find_window_proxy(self.browsing_context_id)) } // https://html.spec.whatwg.org/multipage/#dom-iframe-contentdocument @@ -711,7 +711,7 @@ impl VirtualMethods for HTMLIFrameElement { // is in a document tree and has a browsing context, which is what causes // the child browsing context to be created. if self.upcast::<Node>().is_in_doc_with_browsing_context() { - debug!("iframe {} src set while in browsing context.", self.frame_id); + debug!("iframe {} src set while in browsing context.", self.browsing_context_id); self.process_the_iframe_attributes(ProcessingMode::NotFirstTime); } }, @@ -740,7 +740,7 @@ impl VirtualMethods for HTMLIFrameElement { // to the newly-created browsing context, and then process the // iframe attributes for the "first time"." if self.upcast::<Node>().is_in_doc_with_browsing_context() { - debug!("iframe {} bound to browsing context.", self.frame_id); + debug!("iframe {} bound to browsing context.", self.browsing_context_id); debug_assert!(tree_in_doc, "is_in_doc_with_bc, but not tree_in_doc"); self.create_nested_browsing_context(); self.process_the_iframe_attributes(ProcessingMode::FirstTime); @@ -754,13 +754,13 @@ impl VirtualMethods for HTMLIFrameElement { LoadBlocker::terminate(&mut blocker); // https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded - debug!("Unbinding frame {}.", self.frame_id); + debug!("Unbinding frame {}.", self.browsing_context_id); let window = window_from_node(self); let (sender, receiver) = ipc::channel().unwrap(); // Ask the constellation to remove the iframe, and tell us the // pipeline ids of the closed pipelines. - let msg = ConstellationMsg::RemoveIFrame(self.frame_id, sender); + let msg = ConstellationMsg::RemoveIFrame(self.browsing_context_id, sender); window.upcast::<GlobalScope>().constellation_chan().send(msg).unwrap(); let exited_pipeline_ids = receiver.recv().unwrap(); diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 6d16cac6731..bec7a34d63f 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -61,7 +61,7 @@ use heapsize::{HeapSizeOf, heap_size_of}; use html5ever::{Prefix, Namespace, QualName}; use js::jsapi::{JSContext, JSObject, JSRuntime}; use libc::{self, c_void, uintptr_t}; -use msg::constellation_msg::{FrameId, PipelineId}; +use msg::constellation_msg::{BrowsingContextId, PipelineId}; use ref_slice::ref_slice; use script_layout_interface::{HTMLCanvasData, OpaqueStyleAndLayoutData, SVGSVGData}; use script_layout_interface::{LayoutElementType, LayoutNodeType, TrustedNodeAddress}; @@ -968,7 +968,7 @@ pub trait LayoutNodeHelpers { fn image_url(&self) -> Option<ServoUrl>; fn canvas_data(&self) -> Option<HTMLCanvasData>; fn svg_data(&self) -> Option<SVGSVGData>; - fn iframe_frame_id(&self) -> FrameId; + fn iframe_browsing_context_id(&self) -> BrowsingContextId; fn iframe_pipeline_id(&self) -> PipelineId; fn opaque(&self) -> OpaqueNode; } @@ -1119,10 +1119,10 @@ impl LayoutNodeHelpers for LayoutJS<Node> { .map(|svg| svg.data()) } - fn iframe_frame_id(&self) -> FrameId { + fn iframe_browsing_context_id(&self) -> BrowsingContextId { let iframe_element = self.downcast::<HTMLIFrameElement>() .expect("not an iframe element!"); - iframe_element.frame_id() + iframe_element.browsing_context_id() } fn iframe_pipeline_id(&self) -> PipelineId { diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index 3290afa1f2c..e022e69a810 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -28,7 +28,7 @@ use js::jsapi::{MutableHandle, MutableHandleObject, MutableHandleValue}; use js::jsapi::{ObjectOpResult, PropertyDescriptor}; use js::jsval::{UndefinedValue, PrivateValue}; use js::rust::get_object_class; -use msg::constellation_msg::FrameId; +use msg::constellation_msg::BrowsingContextId; use msg::constellation_msg::PipelineId; use std::cell::Cell; use std::ptr; @@ -45,10 +45,10 @@ pub struct WindowProxy { /// changes Window. reflector: Reflector, - /// The frame id of the browsing context. - /// In the case that this is a nested browsing context, this is the frame id + /// The id of the browsing context. + /// In the case that this is a nested browsing context, this is the id /// of the container. - frame_id: FrameId, + browsing_context_id: BrowsingContextId, /// The pipeline id of the currently active document. /// May be None, when the currently active document is in another script thread. @@ -68,7 +68,7 @@ pub struct WindowProxy { } impl WindowProxy { - pub fn new_inherited(frame_id: FrameId, + pub fn new_inherited(browsing_context_id: BrowsingContextId, currently_active: Option<PipelineId>, frame_element: Option<&Element>, parent: Option<&WindowProxy>) @@ -76,7 +76,7 @@ impl WindowProxy { { WindowProxy { reflector: Reflector::new(), - frame_id: frame_id, + browsing_context_id: browsing_context_id, currently_active: Cell::new(currently_active), discarded: Cell::new(false), frame_element: frame_element.map(JS::from_ref), @@ -86,7 +86,7 @@ impl WindowProxy { #[allow(unsafe_code)] pub fn new(window: &Window, - frame_id: FrameId, + browsing_context_id: BrowsingContextId, frame_element: Option<&Element>, parent: Option<&WindowProxy>) -> Root<WindowProxy> @@ -107,7 +107,7 @@ impl WindowProxy { // Create a new browsing context. let current = Some(window.global().pipeline_id()); - let mut window_proxy = box WindowProxy::new_inherited(frame_id, current, frame_element, parent); + let mut window_proxy = box WindowProxy::new_inherited(browsing_context_id, current, frame_element, parent); // The window proxy owns the browsing context. // When we finalize the window proxy, it drops the browsing context it owns. @@ -125,7 +125,7 @@ impl WindowProxy { #[allow(unsafe_code)] pub fn new_dissimilar_origin(global_to_clone_from: &GlobalScope, - frame_id: FrameId, + browsing_context_id: BrowsingContextId, parent: Option<&WindowProxy>) -> Root<WindowProxy> { @@ -136,7 +136,7 @@ impl WindowProxy { let cx = global_to_clone_from.get_cx(); // Create a new browsing context. - let mut window_proxy = box WindowProxy::new_inherited(frame_id, None, None, parent); + let mut window_proxy = box WindowProxy::new_inherited(browsing_context_id, None, None, parent); // Create a new dissimilar-origin window. let window = DissimilarOriginWindow::new(global_to_clone_from, &*window_proxy); @@ -171,8 +171,8 @@ impl WindowProxy { self.discarded.get() } - pub fn frame_id(&self) -> FrameId { - self.frame_id + pub fn browsing_context_id(&self) -> BrowsingContextId { + self.browsing_context_id } pub fn frame_element(&self) -> Option<&Element> { diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index 3d4b90eaeab..7104c02ce32 100644 --- a/components/script/layout_wrapper.rs +++ b/components/script/layout_wrapper.rs @@ -44,7 +44,7 @@ use dom::node::{LayoutNodeHelpers, Node}; use dom::text::Text; use gfx_traits::ByteIndex; use html5ever::{LocalName, Namespace}; -use msg::constellation_msg::{FrameId, PipelineId}; +use msg::constellation_msg::{BrowsingContextId, PipelineId}; use range::Range; use script_layout_interface::{HTMLCanvasData, LayoutNodeType, SVGSVGData, TrustedNodeAddress}; use script_layout_interface::{OpaqueStyleAndLayoutData, PartialPersistentLayoutData}; @@ -908,9 +908,9 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> { this.svg_data() } - fn iframe_frame_id(&self) -> FrameId { + fn iframe_browsing_context_id(&self) -> BrowsingContextId { let this = unsafe { self.get_jsmanaged() }; - this.iframe_frame_id() + this.iframe_browsing_context_id() } fn iframe_pipeline_id(&self) -> PipelineId { diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index b817fc77d1d..9ab6fd301bc 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -71,7 +71,7 @@ use js::jsval::UndefinedValue; use js::rust::Runtime; use mem::heap_size_of_self_and_children; use microtask::{MicrotaskQueue, Microtask}; -use msg::constellation_msg::{FrameId, FrameType, PipelineId, PipelineNamespace}; +use msg::constellation_msg::{BrowsingContextId, FrameType, PipelineId, PipelineNamespace}; use net_traits::{CoreResourceMsg, FetchMetadata, FetchResponseListener}; use net_traits::{IpcSend, Metadata, ReferrerPolicy, ResourceThreads}; use net_traits::image_cache::{ImageCache, PendingImageResponse}; @@ -142,7 +142,7 @@ struct InProgressLoad { /// The pipeline which requested this load. pipeline_id: PipelineId, /// The frame being loaded into. - frame_id: FrameId, + browsing_context_id: BrowsingContextId, /// The parent pipeline and frame type associated with this load, if any. parent_info: Option<(PipelineId, FrameType)>, /// The current window size associated with this pipeline. @@ -162,7 +162,7 @@ struct InProgressLoad { impl InProgressLoad { /// Create a new InProgressLoad object. fn new(id: PipelineId, - frame_id: FrameId, + browsing_context_id: BrowsingContextId, parent_info: Option<(PipelineId, FrameType)>, layout_chan: Sender<message::Msg>, window_size: Option<WindowSizeData>, @@ -170,7 +170,7 @@ impl InProgressLoad { origin: MutableOrigin) -> InProgressLoad { InProgressLoad { pipeline_id: id, - frame_id: frame_id, + browsing_context_id: browsing_context_id, parent_info: parent_info, layout_chan: layout_chan, window_size: window_size, @@ -368,8 +368,10 @@ impl Documents { self.find_window(pipeline_id).map(|window| Root::from_ref(window.upcast())) } - pub fn find_iframe(&self, pipeline_id: PipelineId, frame_id: FrameId) -> Option<Root<HTMLIFrameElement>> { - self.find_document(pipeline_id).and_then(|doc| doc.find_iframe(frame_id)) + pub fn find_iframe(&self, pipeline_id: PipelineId, browsing_context_id: BrowsingContextId) + -> Option<Root<HTMLIFrameElement>> + { + self.find_document(pipeline_id).and_then(|doc| doc.find_iframe(browsing_context_id)) } pub fn iter<'a>(&'a self) -> DocumentsIter<'a> { @@ -400,7 +402,7 @@ pub struct ScriptThread { documents: DOMRefCell<Documents>, /// The window proxies known by this thread /// TODO: this map grows, but never shrinks. Issue #15258. - window_proxies: DOMRefCell<HashMap<FrameId, JS<WindowProxy>>>, + window_proxies: DOMRefCell<HashMap<BrowsingContextId, JS<WindowProxy>>>, /// A list of data pertaining to loads that have not yet received a network response incomplete_loads: DOMRefCell<Vec<InProgressLoad>>, /// A map to store service worker registrations for a given origin @@ -538,11 +540,11 @@ impl ScriptThreadFactory for ScriptThread { thread::Builder::new().name(format!("ScriptThread {:?}", state.id)).spawn(move || { thread_state::initialize(thread_state::SCRIPT); PipelineNamespace::install(state.pipeline_namespace_id); - FrameId::install(state.top_level_frame_id); + BrowsingContextId::install(state.top_level_browsing_context_id); let roots = RootCollection::new(); let _stack_roots_tls = StackRootTLS::new(&roots); let id = state.id; - let frame_id = state.frame_id; + let browsing_context_id = state.browsing_context_id; let parent_info = state.parent_info; let mem_profiler_chan = state.mem_profiler_chan.clone(); let window_size = state.window_size; @@ -557,7 +559,7 @@ impl ScriptThreadFactory for ScriptThread { let mut failsafe = ScriptMemoryFailsafe::new(&script_thread); let origin = MutableOrigin::new(load_data.url.origin()); - let new_load = InProgressLoad::new(id, frame_id, parent_info, + let new_load = InProgressLoad::new(id, browsing_context_id, parent_info, layout_chan, window_size, load_data.url.clone(), origin); script_thread.start_page_load(new_load, load_data); @@ -669,7 +671,7 @@ impl ScriptThread { })) } - pub fn find_window_proxy(id: FrameId) -> Option<Root<WindowProxy>> { + pub fn find_window_proxy(id: BrowsingContextId) -> Option<Root<WindowProxy>> { SCRIPT_THREAD_ROOT.with(|root| root.get().and_then(|script_thread| { let script_thread = unsafe { &*script_thread }; script_thread.window_proxies.borrow().get(&id) @@ -1049,8 +1051,8 @@ impl ScriptThread { fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) { match msg { - ConstellationControlMsg::Navigate(parent_pipeline_id, frame_id, load_data, replace) => - self.handle_navigate(parent_pipeline_id, Some(frame_id), load_data, replace), + ConstellationControlMsg::Navigate(parent_pipeline_id, browsing_context_id, load_data, replace) => + self.handle_navigate(parent_pipeline_id, Some(browsing_context_id), load_data, replace), ConstellationControlMsg::SendEvent(id, event) => self.handle_event(id, event), ConstellationControlMsg::ResizeInactive(id, new_size) => @@ -1061,22 +1063,22 @@ impl ScriptThread { self.handle_set_document_activity_msg(pipeline_id, activity), ConstellationControlMsg::ChangeFrameVisibilityStatus(pipeline_id, visible) => self.handle_visibility_change_msg(pipeline_id, visible), - ConstellationControlMsg::NotifyVisibilityChange(parent_pipeline_id, frame_id, visible) => - self.handle_visibility_change_complete_msg(parent_pipeline_id, frame_id, visible), + ConstellationControlMsg::NotifyVisibilityChange(parent_pipeline_id, browsing_context_id, visible) => + self.handle_visibility_change_complete_msg(parent_pipeline_id, browsing_context_id, visible), ConstellationControlMsg::PostMessage(pipeline_id, origin, data) => self.handle_post_message_msg(pipeline_id, origin, data), ConstellationControlMsg::MozBrowserEvent(parent_pipeline_id, - frame_id, + browsing_context_id, event) => self.handle_mozbrowser_event_msg(parent_pipeline_id, - frame_id, + browsing_context_id, event), ConstellationControlMsg::UpdatePipelineId(parent_pipeline_id, - frame_id, + browsing_context_id, new_pipeline_id, reason) => self.handle_update_pipeline_id(parent_pipeline_id, - frame_id, + browsing_context_id, new_pipeline_id, reason), ConstellationControlMsg::FocusIFrame(parent_pipeline_id, frame_id) => @@ -1089,9 +1091,9 @@ impl ScriptThread { self.handle_transition_event(unsafe_node, name, duration), ConstellationControlMsg::WebFontLoaded(pipeline_id) => self.handle_web_font_loaded(pipeline_id), - ConstellationControlMsg::DispatchFrameLoadEvent { - target: frame_id, parent: parent_id, child: child_id } => - self.handle_frame_load_event(parent_id, frame_id, child_id), + ConstellationControlMsg::DispatchIFrameLoadEvent { + target: browsing_context_id, parent: parent_id, child: child_id } => + self.handle_iframe_load_event(parent_id, browsing_context_id, child_id), ConstellationControlMsg::DispatchStorageEvent(pipeline_id, storage, url, key, old_value, new_value) => self.handle_storage_event(pipeline_id, storage, url, key, old_value, new_value), ConstellationControlMsg::ReportCSSError(pipeline_id, filename, line, column, msg) => @@ -1224,8 +1226,8 @@ impl ScriptThread { webdriver_handlers::handle_get_rect(&*documents, pipeline_id, node_id, reply), WebDriverScriptCommand::GetElementText(node_id, reply) => webdriver_handlers::handle_get_text(&*documents, pipeline_id, node_id, reply), - WebDriverScriptCommand::GetFrameId(frame_id, reply) => - webdriver_handlers::handle_get_frame_id(&*documents, pipeline_id, frame_id, reply), + WebDriverScriptCommand::GetPipelineId(browsing_context_id, reply) => + webdriver_handlers::handle_get_pipeline_id(&*documents, pipeline_id, browsing_context_id, reply), WebDriverScriptCommand::GetUrl(reply) => webdriver_handlers::handle_get_url(&*documents, pipeline_id, reply), WebDriverScriptCommand::IsEnabled(element_id, reply) => @@ -1292,7 +1294,7 @@ impl ScriptThread { let NewLayoutInfo { parent_info, new_pipeline_id, - frame_id, + browsing_context_id, load_data, window_size, pipeline_port, @@ -1328,7 +1330,7 @@ impl ScriptThread { }; // Kick off the fetch for the new resource. - let new_load = InProgressLoad::new(new_pipeline_id, frame_id, parent_info, + let new_load = InProgressLoad::new(new_pipeline_id, browsing_context_id, parent_info, layout_chan, window_size, load_data.url.clone(), origin); if load_data.url.as_str() == "about:blank" { @@ -1369,8 +1371,12 @@ impl ScriptThread { } /// Updates iframe element after a change in visibility - fn handle_visibility_change_complete_msg(&self, parent_pipeline_id: PipelineId, id: FrameId, visible: bool) { - let iframe = self.documents.borrow().find_iframe(parent_pipeline_id, id); + fn handle_visibility_change_complete_msg(&self, + parent_pipeline_id: PipelineId, + browsing_context_id: BrowsingContextId, + visible: bool) + { + let iframe = self.documents.borrow().find_iframe(parent_pipeline_id, browsing_context_id); if let Some(iframe) = iframe { iframe.change_visibility_status(visible); } @@ -1418,9 +1424,9 @@ impl ScriptThread { fn handle_focus_iframe_msg(&self, parent_pipeline_id: PipelineId, - frame_id: FrameId) { + browsing_context_id: BrowsingContextId) { let doc = self.documents.borrow().find_document(parent_pipeline_id).unwrap(); - let frame_element = doc.find_iframe(frame_id); + let frame_element = doc.find_iframe(browsing_context_id); if let Some(ref frame_element) = frame_element { doc.begin_focus_transaction(); @@ -1440,17 +1446,17 @@ impl ScriptThread { /// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart fn handle_mozbrowser_event_msg(&self, parent_pipeline_id: PipelineId, - frame_id: Option<FrameId>, + browsing_context_id: Option<BrowsingContextId>, event: MozBrowserEvent) { let doc = match { self.documents.borrow().find_document(parent_pipeline_id) } { - None => return warn!("Mozbrowser event after pipeline {:?} closed.", parent_pipeline_id), + None => return warn!("Mozbrowser event after pipeline {} closed.", parent_pipeline_id), Some(doc) => doc, }; - match frame_id { + match browsing_context_id { None => doc.window().dispatch_mozbrowser_event(event), - Some(frame_id) => match doc.find_iframe(frame_id) { - None => warn!("Mozbrowser event after iframe {:?}/{:?} closed.", parent_pipeline_id, frame_id), + Some(browsing_context_id) => match doc.find_iframe(browsing_context_id) { + None => warn!("Mozbrowser event after iframe {}/{} closed.", parent_pipeline_id, browsing_context_id), Some(frame_element) => frame_element.dispatch_mozbrowser_event(event), }, } @@ -1458,10 +1464,10 @@ impl ScriptThread { fn handle_update_pipeline_id(&self, parent_pipeline_id: PipelineId, - frame_id: FrameId, + browsing_context_id: BrowsingContextId, new_pipeline_id: PipelineId, reason: UpdatePipelineIdReason) { - let frame_element = self.documents.borrow().find_iframe(parent_pipeline_id, frame_id); + let frame_element = self.documents.borrow().find_iframe(parent_pipeline_id, browsing_context_id); if let Some(frame_element) = frame_element { frame_element.update_pipeline_id(new_pipeline_id, reason); } @@ -1690,18 +1696,22 @@ impl ScriptThread { storage.queue_storage_event(url, key, old_value, new_value); } - /// Notify the containing document of a child frame that has completed loading. - fn handle_frame_load_event(&self, parent_id: PipelineId, frame_id: FrameId, child_id: PipelineId) { - let iframe = self.documents.borrow().find_iframe(parent_id, frame_id); + /// Notify the containing document of a child iframe that has completed loading. + fn handle_iframe_load_event(&self, + parent_id: PipelineId, + browsing_context_id: BrowsingContextId, + child_id: PipelineId) + { + let iframe = self.documents.borrow().find_iframe(parent_id, browsing_context_id); match iframe { Some(iframe) => iframe.iframe_load_event_steps(child_id), None => warn!("Message sent to closed pipeline {}.", parent_id), } } - fn ask_constellation_for_frame_id(&self, pipeline_id: PipelineId) -> Option<FrameId> { + fn ask_constellation_for_browsing_context_id(&self, pipeline_id: PipelineId) -> Option<BrowsingContextId> { let (result_sender, result_receiver) = ipc::channel().unwrap(); - let msg = ConstellationMsg::GetFrameId(pipeline_id, result_sender); + let msg = ConstellationMsg::GetBrowsingContextId(pipeline_id, result_sender); self.constellation_chan.send(msg).expect("Failed to send to constellation."); result_receiver.recv().expect("Failed to get frame id from constellation.") } @@ -1724,19 +1734,19 @@ impl ScriptThread { pipeline_id: PipelineId) -> Option<Root<WindowProxy>> { - let frame_id = match self.ask_constellation_for_frame_id(pipeline_id) { - Some(frame_id) => frame_id, + let browsing_context_id = match self.ask_constellation_for_browsing_context_id(pipeline_id) { + Some(browsing_context_id) => browsing_context_id, None => return None, }; - if let Some(window_proxy) = self.window_proxies.borrow().get(&frame_id) { + if let Some(window_proxy) = self.window_proxies.borrow().get(&browsing_context_id) { return Some(Root::from_ref(window_proxy)); } let parent = match self.ask_constellation_for_parent_info(pipeline_id) { Some((parent_id, FrameType::IFrame)) => self.remote_window_proxy(global_to_clone, parent_id), _ => None, }; - let window_proxy = WindowProxy::new_dissimilar_origin(global_to_clone, frame_id, parent.r()); - self.window_proxies.borrow_mut().insert(frame_id, JS::from_ref(&*window_proxy)); + let window_proxy = WindowProxy::new_dissimilar_origin(global_to_clone, browsing_context_id, parent.r()); + self.window_proxies.borrow_mut().insert(browsing_context_id, JS::from_ref(&*window_proxy)); Some(window_proxy) } @@ -1748,16 +1758,16 @@ impl ScriptThread { // to the `window_proxies` map, and return it. fn local_window_proxy(&self, window: &Window, - frame_id: FrameId, + browsing_context_id: BrowsingContextId, parent_info: Option<(PipelineId, FrameType)>) -> Root<WindowProxy> { - if let Some(window_proxy) = self.window_proxies.borrow().get(&frame_id) { + if let Some(window_proxy) = self.window_proxies.borrow().get(&browsing_context_id) { window_proxy.set_currently_active(&*window); return Root::from_ref(window_proxy); } let iframe = match parent_info { - Some((parent_id, FrameType::IFrame)) => self.documents.borrow().find_iframe(parent_id, frame_id), + Some((parent_id, FrameType::IFrame)) => self.documents.borrow().find_iframe(parent_id, browsing_context_id), _ => None, }; let parent = match (parent_info, iframe.as_ref()) { @@ -1765,8 +1775,8 @@ impl ScriptThread { (Some((parent_id, FrameType::IFrame)), _) => self.remote_window_proxy(window.upcast(), parent_id), _ => None, }; - let window_proxy = WindowProxy::new(&window, frame_id, iframe.r().map(Castable::upcast), parent.r()); - self.window_proxies.borrow_mut().insert(frame_id, JS::from_ref(&*window_proxy)); + let window_proxy = WindowProxy::new(&window, browsing_context_id, iframe.r().map(Castable::upcast), parent.r()); + self.window_proxies.borrow_mut().insert(browsing_context_id, JS::from_ref(&*window_proxy)); window_proxy } @@ -1823,7 +1833,7 @@ impl ScriptThread { self.webvr_thread.clone()); // Initialize the browsing context for the window. - let window_proxy = self.local_window_proxy(&window, incomplete.frame_id, incomplete.parent_info); + let window_proxy = self.local_window_proxy(&window, incomplete.browsing_context_id, incomplete.parent_info); window.init_window_proxy(&window_proxy); let last_modified = metadata.headers.as_ref().and_then(|headers| { @@ -2093,12 +2103,12 @@ impl ScriptThread { /// The entry point for content to notify that a new load has been requested /// for the given pipeline (specifically the "navigate" algorithm). fn handle_navigate(&self, parent_pipeline_id: PipelineId, - frame_id: Option<FrameId>, + browsing_context_id: Option<BrowsingContextId>, load_data: LoadData, replace: bool) { - match frame_id { - Some(frame_id) => { - let iframe = self.documents.borrow().find_iframe(parent_pipeline_id, frame_id); + match browsing_context_id { + Some(browsing_context_id) => { + let iframe = self.documents.borrow().find_iframe(parent_pipeline_id, browsing_context_id); if let Some(iframe) = iframe { iframe.navigate_or_reload_child_browsing_context(Some(load_data), NavigationType::Regular, replace); } diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index 7e7fe95122b..7bc31263c25 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -109,10 +109,10 @@ pub fn handle_execute_async_script(documents: &Documents, window.upcast::<GlobalScope>().evaluate_js_on_global_with_result(&eval, rval.handle_mut()); } -pub fn handle_get_frame_id(documents: &Documents, - pipeline: PipelineId, - webdriver_frame_id: WebDriverFrameId, - reply: IpcSender<Result<Option<PipelineId>, ()>>) { +pub fn handle_get_pipeline_id(documents: &Documents, + pipeline: PipelineId, + webdriver_frame_id: WebDriverFrameId, + reply: IpcSender<Result<Option<PipelineId>, ()>>) { let result = match webdriver_frame_id { WebDriverFrameId::Short(_) => { // This isn't supported yet |