diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/bindings/trace.rs | 4 | ||||
-rw-r--r-- | components/script/dom/browsingcontext.rs | 6 | ||||
-rw-r--r-- | components/script/dom/document.rs | 16 | ||||
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 38 | ||||
-rw-r--r-- | components/script/dom/servohtmlparser.rs | 8 | ||||
-rw-r--r-- | components/script/dom/window.rs | 26 |
6 files changed, 29 insertions, 69 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index fae24096bac..8125013a960 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -57,7 +57,7 @@ use js::jsapi::{GCTraceKindToAscii, Heap, JSObject, JSTracer, TraceKind}; use js::jsval::JSVal; use js::rust::Runtime; use libc; -use msg::constellation_msg::{FrameType, PipelineId, ReferrerPolicy, SubpageId, WindowSizeType}; +use msg::constellation_msg::{FrameType, PipelineId, ReferrerPolicy, WindowSizeType}; use net_traits::{Metadata, NetworkError, ResourceThreads}; use net_traits::filemanager_thread::RelativePos; use net_traits::image::base::{Image, ImageMetadata}; @@ -308,7 +308,7 @@ no_jsmanaged_fields!(PropertyDeclarationBlock); no_jsmanaged_fields!(HashSet<T>); // These three are interdependent, if you plan to put jsmanaged data // in one of these make sure it is propagated properly to containing structs -no_jsmanaged_fields!(FrameType, SubpageId, WindowSizeData, WindowSizeType, PipelineId); +no_jsmanaged_fields!(FrameType, WindowSizeData, WindowSizeType, PipelineId); no_jsmanaged_fields!(TimerEventId, TimerSource); no_jsmanaged_fields!(WorkerId); no_jsmanaged_fields!(QuirksMode); diff --git a/components/script/dom/browsingcontext.rs b/components/script/dom/browsingcontext.rs index dad7dfa3b91..02d153296ae 100644 --- a/components/script/dom/browsingcontext.rs +++ b/components/script/dom/browsingcontext.rs @@ -26,7 +26,7 @@ use js::jsapi::{JS_GetOwnPropertyDescriptorById, JS_HasPropertyById}; use js::jsapi::{MutableHandle, MutableHandleObject, MutableHandleValue}; use js::jsapi::{ObjectOpResult, PropertyDescriptor}; use js::jsval::{UndefinedValue, PrivateValue}; -use msg::constellation_msg::{PipelineId, SubpageId}; +use msg::constellation_msg::PipelineId; use std::cell::Cell; use url::Url; @@ -160,10 +160,10 @@ impl BrowsingContext { self.children.borrow_mut().push(JS::from_ref(&context)); } - pub fn find_child_by_subpage(&self, subpage_id: SubpageId) -> Option<Root<Window>> { + pub fn find_child_by_id(&self, pipeline_id: PipelineId) -> Option<Root<Window>> { self.children.borrow().iter().find(|context| { let window = context.active_window(); - window.subpage() == Some(subpage_id) + window.pipeline_id() == pipeline_id }).map(|context| context.active_window()) } diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index a43194783a0..3436a4aaa0b 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -94,7 +94,7 @@ use js::jsapi::{JSContext, JSObject, JSRuntime}; use js::jsapi::JS_GetRuntime; use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER}; use msg::constellation_msg::{Key, KeyModifiers, KeyState}; -use msg::constellation_msg::{PipelineId, ReferrerPolicy, SubpageId}; +use msg::constellation_msg::{PipelineId, ReferrerPolicy}; use net_traits::{AsyncResponseTarget, IpcSend, PendingAsyncLoad}; use net_traits::CookieSource::NonHTTP; use net_traits::CoreResourceMsg::{GetCookiesForUrl, SetCookiesForUrl}; @@ -1342,9 +1342,9 @@ impl Document { pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) { if PREFS.is_mozbrowser_enabled() { - if let Some((parent_pipeline_id, subpage_id, _)) = self.window.parent_info() { + if let Some((parent_pipeline_id, _)) = self.window.parent_info() { let event = ConstellationMsg::MozBrowserEvent(parent_pipeline_id, - Some(subpage_id), + Some(self.window.pipeline_id()), event); self.window.constellation_chan().send(event).unwrap(); } @@ -1581,15 +1581,7 @@ impl Document { } /// Find an iframe element in the document. - pub fn find_iframe(&self, subpage_id: SubpageId) -> Option<Root<HTMLIFrameElement>> { - self.upcast::<Node>() - .traverse_preorder() - .filter_map(Root::downcast::<HTMLIFrameElement>) - .find(|node| node.subpage_id() == Some(subpage_id)) - } - - /// Find an iframe element in the document. - pub fn find_iframe_by_pipeline(&self, pipeline: PipelineId) -> Option<Root<HTMLIFrameElement>> { + pub fn find_iframe(&self, pipeline: PipelineId) -> Option<Root<HTMLIFrameElement>> { self.upcast::<Node>() .traverse_preorder() .filter_map(Root::downcast::<HTMLIFrameElement>) diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 051f7588687..220eb7d1c7c 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -38,7 +38,7 @@ use dom::window::{ReflowReason, Window}; use ipc_channel::ipc; use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue}; use js::jsval::{NullValue, UndefinedValue}; -use msg::constellation_msg::{FrameType, LoadData, PipelineId, SubpageId, TraversalDirection}; +use msg::constellation_msg::{FrameType, LoadData, PipelineId, TraversalDirection}; use net_traits::response::HttpsState; use script_layout_interface::message::ReflowQueryType; use script_traits::{IFrameLoadInfo, MozBrowserEvent, ScriptMsg as ConstellationMsg}; @@ -68,7 +68,6 @@ bitflags! { pub struct HTMLIFrameElement { htmlelement: HTMLElement, pipeline_id: Cell<Option<PipelineId>>, - subpage_id: Cell<Option<SubpageId>>, sandbox: MutNullableHeap<JS<DOMTokenList>>, sandbox_allowance: Cell<Option<SandboxAllowance>>, load_blocker: DOMRefCell<Option<LoadBlocker>>, @@ -94,14 +93,11 @@ impl HTMLIFrameElement { }).unwrap_or_else(|| Url::parse("about:blank").unwrap()) } - pub fn generate_new_subpage_id(&self) -> (SubpageId, Option<SubpageId>) { - self.pipeline_id.set(Some(PipelineId::new())); - - let old_subpage_id = self.subpage_id.get(); - let win = window_from_node(self); - let subpage_id = win.get_next_subpage_id(); - self.subpage_id.set(Some(subpage_id)); - (subpage_id, old_subpage_id) + pub fn generate_new_pipeline_id(&self) -> (Option<PipelineId>, PipelineId) { + let old_pipeline_id = self.pipeline_id.get(); + let new_pipeline_id = PipelineId::new(); + self.pipeline_id.set(Some(new_pipeline_id)); + (old_pipeline_id, new_pipeline_id) } pub fn navigate_or_reload_child_browsing_context(&self, load_data: Option<LoadData>) { @@ -126,16 +122,14 @@ impl HTMLIFrameElement { } let window = window_from_node(self); - let (new_subpage_id, old_subpage_id) = self.generate_new_subpage_id(); - let new_pipeline_id = self.pipeline_id.get().unwrap(); + let (old_pipeline_id, new_pipeline_id) = self.generate_new_pipeline_id(); let private_iframe = self.privatebrowsing(); let frame_type = if self.Mozbrowser() { FrameType::MozBrowserIFrame } else { FrameType::IFrame }; let load_info = IFrameLoadInfo { load_data: load_data, parent_pipeline_id: window.pipeline_id(), - new_subpage_id: new_subpage_id, - old_subpage_id: old_subpage_id, + old_pipeline_id: old_pipeline_id, new_pipeline_id: new_pipeline_id, sandbox: sandboxed, is_private: private_iframe, @@ -170,8 +164,7 @@ impl HTMLIFrameElement { } } - pub fn update_subpage_id(&self, new_subpage_id: SubpageId, new_pipeline_id: PipelineId) { - self.subpage_id.set(Some(new_subpage_id)); + pub fn update_pipeline_id(&self, new_pipeline_id: PipelineId) { self.pipeline_id.set(Some(new_pipeline_id)); let mut blocker = self.load_blocker.borrow_mut(); @@ -186,7 +179,6 @@ impl HTMLIFrameElement { HTMLIFrameElement { htmlelement: HTMLElement::new_inherited(localName, prefix, document), pipeline_id: Cell::new(None), - subpage_id: Cell::new(None), sandbox: Default::default(), sandbox_allowance: Cell::new(None), load_blocker: DOMRefCell::new(None), @@ -208,11 +200,6 @@ impl HTMLIFrameElement { self.pipeline_id.get() } - #[inline] - pub fn subpage_id(&self) -> Option<SubpageId> { - self.subpage_id.get() - } - pub fn change_visibility_status(&self, visibility: bool) { if self.visibility.get() != visibility { self.visibility.set(visibility); @@ -270,11 +257,11 @@ impl HTMLIFrameElement { } pub fn get_content_window(&self) -> Option<Root<Window>> { - self.subpage_id.get().and_then(|subpage_id| { + self.pipeline_id.get().and_then(|pipeline_id| { let window = window_from_node(self); let window = window.r(); let browsing_context = window.browsing_context(); - browsing_context.find_child_by_subpage(subpage_id) + browsing_context.find_child_by_id(pipeline_id) }) } @@ -659,12 +646,11 @@ impl VirtualMethods for HTMLIFrameElement { receiver.recv().unwrap() } - // Resetting the subpage id to None is required here so that + // Resetting the pipeline_id to None is required here so that // if this iframe is subsequently re-added to the document // the load doesn't think that it's a navigation, but instead // a new iframe. Without this, the constellation gets very // confused. - self.subpage_id.set(None); self.pipeline_id.set(None); } } diff --git a/components/script/dom/servohtmlparser.rs b/components/script/dom/servohtmlparser.rs index 548dad24dae..24a22be75dd 100644 --- a/components/script/dom/servohtmlparser.rs +++ b/components/script/dom/servohtmlparser.rs @@ -30,7 +30,7 @@ use hyper::header::ContentType; use hyper::mime::{Mime, SubLevel, TopLevel}; use hyper_serde::Serde; use js::jsapi::JSTracer; -use msg::constellation_msg::{PipelineId, SubpageId}; +use msg::constellation_msg::PipelineId; use net_traits::{AsyncResponseListener, Metadata, NetworkError}; use network_listener::PreInvoke; use parse::{Parser, ParserRef, TrustedParser}; @@ -67,19 +67,16 @@ pub struct ParserContext { is_synthesized_document: bool, /// The pipeline associated with this document. id: PipelineId, - /// The subpage associated with this document. - subpage: Option<SubpageId>, /// The URL for this document. url: Url, } impl ParserContext { - pub fn new(id: PipelineId, subpage: Option<SubpageId>, url: Url) -> ParserContext { + pub fn new(id: PipelineId, url: Url) -> ParserContext { ParserContext { parser: None, is_synthesized_document: false, id: id, - subpage: subpage, url: url, } } @@ -102,7 +99,6 @@ impl AsyncResponseListener for ParserContext { let content_type = metadata.clone().and_then(|meta| meta.content_type).map(Serde::into_inner); let parser = match ScriptThread::page_headers_available(&self.id, - self.subpage.as_ref(), metadata) { Some(parser) => parser, None => return, diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index da8d9be0ead..f4efcd8dd76 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -51,7 +51,7 @@ use js::jsval::UndefinedValue; use js::rust::CompileOptionsWrapper; use js::rust::Runtime; use libc; -use msg::constellation_msg::{FrameType, LoadData, PipelineId, SubpageId, WindowSizeType}; +use msg::constellation_msg::{FrameType, LoadData, PipelineId, WindowSizeType}; use net_traits::ResourceThreads; use net_traits::bluetooth_thread::BluetoothMethodMsg; use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread}; @@ -200,16 +200,14 @@ pub struct Window { /// page changes. devtools_wants_updates: Cell<bool>, - next_subpage_id: Cell<SubpageId>, - /// Pending resize event, if any. resize_event: Cell<Option<(WindowSizeData, WindowSizeType)>>, /// Pipeline id associated with this page. id: PipelineId, - /// Subpage id associated with this page, if any. - parent_info: Option<(PipelineId, SubpageId, FrameType)>, + /// Parent id associated with this page, if any. + parent_info: Option<(PipelineId, FrameType)>, /// Global static data related to the DOM. dom_static: GlobalStaticData, @@ -335,11 +333,7 @@ impl Window { self.id } - pub fn subpage(&self) -> Option<SubpageId> { - self.parent_info.map(|p| p.1) - } - - pub fn parent_info(&self) -> Option<(PipelineId, SubpageId, FrameType)> { + pub fn parent_info(&self) -> Option<(PipelineId, FrameType)> { self.parent_info } @@ -1492,13 +1486,6 @@ impl Window { WindowProxyHandler(self.dom_static.windowproxy_handler.0) } - pub fn get_next_subpage_id(&self) -> SubpageId { - let subpage_id = self.next_subpage_id.get(); - let SubpageId(id_num) = subpage_id; - self.next_subpage_id.set(SubpageId(id_num + 1)); - subpage_id - } - pub fn get_pending_reflow_count(&self) -> u32 { self.pending_reflow_count.get() } @@ -1612,7 +1599,7 @@ impl Window { // https://html.spec.whatwg.org/multipage/#top-level-browsing-context pub fn is_top_level(&self) -> bool { match self.parent_info { - Some((_, _, FrameType::IFrame)) => false, + Some((_, FrameType::IFrame)) => false, _ => true, } } @@ -1676,7 +1663,7 @@ impl Window { timer_event_chan: IpcSender<TimerEvent>, layout_chan: Sender<Msg>, id: PipelineId, - parent_info: Option<(PipelineId, SubpageId, FrameType)>, + parent_info: Option<(PipelineId, FrameType)>, window_size: Option<WindowSizeData>) -> Root<Window> { let layout_rpc: Box<LayoutRPC> = { @@ -1726,7 +1713,6 @@ impl Window { page_clip_rect: Cell::new(max_rect()), fragment_name: DOMRefCell::new(None), resize_event: Cell::new(None), - next_subpage_id: Cell::new(SubpageId(0)), layout_chan: layout_chan, layout_rpc: layout_rpc, window_size: Cell::new(window_size), |