aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorAneesh Agrawal <aneeshusa@gmail.com>2016-06-09 07:01:24 -0400
committerAneesh Agrawal <aneeshusa@gmail.com>2016-09-13 15:17:40 -0400
commit9d097e7d1570d68e5fe77ff01595cf14a3e2cc29 (patch)
tree32e6f49e53774b2fdfb4dec38223d48f9b12a7f9 /components/script/dom
parentbb53da69578887befae195b18255967cc7f3fc59 (diff)
downloadservo-9d097e7d1570d68e5fe77ff01595cf14a3e2cc29.tar.gz
servo-9d097e7d1570d68e5fe77ff01595cf14a3e2cc29.zip
Use fn pipeline_id consistently, not fn pipeline
Consistently use the name 'pipeline_id' to refer to a function that returns an (optional) PipelineId. This was prompted by discovering both fn pipeline and fn pipeline_id doing the same job in htmliframeelement.rs. Note that there is fn pipeline in components/compositing/compositor.rs, but that actually returns an Option<&CompositionPipeline>, not any kind of PipelineId.
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/bindings/global.rs6
-rw-r--r--components/script/dom/browsingcontext.rs2
-rw-r--r--components/script/dom/console.rs2
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs2
-rw-r--r--components/script/dom/document.rs14
-rw-r--r--components/script/dom/history.rs4
-rw-r--r--components/script/dom/htmlformelement.rs2
-rw-r--r--components/script/dom/htmliframeelement.rs10
-rw-r--r--components/script/dom/request.rs2
-rw-r--r--components/script/dom/serviceworkercontainer.rs2
-rw-r--r--components/script/dom/serviceworkerglobalscope.rs2
-rw-r--r--components/script/dom/serviceworkerregistration.rs4
-rw-r--r--components/script/dom/storage.rs2
-rw-r--r--components/script/dom/window.rs6
-rw-r--r--components/script/dom/worker.rs6
-rw-r--r--components/script/dom/workerglobalscope.rs8
-rw-r--r--components/script/dom/xmlhttprequest.rs9
17 files changed, 41 insertions, 42 deletions
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs
index a5c9d1a3d79..9452972f774 100644
--- a/components/script/dom/bindings/global.rs
+++ b/components/script/dom/bindings/global.rs
@@ -69,10 +69,10 @@ impl<'a> GlobalRef<'a> {
}
/// Get the `PipelineId` for this global scope.
- pub fn pipeline(&self) -> PipelineId {
+ pub fn pipeline_id(&self) -> PipelineId {
match *self {
- GlobalRef::Window(window) => window.pipeline(),
- GlobalRef::Worker(worker) => worker.pipeline(),
+ GlobalRef::Window(window) => window.pipeline_id(),
+ GlobalRef::Worker(worker) => worker.pipeline_id(),
}
}
diff --git a/components/script/dom/browsingcontext.rs b/components/script/dom/browsingcontext.rs
index 919b574c27a..dad7dfa3b91 100644
--- a/components/script/dom/browsingcontext.rs
+++ b/components/script/dom/browsingcontext.rs
@@ -152,7 +152,7 @@ impl BrowsingContext {
old
}
- pub fn pipeline(&self) -> PipelineId {
+ pub fn pipeline_id(&self) -> PipelineId {
self.id
}
diff --git a/components/script/dom/console.rs b/components/script/dom/console.rs
index 37d549befd9..f167e8b28fe 100644
--- a/components/script/dom/console.rs
+++ b/components/script/dom/console.rs
@@ -18,7 +18,7 @@ impl Console {
if let Some(chan) = global.devtools_chan() {
let console_message = prepare_message(level, message);
let devtools_message = ScriptToDevtoolsControlMsg::ConsoleAPI(
- global.pipeline(),
+ global.pipeline_id(),
console_message,
global.get_worker_id());
chan.send(devtools_message).unwrap();
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs
index 4f0bad72949..2314d94f15b 100644
--- a/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/components/script/dom/dedicatedworkerglobalscope.rs
@@ -243,7 +243,7 @@ impl DedicatedWorkerGlobalScope {
}
}
- pub fn pipeline(&self) -> PipelineId {
+ pub fn pipeline_id(&self) -> PipelineId {
self.id
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index fe55c035ff7..fd4bb67370b 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -641,7 +641,7 @@ impl Document {
// Update the focus state for all elements in the focus chain.
// https://html.spec.whatwg.org/multipage/#focus-chain
if focus_type == FocusType::Element {
- let event = ConstellationMsg::Focus(self.window.pipeline());
+ let event = ConstellationMsg::Focus(self.window.pipeline_id());
self.window.constellation_chan().send(event).unwrap();
}
}
@@ -661,7 +661,7 @@ impl Document {
pub fn send_title_to_compositor(&self) {
let window = self.window();
window.constellation_chan()
- .send(ConstellationMsg::SetTitle(window.pipeline(),
+ .send(ConstellationMsg::SetTitle(window.pipeline_id(),
Some(String::from(self.Title()))))
.unwrap();
}
@@ -1367,7 +1367,7 @@ impl Document {
// TODO: Should tick animation only when document is visible
if !self.running_animation_callbacks.get() {
let event = ConstellationMsg::ChangeRunningAnimationsState(
- self.window.pipeline(),
+ self.window.pipeline_id(),
AnimationState::AnimationCallbacksPresent);
self.window.constellation_chan().send(event).unwrap();
}
@@ -1405,7 +1405,7 @@ impl Document {
if self.animation_frame_list.borrow().is_empty() {
mem::swap(&mut *self.animation_frame_list.borrow_mut(),
&mut animation_frame_list);
- let event = ConstellationMsg::ChangeRunningAnimationsState(self.window.pipeline(),
+ let event = ConstellationMsg::ChangeRunningAnimationsState(self.window.pipeline_id(),
AnimationState::NoAnimationCallbacksPresent);
self.window.constellation_chan().send(event).unwrap();
}
@@ -1469,7 +1469,7 @@ impl Document {
let loader = self.loader.borrow();
if !loader.is_blocked() && !loader.events_inhibited() {
let win = self.window();
- let msg = MainThreadScriptMsg::DocumentLoadsComplete(win.pipeline());
+ let msg = MainThreadScriptMsg::DocumentLoadsComplete(win.pipeline_id());
win.main_thread_script_chan().send(msg).unwrap();
}
}
@@ -1567,7 +1567,7 @@ impl Document {
}
pub fn notify_constellation_load(&self) {
- let pipeline_id = self.window.pipeline();
+ let pipeline_id = self.window.pipeline_id();
let load_event = ConstellationMsg::LoadComplete(pipeline_id);
self.window.constellation_chan().send(load_event).unwrap();
}
@@ -1593,7 +1593,7 @@ impl Document {
self.upcast::<Node>()
.traverse_preorder()
.filter_map(Root::downcast::<HTMLIFrameElement>)
- .find(|node| node.pipeline() == Some(pipeline))
+ .find(|node| node.pipeline_id() == Some(pipeline))
}
pub fn get_dom_loading(&self) -> u64 {
diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs
index 559b39f9b2c..5ced543d728 100644
--- a/components/script/dom/history.rs
+++ b/components/script/dom/history.rs
@@ -38,7 +38,7 @@ impl History {
impl History {
fn traverse_history(&self, direction: TraversalDirection) {
- let pipeline = self.window.pipeline();
+ let pipeline = self.window.pipeline_id();
let msg = ConstellationMsg::TraverseHistory(Some(pipeline), direction);
let _ = self.window.constellation_chan().send(msg);
}
@@ -47,7 +47,7 @@ impl History {
impl HistoryMethods for History {
// https://html.spec.whatwg.org/multipage/#dom-history-length
fn Length(&self) -> u32 {
- let pipeline = self.window.pipeline();
+ let pipeline = self.window.pipeline_id();
let (sender, recv) = ipc::channel().expect("Failed to create channel to send jsh length.");
let msg = ConstellationMsg::JointSessionHistoryLength(pipeline, sender);
let _ = self.window.constellation_chan().send(msg);
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index fa16618b564..ff0f6e53b92 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -435,7 +435,7 @@ impl HTMLFormElement {
// Step 2
let nav = box PlannedNavigation {
load_data: load_data,
- pipeline_id: window.pipeline(),
+ pipeline_id: window.pipeline_id(),
script_chan: window.main_thread_script_chan().clone(),
generation_id: self.generation_id.get(),
form: Trusted::new(self)
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 59578b37b59..58e0842bef3 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -133,7 +133,7 @@ impl HTMLIFrameElement {
let load_info = IFrameLoadInfo {
load_data: load_data,
- containing_pipeline_id: window.pipeline(),
+ containing_pipeline_id: window.pipeline_id(),
new_subpage_id: new_subpage_id,
old_subpage_id: old_subpage_id,
new_pipeline_id: new_pipeline_id,
@@ -213,10 +213,6 @@ impl HTMLIFrameElement {
self.subpage_id.get()
}
- pub fn pipeline(&self) -> Option<PipelineId> {
- self.pipeline_id.get()
- }
-
pub fn change_visibility_status(&self, visibility: bool) {
if self.visibility.get() != visibility {
self.visibility.set(visibility);
@@ -241,7 +237,7 @@ impl HTMLIFrameElement {
pub fn iframe_load_event_steps(&self, loaded_pipeline: PipelineId) {
// TODO(#9592): assert that the load blocker is present at all times when we
// can guarantee that it's created for the case of iframe.reload().
- assert_eq!(loaded_pipeline, self.pipeline().unwrap());
+ assert_eq!(loaded_pipeline, self.pipeline_id().unwrap());
// TODO A cross-origin child document would not be easily accessible
// from this script thread. It's unclear how to implement
@@ -423,7 +419,7 @@ pub fn Navigate(iframe: &HTMLIFrameElement, direction: TraversalDirection) -> Er
if iframe.Mozbrowser() {
if iframe.upcast::<Node>().is_in_doc() {
let window = window_from_node(iframe);
- let msg = ConstellationMsg::TraverseHistory(iframe.pipeline(), direction);
+ let msg = ConstellationMsg::TraverseHistory(iframe.pipeline_id(), direction);
window.constellation_chan().send(msg).unwrap();
}
diff --git a/components/script/dom/request.rs b/components/script/dom/request.rs
index a32799cd61c..25f64438a0a 100644
--- a/components/script/dom/request.rs
+++ b/components/script/dom/request.rs
@@ -424,7 +424,7 @@ fn net_request_from_global(global: GlobalRef,
url: Url,
is_service_worker_global_scope: bool) -> NetTraitsRequest {
let origin = Origin::Origin(global.get_url().origin());
- let pipeline_id = global.pipeline();
+ let pipeline_id = global.pipeline_id();
NetTraitsRequest::new(url,
Some(origin),
is_service_worker_global_scope,
diff --git a/components/script/dom/serviceworkercontainer.rs b/components/script/dom/serviceworkercontainer.rs
index 06080b7731c..d6379c30183 100644
--- a/components/script/dom/serviceworkercontainer.rs
+++ b/components/script/dom/serviceworkercontainer.rs
@@ -100,7 +100,7 @@ impl ServiceWorkerContainerMethods for ServiceWorkerContainer {
script_url,
scope_str.clone(),
self);
- ScriptThread::set_registration(scope, &*worker_registration, self.global().r().pipeline());
+ ScriptThread::set_registration(scope, &*worker_registration, self.global().r().pipeline_id());
Ok(worker_registration)
}
}
diff --git a/components/script/dom/serviceworkerglobalscope.rs b/components/script/dom/serviceworkerglobalscope.rs
index 3d26cbdb67f..16d5348b6e5 100644
--- a/components/script/dom/serviceworkerglobalscope.rs
+++ b/components/script/dom/serviceworkerglobalscope.rs
@@ -285,7 +285,7 @@ impl ServiceWorkerGlobalScope {
}
}
- pub fn pipeline(&self) -> PipelineId {
+ pub fn pipeline_id(&self) -> PipelineId {
self.id
}
diff --git a/components/script/dom/serviceworkerregistration.rs b/components/script/dom/serviceworkerregistration.rs
index e20b7e06c47..ccf238dde8a 100644
--- a/components/script/dom/serviceworkerregistration.rs
+++ b/components/script/dom/serviceworkerregistration.rs
@@ -53,14 +53,14 @@ impl ServiceWorkerRegistration {
let worker_load_origin = WorkerScriptLoadOrigin {
referrer_url: None,
referrer_policy: None,
- pipeline_id: Some(global.pipeline())
+ pipeline_id: Some(global.pipeline_id())
};
let worker_id = global.get_next_worker_id();
let init = prepare_workerscope_init(global, None);
ScopeThings {
script_url: script_url,
- pipeline_id: global.pipeline(),
+ pipeline_id: global.pipeline_id(),
init: init,
worker_load_origin: worker_load_origin,
devtools_chan: global.devtools_chan(),
diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs
index 7827cdb6b15..411e304b2f5 100644
--- a/components/script/dom/storage.rs
+++ b/components/script/dom/storage.rs
@@ -206,7 +206,7 @@ impl Runnable for StorageEventRunnable {
assert!(UrlHelper::SameOrigin(&ev_url, &it_window.get_url()));
// TODO: Such a Document object is not necessarily fully active, but events fired on such
// objects are ignored by the event loop until the Document becomes fully active again.
- if ev_window.pipeline() != it_window.pipeline() {
+ if ev_window.pipeline_id() != it_window.pipeline_id() {
storage_event.upcast::<Event>().fire(it_window.upcast());
}
}
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index e8006123360..da8d9be0ead 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -331,7 +331,7 @@ impl Window {
worker_id
}
- pub fn pipeline(&self) -> PipelineId {
+ pub fn pipeline_id(&self) -> PipelineId {
self.id
}
@@ -472,7 +472,7 @@ impl WindowMethods for Window {
}
let (sender, receiver) = ipc::channel().unwrap();
- self.constellation_chan().send(ConstellationMsg::Alert(self.pipeline(), s.to_string(), sender)).unwrap();
+ self.constellation_chan().send(ConstellationMsg::Alert(self.pipeline_id(), s.to_string(), sender)).unwrap();
let should_display_alert_dialog = receiver.recv().unwrap();
if should_display_alert_dialog {
@@ -1058,7 +1058,7 @@ impl Window {
// TODO (farodin91): Raise an event to stop the current_viewport
self.update_viewport_for_scroll(x, y);
- let message = ConstellationMsg::ScrollFragmentPoint(self.pipeline(), layer_id, point, smooth);
+ let message = ConstellationMsg::ScrollFragmentPoint(self.pipeline_id(), layer_id, point, smooth);
self.constellation_chan.send(message).unwrap();
}
diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs
index e40ebee24f0..9438569a5d1 100644
--- a/components/script/dom/worker.rs
+++ b/components/script/dom/worker.rs
@@ -85,13 +85,13 @@ impl Worker {
let worker_load_origin = WorkerScriptLoadOrigin {
referrer_url: None,
referrer_policy: None,
- pipeline_id: Some(global.pipeline())
+ pipeline_id: Some(global.pipeline_id()),
};
let (devtools_sender, devtools_receiver) = ipc::channel().unwrap();
let worker_id = global.get_next_worker_id();
if let Some(ref chan) = global.devtools_chan() {
- let pipeline_id = global.pipeline();
+ let pipeline_id = global.pipeline_id();
let title = format!("Worker for {}", worker_url);
let page_info = DevtoolsPageInfo {
title: title,
@@ -105,7 +105,7 @@ impl Worker {
let init = prepare_workerscope_init(global, Some(devtools_sender));
DedicatedWorkerGlobalScope::run_worker_scope(
- init, worker_url, global.pipeline(), devtools_receiver, worker.runtime.clone(), worker_ref,
+ init, worker_url, global.pipeline_id(), devtools_receiver, worker.runtime.clone(), worker_ref,
global.script_chan(), sender, receiver, worker_load_origin, closing);
Ok(worker)
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs
index 1c2c46fb52d..95e9bb13106 100644
--- a/components/script/dom/workerglobalscope.rs
+++ b/components/script/dom/workerglobalscope.rs
@@ -238,7 +238,7 @@ impl LoadOrigin for WorkerGlobalScope {
None
}
fn pipeline_id(&self) -> Option<PipelineId> {
- Some(self.pipeline())
+ Some(self.pipeline_id())
}
}
@@ -410,13 +410,13 @@ impl WorkerGlobalScope {
FileReadingTaskSource(self.script_chan())
}
- pub fn pipeline(&self) -> PipelineId {
+ pub fn pipeline_id(&self) -> PipelineId {
let dedicated = self.downcast::<DedicatedWorkerGlobalScope>();
let service_worker = self.downcast::<ServiceWorkerGlobalScope>();
if let Some(dedicated) = dedicated {
- return dedicated.pipeline();
+ return dedicated.pipeline_id();
} else if let Some(service_worker) = service_worker {
- return service_worker.pipeline();
+ return service_worker.pipeline_id();
} else {
panic!("need to implement a sender for SharedWorker")
}
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index a97dc7f802b..c23b97b48d7 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -278,7 +278,7 @@ impl LoadOrigin for XMLHttpRequest {
}
fn pipeline_id(&self) -> Option<PipelineId> {
let global = self.global();
- Some(global.r().pipeline())
+ Some(global.r().pipeline_id())
}
}
@@ -1189,7 +1189,7 @@ impl XMLHttpRequest {
let decoded = charset.decode(&self.response.borrow(), DecoderTrap::Replace).unwrap();
let document = self.new_doc(IsHTMLDocument::HTMLDocument);
// TODO: Disable scripting while parsing
- parse_html(document.r(), DOMString::from(decoded), wr.get_url(), ParseContext::Owner(Some(wr.pipeline())));
+ parse_html(document.r(), DOMString::from(decoded), wr.get_url(), ParseContext::Owner(Some(wr.pipeline_id())));
document
}
@@ -1200,7 +1200,10 @@ impl XMLHttpRequest {
let decoded = charset.decode(&self.response.borrow(), DecoderTrap::Replace).unwrap();
let document = self.new_doc(IsHTMLDocument::NonHTMLDocument);
// TODO: Disable scripting while parsing
- parse_xml(document.r(), DOMString::from(decoded), wr.get_url(), xml::ParseContext::Owner(Some(wr.pipeline())));
+ parse_xml(document.r(),
+ DOMString::from(decoded),
+ wr.get_url(),
+ xml::ParseContext::Owner(Some(wr.pipeline_id())));
document
}