Use Page::window_for_script_deallocation in ScriptMemoryFailsafe

Also: Rename window_for_script_dealloation to window_for_script_deallocation
This commit is contained in:
josiahdaniels 2015-04-12 17:38:38 -04:00
parent b019df8927
commit 5e90299450
2 changed files with 3 additions and 3 deletions

View file

@ -76,7 +76,7 @@ impl Page {
Temporary::new(self.frame.borrow().as_ref().unwrap().window.clone()) Temporary::new(self.frame.borrow().as_ref().unwrap().window.clone())
} }
pub fn window_for_script_dealloation(&self) -> Unrooted<Window> { pub fn window_for_script_deallocation(&self) -> Unrooted<Window> {
Unrooted::from_js(self.frame.borrow().as_ref().unwrap().window) Unrooted::from_js(self.frame.borrow().as_ref().unwrap().window)
} }

View file

@ -25,7 +25,7 @@ use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, HTMLIFr
use dom::bindings::conversions::FromJSValConvertible; use dom::bindings::conversions::FromJSValConvertible;
use dom::bindings::conversions::StringificationBehavior; use dom::bindings::conversions::StringificationBehavior;
use dom::bindings::js::{JS, JSRef, Temporary, OptionalRootable, RootedReference}; use dom::bindings::js::{JS, JSRef, Temporary, OptionalRootable, RootedReference};
use dom::bindings::js::{RootCollection, RootCollectionPtr, Unrooted}; use dom::bindings::js::{RootCollection, RootCollectionPtr};
use dom::bindings::refcounted::{LiveDOMReferences, Trusted, TrustedReference}; use dom::bindings::refcounted::{LiveDOMReferences, Trusted, TrustedReference};
use dom::bindings::structuredclone::StructuredCloneData; use dom::bindings::structuredclone::StructuredCloneData;
use dom::bindings::trace::{JSTraceable, trace_collections}; use dom::bindings::trace::{JSTraceable, trace_collections};
@ -317,7 +317,7 @@ impl<'a> Drop for ScriptMemoryFailsafe<'a> {
unsafe { unsafe {
let page = owner.page.borrow_for_script_deallocation(); let page = owner.page.borrow_for_script_deallocation();
for page in page.iter() { for page in page.iter() {
let window = Unrooted::from_temporary(page.window()); let window = page.window_for_script_deallocation();
(*window.unsafe_get()).clear_js_context_for_script_deallocation(); (*window.unsafe_get()).clear_js_context_for_script_deallocation();
} }
*owner.js_context.borrow_for_script_deallocation() = None; *owner.js_context.borrow_for_script_deallocation() = None;