Bug 918023 - SpiderMonkey: Const-qualify various static variables. r=njn

This commit is contained in:
Dan Gohman 2013-09-24 08:21:22 -07:00
Родитель 2f2cd5508e
Коммит 69a7a0d34e
32 изменённых файлов: 109 добавлений и 101 удалений

Просмотреть файл

@ -33,7 +33,7 @@ DefineStaticJSVals(JSContext* cx)
}
int HandlerFamily;
const char HandlerFamily = 0;
js::DOMProxyShadowsResult
DOMProxyShadows(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id)
@ -62,7 +62,7 @@ DOMProxyShadows(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id)
struct SetDOMProxyInformation
{
SetDOMProxyInformation() {
js::SetDOMProxyInformation((void*) &HandlerFamily,
js::SetDOMProxyInformation((const void*) &HandlerFamily,
js::PROXY_EXTRA_SLOT + JSPROXYSLOT_EXPANDO, DOMProxyShadows);
}
};

Просмотреть файл

@ -27,8 +27,9 @@ enum {
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)
{
@ -45,7 +46,7 @@ inline bool IsDOMProxy(JSObject *obj)
class BaseDOMProxyHandler : public js::BaseProxyHandler
{
public:
BaseDOMProxyHandler(void* aProxyFamily)
BaseDOMProxyHandler(const void* aProxyFamily)
: js::BaseProxyHandler(aProxyFamily)
{}

Просмотреть файл

@ -186,7 +186,7 @@ jsd_free_script_entry(void *priv, JSHashEntry *he, unsigned flag)
}
}
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
};

Просмотреть файл

@ -1002,9 +1002,11 @@ jsdScript::CreatePPLineMap()
}
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)))

Просмотреть файл

