mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Only expose Storage/StorageEvent in Window
This commit is contained in:
parent
f7e75fd001
commit
1aeca9c255
7 changed files with 10 additions and 13 deletions
|
@ -11,8 +11,8 @@ use dom::bindings::refcounted::Trusted;
|
|||
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::storageevent::StorageEvent;
|
||||
use dom::window::Window;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use net_traits::IpcSend;
|
||||
use net_traits::storage_thread::{StorageThreadMsg, StorageType};
|
||||
|
@ -35,7 +35,7 @@ impl Storage {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, storage_type: StorageType) -> Root<Storage> {
|
||||
pub fn new(global: &Window, storage_type: StorageType) -> Root<Storage> {
|
||||
reflect_dom_object(box Storage::new_inherited(storage_type), global, StorageBinding::Wrap)
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ impl Runnable for StorageEventRunnable {
|
|||
let window = global.as_window();
|
||||
|
||||
let storage_event = StorageEvent::new(
|
||||
&global,
|
||||
&window,
|
||||
atom!("storage"),
|
||||
EventBubbles::DoesNotBubble, EventCancelable::NotCancelable,
|
||||
this.key.map(DOMString::from), this.old_value.map(DOMString::from), this.new_value.map(DOMString::from),
|
||||
|
|
|
@ -11,7 +11,6 @@ use dom::bindings::js::{MutNullableJS, Root, RootedReference};
|
|||
use dom::bindings::reflector::reflect_dom_object;
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::storage::Storage;
|
||||
use dom::window::Window;
|
||||
use servo_atoms::Atom;
|
||||
|
@ -50,7 +49,7 @@ impl StorageEvent {
|
|||
StorageEventBinding::Wrap)
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalScope,
|
||||
pub fn new(global: &Window,
|
||||
type_: Atom,
|
||||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable,
|
||||
|
@ -70,7 +69,7 @@ impl StorageEvent {
|
|||
ev
|
||||
}
|
||||
|
||||
pub fn Constructor(global: &GlobalScope,
|
||||
pub fn Constructor(global: &Window,
|
||||
type_: DOMString,
|
||||
init: &StorageEventBinding::StorageEventInit) -> Fallible<Root<StorageEvent>> {
|
||||
let key = init.key.clone();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
[Exposed=Window]
|
||||
interface Storage {
|
||||
|
||||
readonly attribute unsigned long length;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* Event sent to a window when a storage area changes.
|
||||
*/
|
||||
|
||||
[Constructor(DOMString type, optional StorageEventInit eventInitDict), Exposed=(Window,Worker)]
|
||||
[Constructor(DOMString type, optional StorageEventInit eventInitDict), Exposed=Window]
|
||||
interface StorageEvent : Event {
|
||||
readonly attribute DOMString? key;
|
||||
readonly attribute DOMString? oldValue;
|
||||
|
|
|
@ -469,12 +469,12 @@ impl WindowMethods for Window {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-sessionstorage
|
||||
fn SessionStorage(&self) -> Root<Storage> {
|
||||
self.session_storage.or_init(|| Storage::new(self.upcast(), StorageType::Session))
|
||||
self.session_storage.or_init(|| Storage::new(self, StorageType::Session))
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-localstorage
|
||||
fn LocalStorage(&self) -> Root<Storage> {
|
||||
self.local_storage.or_init(|| Storage::new(self.upcast(), StorageType::Local))
|
||||
self.local_storage.or_init(|| Storage::new(self, StorageType::Local))
|
||||
}
|
||||
|
||||
// https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#dfn-GlobalCrypto
|
||||
|
|
|
@ -25645,7 +25645,7 @@
|
|||
"support"
|
||||
],
|
||||
"mozilla/interfaces.worker.js": [
|
||||
"3fbec39bafa473f0eeb7af3461f38151856bf362",
|
||||
"9b3a3c96ec539bb323a0def92c747996deaa7331",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/iterable.html": [
|
||||
|
|
|
@ -37,8 +37,6 @@ test_interfaces([
|
|||
"ProgressEvent",
|
||||
"Request",
|
||||
"Response",
|
||||
"Storage",
|
||||
"StorageEvent",
|
||||
"TextDecoder",
|
||||
"TextEncoder",
|
||||
"URL",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue