aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-01-01 21:33:52 +0100
committerMs2ger <ms2ger@gmail.com>2015-01-01 22:19:34 +0100
commit43eecf6e7a49a30cac1256fca0817585d4ab3ac8 (patch)
tree805a76c60f90d2e1052f3873fcbe2bc6145fc207
parent111a196e9d300164391d12ab292c1d4c0ef2b44a (diff)
downloadservo-43eecf6e7a49a30cac1256fca0817585d4ab3ac8.tar.gz
servo-43eecf6e7a49a30cac1256fca0817585d4ab3ac8.zip
Stop using ptr.is_not_null() in script.
This method is deprecated in rust master; removing its users in advance will make a future rust upgrade smoother.
-rw-r--r--components/script/dom/bindings/callback.rs2
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py24
-rw-r--r--components/script/dom/bindings/conversions.rs2
-rw-r--r--components/script/dom/bindings/proxyhandler.rs4
-rw-r--r--components/script/dom/bindings/utils.rs10
-rw-r--r--components/script/dom/browsercontext.rs6
-rw-r--r--components/script/dom/eventtarget.rs2
-rw-r--r--components/script/script_task.rs4
8 files changed, 27 insertions, 27 deletions
diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs
index 56690bcfd41..9d74b0560da 100644
--- a/components/script/dom/bindings/callback.rs
+++ b/components/script/dom/bindings/callback.rs
@@ -121,7 +121,7 @@ impl CallbackInterface {
pub fn WrapCallThisObject<T: Reflectable>(cx: *mut JSContext,
p: JSRef<T>) -> *mut JSObject {
let mut obj = p.reflector().get_jsobject();
- assert!(obj.is_not_null());
+ assert!(!obj.is_null());
unsafe {
if JS_WrapObject(cx, &mut obj) == 0 {
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 49abbdfd6fb..f59517a0b23 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -1805,7 +1805,7 @@ let obj = with_compartment(aCx, proto, || {
proto, %s,
ptr::null_mut(), ptr::null_mut())
});
-assert!(obj.is_not_null());\
+assert!(!obj.is_null());\
""" % (descriptor.name, parent)
else:
if descriptor.isGlobal():
@@ -1815,7 +1815,7 @@ assert!(obj.is_not_null());\
" JS_NewObject(aCx, &Class.base as *const js::Class as *const JSClass, &*proto, &*%s)\n"
"});\n" % parent)
create += """\
-assert!(obj.is_not_null());
+assert!(!obj.is_null());
JS_SetReservedSlot(obj, DOM_OBJECT_SLOT as u32,
PrivateValue(squirrel_away_unique(aObject) as *const libc::c_void));"""
@@ -1841,11 +1841,11 @@ class CGWrapMethod(CGAbstractMethod):
if not self.descriptor.isGlobal():
return CGGeneric("""\
let scope = aScope.reflector().get_jsobject();
-assert!(scope.is_not_null());
+assert!(!scope.is_null());
assert!(((*JS_GetClass(scope)).flags & JSCLASS_IS_GLOBAL) != 0);
let proto = with_compartment(aCx, scope, || GetProtoObject(aCx, scope, scope));
-assert!(proto.is_not_null());
+assert!(!proto.is_null());
%s
@@ -1974,7 +1974,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
toBindingNamespace(parentProtoName))
getParentProto = ("let parentProto: *mut JSObject = %s;\n"
- "assert!(parentProto.is_not_null());\n") % getParentProto
+ "assert!(!parentProto.is_null());\n") % getParentProto
if self.descriptor.concrete:
if self.descriptor.proxy:
@@ -2036,7 +2036,7 @@ let protoOrIfaceArray = GetProtoOrIfaceArray(aGlobal);
let cachedObject: *mut JSObject = *protoOrIfaceArray.offset(%s as int);
if cachedObject.is_null() {
let tmp: *mut JSObject = CreateInterfaceObjects(aCx, aGlobal, aReceiver);
- assert!(tmp.is_not_null());
+ assert!(!tmp.is_null());
*protoOrIfaceArray.offset(%s as int) = tmp;
tmp
} else {
@@ -2151,8 +2151,8 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
def definition_body(self):
return CGGeneric("""\
-assert!(global.is_not_null());
-assert!(GetProtoObject(cx, global, global).is_not_null());""")
+assert!(!global.is_null());
+assert!(!GetProtoObject(cx, global, global).is_null());""")
def needCx(returnType, arguments, considerTypes):
return (considerTypes and
@@ -3691,12 +3691,12 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
return setOrIndexedGet + """\
let expando: *mut JSObject = GetExpandoObject(proxy);
//if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) {
-if expando.is_not_null() {
+if !expando.is_null() {
let flags = if set { JSRESOLVE_ASSIGNING } else { 0 } | JSRESOLVE_QUALIFIED;
if JS_GetPropertyDescriptorById(cx, expando, id, flags, desc) == 0 {
return false;
}
- if (*desc).obj.is_not_null() {
+ if !(*desc).obj.is_null() {
// Pretend the property lives on the wrapper.
(*desc).obj = proxy;
return true;
@@ -3828,7 +3828,7 @@ class CGDOMJSProxyHandler_hasOwn(CGAbstractExternMethod):
return indexed + """\
let expando: *mut JSObject = GetExpandoObject(proxy);
-if expando.is_not_null() {
+if !expando.is_null() {
let mut b: JSBool = 1;
let ok = JS_HasPropertyById(cx, expando, id, &mut b) != 0;
*bp = b != 0;
@@ -3853,7 +3853,7 @@ class CGDOMJSProxyHandler_get(CGAbstractExternMethod):
def getBody(self):
getFromExpando = """\
let expando = GetExpandoObject(proxy);
-if expando.is_not_null() {
+if !expando.is_null() {
let mut hasProp = 0;
if JS_HasPropertyById(cx, expando, id, &mut hasProp) == 0 {
return false;
diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs
index 08c2abb9e8b..85a71d15680 100644
--- a/components/script/dom/bindings/conversions.rs
+++ b/components/script/dom/bindings/conversions.rs
@@ -343,7 +343,7 @@ impl FromJSValConvertible<()> for ByteString {
impl ToJSValConvertible for Reflector {
fn to_jsval(&self, cx: *mut JSContext) -> JSVal {
let obj = self.get_jsobject();
- assert!(obj.is_not_null());
+ assert!(!obj.is_null());
let mut value = ObjectValue(unsafe { &*obj });
if unsafe { JS_WrapValue(cx, &mut value) } == 0 {
panic!("JS_WrapValue failed.");
diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs
index 0d77ff63cdd..20bf723513f 100644
--- a/components/script/dom/bindings/proxyhandler.rs
+++ b/components/script/dom/bindings/proxyhandler.rs
@@ -33,7 +33,7 @@ pub unsafe extern fn getPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObj
if !InvokeGetOwnPropertyDescriptor(handler, cx, proxy, id, set, desc) {
return false;
}
- if (*desc).obj.is_not_null() {
+ if !(*desc).obj.is_null() {
return true;
}
@@ -89,7 +89,7 @@ pub fn _obj_toString(cx: *mut JSContext, name: &str) -> *mut JSString {
let length = result.len() as libc::size_t;
let string = JS_NewStringCopyN(cx, chars, length);
- assert!(string.is_not_null());
+ assert!(!string.is_null());
return string;
}
}
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index 9cf2c3eea47..fdbada5e1ce 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -214,10 +214,10 @@ fn CreateInterfaceObject(cx: *mut JSContext, global: *mut JSObject, receiver: *m
unsafe {
let fun = JS_NewFunction(cx, Some(constructorNative), ctorNargs,
JSFUN_CONSTRUCTOR, global, name);
- assert!(fun.is_not_null());
+ assert!(!fun.is_null());
let constructor = JS_GetFunctionObject(fun);
- assert!(constructor.is_not_null());
+ assert!(!constructor.is_null());
match members.staticMethods {
Some(staticMethods) => DefineMethods(cx, constructor, staticMethods),
@@ -234,7 +234,7 @@ fn CreateInterfaceObject(cx: *mut JSContext, global: *mut JSObject, receiver: *m
_ => (),
}
- if proto.is_not_null() {
+ if !proto.is_null() {
assert!(JS_LinkConstructorAndPrototype(cx, constructor, proto) != 0);
}
@@ -288,7 +288,7 @@ fn CreateInterfacePrototypeObject(cx: *mut JSContext, global: *mut JSObject,
members: &'static NativeProperties) -> *mut JSObject {
unsafe {
let ourProto = JS_NewObjectWithUniqueType(cx, protoClass, &*parentProto, &*global);
- assert!(ourProto.is_not_null());
+ assert!(!ourProto.is_null());
match members.methods {
Some(methods) => DefineMethods(cx, ourProto, methods),
@@ -366,7 +366,7 @@ impl Reflector {
/// Initialize the reflector. (May be called only once.)
pub fn set_jsobject(&self, object: *mut JSObject) {
assert!(self.object.get().is_null());
- assert!(object.is_not_null());
+ assert!(!object.is_null());
self.object.set(object);
}
diff --git a/components/script/dom/browsercontext.rs b/components/script/dom/browsercontext.rs
index 0bd96b75ec8..ee299c6993b 100644
--- a/components/script/dom/browsercontext.rs
+++ b/components/script/dom/browsercontext.rs
@@ -43,7 +43,7 @@ impl BrowserContext {
}
pub fn window_proxy(&self) -> *mut JSObject {
- assert!(self.window_proxy.is_not_null());
+ assert!(!self.window_proxy.is_null());
self.window_proxy
}
@@ -53,14 +53,14 @@ impl BrowserContext {
let js_info = page.js_info();
let WindowProxyHandler(handler) = js_info.as_ref().unwrap().dom_static.windowproxy_handler;
- assert!(handler.is_not_null());
+ assert!(!handler.is_null());
let parent = win.reflector().get_jsobject();
let cx = js_info.as_ref().unwrap().js_context.ptr;
let wrapper = with_compartment(cx, parent, || unsafe {
WrapperNew(cx, parent, handler)
});
- assert!(wrapper.is_not_null());
+ assert!(!wrapper.is_null());
self.window_proxy = wrapper;
}
}
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index 05ad3a55fff..4ea2807b8c7 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -221,7 +221,7 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
let funobj = unsafe {
JS_CloneFunctionObject(cx, JS_GetFunctionObject(handler), scope)
};
- assert!(funobj.is_not_null());
+ assert!(!funobj.is_null());
self.set_event_handler_common(ty, Some(EventHandlerNonNull::new(funobj)));
}
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index c1476780d61..c8646e5d6e3 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -392,7 +392,7 @@ impl ScriptTask {
let js_runtime = js::rust::rt();
assert!({
let ptr: *mut JSRuntime = (*js_runtime).ptr;
- ptr.is_not_null()
+ !ptr.is_null()
});
// Unconstrain the runtime's threshold on nominal heap size, to avoid
@@ -407,7 +407,7 @@ impl ScriptTask {
let js_context = js_runtime.cx();
assert!({
let ptr: *mut JSContext = (*js_context).ptr;
- ptr.is_not_null()
+ !ptr.is_null()
});
js_context.set_default_options_and_version();
js_context.set_logging_error_reporter();