Bug 918023 - SpiderMonkey: Const-qualify various static variables. r=njn
☠☠ backed out by ac09e1a3fa46 ☠ ☠
authorDan Gohman <sunfish@google.com>
Tue, 24 Sep 2013 08:21:22 -0700
changeset 148453 2c3d1c9241d7b0f3612bb9cb705b33c537eb7925
parent 148452 28316508a37f5ea157afe9616b752d5545ae0118
child 148454 6d91b99de1cb97a2fd1ab9173692f05c0468bc89
push id25343
push userkwierso@gmail.com
push dateWed, 25 Sep 2013 02:43:37 +0000
treeherdermozilla-central@ce5bc913350a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs918023
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 918023 - SpiderMonkey: Const-qualify various static variables. r=njn
dom/bindings/DOMJSProxyHandler.cpp
dom/bindings/DOMJSProxyHandler.h
js/jsd/jsd_scpt.cpp
js/jsd/jsd_xpc.cpp
js/jsd/jshash.cpp
js/jsd/jshash.h
js/src/builtin/ParallelArray.cpp
js/src/ctypes/CTypes.cpp
js/src/jit/IonMacroAssembler.h
js/src/jsapi.cpp
js/src/jsapi.h
js/src/jsarray.cpp
js/src/jscntxt.cpp
js/src/jsfriendapi.cpp
js/src/jsfriendapi.h
js/src/jsgc.cpp
js/src/jskwgen.cpp
js/src/jsproxy.cpp
js/src/jsproxy.h
js/src/jsstr.cpp
js/src/jswrapper.cpp
js/src/jswrapper.h
js/src/shell/js.cpp
js/src/vm/Runtime.h
js/src/vm/WrapperObject.h
js/xpconnect/shell/xpcshell.cpp
js/xpconnect/src/Sandbox.cpp
js/xpconnect/src/XPCJSID.cpp
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/XPCMaps.cpp
js/xpconnect/src/XPCMaps.h
js/xpconnect/src/xpcprivate.h
--- a/dom/bindings/DOMJSProxyHandler.cpp
+++ b/dom/bindings/DOMJSProxyHandler.cpp
@@ -28,17 +28,17 @@ jsid s_length_id = JSID_VOID;
 
 bool
 DefineStaticJSVals(JSContext* cx)
 {
   return InternJSString(cx, s_length_id, "length");
 }
 
 
