aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2016-05-30 14:35:25 +0200
committerMs2ger <Ms2ger@gmail.com>2016-05-30 16:33:31 +0200
commitb6a7895396733426e7525a7294472b01def87ccb (patch)
tree3df1bfb832c061cd72ebf941488fde6028500be4 /components/script/script_thread.rs
parentef265b1c0bd0ad42ef6ea8588a9c3b3782308129 (diff)
downloadservo-b6a7895396733426e7525a7294472b01def87ccb.tar.gz
servo-b6a7895396733426e7525a7294472b01def87ccb.zip
Add a missing JSAutoCompartment to javascript url handling.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 9ee604ba2e7..a1e563d23d1 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -30,6 +30,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableHeap, Root, RootCollection};
use dom::bindings::js::{RootCollectionPtr, RootedReference};
use dom::bindings::refcounted::{LiveDOMReferences, Trusted};
+use dom::bindings::reflector::Reflectable;
use dom::bindings::str::DOMString;
use dom::bindings::trace::JSTraceable;
use dom::bindings::utils::WRAP_CALLBACKS;
@@ -54,7 +55,8 @@ use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use js::glue::GetWindowProxyClass;
use js::jsapi::{DOMProxyShadowsResult, HandleId, HandleObject, RootedValue};
-use js::jsapi::{JSContext, JS_SetWrapObjectCallbacks, JSTracer, SetWindowProxyClass};
+use js::jsapi::{JSAutoCompartment, JSContext, JS_SetWrapObjectCallbacks};
+use js::jsapi::{JSTracer, SetWindowProxyClass};
use js::jsval::UndefinedValue;
use js::rust::Runtime;
use layout_interface::{self, NewLayoutThreadInfo, ReflowQueryType};
@@ -1599,6 +1601,7 @@ impl ScriptThread {
// Script source is ready to be evaluated (11.)
unsafe {
+ let _ac = JSAutoCompartment::new(self.get_cx(), window.reflector().get_jsobject().get());
let mut jsval = RootedValue::new(self.get_cx(), UndefinedValue());
window.evaluate_js_on_global_with_result(&script_source, jsval.handle_mut());
let strval = DOMString::from_jsval(self.get_cx(),