From 46e4ac280fe13d7b1234e9e462a2db4ed47e2851 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 25 Jan 2015 21:23:12 +0100 Subject: [PATCH] Panic if JS_NewObjectWithGivenProto fails. --- components/script/dom/bindings/proxyhandler.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs index 49dbbf867d7..0fbfc1700a0 100644 --- a/components/script/dom/bindings/proxyhandler.rs +++ b/components/script/dom/bindings/proxyhandler.rs @@ -63,10 +63,6 @@ pub unsafe extern fn defineProperty_(cx: *mut JSContext, proxy: *mut JSObject, i } let expando = EnsureExpandoObject(cx, proxy); - if expando.is_null() { - return false; - } - return JS_DefinePropertyById(cx, expando, id, (*desc).value, (*desc).getter, (*desc).setter, (*desc).attrs) != 0; } @@ -115,9 +111,7 @@ pub fn EnsureExpandoObject(cx: *mut JSContext, obj: *mut JSObject) -> *mut JSObj expando = JS_NewObjectWithGivenProto(cx, ptr::null_mut(), ptr::null_mut(), GetObjectParent(obj)); - if expando.is_null() { - return ptr::null_mut(); - } + assert!(!expando.is_null()); SetProxyExtra(obj, JSPROXYSLOT_EXPANDO, ObjectValue(&*expando)); }