diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-10-16 17:07:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-16 17:07:50 -0500 |
commit | e8a6f2862c2a6084e4f4e64ab466c89ae83cff59 (patch) | |
tree | 645db1e37eceef034743c28f9af1544a3fff6d8d /components/script/dom/textencoder.rs | |
parent | 3209d22968046b5c3d29a37b79a655497db2050a (diff) | |
parent | 49e4540ece8641afcb6534a9c3b74e88895f5447 (diff) | |
download | servo-e8a6f2862c2a6084e4f4e64ab466c89ae83cff59.tar.gz servo-e8a6f2862c2a6084e4f4e64ab466c89ae83cff59.zip |
Auto merge of #18875 - servo:stable-js, r=nox,jdm
Remove the need for rust-mozjs to use unstable Rust features
<!-- 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/18875)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/textencoder.rs')
-rw-r--r-- | components/script/dom/textencoder.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/components/script/dom/textencoder.rs b/components/script/dom/textencoder.rs index 78ccbfcae0b..7ca2a429525 100644 --- a/components/script/dom/textencoder.rs +++ b/components/script/dom/textencoder.rs @@ -2,16 +2,16 @@ * 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 core::nonzero::NonZero; 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}; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; -use js::jsapi::{JSContext, JSObject}; +use js::jsapi::JSContext; use js::typedarray::{Uint8Array, CreateWith}; use std::ptr; @@ -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) -> NonZero<*mut JSObject> { + unsafe fn Encode(&self, cx: *mut JSContext, input: USVString) -> NonNullJSObjectPtr { let encoded = input.0.as_bytes(); rooted!(in(cx) let mut js_object = ptr::null_mut()); assert!(Uint8Array::create(cx, CreateWith::Slice(&encoded), js_object.handle_mut()).is_ok()); - NonZero::new_unchecked(js_object.get()) + NonNullJSObjectPtr::new_unchecked(js_object.get()) } } |