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 258537 18af6cfb3b86
parent 258536 4dc8d874746b
child 258538 65cf03fc2bc9
push id4691
push userryanvm@gmail.com
push date2015-04-20 17:16 +0000
treeherdermozilla-beta@72f1b4086067 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley, abillings
bugs1153688
milestone38.0
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;