aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-01-22 12:42:05 +0100
committerSimon Sapin <simon.sapin@exyr.org>2018-01-22 17:41:25 +0100
commit52eda6082fd32d3e28f3600858afd8f5bbc918fe (patch)
treee4318bad96b0c58beec18a2ece26d114b620c8f3
parent897a5b39c5d843cf0920870e8b4a01a84df236fc (diff)
downloadservo-52eda6082fd32d3e28f3600858afd8f5bbc918fe.tar.gz
servo-52eda6082fd32d3e28f3600858afd8f5bbc918fe.zip
Replace NonNullJSObjectPtr with std::ptr::NonNull<JSObject>
-rw-r--r--Cargo.lock8
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py6
-rw-r--r--components/script/dom/bindings/conversions.rs12
-rw-r--r--components/script/dom/bindings/iterable.rs6
-rw-r--r--components/script/dom/bindings/mod.rs1
-rw-r--r--components/script/dom/bindings/nonnull.rs24
-rw-r--r--components/script/dom/crypto.rs6
-rw-r--r--components/script/dom/document.rs10
-rw-r--r--components/script/dom/gamepad.rs6
-rw-r--r--components/script/dom/imagedata.rs6
-rw-r--r--components/script/dom/testbinding.rs16
-rw-r--r--components/script/dom/textencoder.rs6
-rw-r--r--components/script/dom/vreyeparameters.rs6
-rw-r--r--components/script/dom/vrframedata.rs18
-rw-r--r--components/script/dom/vrpose.rs18
-rw-r--r--components/script/dom/vrstageparameters.rs6
-rw-r--r--components/script/dom/webgl2renderingcontext.rs4
-rw-r--r--components/script/dom/webgl_extensions/extensions.rs5
-rw-r--r--components/script/dom/webgl_extensions/wrapper.rs9
-rw-r--r--components/script/dom/webglrenderingcontext.rs4
-rw-r--r--components/script/dom/xmldocument.rs5
-rw-r--r--components/script/dom/xmlhttprequest.rs8
22 files changed, 79 insertions, 111 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 8918a3cc89e..c6df3be6f7d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1617,7 +1617,7 @@ dependencies = [
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hashglobe 0.1.0",
- "mozjs 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "mozjs 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.19.0",
"servo_arc 0.1.0",
"smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1778,7 +1778,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "mozjs"
-version = "0.1.10"
+version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2434,7 +2434,7 @@ dependencies = [
"mime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "mozjs 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "mozjs 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"net_traits 0.0.1",
"nonzero 0.0.1",
@@ -3704,7 +3704,7 @@ dependencies = [
"checksum mio 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9e965267d4d58496fc4f740e9861118367f13570cadf66316ed2c3f2f14d87c7"
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
"checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f"
-"checksum mozjs 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd8370617e9a151ed9e7b49f38092075d0ae80bdf9f1dcd807a60cc9c3b7151"
+"checksum mozjs 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "199f707066bf05b559ef6e46741c20e4f7bca8ae3a9c9d953d728dbb840f4eaa"
"checksum mozjs_sys 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef1e24df9f76502cd4459919098ec1ac3af75ce694ec5b8837aa91f69f2ad0eb"
"checksum mp3-metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ab5f1d2693586420208d1200ce5a51cd44726f055b635176188137aff42c7de"
"checksum mp4parse 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f821e3799bc0fd16d9b861fb02fa7ee1b5fba29f45ad591dade105c48ca9a1a0"
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 4a377aa351f..92f6b3a71b6 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -1422,7 +1422,7 @@ def getRetvalDeclarationForType(returnType, descriptorProvider):
if returnType.isAny():
return CGGeneric("JSVal")
if returnType.isObject() or returnType.isSpiderMonkeyInterface():
- result = CGGeneric("NonNullJSObjectPtr")
+ result = CGGeneric("NonNull<JSObject>")
if returnType.nullable():
result = CGWrapper(result, pre="Option<", post=">")
return result
@@ -2268,7 +2268,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, typedefs, config):
'dom::bindings::conversions::StringificationBehavior',
'dom::bindings::conversions::root_from_handlevalue',
'dom::bindings::error::throw_not_in_union',
- 'dom::bindings::nonnull::NonNullJSObjectPtr',
+ 'std::ptr::NonNull',
'dom::bindings::mozmap::MozMap',
'dom::bindings::root::DomRoot',
'dom::bindings::str::ByteString',
@@ -5811,7 +5811,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'dom::bindings::proxyhandler::get_expando_object',
'dom::bindings::proxyhandler::get_property_descriptor',
'dom::bindings::mozmap::MozMap',
- 'dom::bindings::nonnull::NonNullJSObjectPtr',
+ 'std::ptr::NonNull',
'dom::bindings::num::Finite',
'dom::bindings::str::ByteString',
'dom::bindings::str::DOMString',
diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs
index 68318c53d70..e40a1d7092b 100644
--- a/components/script/dom/bindings/conversions.rs
+++ b/components/script/dom/bindings/conversions.rs
@@ -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) {
diff --git a/components/script/dom/bindings/iterable.rs b/components/script/dom/bindings/iterable.rs
index 36cef24d4bd..0228e31caae 100644
--- a/components/script/dom/bindings/iterable.rs
+++ b/components/script/dom/bindings/iterable.rs
@@ -9,7 +9,6 @@
use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyAndValueResult;
use dom::bindings::codegen::Bindings::IterableIteratorBinding::IterableKeyOrValueResult;
use dom::bindings::error::Fallible;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::{Dom, DomRoot};
use dom::bindings::trace::JSTraceable;
@@ -20,6 +19,7 @@ use js::jsapi::{HandleValue, Heap, JSContext, MutableHandleObject, JSObject};
use js::jsval::UndefinedValue;
use std::cell::Cell;
use std::ptr;
+use std::ptr::NonNull;
/// The values that an iterator will iterate over.
#[derive(JSTraceable, MallocSizeOf)]
@@ -73,7 +73,7 @@ impl<T: DomObject + JSTraceable + Iterable> IterableIterator<T> {
/// Return the next value from the iterable object.
#[allow(non_snake_case)]
- pub fn Next(&self, cx: *mut JSContext) -> Fallible<NonNullJSObjectPtr> {
+ pub fn Next(&self, cx: *mut JSContext) -> Fallible<NonNull<JSObject>> {
let index = self.index.get();
rooted!(in(cx) let mut value = UndefinedValue());
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
@@ -106,7 +106,7 @@ impl<T: DomObject + JSTraceable + Iterable> IterableIterator<T> {
self.index.set(index + 1);
result.map(|_| {
assert!(!rval.is_null());
- unsafe { NonNullJSObjectPtr::new_unchecked(rval.get()) }
+ unsafe { NonNull::new_unchecked(rval.get()) }
})
}
}
diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs
index 6fdf690588f..8ba3ea72332 100644
--- a/components/script/dom/bindings/mod.rs
+++ b/components/script/dom/bindings/mod.rs
@@ -145,7 +145,6 @@ pub mod interface;
pub mod iterable;
pub mod mozmap;
pub mod namespace;
-pub mod nonnull;
pub mod num;
pub mod proxyhandler;
pub mod refcounted;
diff --git a/components/script/dom/bindings/nonnull.rs b/components/script/dom/bindings/nonnull.rs
deleted file mode 100644
index 36dade7136b..00000000000
--- a/components/script/dom/bindings/nonnull.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//! A wrapper type for `NonZero<*mut JSObject>`, to enable local trait impls
-
-use js::jsapi::JSObject;
-use nonzero::NonZero;
-
-/// A wrapper type for `NonZero<*mut JSObject>`, to enable local trait impls
-#[derive(Clone, Copy)]
-pub struct NonNullJSObjectPtr(NonZero<*mut JSObject>);
-
-impl NonNullJSObjectPtr {
- #[inline]
- pub unsafe fn new_unchecked(ptr: *mut JSObject) -> Self {
- NonNullJSObjectPtr(NonZero::new_unchecked(ptr))
- }
-
- #[inline]
- pub fn get(self) -> *mut JSObject {
- self.0.get()
- }
-}
diff --git a/components/script/dom/crypto.rs b/components/script/dom/crypto.rs
index 1a13194151c..71e67e46b9a 100644
--- a/components/script/dom/crypto.rs
+++ b/components/script/dom/crypto.rs
@@ -6,7 +6,6 @@ use dom::bindings::cell::DomRefCell;
use dom::bindings::codegen::Bindings::CryptoBinding;
use dom::bindings::codegen::Bindings::CryptoBinding::CryptoMethods;
use dom::bindings::error::{Error, Fallible};
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::root::DomRoot;
use dom::globalscope::GlobalScope;
@@ -14,6 +13,7 @@ use dom_struct::dom_struct;
use js::jsapi::{JSContext, JSObject};
use js::jsapi::Type;
use servo_rand::{ServoRng, Rng};
+use std::ptr::NonNull;
unsafe_no_jsmanaged_fields!(ServoRng);
@@ -44,7 +44,7 @@ impl CryptoMethods for Crypto {
unsafe fn GetRandomValues(&self,
_cx: *mut JSContext,
input: *mut JSObject)
- -> Fallible<NonNullJSObjectPtr> {
+ -> Fallible<NonNull<JSObject>> {
assert!(!input.is_null());
typedarray!(in(_cx) let mut array_buffer_view: ArrayBufferView = input);
let (array_type, mut data) = match array_buffer_view.as_mut() {
@@ -65,7 +65,7 @@ impl CryptoMethods for Crypto {
self.rng.borrow_mut().fill_bytes(&mut data);
- Ok(NonNullJSObjectPtr::new_unchecked(input))
+ Ok(NonNull::new_unchecked(input))
}
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index aecc0b0d0e7..a833ac75f58 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -21,7 +21,6 @@ use dom::bindings::codegen::Bindings::WindowBinding::{FrameRequestCallback, Scro
use dom::bindings::codegen::UnionTypes::NodeOrString;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::num::Finite;
use dom::bindings::refcounted::{Trusted, TrustedPromise};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
@@ -96,7 +95,7 @@ use html5ever::{LocalName, Namespace, QualName};
use hyper::header::{Header, SetCookie};
use hyper_serde::Serde;
use ipc_channel::ipc::{self, IpcSender};
-use js::jsapi::{JSContext, JSRuntime};
+use js::jsapi::{JSContext, JSObject, JSRuntime};
use js::jsapi::JS_GetRuntime;
use metrics::{InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory, ProgressiveWebMetric};
use msg::constellation_msg::{BrowsingContextId, Key, KeyModifiers, KeyState, TopLevelBrowsingContextId};
@@ -125,6 +124,7 @@ use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::default::Default;
use std::iter::once;
use std::mem;
+use std::ptr::NonNull;
use std::rc::Rc;
use std::time::{Duration, Instant};
use style::attr::AttrValue;
@@ -3554,7 +3554,7 @@ impl DocumentMethods for Document {
#[allow(unsafe_code)]
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
- unsafe fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString) -> Option<NonNullJSObjectPtr> {
+ unsafe fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString) -> Option<NonNull<JSObject>> {
#[derive(JSTraceable, MallocSizeOf)]
struct NamedElementFilter {
name: Atom,
@@ -3611,7 +3611,7 @@ impl DocumentMethods for Document {
if elements.peek().is_none() {
// TODO: Step 2.
// Step 3.
- return Some(NonNullJSObjectPtr::new_unchecked(first.reflector().get_jsobject().get()));
+ return Some(NonNull::new_unchecked(first.reflector().get_jsobject().get()));
}
} else {
return None;
@@ -3622,7 +3622,7 @@ impl DocumentMethods for Document {
name: name,
};
let collection = HTMLCollection::create(self.window(), root, Box::new(filter));
- Some(NonNullJSObjectPtr::new_unchecked(collection.reflector().get_jsobject().get()))
+ Some(NonNull::new_unchecked(collection.reflector().get_jsobject().get()))
}
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:supported-property-names
diff --git a/components/script/dom/gamepad.rs b/components/script/dom/gamepad.rs
index e5381d5587b..769b1ee548f 100644
--- a/components/script/dom/gamepad.rs
+++ b/components/script/dom/gamepad.rs
@@ -5,7 +5,6 @@
use dom::bindings::codegen::Bindings::GamepadBinding;
use dom::bindings::codegen::Bindings::GamepadBinding::GamepadMethods;
use dom::bindings::inheritance::Castable;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::num::Finite;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::{Dom, DomRoot};
@@ -21,6 +20,7 @@ use js::jsapi::{Heap, JSContext, JSObject};
use js::typedarray::{Float64Array, CreateWith};
use std::cell::Cell;
use std::ptr;
+use std::ptr::NonNull;
use webvr_traits::{WebVRGamepadData, WebVRGamepadHand, WebVRGamepadState};
#[dom_struct]
@@ -131,8 +131,8 @@ impl GamepadMethods for Gamepad {
#[allow(unsafe_code)]
// https://w3c.github.io/gamepad/#dom-gamepad-axes
- unsafe fn Axes(&self, _cx: *mut JSContext) -> NonNullJSObjectPtr {
- NonNullJSObjectPtr::new_unchecked(self.axes.get())
+ unsafe fn Axes(&self, _cx: *mut JSContext) -> NonNull<JSObject> {
+ NonNull::new_unchecked(self.axes.get())
}
// https://w3c.github.io/gamepad/#dom-gamepad-buttons
diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs
index 6be4e5d89c2..9a51c0088d1 100644
--- a/components/script/dom/imagedata.rs
+++ b/components/script/dom/imagedata.rs
@@ -5,7 +5,6 @@
use dom::bindings::codegen::Bindings::ImageDataBinding;
use dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods;
use dom::bindings::error::{Fallible, Error};
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::root::DomRoot;
use dom::globalscope::GlobalScope;
@@ -16,6 +15,7 @@ use js::rust::Runtime;
use js::typedarray::{Uint8ClampedArray, CreateWith};
use std::default::Default;
use std::ptr;
+use std::ptr::NonNull;
use std::vec::Vec;
#[dom_struct]
@@ -159,8 +159,8 @@ impl ImageDataMethods for ImageData {
#[allow(unsafe_code)]
// https://html.spec.whatwg.org/multipage/#dom-imagedata-data
- unsafe fn Data(&self, _: *mut JSContext) -> NonNullJSObjectPtr {
+ unsafe fn Data(&self, _: *mut JSContext) -> NonNull<JSObject> {
assert!(!self.data.get().is_null());
- NonNullJSObjectPtr::new_unchecked(self.data.get())
+ NonNull::new_unchecked(self.data.get())
}
}
diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs
index 6ffe2efefdd..aeaad77eb11 100644
--- a/components/script/dom/testbinding.rs
+++ b/components/script/dom/testbinding.rs
@@ -21,7 +21,6 @@ use dom::bindings::codegen::UnionTypes::{StringOrLongSequence, StringOrStringSeq
use dom::bindings::codegen::UnionTypes::{StringOrUnsignedLong, StringOrBoolean, UnsignedLongOrBoolean};
use dom::bindings::error::{Error, Fallible};
use dom::bindings::mozmap::MozMap;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::num::Finite;
use dom::bindings::refcounted::TrustedPromise;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
@@ -43,6 +42,7 @@ use script_traits::MsDuration;
use servo_config::prefs::PREFS;
use std::borrow::ToOwned;
use std::ptr;
+use std::ptr::NonNull;
use std::rc::Rc;
use timers::OneshotTimerCallback;
@@ -152,20 +152,20 @@ impl TestBindingMethods for TestBinding {
}
fn SetUnion9Attribute(&self, _: ByteStringOrLong) {}
#[allow(unsafe_code)]
- unsafe fn ArrayAttribute(&self, cx: *mut JSContext) -> NonNullJSObjectPtr {
+ unsafe fn ArrayAttribute(&self, cx: *mut JSContext) -> NonNull<JSObject> {
rooted!(in(cx) let array = JS_NewUint8ClampedArray(cx, 16));
assert!(!array.is_null());
- NonNullJSObjectPtr::new_unchecked(array.get())
+ NonNull::new_unchecked(array.get())
}
#[allow(unsafe_code)]
unsafe fn AnyAttribute(&self, _: *mut JSContext) -> JSVal { NullValue() }
#[allow(unsafe_code)]
unsafe fn SetAnyAttribute(&self, _: *mut JSContext, _: HandleValue) {}
#[allow(unsafe_code)]
- unsafe fn ObjectAttribute(&self, cx: *mut JSContext) -> NonNullJSObjectPtr {
+ unsafe fn ObjectAttribute(&self, cx: *mut JSContext) -> NonNull<JSObject> {
rooted!(in(cx) let obj = JS_NewPlainObject(cx));
assert!(!obj.is_null());
- NonNullJSObjectPtr::new_unchecked(obj.get())
+ NonNull::new_unchecked(obj.get())
}
#[allow(unsafe_code)]
unsafe fn SetObjectAttribute(&self, _: *mut JSContext, _: *mut JSObject) {}
@@ -221,7 +221,7 @@ impl TestBindingMethods for TestBinding {
self.url.set(url);
}
#[allow(unsafe_code)]
- unsafe fn GetObjectAttributeNullable(&self, _: *mut JSContext) -> Option<NonNullJSObjectPtr> { None }
+ unsafe fn GetObjectAttributeNullable(&self, _: *mut JSContext) -> Option<NonNull<JSObject>> { None }
#[allow(unsafe_code)]
unsafe fn SetObjectAttributeNullable(&self, _: *mut JSContext, _: *mut JSObject) {}
fn GetUnionAttributeNullable(&self) -> Option<HTMLElementOrLong> {
@@ -273,7 +273,7 @@ impl TestBindingMethods for TestBinding {
#[allow(unsafe_code)]
unsafe fn ReceiveAny(&self, _: *mut JSContext) -> JSVal { NullValue() }
#[allow(unsafe_code)]
- unsafe fn ReceiveObject(&self, cx: *mut JSContext) -> NonNullJSObjectPtr {
+ unsafe fn ReceiveObject(&self, cx: *mut JSContext) -> NonNull<JSObject> {
self.ObjectAttribute(cx)
}
fn ReceiveUnion(&self) -> HTMLElementOrLong { HTMLElementOrLong::Long(0) }
@@ -317,7 +317,7 @@ impl TestBindingMethods for TestBinding {
Some(Blob::new(&self.global(), BlobImpl::new_from_bytes(vec![]), "".to_owned()))
}
#[allow(unsafe_code)]
- unsafe fn ReceiveNullableObject(&self, cx: *mut JSContext) -> Option<NonNullJSObjectPtr> {
+ unsafe fn ReceiveNullableObject(&self, cx: *mut JSContext) -> Option<NonNull<JSObject>> {
self.GetObjectAttributeNullable(cx)
}
fn ReceiveNullableUnion(&self) -> Option<HTMLElementOrLong> {
diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs
index 8fb97ac9e78..cc0eae4e5a2 100644
--- a/components/script/dom/textencoder.rs
+++ b/components/script/dom/textencoder.rs
@@ -5,7 +5,6 @@
use dom::bindings::codegen::Bindings::TextEncoderBinding;
use dom::bindings::codegen::Bindings::TextEncoderBinding::TextEncoderMethods;
use dom::bindings::error::Fallible;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::root::DomRoot;
use dom::bindings::str::{DOMString, USVString};
@@ -14,6 +13,7 @@ use dom_struct::dom_struct;
use js::jsapi::{JSContext, JSObject};
use js::typedarray::{Uint8Array, CreateWith};
use std::ptr;
+use std::ptr::NonNull;
#[dom_struct]
pub struct TextEncoder {
@@ -47,12 +47,12 @@ impl TextEncoderMethods for TextEncoder {
#[allow(unsafe_code)]
// https://encoding.spec.whatwg.org/#dom-textencoder-encode
- unsafe fn Encode(&self, cx: *mut JSContext, input: USVString) -> NonNullJSObjectPtr {
+ unsafe fn Encode(&self, cx: *mut JSContext, input: USVString) -> NonNull<JSObject> {
let encoded = input.0.as_bytes();
rooted!(in(cx) let mut js_object = ptr::null_mut::<JSObject>());
assert!(Uint8Array::create(cx, CreateWith::Slice(&encoded), js_object.handle_mut()).is_ok());
- NonNullJSObjectPtr::new_unchecked(js_object.get())
+ NonNull::new_unchecked(js_object.get())
}
}
diff --git a/components/script/dom/vreyeparameters.rs b/components/script/dom/vreyeparameters.rs
index 496277ba65d..333c717f06b 100644
--- a/components/script/dom/vreyeparameters.rs
+++ b/components/script/dom/vreyeparameters.rs
@@ -5,7 +5,6 @@
use dom::bindings::cell::DomRefCell;
use dom::bindings::codegen::Bindings::VREyeParametersBinding;
use dom::bindings::codegen::Bindings::VREyeParametersBinding::VREyeParametersMethods;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::root::{Dom, DomRoot};
use dom::globalscope::GlobalScope;
@@ -15,6 +14,7 @@ use js::jsapi::{Heap, JSContext, JSObject};
use js::typedarray::{Float32Array, CreateWith};
use std::default::Default;
use std::ptr;
+use std::ptr::NonNull;
use webvr_traits::WebVREyeParameters;
#[dom_struct]
@@ -60,8 +60,8 @@ impl VREyeParameters {
impl VREyeParametersMethods for VREyeParameters {
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vreyeparameters-offset
- unsafe fn Offset(&self, _cx: *mut JSContext) -> NonNullJSObjectPtr {
- NonNullJSObjectPtr::new_unchecked(self.offset.get())
+ unsafe fn Offset(&self, _cx: *mut JSContext) -> NonNull<JSObject> {
+ NonNull::new_unchecked(self.offset.get())
}
// https://w3c.github.io/webvr/#dom-vreyeparameters-fieldofview
diff --git a/components/script/dom/vrframedata.rs b/components/script/dom/vrframedata.rs
index 530a3727020..621f70a55c9 100644
--- a/components/script/dom/vrframedata.rs
+++ b/components/script/dom/vrframedata.rs
@@ -5,7 +5,6 @@
use dom::bindings::codegen::Bindings::VRFrameDataBinding;
use dom::bindings::codegen::Bindings::VRFrameDataBinding::VRFrameDataMethods;
use dom::bindings::error::Fallible;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::num::Finite;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::{Dom, DomRoot};
@@ -17,6 +16,7 @@ use js::jsapi::{Heap, JSContext, JSObject};
use js::typedarray::{Float32Array, CreateWith};
use std::cell::Cell;
use std::ptr;
+use std::ptr::NonNull;
use webvr_traits::WebVRFrameData;
#[dom_struct]
@@ -118,26 +118,26 @@ impl VRFrameDataMethods for VRFrameData {
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrframedata-leftprojectionmatrix
- unsafe fn LeftProjectionMatrix(&self, _cx: *mut JSContext) -> NonNullJSObjectPtr {
- NonNullJSObjectPtr::new_unchecked(self.left_proj.get())
+ unsafe fn LeftProjectionMatrix(&self, _cx: *mut JSContext) -> NonNull<JSObject> {
+ NonNull::new_unchecked(self.left_proj.get())
}
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrframedata-leftviewmatrix
- unsafe fn LeftViewMatrix(&self, _cx: *mut JSContext) -> NonNullJSObjectPtr {
- NonNullJSObjectPtr::new_unchecked(self.left_view.get())
+ unsafe fn LeftViewMatrix(&self, _cx: *mut JSContext) -> NonNull<JSObject> {
+ NonNull::new_unchecked(self.left_view.get())
}
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrframedata-rightprojectionmatrix
- unsafe fn RightProjectionMatrix(&self, _cx: *mut JSContext) -> NonNullJSObjectPtr {
- NonNullJSObjectPtr::new_unchecked(self.right_proj.get())
+ unsafe fn RightProjectionMatrix(&self, _cx: *mut JSContext) -> NonNull<JSObject> {
+ NonNull::new_unchecked(self.right_proj.get())
}
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrframedata-rightviewmatrix
- unsafe fn RightViewMatrix(&self, _cx: *mut JSContext) -> NonNullJSObjectPtr {
- NonNullJSObjectPtr::new_unchecked(self.right_view.get())
+ unsafe fn RightViewMatrix(&self, _cx: *mut JSContext) -> NonNull<JSObject> {
+ NonNull::new_unchecked(self.right_view.get())
}
// https://w3c.github.io/webvr/#dom-vrframedata-pose
diff --git a/components/script/dom/vrpose.rs b/components/script/dom/vrpose.rs
index a0b3ec7c92a..01778471ccb 100644
--- a/components/script/dom/vrpose.rs
+++ b/components/script/dom/vrpose.rs
@@ -4,7 +4,6 @@
use dom::bindings::codegen::Bindings::VRPoseBinding;
use dom::bindings::codegen::Bindings::VRPoseBinding::VRPoseMethods;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::DomRoot;
use dom::globalscope::GlobalScope;
@@ -12,6 +11,7 @@ use dom_struct::dom_struct;
use js::jsapi::{Heap, JSContext, JSObject};
use js::typedarray::{Float32Array, CreateWith};
use std::ptr;
+use std::ptr::NonNull;
use webvr_traits::webvr;
#[dom_struct]
@@ -52,13 +52,13 @@ unsafe fn update_or_create_typed_array(cx: *mut JSContext,
#[inline]
#[allow(unsafe_code)]
-fn heap_to_option(heap: &Heap<*mut JSObject>) -> Option<NonNullJSObjectPtr> {
+fn heap_to_option(heap: &Heap<*mut JSObject>) -> Option<NonNull<JSObject>> {
let js_object = heap.get();
if js_object.is_null() {
None
} else {
unsafe {
- Some(NonNullJSObjectPtr::new_unchecked(js_object))
+ Some(NonNull::new_unchecked(js_object))
}
}
}
@@ -101,37 +101,37 @@ impl VRPose {
impl VRPoseMethods for VRPose {
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrpose-position
- unsafe fn GetPosition(&self, _cx: *mut JSContext) -> Option<NonNullJSObjectPtr> {
+ unsafe fn GetPosition(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> {
heap_to_option(&self.position)
}
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrpose-linearvelocity
- unsafe fn GetLinearVelocity(&self, _cx: *mut JSContext) -> Option<NonNullJSObjectPtr> {
+ unsafe fn GetLinearVelocity(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> {
heap_to_option(&self.linear_vel)
}
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrpose-linearacceleration
- unsafe fn GetLinearAcceleration(&self, _cx: *mut JSContext) -> Option<NonNullJSObjectPtr> {
+ unsafe fn GetLinearAcceleration(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> {
heap_to_option(&self.linear_acc)
}
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrpose-orientation
- unsafe fn GetOrientation(&self, _cx: *mut JSContext) -> Option<NonNullJSObjectPtr> {
+ unsafe fn GetOrientation(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> {
heap_to_option(&self.orientation)
}
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrpose-angularvelocity
- unsafe fn GetAngularVelocity(&self, _cx: *mut JSContext) -> Option<NonNullJSObjectPtr> {
+ unsafe fn GetAngularVelocity(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> {
heap_to_option(&self.angular_vel)
}
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrpose-angularacceleration
- unsafe fn GetAngularAcceleration(&self, _cx: *mut JSContext) -> Option<NonNullJSObjectPtr> {
+ unsafe fn GetAngularAcceleration(&self, _cx: *mut JSContext) -> Option<NonNull<JSObject>> {
heap_to_option(&self.angular_acc)
}
}
diff --git a/components/script/dom/vrstageparameters.rs b/components/script/dom/vrstageparameters.rs
index 9a34af4c03e..bd4dfa5a3a6 100644
--- a/components/script/dom/vrstageparameters.rs
+++ b/components/script/dom/vrstageparameters.rs
@@ -5,7 +5,6 @@
use dom::bindings::cell::DomRefCell;
use dom::bindings::codegen::Bindings::VRStageParametersBinding;
use dom::bindings::codegen::Bindings::VRStageParametersBinding::VRStageParametersMethods;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::num::Finite;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::DomRoot;
@@ -14,6 +13,7 @@ use dom_struct::dom_struct;
use js::jsapi::{Heap, JSContext, JSObject};
use js::typedarray::{Float32Array, CreateWith};
use std::ptr;
+use std::ptr::NonNull;
use webvr_traits::WebVRStageParameters;
#[dom_struct]
@@ -69,8 +69,8 @@ impl VRStageParameters {
impl VRStageParametersMethods for VRStageParameters {
#[allow(unsafe_code)]
// https://w3c.github.io/webvr/#dom-vrstageparameters-sittingtostandingtransform
- unsafe fn SittingToStandingTransform(&self, _cx: *mut JSContext) -> NonNullJSObjectPtr {
- NonNullJSObjectPtr::new_unchecked(self.transform.get())
+ unsafe fn SittingToStandingTransform(&self, _cx: *mut JSContext) -> NonNull<JSObject> {
+ NonNull::new_unchecked(self.transform.get())
}
// https://w3c.github.io/webvr/#dom-vrstageparameters-sizex
diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs
index 168f1146370..9bf016f9631 100644
--- a/components/script/dom/webgl2renderingcontext.rs
+++ b/components/script/dom/webgl2renderingcontext.rs
@@ -10,7 +10,6 @@ use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContext
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement;
use dom::bindings::error::Fallible;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::reflector::{reflect_dom_object, Reflector};
use dom::bindings::root::{Dom, DomRoot, LayoutDom};
use dom::bindings::str::DOMString;
@@ -33,6 +32,7 @@ use js::jsapi::{JSContext, JSObject};
use js::jsval::JSVal;
use offscreen_gl_context::GLContextAttributes;
use script_layout_interface::HTMLCanvasDataSource;
+use std::ptr::NonNull;
#[dom_struct]
pub struct WebGL2RenderingContext {
@@ -132,7 +132,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
#[allow(unsafe_code)]
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.14
- unsafe fn GetExtension(&self, cx: *mut JSContext, name: DOMString) -> Option<NonNullJSObjectPtr> {
+ unsafe fn GetExtension(&self, cx: *mut JSContext, name: DOMString) -> Option<NonNull<JSObject>> {
self.base.GetExtension(cx, name)
}
diff --git a/components/script/dom/webgl_extensions/extensions.rs b/components/script/dom/webgl_extensions/extensions.rs
index e599df7a25c..3c22817d555 100644
--- a/components/script/dom/webgl_extensions/extensions.rs
+++ b/components/script/dom/webgl_extensions/extensions.rs
@@ -7,19 +7,20 @@ use dom::bindings::cell::DomRefCell;
use dom::bindings::codegen::Bindings::OESStandardDerivativesBinding::OESStandardDerivativesConstants;
use dom::bindings::codegen::Bindings::OESTextureHalfFloatBinding::OESTextureHalfFloatConstants;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::root::DomRoot;
use dom::bindings::trace::JSTraceable;
use dom::webglrenderingcontext::WebGLRenderingContext;
use fnv::{FnvHashMap, FnvHashSet};
use gleam::gl::GLenum;
use js::jsapi::JSContext;
+use js::jsapi::JSObject;
use js::jsval::JSVal;
use malloc_size_of::MallocSizeOf;
use ref_filter_map::ref_filter_map;
use std::cell::Ref;
use std::collections::HashMap;
use std::iter::FromIterator;
+use std::ptr::NonNull;
use super::{ext, WebGLExtension, WebGLExtensionSpec};
use super::wrapper::{WebGLExtensionWrapper, TypedWebGLExtensionWrapper};
@@ -127,7 +128,7 @@ impl WebGLExtensions {
.collect()
}
- pub fn get_or_init_extension(&self, name: &str, ctx: &WebGLRenderingContext) -> Option<NonNullJSObjectPtr> {
+ pub fn get_or_init_extension(&self, name: &str, ctx: &WebGLRenderingContext) -> Option<NonNull<JSObject>> {
let name = name.to_uppercase();
self.extensions.borrow().get(&name).and_then(|extension| {
if extension.is_supported(self) {
diff --git a/components/script/dom/webgl_extensions/wrapper.rs b/components/script/dom/webgl_extensions/wrapper.rs
index 8af48a6d93e..05fb375ffbd 100644
--- a/components/script/dom/webgl_extensions/wrapper.rs
+++ b/components/script/dom/webgl_extensions/wrapper.rs
@@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::reflector::DomObject;
use dom::bindings::root::{DomRoot, MutNullableDom};
use dom::bindings::trace::JSTraceable;
use dom::webglrenderingcontext::WebGLRenderingContext;
+use js::jsapi::JSObject;
use malloc_size_of::MallocSizeOf;
use std::any::Any;
+use std::ptr::NonNull;
use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec};
/// Trait used internally by WebGLExtensions to store and
@@ -17,7 +18,7 @@ pub trait WebGLExtensionWrapper: JSTraceable + MallocSizeOf {
fn instance_or_init(&self,
ctx: &WebGLRenderingContext,
ext: &WebGLExtensions)
- -> NonNullJSObjectPtr;
+ -> NonNull<JSObject>;
fn spec(&self) -> WebGLExtensionSpec;
fn is_supported(&self, &WebGLExtensions) -> bool;
fn is_enabled(&self) -> bool;
@@ -48,7 +49,7 @@ impl<T> WebGLExtensionWrapper for TypedWebGLExtensionWrapper<T>
fn instance_or_init(&self,
ctx: &WebGLRenderingContext,
ext: &WebGLExtensions)
- -> NonNullJSObjectPtr {
+ -> NonNull<JSObject> {
let mut enabled = true;
let extension = self.extension.or_init(|| {
enabled = false;
@@ -58,7 +59,7 @@ impl<T> WebGLExtensionWrapper for TypedWebGLExtensionWrapper<T>
self.enable(ext);
}
unsafe {
- NonNullJSObjectPtr::new_unchecked(extension.reflector().get_jsobject().get())
+ NonNull::new_unchecked(extension.reflector().get_jsobject().get())
}
}
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 21712563e40..61f05a923e8 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -17,7 +17,6 @@ use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasE
use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, ToJSValConvertible};
use dom::bindings::error::{Error, Fallible};
use dom::bindings::inheritance::Castable;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
use dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom};
use dom::bindings::str::DOMString;
@@ -57,6 +56,7 @@ use script_layout_interface::HTMLCanvasDataSource;
use servo_config::prefs::PREFS;
use std::cell::{Cell, Ref};
use std::iter::FromIterator;
+use std::ptr::NonNull;
use webrender_api;
type ImagePixelResult = Result<(Vec<u8>, Size2D<i32>, bool), ()>;
@@ -1389,7 +1389,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
#[allow(unsafe_code)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.14
unsafe fn GetExtension(&self, _cx: *mut JSContext, name: DOMString)
- -> Option<NonNullJSObjectPtr> {
+ -> Option<NonNull<JSObject>> {
self.extension_manager.init_once(|| {
self.get_gl_extensions()
});
diff --git a/components/script/dom/xmldocument.rs b/components/script/dom/xmldocument.rs
index ed67be90900..68764eb1080 100644
--- a/components/script/dom/xmldocument.rs
+++ b/components/script/dom/xmldocument.rs
@@ -6,7 +6,6 @@ use document_loader::DocumentLoader;
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
use dom::bindings::codegen::Bindings::XMLDocumentBinding::{self, XMLDocumentMethods};
use dom::bindings::inheritance::Castable;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::reflector::reflect_dom_object;
use dom::bindings::root::DomRoot;
use dom::bindings::str::DOMString;
@@ -16,8 +15,10 @@ use dom::node::Node;
use dom::window::Window;
use dom_struct::dom_struct;
use js::jsapi::JSContext;
+use js::jsapi::JSObject;
use script_traits::DocumentActivity;
use servo_url::{MutableOrigin, ServoUrl};
+use std::ptr::NonNull;
// https://dom.spec.whatwg.org/#xmldocument
#[dom_struct]
@@ -101,7 +102,7 @@ impl XMLDocumentMethods for XMLDocument {
#[allow(unsafe_code)]
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
- unsafe fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString) -> Option<NonNullJSObjectPtr> {
+ unsafe fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString) -> Option<NonNull<JSObject>> {
self.upcast::<Document>().NamedGetter(_cx, name)
}
}
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 716115307d2..eb4804b2053 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -14,7 +14,6 @@ use dom::bindings::codegen::UnionTypes::DocumentOrBodyInit;
use dom::bindings::conversions::ToJSValConvertible;
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::inheritance::Castable;
-use dom::bindings::nonnull::NonNullJSObjectPtr;
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::root::{Dom, DomRoot, MutNullableDom};
@@ -67,6 +66,7 @@ use std::borrow::ToOwned;
use std::cell::Cell;
use std::default::Default;
use std::ptr;
+use std::ptr::NonNull;
use std::slice;
use std::str;
use std::sync::{Arc, Mutex};
@@ -1120,11 +1120,11 @@ impl XMLHttpRequest {
// https://xhr.spec.whatwg.org/#arraybuffer-response
#[allow(unsafe_code)]
- unsafe fn arraybuffer_response(&self, cx: *mut JSContext) -> Option<NonNullJSObjectPtr> {
+ unsafe fn arraybuffer_response(&self, cx: *mut JSContext) -> Option<NonNull<JSObject>> {
// Step 1
let created = self.response_arraybuffer.get();
if !created.is_null() {
- return Some(NonNullJSObjectPtr::new_unchecked(created));
+ return Some(NonNull::new_unchecked(created));
}
// Step 2
@@ -1132,7 +1132,7 @@ impl XMLHttpRequest {
rooted!(in(cx) let mut array_buffer = ptr::null_mut::<JSObject>());
ArrayBuffer::create(cx, CreateWith::Slice(&bytes), array_buffer.handle_mut()).ok().and_then(|()| {
self.response_arraybuffer.set(array_buffer.get());
- Some(NonNullJSObjectPtr::new_unchecked(array_buffer.get()))
+ Some(NonNull::new_unchecked(array_buffer.get()))
})
}