@ -64,7 +64,7 @@ DefaultFreeEntry(void *pool, JSHashEntry *he, unsigned flag)
js_free(he);
}
static JSHashAllocOps defaultHashAllocOps = {
static const JSHashAllocOps defaultHashAllocOps = {
DefaultAllocTable, DefaultFreeTable,
DefaultAllocEntry, DefaultFreeEntry
};
@ -72,7 +72,7 @@ static JSHashAllocOps defaultHashAllocOps = {
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;
@ -114,7 +114,7 @@ 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);

Просмотреть файл

@ -56,7 +56,7 @@ struct JSHashTable {
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 */
@ -73,7 +73,7 @@ struct JSHashTable {
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);

Просмотреть файл

@ -186,10 +186,12 @@ ParallelArrayObject::initClass(JSContext *cx, HandleObject obj)
// 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)

Просмотреть файл

@ -787,7 +787,7 @@ GetABICode(JSObject* obj)
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"

Просмотреть файл

@ -304,7 +304,7 @@ class MacroAssembler : public MacroAssemblerSpecific
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());

Просмотреть файл

@ -884,7 +884,7 @@ JS_SetVersionForCompartment(JSCompartment *compartment, JSVersion version)
compartment->options().setVersion(version);
}
static struct v2smap {
static const struct v2smap {
JSVersion version;
const char *string;
} v2smap[] = {
@ -3992,7 +3992,7 @@ JS_GetSecurityCallbacks(JSRuntime *rt)
}
JS_PUBLIC_API(void)
JS_SetTrustedPrincipals(JSRuntime *rt, JSPrincipals *prin)
JS_SetTrustedPrincipals(JSRuntime *rt, const JSPrincipals *prin)
{
rt->setTrustedPrincipals(prin);
}
@ -4661,7 +4661,7 @@ JS_GetGlobalFromScript(JSScript *script)
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()));
@ -4705,7 +4705,7 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, CompileOptions options,
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;
@ -4723,7 +4723,7 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, CompileOptions options,
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)
{
@ -4737,7 +4737,7 @@ JS_CompileUCFunction(JSContext *cx, JSObject *objArg, const char *name,
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)
{
@ -4751,7 +4751,7 @@ JS_CompileFunctionForPrincipals(JSContext *cx, JSObject *objArg,
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)
{

Просмотреть файл

@ -3074,7 +3074,7 @@ JS_GetSecurityCallbacks(JSRuntime *rt);
* 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
@ -3216,20 +3216,20 @@ 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);
@ -3330,12 +3330,12 @@ 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 */

Просмотреть файл

@ -1358,7 +1358,7 @@ CompareStringValues(JSContext *cx, const Value &a, const Value &b, bool *lessOrE
return true;
}
static uint64_t const powersOf10[] = {
static const uint64_t powersOf10[] = {
1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 1000000000000ULL
};

Просмотреть файл

@ -1190,7 +1190,7 @@ ComputeIsJITBroken()
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
@ -1199,7 +1199,7 @@ ComputeIsJITBroken()
"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);

Просмотреть файл

@ -218,7 +218,7 @@ JS_SetCompartmentPrincipals(JSCompartment *compartment, JSPrincipals *principals
// 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.
@ -1031,12 +1031,12 @@ 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;
@ -1044,7 +1044,7 @@ js::SetDOMProxyInformation(void *domProxyHandlerFamily, uint32_t domProxyExpando
gDOMProxyShadowsCheck = domProxyShadowsCheck;
}
void *
const void *
js::GetDOMProxyHandlerFamily()
{
return gDOMProxyHandlerFamily;

Просмотреть файл

@ -854,10 +854,10 @@ typedef enum 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();

Просмотреть файл

@ -4790,7 +4790,7 @@ js::NewCompartment(JSContext *cx, Zone *zone, JSPrincipals *principals,
zone->setGCLastBytes(8192, GC_NORMAL);
JSPrincipals *trusted = rt->trustedPrincipals();
const JSPrincipals *trusted = rt->trustedPrincipals();
zone->isSystem = principals && principals == trusted;
}

Просмотреть файл

@ -13,7 +13,7 @@
#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

Просмотреть файл

@ -76,7 +76,7 @@ js::assertEnteredPolicy(JSContext *cx, JSObject *proxy, jsid id)
}
#endif
BaseProxyHandler::BaseProxyHandler(void *family)
BaseProxyHandler::BaseProxyHandler(const void *family)
: mFamily(family),
mHasPrototype(false),
mHasPolicy(false)
@ -524,7 +524,7 @@ DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy)
return UncheckedUnwrap(proxy);
}
DirectProxyHandler::DirectProxyHandler(void *family)
DirectProxyHandler::DirectProxyHandler(const void *family)
: BaseProxyHandler(family)
{
}
@ -785,7 +785,8 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler
} /* 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)
@ -1083,7 +1084,8 @@ class ScriptedDirectProxyHandler : public DirectProxyHandler {
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

Просмотреть файл

@ -67,7 +67,7 @@ class JS_FRIEND_API(Wrapper);
*/
class JS_FRIEND_API(BaseProxyHandler)
{
void *mFamily;
const void *mFamily;
bool mHasPrototype;
bool mHasPolicy;
protected:
@ -76,7 +76,7 @@ class JS_FRIEND_API(BaseProxyHandler)
void setHasPolicy(bool aHasPolicy) { mHasPolicy = aHasPolicy; }
public:
explicit BaseProxyHandler(void *family);
explicit BaseProxyHandler(const void *family);
virtual ~BaseProxyHandler();
bool hasPrototype() {
@ -87,7 +87,7 @@ class JS_FRIEND_API(BaseProxyHandler)
return mHasPolicy;
}
inline void *family() {
inline const void *family() {
return mFamily;
}
static size_t offsetOfFamily() {
@ -179,7 +179,7 @@ class JS_FRIEND_API(BaseProxyHandler)
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;

Просмотреть файл

@ -106,8 +106,8 @@ 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)

Просмотреть файл

@ -21,7 +21,7 @@
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
@ -833,7 +833,7 @@ DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandle
}
DeadObjectProxy DeadObjectProxy::singleton;
int DeadObjectProxy::sDeadObjectFamily;
const char DeadObjectProxy::sDeadObjectFamily = 0;
JSObject *
js::NewDeadProxyObject(JSContext *cx, JSObject *parent)

Просмотреть файл

@ -169,7 +169,8 @@ 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();
@ -219,7 +220,8 @@ TransparentObjectWrapper(JSContext *cx, HandleObject existing, HandleObject obj,
// 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)

Просмотреть файл

@ -80,23 +80,23 @@ 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
@ -156,11 +156,11 @@ 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;
@ -171,13 +171,13 @@ 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);
@ -612,8 +612,6 @@ MapContextOptionNameToFlag(JSContext* cx, const char* name)
return 0;
}
extern const JSClass global_class;
static bool
Version(JSContext *cx, unsigned argc, jsval *vp)
{
@ -4254,7 +4252,7 @@ Help(JSContext *cx, unsigned argc, jsval *vp)
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"
@ -4426,7 +4424,7 @@ global_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
#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,
@ -4588,7 +4586,7 @@ dom_doFoo(JSContext* cx, HandleObject obj, void *self, const JSJitMethodCallArgs
return true;
}
const JSJitInfo dom_x_getterinfo = {
static const JSJitInfo dom_x_getterinfo = {
{ (JSJitGetterOp)dom_get_x },
0, /* protoID */
0, /* depth */
@ -4597,7 +4595,7 @@ const JSJitInfo dom_x_getterinfo = {
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 */
@ -4606,7 +4604,7 @@ const JSJitInfo dom_x_setterinfo = {
false /* isConstant. Only relevant for getters. */
};
const JSJitInfo doFoo_methodinfo = {
static const JSJitInfo doFoo_methodinfo = {
{ (JSJitGetterOp)dom_doFoo },
0, /* protoID */
0, /* depth */
@ -5128,7 +5126,7 @@ ProcessArgs(JSContext *cx, JSObject *obj_, OptionParser *op)
return gExitCode ? gExitCode : EXIT_SUCCESS;
}
int
static int
Shell(JSContext *cx, OptionParser *op, char **envp)
{
JSAutoRequest ar(cx);
@ -5180,16 +5178,16 @@ MaybeOverrideOutFileFromEnv(const char* const envVar,
}
/* Set the initial counter to 1 so the principal will never be destroyed. */
JSPrincipals shellTrustedPrincipals = { 1 };
static const JSPrincipals shellTrustedPrincipals = { 1 };
bool
static bool
CheckObjectAccess(JSContext *cx, HandleObject obj, HandleId id, JSAccessMode mode,
MutableHandleValue vp)
{
return true;
}
const JSSecurityCallbacks securityCallbacks = {
static const JSSecurityCallbacks securityCallbacks = {
CheckObjectAccess,
NULL
};

Просмотреть файл

@ -1393,10 +1393,10 @@ struct JSRuntime : public JS::shadow::Runtime,
}
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

Просмотреть файл

@ -15,7 +15,8 @@
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
{

Просмотреть файл

@ -1026,7 +1026,7 @@ typedef enum JSShellErrNum {
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"

Просмотреть файл

@ -381,7 +381,7 @@ CloneNonReflectorsWrite(JSContext *cx, JSStructuredCloneWriter *writer,
return false;
}
JSStructuredCloneCallbacks gForwarderStructuredCloneCallbacks = {
const JSStructuredCloneCallbacks gForwarderStructuredCloneCallbacks = {
CloneNonReflectorsRead,
CloneNonReflectorsWrite,
nullptr

Просмотреть файл

@ -158,8 +158,8 @@ 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;
}

Просмотреть файл

@ -54,7 +54,7 @@ using mozilla::dom::PerThreadAtomCache;
/***************************************************************************/
const char* XPCJSRuntime::mStrings[] = {
const char* const XPCJSRuntime::mStrings[] = {
"constructor", // IDX_CONSTRUCTOR
"toString", // IDX_TO_STRING
"toSource", // IDX_TO_SOURCE

Просмотреть файл

@ -157,7 +157,7 @@ Native2WrappedNativeMap::SizeOfEntryExcludingThis(PLDHashEntryHdr *hdr,
/***************************************************************************/
// implement IID2WrappedJSClassMap...
struct PLDHashTableOps IID2WrappedJSClassMap::Entry::sOps =
const struct PLDHashTableOps IID2WrappedJSClassMap::Entry::sOps =
{
PL_DHashAllocTable,
PL_DHashFreeTable,
@ -194,7 +194,7 @@ IID2WrappedJSClassMap::~IID2WrappedJSClassMap()
/***************************************************************************/
// implement IID2NativeInterfaceMap...
struct PLDHashTableOps IID2NativeInterfaceMap::Entry::sOps =
const struct PLDHashTableOps IID2NativeInterfaceMap::Entry::sOps =
{
PL_DHashAllocTable,
PL_DHashFreeTable,
@ -401,7 +401,7 @@ NativeSetMap::Entry::Match(PLDHashTable *table,
return true;
}
struct PLDHashTableOps NativeSetMap::Entry::sOps =
const struct PLDHashTableOps NativeSetMap::Entry::sOps =
{
PL_DHashAllocTable,
PL_DHashFreeTable,
@ -468,7 +468,7 @@ IID2ThisTranslatorMap::Entry::Clear(PLDHashTable *table, PLDHashEntryHdr *entry)
memset(entry, 0, table->entrySize);
}
struct PLDHashTableOps IID2ThisTranslatorMap::Entry::sOps =
const struct PLDHashTableOps IID2ThisTranslatorMap::Entry::sOps =
{
PL_DHashAllocTable,
PL_DHashFreeTable,
@ -548,7 +548,7 @@ XPCNativeScriptableSharedMap::Entry::Match(PLDHashTable *table,
return 0 == strcmp(name1, name2);
}
struct PLDHashTableOps XPCNativeScriptableSharedMap::Entry::sOps =
const struct PLDHashTableOps XPCNativeScriptableSharedMap::Entry::sOps =
{
PL_DHashAllocTable,
PL_DHashFreeTable,

Просмотреть файл

@ -175,7 +175,7 @@ public:
const nsIID* key;
nsXPCWrappedJSClass* value;
static struct PLDHashTableOps sOps;
static const struct PLDHashTableOps sOps;
};
static IID2WrappedJSClassMap* newMap(int size);
@ -232,7 +232,7 @@ public:
const nsIID* key;
XPCNativeInterface* value;
static struct PLDHashTableOps sOps;
static const struct PLDHashTableOps sOps;
};
static IID2NativeInterfaceMap* newMap(int size);
@ -417,7 +417,7 @@ public:
const PLDHashEntryHdr *entry,
const void *key);
static struct PLDHashTableOps sOps;
static const struct PLDHashTableOps sOps;
};
static NativeSetMap* newMap(int size);
@ -494,7 +494,7 @@ public:
static void
Clear(PLDHashTable *table, PLDHashEntryHdr *entry);
static struct PLDHashTableOps sOps;
static const struct PLDHashTableOps sOps;
};
static IID2ThisTranslatorMap* newMap(int size);
@ -557,7 +557,7 @@ public:
const PLDHashEntryHdr *entry,
const void *key);
static struct PLDHashTableOps sOps;
static const struct PLDHashTableOps sOps;
};
static XPCNativeScriptableSharedMap* newMap(int size);

Просмотреть файл

@ -786,7 +786,7 @@ private:
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];