-int HandlerFamily;
+const char HandlerFamily = 0;
 
 js::DOMProxyShadowsResult
 DOMProxyShadows(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id)
 {
   JS::Value v = js::GetProxyExtra(proxy, JSPROXYSLOT_EXPANDO);
   if (v.isObject()) {
     bool hasOwn;
     if (!JS_AlreadyHasOwnPropertyById(cx, &v.toObject(), id, &hasOwn))
@@ -57,17 +57,17 @@ DOMProxyShadows(JSContext* cx, JS::Handl
 
   return hasOwn ? js::Shadows : js::DoesntShadowUnique;
 }
 
 // Store the information for the specialized ICs.
 struct SetDOMProxyInformation
 {
   SetDOMProxyInformation() {
-    js::SetDOMProxyInformation((void*) &HandlerFamily,
+    js::SetDOMProxyInformation((const void*) &HandlerFamily,
                                js::PROXY_EXTRA_SLOT + JSPROXYSLOT_EXPANDO, DOMProxyShadows);
   }
 };
 
 SetDOMProxyInformation gSetDOMProxyInformation;
 
 // static
 JSObject*
--- a/dom/bindings/DOMJSProxyHandler.h
+++ b/dom/bindings/DOMJSProxyHandler.h
@@ -22,35 +22,36 @@ class DOMClass;
 
 enum {
   JSPROXYSLOT_EXPANDO = 0,
   JSPROXYSLOT_XRAY_EXPANDO
 };
 
 template<typename T> struct Prefable;
 
-extern int HandlerFamily;
-inline void* ProxyFamily() { return &HandlerFamily; }
+// This variable exists solely to provide a unique address for use as an identifier.
+extern const char HandlerFamily;
+inline const void* ProxyFamily() { return &HandlerFamily; }
 
 inline bool IsDOMProxy(JSObject *obj, const js::Class* clasp)
 {
     MOZ_ASSERT(js::GetObjectClass(obj) == clasp);
     return (js::IsObjectProxyClass(clasp) || js::IsFunctionProxyClass(clasp)) &&
            js::GetProxyHandler(obj)->family() == ProxyFamily();
 }
 
 inline bool IsDOMProxy(JSObject *obj)
 {
     return IsDOMProxy(obj, js::GetObjectClass(obj));
 }
 
 class BaseDOMProxyHandler : public js::BaseProxyHandler
 {
 public:
-  BaseDOMProxyHandler(void* aProxyFamily)
+  BaseDOMProxyHandler(const void* aProxyFamily)
     : js::BaseProxyHandler(aProxyFamily)
   {}
 
   // Implementations of traps that can be implemented in terms of
   // fundamental traps.
   bool enumerate(JSContext* cx, JS::Handle<JSObject*> proxy,
                  JS::AutoIdVector& props) MOZ_OVERRIDE;
   bool getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject*> proxy,
--- a/js/jsd/jsd_scpt.cpp
+++ b/js/jsd/jsd_scpt.cpp
@@ -181,17 +181,17 @@ jsd_free_script_entry(void *priv, JSHash
 {
     if (flag == HT_FREE_ENTRY)
     {
         _destroyJSDScript((JSDContext*) priv, (JSDScript*) he->value);
         free(he);
     }
 }
 
-static JSHashAllocOps script_alloc_ops = {
+static const JSHashAllocOps script_alloc_ops = {
     jsd_alloc_script_table, jsd_free_script_table,
     jsd_alloc_script_entry, jsd_free_script_entry
 };
 
 #ifndef JSD_SCRIPT_HASH_SIZE
 #define JSD_SCRIPT_HASH_SIZE 1024
 #endif
 
--- a/js/jsd/jsd_xpc.cpp
+++ b/js/jsd/jsd_xpc.cpp
@@ -997,19 +997,21 @@ jsdScript::CreatePPLineMap()
             if (!jsstr)
                 return nullptr;
 
             if (!(chars = JS_GetStringCharsAndLength(cx, jsstr, &length)))
                 return nullptr;
         }
 
         JS::Anchor<JSString *> kungFuDeathGrip(jsstr);
-        const char *argnames[] = {"arg1", "arg2", "arg3", "arg4", 
-                                  "arg5", "arg6", "arg7", "arg8",
-                                  "arg9", "arg10", "arg11", "arg12" };
+        static const char *const argnames[] = {
+            "arg1", "arg2", "arg3", "arg4",
+            "arg5", "arg6", "arg7", "arg8",
+            "arg9", "arg10", "arg11", "arg12"
+        };
         fun = JS_CompileUCFunction (cx, obj, "ppfun", nargs, argnames, chars,
                                     length, "x-jsd:ppbuffer?type=function", 3);
         if (!fun || !(script = JS_GetFunctionScript(cx, fun)))
             return nullptr;
         baseLine = 3;
     } else {
         script = JSD_GetJSScript(mCx, mScript);
         JSString *jsstr;
--- a/js/jsd/jshash.cpp
+++ b/js/jsd/jshash.cpp
@@ -59,25 +59,25 @@ DefaultAllocEntry(void *pool, const void
 
 static void
 DefaultFreeEntry(void *pool, JSHashEntry *he, unsigned flag)
 {
     if (flag == HT_FREE_ENTRY)
         js_free(he);
 }
 
-static JSHashAllocOps defaultHashAllocOps = {
+static const JSHashAllocOps defaultHashAllocOps = {
     DefaultAllocTable, DefaultFreeTable,
     DefaultAllocEntry, DefaultFreeEntry
 };
 
 JSHashTable *
 JS_NewHashTable(uint32_t n, JSHashFunction keyHash,
                 JSHashComparator keyCompare, JSHashComparator valueCompare,
-                JSHashAllocOps *allocOps, void *allocPriv)
+                const JSHashAllocOps *allocOps, void *allocPriv)
 {
     JSHashTable *ht;
     size_t nb;
 
     if (n <= MINBUCKETS) {
         n = MINBUCKETSLOG2;
     } else {
         n = CeilingLog2Size(n);
@@ -109,17 +109,17 @@ JS_NewHashTable(uint32_t n, JSHashFuncti
     return ht;
 }
 
 void
 JS_HashTableDestroy(JSHashTable *ht)
 {
     uint32_t i, n;
     JSHashEntry *he, **hep;
-    JSHashAllocOps *allocOps = ht->allocOps;
+    const JSHashAllocOps *allocOps = ht->allocOps;
     void *allocPriv = ht->allocPriv;
 
     n = NBUCKETS(ht);
     for (i = 0; i < n; i++) {
         hep = &ht->buckets[i];
         while ((he = *hep) != nullptr) {
             *hep = he->next;
             allocOps->freeEntry(allocPriv, he, HT_FREE_ENTRY);
--- a/js/jsd/jshash.h
+++ b/js/jsd/jshash.h
@@ -51,34 +51,34 @@ struct JSHashEntry {
 
 struct JSHashTable {
     JSHashEntry         **buckets;      /* vector of hash buckets */
     uint32_t            nentries;       /* number of entries in table */
     uint32_t            shift;          /* multiplicative hash shift */
     JSHashFunction      keyHash;        /* key hash function */
     JSHashComparator    keyCompare;     /* key comparison function */
     JSHashComparator    valueCompare;   /* value comparison function */
-    JSHashAllocOps      *allocOps;      /* allocation operations */
+    const JSHashAllocOps *allocOps;     /* allocation operations */
     void                *allocPriv;     /* allocation private data */
 #ifdef JS_HASHMETER
     uint32_t            nlookups;       /* total number of lookups */
     uint32_t            nsteps;         /* number of hash chains traversed */
     uint32_t            ngrows;         /* number of table expansions */
     uint32_t            nshrinks;       /* number of table contractions */
 #endif
 };
 
 /*
  * Create a new hash table.
  * If allocOps is null, use default allocator ops built on top of malloc().
  */
 extern JSHashTable * 
 JS_NewHashTable(uint32_t n, JSHashFunction keyHash,
                 JSHashComparator keyCompare, JSHashComparator valueCompare,
-                JSHashAllocOps *allocOps, void *allocPriv);
+                const JSHashAllocOps *allocOps, void *allocPriv);
 
 extern void
 JS_HashTableDestroy(JSHashTable *ht);
 
 /* Low level access methods */
 extern JSHashEntry **
 JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key);
 
--- a/js/src/builtin/ParallelArray.cpp
+++ b/js/src/builtin/ParallelArray.cpp
@@ -181,20 +181,22 @@ ParallelArrayObject::constructHelper(JSC
 
 JSObject *
 ParallelArrayObject::initClass(JSContext *cx, HandleObject obj)
 {
     JS_ASSERT(obj->isNative());
 
     // Cache constructor names.
     {
-        const char *ctorStrs[NumCtors] = { "ParallelArrayConstructEmpty",
-                                           "ParallelArrayConstructFromArray",
-                                           "ParallelArrayConstructFromFunction",
-                                           "ParallelArrayConstructFromFunctionMode" };
+        static const char *const ctorStrs[NumCtors] = {
+            "ParallelArrayConstructEmpty",
+            "ParallelArrayConstructFromArray",
+            "ParallelArrayConstructFromFunction",
+            "ParallelArrayConstructFromFunctionMode"
+        };
         for (uint32_t i = 0; i < NumCtors; i++) {
             JSAtom *atom = Atomize(cx, ctorStrs[i], strlen(ctorStrs[i]), InternAtom);
             if (!atom)
                 return NULL;
             ctorNames[i].init(atom->asPropertyName());
         }
     }
 
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -782,17 +782,17 @@ GetABICode(JSObject* obj)
   // and extract the enumerated class type from the reserved slot.
   if (JS_GetClass(obj) != &sCABIClass)
     return INVALID_ABI;
 
   jsval result = JS_GetReservedSlot(obj, SLOT_ABICODE);
   return ABICode(JSVAL_TO_INT(result));
 }
 
-static JSErrorFormatString ErrorFormatString[CTYPESERR_LIMIT] = {
+static const JSErrorFormatString ErrorFormatString[CTYPESERR_LIMIT] = {
 #define MSG_DEF(name, number, count, exception, format) \
   { format, count, exception } ,
 #include "ctypes/ctypes.msg"
 #undef MSG_DEF
 };
 
 static const JSErrorFormatString*
 GetErrorMessage(void* userRef, const char* locale, const unsigned errorNumber)
--- a/js/src/jit/IonMacroAssembler.h
+++ b/js/src/jit/IonMacroAssembler.h
@@ -299,17 +299,17 @@ class MacroAssembler : public MacroAssem
     }
     void branchTestObjShape(Condition cond, Register obj, const Shape *shape, Label *label) {
         branchPtr(cond, Address(obj, JSObject::offsetOfShape()), ImmGCPtr(shape), label);
     }
     void branchTestObjShape(Condition cond, Register obj, Register shape, Label *label) {
         branchPtr(cond, Address(obj, JSObject::offsetOfShape()), shape, label);
     }
     void branchTestProxyHandlerFamily(Condition cond, Register proxy, Register scratch,
-                                      void *handlerp, Label *label) {
+                                      const void *handlerp, Label *label) {
         Address handlerAddr(proxy, ProxyObject::offsetOfHandler());
         loadPrivate(handlerAddr, scratch);
         Address familyAddr(scratch, BaseProxyHandler::offsetOfFamily());
         branchPtr(cond, familyAddr, ImmPtr(handlerp), label);
     }
 
     template <typename Value>
     Condition testMIRType(Condition cond, const Value &val, MIRType type) {
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -879,17 +879,17 @@ JS_GetVersion(JSContext *cx)
 }
 
 JS_PUBLIC_API(void)
 JS_SetVersionForCompartment(JSCompartment *compartment, JSVersion version)
 {
     compartment->options().setVersion(version);
 }
 
-static struct v2smap {
+static const struct v2smap {
     JSVersion   version;
     const char  *string;
 } v2smap[] = {
     {JSVERSION_ECMA_3,  "ECMAv3"},
     {JSVERSION_1_6,     "1.6"},
     {JSVERSION_1_7,     "1.7"},
     {JSVERSION_1_8,     "1.8"},
     {JSVERSION_ECMA_5,  "ECMAv5"},
@@ -3987,17 +3987,17 @@ JS_SetSecurityCallbacks(JSRuntime *rt, c
 
 JS_PUBLIC_API(const JSSecurityCallbacks *)
 JS_GetSecurityCallbacks(JSRuntime *rt)
 {
     return (rt->securityCallbacks != &NullSecurityCallbacks) ? rt->securityCallbacks : NULL;
 }
 
 JS_PUBLIC_API(void)
-JS_SetTrustedPrincipals(JSRuntime *rt, JSPrincipals *prin)
+JS_SetTrustedPrincipals(JSRuntime *rt, const JSPrincipals *prin)
 {
     rt->setTrustedPrincipals(prin);
 }
 
 extern JS_PUBLIC_API(void)
 JS_InitDestroyPrincipalsCallback(JSRuntime *rt, JSDestroyPrincipalsOp destroyPrincipals)
 {
     JS_ASSERT(destroyPrincipals);
@@ -4656,17 +4656,17 @@ JS_PUBLIC_API(JSObject *)
 JS_GetGlobalFromScript(JSScript *script)
 {
     JS_ASSERT(!script->isCachedEval);
     return &script->global();
 }
 
 JS_PUBLIC_API(JSFunction *)
 JS::CompileFunction(JSContext *cx, HandleObject obj, CompileOptions options,
-                    const char *name, unsigned nargs, const char **argnames,
+                    const char *name, unsigned nargs, const char *const *argnames,
                     const jschar *chars, size_t length)
 {
     JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment()));
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, obj);
     JS_ASSERT_IF(options.principals(), cx->compartment()->principals == options.principals());
     AutoLastFrameCheck lfc(cx);
@@ -4700,17 +4700,17 @@ JS::CompileFunction(JSContext *cx, Handl
             return NULL;
     }
 
     return fun;
 }
 
 JS_PUBLIC_API(JSFunction *)
 JS::CompileFunction(JSContext *cx, HandleObject obj, CompileOptions options,
-                    const char *name, unsigned nargs, const char **argnames,
+                    const char *name, unsigned nargs, const char *const *argnames,
                     const char *bytes, size_t length)
 {
     jschar *chars;
     if (options.utf8)
         chars = UTF8CharsToNewTwoByteCharsZ(cx, UTF8Chars(bytes, length), &length).get();
     else
         chars = InflateString(cx, bytes, &length);
     if (!chars)
@@ -4718,45 +4718,45 @@ JS::CompileFunction(JSContext *cx, Handl
 
     JSFunction *fun = CompileFunction(cx, obj, options, name, nargs, argnames, chars, length);
     js_free(chars);
     return fun;
 }
 
 JS_PUBLIC_API(JSFunction *)
 JS_CompileUCFunction(JSContext *cx, JSObject *objArg, const char *name,
-                     unsigned nargs, const char **argnames,
+                     unsigned nargs, const char *const *argnames,
                      const jschar *chars, size_t length,
                      const char *filename, unsigned lineno)
 {
     RootedObject obj(cx, objArg);
     CompileOptions options(cx);
     options.setFileAndLine(filename, lineno);
 
     return CompileFunction(cx, obj, options, name, nargs, argnames, chars, length);
 }
 
 JS_PUBLIC_API(JSFunction *)
 JS_CompileFunctionForPrincipals(JSContext *cx, JSObject *objArg,
                                 JSPrincipals *principals, const char *name,
-                                unsigned nargs, const char **argnames,
+                                unsigned nargs, const char *const *argnames,
                                 const char *ascii, size_t length,
                                 const char *filename, unsigned lineno)
 {
     RootedObject obj(cx, objArg);
     CompileOptions options(cx);
     options.setPrincipals(principals)
            .setFileAndLine(filename, lineno);
 
     return CompileFunction(cx, obj, options, name, nargs, argnames, ascii, length);
 }
 
 JS_PUBLIC_API(JSFunction *)
 JS_CompileFunction(JSContext *cx, JSObject *objArg, const char *name,
-                   unsigned nargs, const char **argnames,
+                   unsigned nargs, const char *const *argnames,
                    const char *ascii, size_t length,
                    const char *filename, unsigned lineno)
 {
     RootedObject obj(cx, objArg);
     CompileOptions options(cx);
     options.setFileAndLine(filename, lineno);
 
     return CompileFunction(cx, obj, options, name, nargs, argnames, ascii, length);
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -3069,17 +3069,17 @@ JS_GetSecurityCallbacks(JSRuntime *rt);
  *
  * This principals is not held (via JS_HoldPrincipals/JS_DropPrincipals) since
  * there is no available JSContext. Instead, the caller must ensure that the
  * given principals stays valid for as long as 'rt' may point to it. If the
  * principals would be destroyed before 'rt', JS_SetTrustedPrincipals must be
  * called again, passing NULL for 'prin'.
  */
 extern JS_PUBLIC_API(void)
-JS_SetTrustedPrincipals(JSRuntime *rt, JSPrincipals *prin);
+JS_SetTrustedPrincipals(JSRuntime *rt, const JSPrincipals *prin);
 
 /*
  * Initialize the callback that is called to destroy JSPrincipals instance
  * when its reference counter drops to zero. The initialization can be done
  * only once per JS runtime.
  */
 extern JS_PUBLIC_API(void)
 JS_InitDestroyPrincipalsCallback(JSRuntime *rt, JSDestroyPrincipalsOp destroyPrincipals);
@@ -3211,30 +3211,30 @@ JS_CompileUCScriptForPrincipals(JSContex
                                 const jschar *chars, size_t length,
                                 const char *filename, unsigned lineno);
 
 extern JS_PUBLIC_API(JSObject *)
 JS_GetGlobalFromScript(JSScript *script);
 
 extern JS_PUBLIC_API(JSFunction *)
 JS_CompileFunction(JSContext *cx, JSObject *obj, const char *name,
-                   unsigned nargs, const char **argnames,
+                   unsigned nargs, const char *const *argnames,
                    const char *bytes, size_t length,
                    const char *filename, unsigned lineno);
 
 extern JS_PUBLIC_API(JSFunction *)
 JS_CompileFunctionForPrincipals(JSContext *cx, JSObject *obj,
                                 JSPrincipals *principals, const char *name,
-                                unsigned nargs, const char **argnames,
+                                unsigned nargs, const char *const *argnames,
                                 const char *bytes, size_t length,
                                 const char *filename, unsigned lineno);
 
 extern JS_PUBLIC_API(JSFunction *)
 JS_CompileUCFunction(JSContext *cx, JSObject *obj, const char *name,
-                     unsigned nargs, const char **argnames,
+                     unsigned nargs, const char *const *argnames,
                      const jschar *chars, size_t length,
                      const char *filename, unsigned lineno);
 
 namespace JS {
 
 /* Options for JavaScript compilation. */
 class JS_PUBLIC_API(CompileOptions)
 {
@@ -3325,22 +3325,22 @@ CompileOffThread(JSContext *cx, Handle<J
                  const jschar *chars, size_t length,
                  OffThreadCompileCallback callback, void *callbackData);
 
 extern JS_PUBLIC_API(JSScript *)
 FinishOffThreadScript(JSContext *maybecx, JSRuntime *rt, void *token);
 
 extern JS_PUBLIC_API(JSFunction *)
 CompileFunction(JSContext *cx, JS::Handle<JSObject*> obj, CompileOptions options,
-                const char *name, unsigned nargs, const char **argnames,
+                const char *name, unsigned nargs, const char *const *argnames,
                 const char *bytes, size_t length);
 
 extern JS_PUBLIC_API(JSFunction *)
 CompileFunction(JSContext *cx, JS::Handle<JSObject*> obj, CompileOptions options,
-                const char *name, unsigned nargs, const char **argnames,
+                const char *name, unsigned nargs, const char *const *argnames,
                 const jschar *chars, size_t length);
 
 } /* namespace JS */
 
 extern JS_PUBLIC_API(JSString *)
 JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, unsigned indent);
 
 /*
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -1353,17 +1353,17 @@ CompareStringValues(JSContext *cx, const
     int32_t result;
     if (!CompareStrings(cx, astr, bstr, &result))
         return false;
 
     *lessOrEqualp = (result <= 0);
     return true;
 }
 
-static uint64_t const powersOf10[] = {
+static const uint64_t powersOf10[] = {
     1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 1000000000000ULL
 };
 
 static inline unsigned
 NumDigitsBase10(uint32_t n)
 {
     /*
      * This is just floor_log10(n) + 1
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -1185,26 +1185,26 @@ ComputeIsJITBroken()
     }
 
     // We're using 2.6.29, and this causes trouble with the JITs on i9000.
     line = "";
     bool broken = false;
     std::ifstream cpuinfo("/proc/cpuinfo");
     do {
         if (0 == line.find("Hardware")) {
-            const char* blacklist[] = {
+            static const char* const blacklist[] = {
                 "SCH-I400",     // Samsung Continuum
                 "SGH-T959",     // Samsung i9000, Vibrant device
                 "SGH-I897",     // Samsung i9000, Captivate device
                 "SCH-I500",     // Samsung i9000, Fascinate device
                 "SPH-D700",     // Samsung i9000, Epic device
                 "GT-I9000",     // Samsung i9000, UK/Europe device
                 NULL
             };
-            for (const char** hw = &blacklist[0]; *hw; ++hw) {
+            for (const char* const* hw = &blacklist[0]; *hw; ++hw) {
                 if (line.npos != line.find(*hw)) {
                     __android_log_print(ANDROID_LOG_INFO, "Gecko",
                                         "Blacklisted device `%s'", *hw);
                     broken = true;
                     break;
                 }
             }
             break;
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -213,17 +213,17 @@ JS_FRIEND_API(void)
 JS_SetCompartmentPrincipals(JSCompartment *compartment, JSPrincipals *principals)
 {
     // Short circuit if there's no change.
     if (principals == compartment->principals)
         return;
 
     // Any compartment with the trusted principals -- and there can be
     // multiple -- is a system compartment.
-    JSPrincipals *trusted = compartment->runtimeFromMainThread()->trustedPrincipals();
+    const JSPrincipals *trusted = compartment->runtimeFromMainThread()->trustedPrincipals();
     bool isSystem = principals && principals == trusted;
 
     // Clear out the old principals, if any.
     if (compartment->principals) {
         JS_DropPrincipals(compartment->runtimeFromMainThread(), compartment->principals);
         compartment->principals = NULL;
         // We'd like to assert that our new principals is always same-origin
         // with the old one, but JSPrincipals doesn't give us a way to do that.
@@ -1026,30 +1026,30 @@ js::SetDOMCallbacks(JSRuntime *rt, const
 }
 
 JS_FRIEND_API(const DOMCallbacks *)
 js::GetDOMCallbacks(JSRuntime *rt)
 {
     return rt->DOMcallbacks;
 }
 
-static void *gDOMProxyHandlerFamily = NULL;
+static const void *gDOMProxyHandlerFamily = NULL;
 static uint32_t gDOMProxyExpandoSlot = 0;
 static DOMProxyShadowsCheck gDOMProxyShadowsCheck;
 
 JS_FRIEND_API(void)
-js::SetDOMProxyInformation(void *domProxyHandlerFamily, uint32_t domProxyExpandoSlot,
+js::SetDOMProxyInformation(const void *domProxyHandlerFamily, uint32_t domProxyExpandoSlot,
                            DOMProxyShadowsCheck domProxyShadowsCheck)
 {
     gDOMProxyHandlerFamily = domProxyHandlerFamily;
     gDOMProxyExpandoSlot = domProxyExpandoSlot;
     gDOMProxyShadowsCheck = domProxyShadowsCheck;
 }
 
-void *
+const void *
 js::GetDOMProxyHandlerFamily()
 {
     return gDOMProxyHandlerFamily;
 }
 
 uint32_t
 js::GetDOMProxyExpandoSlot()
 {
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -849,20 +849,20 @@ typedef enum DOMProxyShadowsResult {
   ShadowCheckFailed,
   Shadows,
   DoesntShadow,
   DoesntShadowUnique
 } DOMProxyShadowsResult;
 typedef DOMProxyShadowsResult
 (* DOMProxyShadowsCheck)(JSContext* cx, JS::HandleObject object, JS::HandleId id);
 JS_FRIEND_API(void)
-SetDOMProxyInformation(void *domProxyHandlerFamily, uint32_t domProxyExpandoSlot,
+SetDOMProxyInformation(const void *domProxyHandlerFamily, uint32_t domProxyExpandoSlot,
                        DOMProxyShadowsCheck domProxyShadowsCheck);
 
-void *GetDOMProxyHandlerFamily();
+const void *GetDOMProxyHandlerFamily();
 uint32_t GetDOMProxyExpandoSlot();
 DOMProxyShadowsCheck GetDOMProxyShadowsCheck();
 
 } /* namespace js */
 
 /* Implemented in jsdate.cpp. */
 
 /*
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -4785,17 +4785,17 @@ js::NewCompartment(JSContext *cx, Zone *
 
         zoneHolder.reset(zone);
 
         if (!zone->init(cx))
             return NULL;
 
         zone->setGCLastBytes(8192, GC_NORMAL);
 
-        JSPrincipals *trusted = rt->trustedPrincipals();
+        const JSPrincipals *trusted = rt->trustedPrincipals();
         zone->isSystem = principals && principals == trusted;
     }
 
     ScopedJSDeletePtr<JSCompartment> compartment(cx->new_<JSCompartment>(zone, options));
     if (!compartment || !compartment->init(cx))
         return NULL;
 
     // Set up the principals.
--- a/js/src/jskwgen.cpp
+++ b/js/src/jskwgen.cpp
@@ -8,17 +8,17 @@
 #include <ctype.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include "vm/Keywords.h"
 
-const char * const keyword_list[] = {
+static const char * const keyword_list[] = {
 #define KEYWORD_STRING(keyword, name, type, version) #keyword,
     FOR_EACH_JAVASCRIPT_KEYWORD(KEYWORD_STRING)
 #undef KEYWORD_STRING
 };
 
 struct gen_opt {
     FILE *output;                       /* output file for generated source */
     unsigned use_if_threshold;          /* max number of choices to generate
--- a/js/src/jsproxy.cpp
+++ b/js/src/jsproxy.cpp
@@ -71,17 +71,17 @@ js::assertEnteredPolicy(JSContext *cx, J
 {
     MOZ_ASSERT(proxy->is<ProxyObject>());
     MOZ_ASSERT(cx->runtime()->enteredPolicy);
     MOZ_ASSERT(cx->runtime()->enteredPolicy->enteredProxy.ref().get() == proxy);
     MOZ_ASSERT(cx->runtime()->enteredPolicy->enteredId.ref().get() == id);
 }
 #endif
 
-BaseProxyHandler::BaseProxyHandler(void *family)
+BaseProxyHandler::BaseProxyHandler(const void *family)
   : mFamily(family),
     mHasPrototype(false),
     mHasPolicy(false)
 {
 }
 
 BaseProxyHandler::~BaseProxyHandler()
 {
@@ -519,17 +519,17 @@ DirectProxyHandler::regexp_toShared(JSCo
 }
 
 JSObject *
 DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy)
 {
     return UncheckedUnwrap(proxy);
 }
 
-DirectProxyHandler::DirectProxyHandler(void *family)
+DirectProxyHandler::DirectProxyHandler(const void *family)
   : BaseProxyHandler(family)
 {
 }
 
 bool
 DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp)
 {
     assertEnteredPolicy(cx, proxy, id);
@@ -780,17 +780,18 @@ class ScriptedIndirectProxyHandler : pub
                             CallArgs args) MOZ_OVERRIDE;
     virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) MOZ_OVERRIDE;
 
     static ScriptedIndirectProxyHandler singleton;
 };
 
 } /* anonymous namespace */
 
-static int sScriptedIndirectProxyHandlerFamily = 0;
+// This variable exists solely to provide a unique address for use as an identifier.
+static const char sScriptedIndirectProxyHandlerFamily = 0;
 
 ScriptedIndirectProxyHandler::ScriptedIndirectProxyHandler()
         : BaseProxyHandler(&sScriptedIndirectProxyHandlerFamily)
 {
 }
 
 ScriptedIndirectProxyHandler::~ScriptedIndirectProxyHandler()
 {
@@ -1078,17 +1079,18 @@ class ScriptedDirectProxyHandler : publi
 
     /* Spidermonkey extensions. */
     virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE;
     virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE;
 
     static ScriptedDirectProxyHandler singleton;
 };
 
-static int sScriptedDirectProxyHandlerFamily = 0;
+// This variable exists solely to provide a unique address for use as an identifier.
+static const char sScriptedDirectProxyHandlerFamily = 0;
 
 // Aux.2 FromGenericPropertyDescriptor(Desc)
 static bool
 FromGenericPropertyDescriptor(JSContext *cx, PropDesc *desc, MutableHandleValue rval)
 {
     // Aux.2 step 1
     if (desc->isUndefined()) {
         rval.setUndefined();
--- a/js/src/jsproxy.h
+++ b/js/src/jsproxy.h
@@ -62,37 +62,37 @@ class JS_FRIEND_API(Wrapper);
  * BaseProxyHandler is the most generic kind of proxy handler. It does not make
  * any assumptions about the target. Consequently, it does not provide any
  * default implementation for the fundamental traps. It does, however, implement
  * the derived traps in terms of the fundamental ones. This allows consumers of
  * this class to define any custom behavior they want.
  */
 class JS_FRIEND_API(BaseProxyHandler)
 {
-    void *mFamily;
+    const void *mFamily;
     bool mHasPrototype;
     bool mHasPolicy;
   protected:
     // Subclasses may set this in their constructor.
     void setHasPrototype(bool aHasPrototype) { mHasPrototype = aHasPrototype; }
     void setHasPolicy(bool aHasPolicy) { mHasPolicy = aHasPolicy; }
 
   public:
-    explicit BaseProxyHandler(void *family);
+    explicit BaseProxyHandler(const void *family);
     virtual ~BaseProxyHandler();
 
     bool hasPrototype() {
         return mHasPrototype;
     }
 
     bool hasPolicy() {
         return mHasPolicy;
     }
 
-    inline void *family() {
+    inline const void *family() {
         return mFamily;
     }
     static size_t offsetOfFamily() {
         return offsetof(BaseProxyHandler, mFamily);
     }
 
     virtual bool isOuterWindow() {
         return false;
@@ -174,17 +174,17 @@ class JS_FRIEND_API(BaseProxyHandler)
  * DirectProxyHandler includes a notion of a target object. All traps are
  * reimplemented such that they forward their behavior to the target. This
  * allows consumers of this class to forward to another object as transparently
  * and efficiently as possible.
  */
 class JS_PUBLIC_API(DirectProxyHandler) : public BaseProxyHandler
 {
   public:
-    explicit DirectProxyHandler(void *family);
+    explicit DirectProxyHandler(const void *family);
 
     /* ES5 Harmony fundamental proxy traps. */
     virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE;
     virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id,
                                        MutableHandle<JSPropertyDescriptor> desc, unsigned flags) MOZ_OVERRIDE;
     virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy,
                                           HandleId id, MutableHandle<JSPropertyDescriptor> desc,
                                           unsigned flags) MOZ_OVERRIDE;
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -101,18 +101,18 @@ str_encodeURI_Component(JSContext *cx, u
 
 
 /* ES5 B.2.1 */
 static bool
 str_escape(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
-    const char digits[] = {'0', '1', '2', '3', '4', '5', '6', '7',
-                           '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+    static const char digits[] = {'0', '1', '2', '3', '4', '5', '6', '7',
+                                  '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
 
     JSLinearString *str = ArgToRootedString(cx, args, 0);
     if (!str)
         return false;
 
     size_t length = str->length();
     const jschar *chars = str->chars();
 
--- a/js/src/jswrapper.cpp
+++ b/js/src/jswrapper.cpp
@@ -16,17 +16,17 @@
 #include "vm/ErrorObject.h"
 #include "vm/WrapperObject.h"
 
 #include "jsobjinlines.h"
 
 using namespace js;
 using namespace js::gc;
 
-int js::sWrapperFamily;
+const char js::sWrapperFamily = 0;
 
 /*
  * Wrapper forwards this call directly to the wrapped object for efficiency
  * and transparency. In particular, the hint is needed to properly stringify
  * Date objects in certain cases - see bug 646129. Note also the
  * SecurityWrapper overrides this trap to avoid information leaks. See bug
  * 720619.
  */
@@ -828,17 +828,17 @@ DeadObjectProxy::getElementIfPresent(JSC
 bool
 DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop)
 {
     protop.set(NULL);
     return true;
 }
 
 DeadObjectProxy DeadObjectProxy::singleton;
-int DeadObjectProxy::sDeadObjectFamily;
+const char DeadObjectProxy::sDeadObjectFamily = 0;
 
 JSObject *
 js::NewDeadProxyObject(JSContext *cx, JSObject *parent)
 {
     return NewProxyObject(cx, &DeadObjectProxy::singleton, JS::NullHandleValue,
                           NULL, parent, ProxyNotCallable);
 }
 
--- a/js/src/jswrapper.h
+++ b/js/src/jswrapper.h
@@ -164,17 +164,18 @@ class JS_FRIEND_API(SecurityWrapper) : p
 };
 
 typedef SecurityWrapper<Wrapper> SameCompartmentSecurityWrapper;
 typedef SecurityWrapper<CrossCompartmentWrapper> CrossCompartmentSecurityWrapper;
 
 class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler
 {
   public:
-    static int sDeadObjectFamily;
+    // This variable exists solely to provide a unique address for use as an identifier.
+    static const char sDeadObjectFamily;
 
     explicit DeadObjectProxy();
 
     /* ES5 Harmony fundamental wrapper traps. */
     virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE;
     virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id,
                                        MutableHandle<JSPropertyDescriptor> desc,
                                        unsigned flags) MOZ_OVERRIDE;
@@ -214,17 +215,18 @@ class JS_FRIEND_API(DeadObjectProxy) : p
 
 extern JSObject *
 TransparentObjectWrapper(JSContext *cx, HandleObject existing, HandleObject obj,
                          HandleObject wrappedProto, HandleObject parent,
                          unsigned flags);
 
 // Proxy family for wrappers. Public so that IsWrapper() can be fully inlined by
 // jsfriendapi users.
-extern JS_FRIEND_DATA(int) sWrapperFamily;
+// This variable exists solely to provide a unique address for use as an identifier.
+extern JS_FRIEND_DATA(const char) sWrapperFamily;
 
 inline bool
 IsWrapper(JSObject *obj)
 {
     return IsProxy(obj) && GetProxyHandler(obj)->family() == &sWrapperFamily;
 }
 
 // Given a JSObject, returns that object stripped of wrappers. If
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -75,33 +75,33 @@
 #endif
 
 using namespace js;
 using namespace js::cli;
 
 using mozilla::ArrayLength;
 using mozilla::Maybe;
 
-typedef enum JSShellExitCode {
+enum JSShellExitCode {
     EXITCODE_RUNTIME_ERROR      = 3,
     EXITCODE_FILE_NOT_FOUND     = 4,
     EXITCODE_OUT_OF_MEMORY      = 5,
     EXITCODE_TIMEOUT            = 6
-} JSShellExitCode;
-
-size_t gStackChunkSize = 8192;
+};
+
+static size_t gStackChunkSize = 8192;
 
 /*
  * Note: This limit should match the stack limit set by the browser in
  *       js/xpconnect/src/XPCJSRuntime.cpp
  */
 #if defined(MOZ_ASAN) || (defined(DEBUG) && !defined(XP_WIN))
-size_t gMaxStackSize = 2 * 128 * sizeof(size_t) * 1024;
+static size_t gMaxStackSize = 2 * 128 * sizeof(size_t) * 1024;
 #else
-size_t gMaxStackSize = 128 * sizeof(size_t) * 1024;
+static size_t gMaxStackSize = 128 * sizeof(size_t) * 1024;
 #endif
 
 #ifdef JS_THREADSAFE
 static unsigned gStackBaseThreadIndex;
 #else
 static uintptr_t gStackBase;
 #endif
 
@@ -151,38 +151,38 @@ static int64_t gWatchdogTimeout = 0;
 static PRCondVar *gSleepWakeup = NULL;
 
 #else
 
 static JSRuntime *gRuntime = NULL;
 
 #endif
 
-int gExitCode = 0;
-bool gQuitting = false;
-bool gGotError = false;
-FILE *gErrFile = NULL;
-FILE *gOutFile = NULL;
+static int gExitCode = 0;
+static bool gQuitting = false;
+static bool gGotError = false;
+static FILE *gErrFile = NULL;
+static FILE *gOutFile = NULL;
 
 static bool reportWarnings = true;
 static bool compileOnly = false;
 static bool fuzzingSafe = false;
 
 #ifdef DEBUG
 static bool dumpEntrainedVariables = false;
 static bool OOM_printAllocationCount = false;
 #endif
 
-typedef enum JSShellErrNum {
+enum JSShellErrNum {
 #define MSG_DEF(name, number, count, exception, format) \
     name = number,
 #include "jsshell.msg"
 #undef MSG_DEF
     JSShellErr_Limit
-} JSShellErrNum;
+};
 
 static JSContext *
 NewContext(JSRuntime *rt);
 
 static void
 DestroyContext(JSContext *cx, bool withGC);
 
 static const JSErrorFormatString *
@@ -607,18 +607,16 @@ MapContextOptionNameToFlag(JSContext* cx
         JS_ReportOutOfMemory(cx);
     } else {
         JS_ReportError(cx, msg);
         free(msg);
     }
     return 0;
 }
 
-extern const JSClass global_class;
-
 static bool
 Version(JSContext *cx, unsigned argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     JSVersion origVersion = JS_GetVersion(cx);
     if (args.length() == 0 || JSVAL_IS_VOID(args[0])) {
         /* Get version. */
         args.rval().setInt32(origVersion);
@@ -4249,17 +4247,17 @@ Help(JSContext *cx, unsigned argc, jsval
                 return false;
         }
     }
 
     JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
-JSErrorFormatString jsShell_ErrorFormatString[JSShellErr_Limit] = {
+static const JSErrorFormatString jsShell_ErrorFormatString[JSShellErr_Limit] = {
 #define MSG_DEF(name, number, count, exception, format) \
     { format, count, JSEXN_ERR } ,
 #include "jsshell.msg"
 #undef MSG_DEF
 };
 
 static const JSErrorFormatString *
 my_GetErrorMessage(void *userRef, const char *locale, const unsigned errorNumber)
@@ -4421,17 +4419,17 @@ global_resolve(JSContext *cx, HandleObje
     }
     JS_free(cx, path);
     return ok;
 #else
     return true;
 #endif
 }
 
-const JSClass global_class = {
+static const JSClass global_class = {
     "global", JSCLASS_NEW_RESOLVE | JSCLASS_GLOBAL_FLAGS,
     JS_PropertyStub,  JS_DeletePropertyStub,
     JS_PropertyStub,  JS_StrictPropertyStub,
     global_enumerate, (JSResolveOp) global_resolve,
     JS_ConvertStub,   NULL
 };
 
 static bool
@@ -4583,35 +4581,35 @@ dom_doFoo(JSContext* cx, HandleObject ob
     JS_ASSERT(JS_GetClass(obj) == GetDomClass());
     JS_ASSERT(self == (void *)0x1234);
 
     /* Just return args.length(). */
     args.rval().setInt32(args.length());
     return true;
 }
 
-const JSJitInfo dom_x_getterinfo = {
+static const JSJitInfo dom_x_getterinfo = {
     { (JSJitGetterOp)dom_get_x },
     0,        /* protoID */
     0,        /* depth */
     JSJitInfo::Getter,
     true,     /* isInfallible. False in setters. */
     true      /* isConstant. Only relevant for getters. */
 };
 
-const JSJitInfo dom_x_setterinfo = {
+static const JSJitInfo dom_x_setterinfo = {
     { (JSJitGetterOp)dom_set_x },
     0,        /* protoID */
     0,        /* depth */
     JSJitInfo::Setter,
     false,    /* isInfallible. False in setters. */
     false     /* isConstant. Only relevant for getters. */
 };
 
-const JSJitInfo doFoo_methodinfo = {
+static const JSJitInfo doFoo_methodinfo = {
     { (JSJitGetterOp)dom_doFoo },
     0,        /* protoID */
     0,        /* depth */
     JSJitInfo::Method,
     false,    /* isInfallible. False in setters. */
     false     /* isConstant. Only relevant for getters. */
 };
 
@@ -5123,17 +5121,17 @@ ProcessArgs(JSContext *cx, JSObject *obj
     }
 
     if (op->getBoolOption('i'))
         Process(cx, obj, NULL, true);
 
     return gExitCode ? gExitCode : EXIT_SUCCESS;
 }
 
-int
+static int
 Shell(JSContext *cx, OptionParser *op, char **envp)
 {
     JSAutoRequest ar(cx);
 
     /*
      * First check to see if type inference is enabled. These flags
      * must be set on the compartment when it is constructed.
      */
@@ -5175,26 +5173,26 @@ MaybeOverrideOutFileFromEnv(const char* 
 {
     const char* outPath = getenv(envVar);
     if (!outPath || !*outPath || !(*outFile = fopen(outPath, "w"))) {
         *outFile = defaultOut;
     }
 }
 
 /* Set the initial counter to 1 so the principal will never be destroyed. */
-JSPrincipals shellTrustedPrincipals = { 1 };
-
-bool
+static const JSPrincipals shellTrustedPrincipals = { 1 };
+
+static bool
 CheckObjectAccess(JSContext *cx, HandleObject obj, HandleId id, JSAccessMode mode,
                   MutableHandleValue vp)
 {
     return true;
 }
 
-const JSSecurityCallbacks securityCallbacks = {
+static const JSSecurityCallbacks securityCallbacks = {
     CheckObjectAccess,
     NULL
 };
 
 /* Pretend we can always preserve wrappers for dummy DOM objects. */
 static bool
 DummyPreserveWrapperCallback(JSContext *cx, JSObject *obj)
 {
--- a/js/src/vm/Runtime.h
+++ b/js/src/vm/Runtime.h
@@ -1388,20 +1388,20 @@ struct JSRuntime : public JS::shadow::Ru
     js::frontend::ParseMapPool parseMapPool_;
   public:
     js::frontend::ParseMapPool &parseMapPool() {
         JS_ASSERT(currentThreadHasExclusiveAccess());
         return parseMapPool_;
     }
 
   private:
-    JSPrincipals        *trustedPrincipals_;
+    const JSPrincipals  *trustedPrincipals_;
   public:
-    void setTrustedPrincipals(JSPrincipals *p) { trustedPrincipals_ = p; }
-    JSPrincipals *trustedPrincipals() const { return trustedPrincipals_; }
+    void setTrustedPrincipals(const JSPrincipals *p) { trustedPrincipals_ = p; }
+    const JSPrincipals *trustedPrincipals() const { return trustedPrincipals_; }
 
     // Set of all currently-living atoms, and the compartment in which they
     // reside. The atoms compartment is additionally used to hold runtime
     // wide Ion code stubs. These may be modified by threads with an
     // ExclusiveContext and require a lock.
   private:
     js::AtomSet atoms_;
     JSCompartment *atomsCompartment_;
--- a/js/src/vm/WrapperObject.h
+++ b/js/src/vm/WrapperObject.h
@@ -10,17 +10,18 @@
 #include "jsobj.h"
 #include "jswrapper.h"
 
 #include "vm/ProxyObject.h"
 
 namespace js {
 
 // Proxy family for wrappers.
-extern int sWrapperFamily;
+// This variable exists solely to provide a unique address for use as an identifier.
+extern const char sWrapperFamily;
 
 class WrapperObject : public ProxyObject
 {
 };
 
 class CrossCompartmentWrapperObject : public WrapperObject
 {
 };
--- a/js/xpconnect/shell/xpcshell.cpp
+++ b/js/xpconnect/shell/xpcshell.cpp
@@ -1021,17 +1021,17 @@ static const JSClass env_class = {
 typedef enum JSShellErrNum {
 #define MSG_DEF(name, number, count, exception, format) \
     name = number,
 #include "jsshell.msg"
 #undef MSG_DEF
     JSShellErr_Limit
 } JSShellErrNum;
 
-JSErrorFormatString jsShell_ErrorFormatString[JSShellErr_Limit] = {
+const JSErrorFormatString jsShell_ErrorFormatString[JSShellErr_Limit] = {
 #define MSG_DEF(name, number, count, exception, format) \
     { format, count } ,
 #include "jsshell.msg"
 #undef MSG_DEF
 };
 
 static const JSErrorFormatString *
 my_GetErrorMessage(void *userRef, const char *locale, const unsigned errorNumber)
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -376,17 +376,17 @@ CloneNonReflectorsWrite(JSContext *cx, J
             return true;
         }
     }
 
     JS_ReportError(cx, "CloneNonReflectorsWrite error");
     return false;
 }
 
-JSStructuredCloneCallbacks gForwarderStructuredCloneCallbacks = {
+const JSStructuredCloneCallbacks gForwarderStructuredCloneCallbacks = {
     CloneNonReflectorsRead,
     CloneNonReflectorsWrite,
     nullptr
 };
 
 /*
  * This is a special structured cloning, that clones only non-reflectors.
  * The function assumes the cx is already entered the compartment we want
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -153,18 +153,18 @@ nsJSID::ToString(char **_retval)
 
     return GetNumber(_retval);
 }
 
 const nsID&
 nsJSID::GetInvalidIID() const
 {
     // {BB1F47B0-D137-11d2-9841-006008962422}
-    static nsID invalid = {0xbb1f47b0, 0xd137, 0x11d2,
-                            {0x98, 0x41, 0x0, 0x60, 0x8, 0x96, 0x24, 0x22}};
+    static const nsID invalid = {0xbb1f47b0, 0xd137, 0x11d2,
+                                  {0x98, 0x41, 0x0, 0x60, 0x8, 0x96, 0x24, 0x22}};
     return invalid;
 }
 
 //static
 nsJSID*
 nsJSID::NewID(const char* str)
 {
     if (!str) {
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -49,17 +49,17 @@
 
 using namespace mozilla;
 using namespace xpc;
 using namespace JS;
 using mozilla::dom::PerThreadAtomCache;
 
 /***************************************************************************/
 
-const char* XPCJSRuntime::mStrings[] = {
+const char* const XPCJSRuntime::mStrings[] = {
     "constructor",          // IDX_CONSTRUCTOR
     "toString",             // IDX_TO_STRING
     "toSource",             // IDX_TO_SOURCE
     "lastResult",           // IDX_LAST_RESULT
     "returnCode",           // IDX_RETURN_CODE
     "value",                // IDX_VALUE
     "QueryInterface",       // IDX_QUERY_INTERFACE
     "Components",           // IDX_COMPONENTS
--- a/js/xpconnect/src/XPCMaps.cpp
+++ b/js/xpconnect/src/XPCMaps.cpp
@@ -152,17 +152,17 @@ Native2WrappedNativeMap::SizeOfEntryExcl
                                                   mozilla::MallocSizeOf mallocSizeOf, void *)
 {
     return mallocSizeOf(((Native2WrappedNativeMap::Entry*)hdr)->value);
 }
 
 /***************************************************************************/
 // implement IID2WrappedJSClassMap...
 
-struct PLDHashTableOps IID2WrappedJSClassMap::Entry::sOps =
+const struct PLDHashTableOps IID2WrappedJSClassMap::Entry::sOps =
 {
     PL_DHashAllocTable,
     PL_DHashFreeTable,
     HashIIDPtrKey,
     MatchIIDPtrKey,
     PL_DHashMoveEntryStub,
     PL_DHashClearEntryStub,
     PL_DHashFinalizeStub
@@ -189,17 +189,17 @@ IID2WrappedJSClassMap::~IID2WrappedJSCla
     if (mTable)
         PL_DHashTableDestroy(mTable);
 }
 
 
 /***************************************************************************/
 // implement IID2NativeInterfaceMap...
 
-struct PLDHashTableOps IID2NativeInterfaceMap::Entry::sOps =
+const struct PLDHashTableOps IID2NativeInterfaceMap::Entry::sOps =
 {
     PL_DHashAllocTable,
     PL_DHashFreeTable,
     HashIIDPtrKey,
     MatchIIDPtrKey,
     PL_DHashMoveEntryStub,
     PL_DHashClearEntryStub,
     PL_DHashFinalizeStub
@@ -396,17 +396,17 @@ NativeSetMap::Entry::Match(PLDHashTable 
             if (*(Current++) != *(CurrentInTable++))
                 return false;
         }
     }
 
     return true;
 }
 
-struct PLDHashTableOps NativeSetMap::Entry::sOps =
+const struct PLDHashTableOps NativeSetMap::Entry::sOps =
 {
     PL_DHashAllocTable,
     PL_DHashFreeTable,
     HashNativeKey,
     Match,
     PL_DHashMoveEntryStub,
     PL_DHashClearEntryStub,
     PL_DHashFinalizeStub
@@ -463,17 +463,17 @@ IID2ThisTranslatorMap::Entry::Match(PLDH
 
 void
 IID2ThisTranslatorMap::Entry::Clear(PLDHashTable *table, PLDHashEntryHdr *entry)
 {
     NS_IF_RELEASE(((Entry*)entry)->value);
     memset(entry, 0, table->entrySize);
 }
 
-struct PLDHashTableOps IID2ThisTranslatorMap::Entry::sOps =
+const struct PLDHashTableOps IID2ThisTranslatorMap::Entry::sOps =
 {
     PL_DHashAllocTable,
     PL_DHashFreeTable,
     HashIIDPtrKey,
     Match,
     PL_DHashMoveEntryStub,
     Clear,
     PL_DHashFinalizeStub
@@ -543,17 +543,17 @@ XPCNativeScriptableSharedMap::Entry::Mat
     const char* name2 = obj2->GetJSClass()->name;
 
     if (!name1 || !name2)
         return name1 == name2;
 
     return 0 == strcmp(name1, name2);
 }
 
-struct PLDHashTableOps XPCNativeScriptableSharedMap::Entry::sOps =
+const struct PLDHashTableOps XPCNativeScriptableSharedMap::Entry::sOps =
 {
     PL_DHashAllocTable,
     PL_DHashFreeTable,
     Hash,
     Match,
     PL_DHashMoveEntryStub,
     PL_DHashClearEntryStub,
     PL_DHashFinalizeStub
--- a/js/xpconnect/src/XPCMaps.h
+++ b/js/xpconnect/src/XPCMaps.h
@@ -170,17 +170,17 @@ private:
 class IID2WrappedJSClassMap
 {
 public:
     struct Entry : public PLDHashEntryHdr
     {
         const nsIID*         key;
         nsXPCWrappedJSClass* value;
 
-        static struct PLDHashTableOps sOps;
+        static const struct PLDHashTableOps sOps;
     };
 
     static IID2WrappedJSClassMap* newMap(int size);
 
     inline nsXPCWrappedJSClass* Find(REFNSIID iid)
     {
         Entry* entry = (Entry*)
             PL_DHashTableOperate(mTable, &iid, PL_DHASH_LOOKUP);
@@ -227,17 +227,17 @@ private:
 class IID2NativeInterfaceMap
 {
 public:
     struct Entry : public PLDHashEntryHdr
     {
         const nsIID*        key;
         XPCNativeInterface* value;
 
-        static struct PLDHashTableOps sOps;
+        static const struct PLDHashTableOps sOps;
     };
 
     static IID2NativeInterfaceMap* newMap(int size);
 
     inline XPCNativeInterface* Find(REFNSIID iid)
     {
         Entry* entry = (Entry*)
             PL_DHashTableOperate(mTable, &iid, PL_DHASH_LOOKUP);
@@ -412,17 +412,17 @@ public:
     {
         XPCNativeSet* key_value;
 
         static bool
         Match(PLDHashTable *table,
               const PLDHashEntryHdr *entry,
               const void *key);
 
-        static struct PLDHashTableOps sOps;
+        static const struct PLDHashTableOps sOps;
     };
 
     static NativeSetMap* newMap(int size);
 
     inline XPCNativeSet* Find(XPCNativeSetKey* key)
     {
         Entry* entry = (Entry*)
             PL_DHashTableOperate(mTable, key, PL_DHASH_LOOKUP);
@@ -489,17 +489,17 @@ public:
         static bool
         Match(PLDHashTable *table,
               const PLDHashEntryHdr *entry,
               const void *key);
 
         static void
         Clear(PLDHashTable *table, PLDHashEntryHdr *entry);
 
-        static struct PLDHashTableOps sOps;
+        static const struct PLDHashTableOps sOps;
     };
 
     static IID2ThisTranslatorMap* newMap(int size);
 
     inline nsIXPCFunctionThisTranslator* Find(REFNSIID iid)
     {
         Entry* entry = (Entry*)
             PL_DHashTableOperate(mTable, &iid, PL_DHASH_LOOKUP);
@@ -552,17 +552,17 @@ public:
         static PLDHashNumber
         Hash(PLDHashTable *table, const void *key);
 
         static bool
         Match(PLDHashTable *table,
               const PLDHashEntryHdr *entry,
               const void *key);
 
-        static struct PLDHashTableOps sOps;
+        static const struct PLDHashTableOps sOps;
     };
 
     static XPCNativeScriptableSharedMap* newMap(int size);
 
     bool GetNewOrUsed(uint32_t flags, char* name, uint32_t interfacesBitmap,
                       XPCNativeScriptableInfo* si);
 
     inline uint32_t Count() {return mTable->entryCount;}
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -781,17 +781,17 @@ public:
     void OnAfterProcessNextEvent() { mSlowScriptCheckpoint = mozilla::TimeStamp(); }
 
 private:
     XPCJSRuntime(); // no implementation
     XPCJSRuntime(nsXPConnect* aXPConnect);
 
     void ReleaseIncrementally(nsTArray<nsISupports *> &array);
 
-    static const char* mStrings[IDX_TOTAL_COUNT];
+    static const char* const mStrings[IDX_TOTAL_COUNT];
     jsid mStrIDs[IDX_TOTAL_COUNT];
     jsval mStrJSVals[IDX_TOTAL_COUNT];
 
     XPCJSContextStack*       mJSContextStack;
     XPCCallContext*          mCallContext;
     AutoMarkingPtr*          mAutoRoots;
     jsid                     mResolveName;
     XPCWrappedNative*        mResolvingWrapper;