Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Auto merge of #20246 - marmistrz:test-lifetime-handles, r=jdm
Use higher level handles from JS bindings

…reak servo

<!-- Please describe your changes on the following line: -->

---
<!-- 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 servo/rust-mozjs#153

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because this is just migration to a lifetimed API
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20246)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Mar 28, 2018
2 parents 12d82fe + 356c57e commit 9149524
Show file tree
Hide file tree
Showing 48 changed files with 403 additions and 307 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Expand Up @@ -19,7 +19,6 @@ opt-level = 3
# lto = false

[patch.crates-io]

# If you need to temporarily test Servo with a local fork of some upstream
# crate, add that here. Use the form:
#
Expand Down
2 changes: 1 addition & 1 deletion components/domobject_derive/lib.rs
Expand Up @@ -40,7 +40,7 @@ fn expand_dom_object(input: syn::DeriveInput) -> quote::Tokens {
#[allow(unsafe_code)]
unsafe fn to_jsval(&self,
cx: *mut ::js::jsapi::JSContext,
rval: ::js::jsapi::MutableHandleValue) {
rval: ::js::rust::MutableHandleValue) {
let object = ::dom::bindings::reflector::DomObject::reflector(self).get_jsobject();
object.to_jsval(cx, rval)
}
Expand Down
2 changes: 1 addition & 1 deletion components/malloc_size_of/Cargo.toml
Expand Up @@ -23,7 +23,7 @@ app_units = "0.6"
cssparser = "0.23.0"
euclid = "0.17"
hashglobe = { path = "../hashglobe" }
mozjs = { version = "0.5.0", features = ["promises"], optional = true }
mozjs = { version = "0.6", features = ["promises"], optional = true }
selectors = { path = "../selectors" }
serde_bytes = { version = "0.10", optional = true }
servo_arc = { path = "../servo_arc" }
Expand Down
2 changes: 1 addition & 1 deletion components/script/Cargo.toml
Expand Up @@ -63,7 +63,7 @@ metrics = {path = "../metrics"}
mitochondria = "1.1.2"
mime = "0.2.1"
mime_guess = "1.8.0"
mozjs = { version = "0.5.0", features = ["promises"]}
mozjs = { version = "0.6", features = ["promises"]}
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
num-traits = "0.1.32"
Expand Down
4 changes: 2 additions & 2 deletions components/script/body.rs
Expand Up @@ -16,11 +16,11 @@ use js::jsapi::Heap;
use js::jsapi::JSContext;
use js::jsapi::JSObject;
use js::jsapi::JS_ClearPendingException;
use js::jsapi::JS_GetPendingException;
use js::jsapi::JS_ParseJSON;
use js::jsapi::Value as JSValue;
use js::jsval::JSVal;
use js::jsval::UndefinedValue;
use js::rust::wrappers::JS_GetPendingException;
use js::rust::wrappers::JS_ParseJSON;
use js::typedarray::{ArrayBuffer, CreateWith};
use mime::{Mime, TopLevel, SubLevel};
use std::cell::Ref;
Expand Down
3 changes: 2 additions & 1 deletion components/script/devtools.rs
Expand Up @@ -22,8 +22,9 @@ use dom::globalscope::GlobalScope;
use dom::node::{Node, window_from_node};
use dom::window::Window;
use ipc_channel::ipc::IpcSender;
use js::jsapi::{JSAutoCompartment, ObjectClassName};
use js::jsapi::JSAutoCompartment;
use js::jsval::UndefinedValue;
use js::rust::wrappers::ObjectClassName;
use msg::constellation_msg::PipelineId;
use script_thread::Documents;
use std::ffi::CStr;
Expand Down
10 changes: 5 additions & 5 deletions components/script/dom/bindings/callback.rs
Expand Up @@ -10,13 +10,13 @@ use dom::bindings::root::{Dom, DomRoot};
use dom::bindings::settings_stack::{AutoEntryScript, AutoIncumbentScript};
use dom::bindings::utils::AsCCharPtrPtr;
use dom::globalscope::GlobalScope;
use js::jsapi::{Heap, MutableHandleObject};
use js::jsapi::{IsCallable, JSContext, JSObject, JS_WrapObject, AddRawValueRoot};
use js::jsapi::{IsCallable, JSContext, JSObject, AddRawValueRoot};
use js::jsapi::{JSCompartment, JS_EnterCompartment, JS_LeaveCompartment, RemoveRawValueRoot};
use js::jsapi::Heap;
use js::jsapi::JSAutoCompartment;
use js::jsapi::JS_GetProperty;
use js::jsval::{JSVal, UndefinedValue, ObjectValue};
use js::rust::Runtime;
use js::rust::{MutableHandleObject, Runtime};
use js::rust::wrappers::{JS_WrapObject, JS_GetProperty};
use std::default::Default;
use std::ffi::CString;
use std::mem::drop;
Expand Down Expand Up @@ -206,7 +206,7 @@ impl CallbackInterface {
/// Wraps the reflector for `p` into the compartment of `cx`.
pub fn wrap_call_this_object<T: DomObject>(cx: *mut JSContext,
p: &T,
rval: MutableHandleObject) {
mut rval: MutableHandleObject) {
rval.set(p.reflector().get_jsobject().get());
assert!(!rval.get().is_null());

Expand Down

0 comments on commit 9149524

Please sign in to comment.