Bug 1153688 - Treat JS Symbol as void on C++ side of Variant. r=bholley, a=abillings
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Fri, 17 Apr 2015 17:30:34 +0300
changeset 265672 f1b9d7872e1910cf1da9266bf39853878e0ea473
parent 265671 a4e7361a2b5dc6053896b5b2f21723d4a09c55da
child 265673 3b137c13eec5de091c3fc1845d1c5b8976688721
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley, abillings
bugs1153688
milestone39.0a2
Bug 1153688 - Treat JS Symbol as void on C++ side of Variant. r=bholley, a=abillings
js/xpconnect/src/XPCVariant.cpp
--- a/js/xpconnect/src/XPCVariant.cpp
+++ b/js/xpconnect/src/XPCVariant.cpp
@@ -185,17 +185,17 @@ XPCArrayHomogenizer::GetTypeForArray(JSC
             return false;
 
         if (val.isInt32()) {
             type = tInt;
         } else if (val.isDouble()) {
             type = tDbl;
         } else if (val.isBoolean()) {
             type = tBool;
-        } else if (val.isUndefined()) {
+        } else if (val.isUndefined() || val.isSymbol()) {
             state = tVar;
             break;
         } else if (val.isNull()) {
             type = tNull;
         } else if (val.isString()) {
             type = tStr;
         } else {
             MOZ_ASSERT(val.isObject(), "invalid type of jsval!");
@@ -268,17 +268,18 @@ bool XPCVariant::InitializeData(JSContex
     RootedValue val(cx, GetJSVal());
 
     if (val.isInt32())
         return NS_SUCCEEDED(nsVariant::SetFromInt32(&mData, val.toInt32()));
     if (val.isDouble())
         return NS_SUCCEEDED(nsVariant::SetFromDouble(&mData, val.toDouble()));
     if (val.isBoolean())
         return NS_SUCCEEDED(nsVariant::SetFromBool(&mData, val.toBoolean()));
-    if (val.isUndefined())
+    // We can't represent symbol on C++ side, so pretend it is void.
+    if (val.isUndefined() || val.isSymbol())
         return NS_SUCCEEDED(nsVariant::SetToVoid(&mData));
     if (val.isNull())
         return NS_SUCCEEDED(nsVariant::SetToEmpty(&mData));
     if (val.isString()) {
         JSString* str = val.toString();
         if (!str)
             return false;