Bug 719501 - Allow JavaScript-navigator-property properties to be null. r=jst
authorGregor Wagner <gwagner@mozilla.com>
Sun, 22 Jan 2012 16:58:30 -0800
changeset 86319 24524a1fd69995a72b59ab9473d6c961e94613c2
parent 86312 ee922e0041e148f6aa67c7ce8c71ad7daff1e2c3
child 86320 975ec4955ef920a70ab94e1ce4022e4b85a66a8a
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs719501
milestone12.0a1
Bug 719501 - Allow JavaScript-navigator-property properties to be null. r=jst
dom/base/nsDOMClassInfo.cpp
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -6510,17 +6510,17 @@ nsWindowSH::GlobalResolve(nsGlobalWindow
       nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi(do_QueryInterface(native));
 
       if (gpi) {
         rv = gpi->Init(aWin, &prop_val);
         NS_ENSURE_SUCCESS(rv, rv);
       }
     }
 
-    if (JSVAL_IS_PRIMITIVE(prop_val)) {
+    if (JSVAL_IS_PRIMITIVE(prop_val) && !JSVAL_IS_NULL(prop_val)) {
       JSObject *scope;
 
       if (aWin->IsOuterWindow()) {
         nsGlobalWindow *inner = aWin->GetCurrentInnerWindowInternal();
         NS_ENSURE_TRUE(inner, NS_ERROR_UNEXPECTED);
 
         scope = inner->GetGlobalJSObject();
       } else {
@@ -7263,17 +7263,17 @@ nsNavigatorSH::NewResolve(nsIXPConnectWr
     if (!window) {
       return NS_ERROR_UNEXPECTED;
     }
 
     rv = gpi->Init(window, &prop_val);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  if (JSVAL_IS_PRIMITIVE(prop_val)) {
+  if (JSVAL_IS_PRIMITIVE(prop_val) && !JSVAL_IS_NULL(prop_val)) {
     nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
     rv = WrapNative(cx, obj, native, true, &prop_val,
                     getter_AddRefs(holder));
 
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (!JS_WrapValue(cx, &prop_val)) {