mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Replace NonNullJSObjectPtr with std::ptr::NonNull<JSObject>
This commit is contained in:
parent
897a5b39c5
commit
52eda6082f
22 changed files with 79 additions and 111 deletions
|
@ -34,7 +34,6 @@
|
|||
|
||||
use dom::bindings::error::{Error, Fallible};
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::nonnull::NonNullJSObjectPtr;
|
||||
use dom::bindings::num::Finite;
|
||||
use dom::bindings::reflector::{DomObject, Reflector};
|
||||
use dom::bindings::root::DomRoot;
|
||||
|
@ -54,7 +53,7 @@ use js::jsapi::{JS_GetLatin1StringCharsAndLength, JS_GetProperty, JS_GetReserved
|
|||
use js::jsapi::{JS_GetTwoByteStringCharsAndLength, JS_IsArrayObject, JS_IsExceptionPending};
|
||||
use js::jsapi::{JS_NewStringCopyN, JS_StringHasLatin1Chars, MutableHandleValue};
|
||||
use js::jsval::{ObjectValue, StringValue, UndefinedValue};
|
||||
use js::rust::{ToString, get_object_class, is_dom_class, is_dom_object, maybe_wrap_value, maybe_wrap_object_value};
|
||||
use js::rust::{ToString, get_object_class, is_dom_class, is_dom_object, maybe_wrap_value};
|
||||
use libc;
|
||||
use num_traits::Float;
|
||||
use servo_config::opts;
|
||||
|
@ -71,15 +70,6 @@ pub trait IDLInterface {
|
|||
rustc_on_unimplemented = "The IDL interface `{Self}` is not derived from `{T}`.")]
|
||||
pub trait DerivedFrom<T: Castable>: Castable {}
|
||||
|
||||
// https://heycam.github.io/webidl/#es-object
|
||||
impl ToJSValConvertible for NonNullJSObjectPtr {
|
||||
#[inline]
|
||||
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
|
||||
rval.set(ObjectValue(self.get()));
|
||||
maybe_wrap_object_value(cx, rval);
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Float + ToJSValConvertible> ToJSValConvertible for Finite<T> {
|
||||
#[inline]
|
||||
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue