mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement Window.sessionStorage: Storage Task, Storage Methods (excluding Storage event, QuotaExceededError)
This commit is contained in:
parent
68c90e2797
commit
f6fb9f862d
31 changed files with 347 additions and 109 deletions
|
@ -20,6 +20,7 @@ use dom::location::Location;
|
|||
use dom::navigator::Navigator;
|
||||
use dom::performance::Performance;
|
||||
use dom::screen::Screen;
|
||||
use dom::storage::Storage;
|
||||
use layout_interface::NoQuery;
|
||||
use page::Page;
|
||||
use script_task::{ExitWindowMsg, ScriptChan, TriggerLoadMsg, TriggerFragmentMsg};
|
||||
|
@ -30,6 +31,7 @@ use timers::{Interval, NonInterval, TimerId, TimerManager};
|
|||
use servo_msg::compositor_msg::ScriptListener;
|
||||
use servo_msg::constellation_msg::LoadData;
|
||||
use servo_net::image_cache_task::ImageCacheTask;
|
||||
use servo_net::storage_task::StorageTask;
|
||||
use servo_util::str::{DOMString,HTML_SPACE_CHARACTERS};
|
||||
|
||||
use js::jsapi::JS_EvaluateUCScript;
|
||||
|
@ -62,6 +64,7 @@ pub struct Window {
|
|||
navigation_start: u64,
|
||||
navigation_start_precise: f64,
|
||||
screen: MutNullableJS<Screen>,
|
||||
session_storage: MutNullableJS<Storage>,
|
||||
timers: TimerManager
|
||||
}
|
||||
|
||||
|
@ -106,6 +109,10 @@ impl Window {
|
|||
pub fn get_url(&self) -> Url {
|
||||
self.page().get_url()
|
||||
}
|
||||
|
||||
pub fn storage_task(&self) -> StorageTask {
|
||||
self.page().storage_task.clone()
|
||||
}
|
||||
}
|
||||
|
||||
// http://www.whatwg.org/html/#atob
|
||||
|
@ -208,6 +215,14 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
self.location.get().unwrap()
|
||||
}
|
||||
|
||||
fn SessionStorage(self) -> Temporary<Storage> {
|
||||
if self.session_storage.get().is_none() {
|
||||
let session_storage = Storage::new(&global::Window(self));
|
||||
self.session_storage.assign(Some(session_storage));
|
||||
}
|
||||
self.session_storage.get().unwrap()
|
||||
}
|
||||
|
||||
fn Console(self) -> Temporary<Console> {
|
||||
if self.console.get().is_none() {
|
||||
let console = Console::new(global::Window(self));
|
||||
|
@ -412,6 +427,7 @@ impl Window {
|
|||
navigation_start: time::get_time().sec as u64,
|
||||
navigation_start_precise: time::precise_time_s(),
|
||||
screen: Default::default(),
|
||||
session_storage: Default::default(),
|
||||
timers: TimerManager::new()
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue