diff options
Diffstat (limited to 'components/script/dom/bindings/callback.rs')
-rw-r--r-- | components/script/dom/bindings/callback.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index 6b8fcc09e34..dd0bf8bf65c 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -2,8 +2,6 @@ * 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/. */ -#![deny(missing_docs)] - //! Base classes to work with IDL callbacks. use dom::bindings::global::global_object_for_js_object; @@ -14,10 +12,11 @@ use js::jsapi::{JS_GetProperty, JS_IsExceptionPending, JS_ReportPendingException use js::jsval::{JSVal, UndefinedValue}; use js::rust::with_compartment; +use std::ffi::CString; use std::ptr; /// The exception handling used for a call. -#[deriving(Copy, PartialEq)] +#[derive(Copy, PartialEq)] pub enum ExceptionHandling { /// Report any exception and don't throw it to the caller code. Report, @@ -26,7 +25,7 @@ pub enum ExceptionHandling { } /// A common base class for representing IDL callback function types. -#[deriving(Copy, Clone,PartialEq)] +#[derive(Copy, Clone,PartialEq)] #[jstraceable] pub struct CallbackFunction { object: CallbackObject @@ -44,7 +43,7 @@ impl CallbackFunction { } /// A common base class for representing IDL callback interface types. -#[deriving(Copy, Clone,PartialEq)] +#[derive(Copy, Clone,PartialEq)] #[jstraceable] pub struct CallbackInterface { object: CallbackObject @@ -52,8 +51,8 @@ pub struct CallbackInterface { /// A common base class for representing IDL callback function and /// callback interface types. -#[allow(raw_pointer_deriving)] -#[deriving(Copy, Clone,PartialEq)] +#[allow(raw_pointer_derive)] +#[derive(Copy, Clone,PartialEq)] #[jstraceable] struct CallbackObject { /// The underlying `JSObject`. @@ -99,7 +98,7 @@ impl CallbackInterface { pub fn GetCallableProperty(&self, cx: *mut JSContext, name: &str) -> Result<JSVal, ()> { let mut callable = UndefinedValue(); unsafe { - let name = name.to_c_str(); + let name = CString::from_slice(name.as_bytes()); if JS_GetProperty(cx, self.callback(), name.as_ptr(), &mut callable) == 0 { return Err(()); } |