diff options
author | Alan Jeffrey <ajeffrey@mozilla.com> | 2016-10-07 15:52:49 -0500 |
---|---|---|
committer | Alan Jeffrey <ajeffrey@mozilla.com> | 2016-11-08 10:48:58 -0600 |
commit | 90e9c910f4338adb01c322034a2cd3230e7e9b8c (patch) | |
tree | 72f56740559e86e4d900329680d1cd221a58b5b0 /components/script/dom/storage.rs | |
parent | dae007fd1634bcf1545e67abaa7746fa95f10e94 (diff) | |
download | servo-90e9c910f4338adb01c322034a2cd3230e7e9b8c.tar.gz servo-90e9c910f4338adb01c322034a2cd3230e7e9b8c.zip |
Replace script thread root browsing context by a collection of documents.
Diffstat (limited to 'components/script/dom/storage.rs')
-rw-r--r-- | components/script/dom/storage.rs | 19 |
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()); + } } } } |