aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/devtools.rs
diff options
context:
space:
mode:
authorKamil Niski <kamil.niski@gmail.com>2019-05-04 11:27:21 +0200
committerKamil Niski <kamil.niski@gmail.com>2019-06-29 19:23:17 +0200
commitadb402487e7f8bf2cd0a1db360b16592f5c654ed (patch)
treecd04a40769e20f2a2c63c5eff914dedc4c745e62 /components/script/devtools.rs
parent84786add227f2c0a675f4bcca708ac8a70011f6c (diff)
downloadservo-adb402487e7f8bf2cd0a1db360b16592f5c654ed.tar.gz
servo-adb402487e7f8bf2cd0a1db360b16592f5c654ed.zip
Create a helper API for entering a DOM object's compartment
Revert some unnecessary changes Fix fmt errors
Diffstat (limited to 'components/script/devtools.rs')
-rw-r--r--components/script/devtools.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/components/script/devtools.rs b/components/script/devtools.rs
index 33a30cfe5db..5a0e1c9090c 100644
--- a/components/script/devtools.rs
+++ b/components/script/devtools.rs
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use crate::compartments::enter_realm;
use crate::dom::bindings::codegen::Bindings::CSSStyleDeclarationBinding::CSSStyleDeclarationMethods;
use crate::dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods;
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
@@ -9,7 +10,6 @@ use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use crate::dom::bindings::conversions::{jsstring_to_str, ConversionResult, FromJSValConvertible};
use crate::dom::bindings::inheritance::Castable;
-use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::document::AnimationFrameCallback;
@@ -23,7 +23,6 @@ use devtools_traits::{AutoMargins, CachedConsoleMessage, CachedConsoleMessageTyp
use devtools_traits::{ComputedNodeLayout, ConsoleAPI, PageError};
use devtools_traits::{EvaluateJSReply, Modification, NodeInfo, TimelineMarker};
use ipc_channel::ipc::IpcSender;
-use js::jsapi::JSAutoRealm;
use js::jsval::UndefinedValue;
use js::rust::wrappers::ObjectClassName;
use msg::constellation_msg::PipelineId;
@@ -36,8 +35,7 @@ pub fn handle_evaluate_js(global: &GlobalScope, eval: String, reply: IpcSender<E
// global.get_cx() returns a valid `JSContext` pointer, so this is safe.
let result = unsafe {
let cx = global.get_cx();
- let globalhandle = global.reflector().get_jsobject();
- let _ac = JSAutoRealm::new(cx, globalhandle.get());
+ let _ac = enter_realm(global);
rooted!(in(cx) let mut rval = UndefinedValue());
global.evaluate_js_on_global_with_result(&eval, rval.handle_mut());