aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/storage.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-11-08 11:31:33 -0600
committerGitHub <noreply@github.com>2016-11-08 11:31:33 -0600
commitd1b7f19410cb882280287b482bd7178a6eb529b1 (patch)
tree925d453b166b8f5bc93ca1caea8efb2d416456c9 /components/script/dom/storage.rs
parent2e2eab069a366be658b759fcd2ed1006a4c60407 (diff)
parent90e9c910f4338adb01c322034a2cd3230e7e9b8c (diff)
downloadservo-d1b7f19410cb882280287b482bd7178a6eb529b1.tar.gz
servo-d1b7f19410cb882280287b482bd7178a6eb529b1.zip
Auto merge of #14013 - asajeffrey:script-thread-no-root-document, r=jdm
Script thread with no root document <!-- Please describe your changes on the following line: --> This PR removes the single root document from the script thread, and replaces it by a lookup table from `PipelineId`s to `Document`s. This is needed if we're going to share script threads, as per #633. The last commit is the one that matters, the ones before are #13646. cc @jdm @Ms2ger @ConnorGBrewster --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because refactoring <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14013) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/storage.rs')
-rw-r--r--components/script/dom/storage.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs
index 3441f57a7e7..099c6c04fea 100644
--- a/components/script/dom/storage.rs
+++ b/components/script/dom/storage.rs
@@ -13,7 +13,6 @@ use dom::bindings::str::DOMString;
use dom::event::{Event, EventBubbles, EventCancelable};
use dom::globalscope::GlobalScope;
use dom::storageevent::StorageEvent;
-use dom::urlhelper::UrlHelper;
use ipc_channel::ipc::{self, IpcSender};
use net_traits::IpcSend;
use net_traits::storage_thread::{StorageThreadMsg, StorageType};
@@ -193,14 +192,16 @@ impl Runnable for StorageEventRunnable {
Some(&storage)
);
- let root_context = script_thread.root_browsing_context();
- for it_context in root_context.iter() {
- let it_window = it_context.active_window();
- 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 global.pipeline_id() != it_window.upcast::<GlobalScope>().pipeline_id() {
- storage_event.upcast::<Event>().fire(it_window.upcast());
+ // TODO: This is only iterating over documents in the current script
+ // thread, so we are not firing events to other script threads.
+ // NOTE: once that is fixed, we can remove borrow_documents from ScriptThread.
+ for (id, document) in script_thread.borrow_documents().iter() {
+ if ev_url.origin() == document.window().get_url().origin() {
+ // 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 global.pipeline_id() != id {
+ storage_event.upcast::<Event>().fire(document.window().upcast());
+ }
}
}
}