diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-05-27 08:49:43 -0500 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-05-27 08:49:43 -0500 |
commit | 3ab5c075595f6bffe3062e26d91f4837fedbf19c (patch) | |
tree | b95c3466c90acb03f576d323226384fd6df4cdeb /components/script | |
parent | 922aef9dd6c121ac4baf338ce92009b8d3b9db66 (diff) | |
parent | 283fc8dd25e32fee83f8a682dd94d34dcb33bf68 (diff) | |
download | servo-3ab5c075595f6bffe3062e26d91f4837fedbf19c.tar.gz servo-3ab5c075595f6bffe3062e26d91f4837fedbf19c.zip |
Auto merge of #11462 - Manishearth:devtools-fixes, r=Ms2ger
devtools: fix segfault, remove println
This fixes the segfault from #11457 by adding an autocompartment.
It also removes the print statements which clog the command line and replaces
them with `debug!()`
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #11457 (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because we don't have full-server
devtools tests
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11462)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/devtools.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/components/script/devtools.rs b/components/script/devtools.rs index e818b0c0ca0..8f783126a62 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -21,7 +21,7 @@ use dom::element::Element; use dom::node::Node; use dom::window::Window; use ipc_channel::ipc::IpcSender; -use js::jsapi::{ObjectClassName, RootedObject, RootedValue}; +use js::jsapi::{JSAutoCompartment, ObjectClassName, RootedObject, RootedValue}; use js::jsval::UndefinedValue; use msg::constellation_msg::PipelineId; use script_thread::get_browsing_context; @@ -35,6 +35,8 @@ pub fn handle_evaluate_js(global: &GlobalRef, eval: String, reply: IpcSender<Eva // 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 = JSAutoCompartment::new(cx, globalhandle.get()); let mut rval = RootedValue::new(cx, UndefinedValue()); global.evaluate_js_on_global_with_result(&eval, rval.handle_mut()); |