mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Compile WebIDL return type "object" to NonZero<*mut JSObject>
This commit is contained in:
parent
3e32948a39
commit
6e1523f4ae
11 changed files with 74 additions and 48 deletions
|
@ -2,6 +2,7 @@
|
|||
* 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::ImageDataBinding;
|
||||
use dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods;
|
||||
use dom::bindings::global::GlobalRef;
|
||||
|
@ -82,9 +83,10 @@ impl ImageDataMethods for ImageData {
|
|||
self.height
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
// https://html.spec.whatwg.org/multipage/#dom-imagedata-data
|
||||
fn Data(&self, _: *mut JSContext) -> *mut JSObject {
|
||||
fn Data(&self, _: *mut JSContext) -> NonZero<*mut JSObject> {
|
||||
assert!(!self.data.get().is_null());
|
||||
self.data.get()
|
||||
unsafe { NonZero::new(self.data.get()) }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue