diff --git a/caps/src/nsSecurityManagerFactory.cpp b/caps/src/nsSecurityManagerFactory.cpp index e94bd7f1dfd..b72f4630ab2 100644 --- a/caps/src/nsSecurityManagerFactory.cpp +++ b/caps/src/nsSecurityManagerFactory.cpp @@ -53,7 +53,7 @@ netscape_security_enablePrivilege(JSContext *cx, unsigned argc, JS::Value *vp) return xpc::EnableUniversalXPConnect(cx); } -static JSFunctionSpec PrivilegeManager_static_methods[] = { +static const JSFunctionSpec PrivilegeManager_static_methods[] = { JS_FS("enablePrivilege", netscape_security_enablePrivilege, 1, 0), JS_FS_END }; diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index ff1fa55119a..40e8d2e8a0f 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -2150,7 +2150,7 @@ TraceMallocDumpAllocations(JSContext *cx, unsigned argc, JS::Value *vp) return JS_TRUE; } -static JSFunctionSpec TraceMallocFunctions[] = { +static const JSFunctionSpec TraceMallocFunctions[] = { JS_FS("TraceMallocDisable", TraceMallocDisable, 0, 0), JS_FS("TraceMallocEnable", TraceMallocEnable, 0, 0), JS_FS("TraceMallocOpenLogFile", TraceMallocOpenLogFile, 1, 0), @@ -2205,7 +2205,7 @@ ReportAndDump(JSContext *cx, unsigned argc, JS::Value *vp) } // namespace dmd } // namespace mozilla -static JSFunctionSpec DMDFunctions[] = { +static const JSFunctionSpec DMDFunctions[] = { JS_FS("DMDReportAndDump", dmd::ReportAndDump, 1, 0), JS_FS_END }; @@ -2306,7 +2306,7 @@ JProfSaveCircularJS(JSContext *cx, unsigned argc, JS::Value *vp) return JS_TRUE; } -static JSFunctionSpec JProfFunctions[] = { +static const JSFunctionSpec JProfFunctions[] = { JS_FS("JProfStartProfiling", JProfStartProfilingJS, 0, 0), JS_FS("JProfStopProfiling", JProfStopProfilingJS, 0, 0), JS_FS("JProfClearCircular", JProfClearCircularJS, 0, 0), diff --git a/dom/indexedDB/IDBKeyRange.cpp b/dom/indexedDB/IDBKeyRange.cpp index 9f89a74c4c9..cd1e487aabb 100644 --- a/dom/indexedDB/IDBKeyRange.cpp +++ b/dom/indexedDB/IDBKeyRange.cpp @@ -225,8 +225,7 @@ IDBKeyRange::DefineConstructors(JSContext* aCx, NS_ASSERTION(aObject, "Null pointer!"); // Add the constructor methods for key ranges. - return JS_DefineFunctions(aCx, aObject, - const_cast(gKeyRangeConstructors)); + return JS_DefineFunctions(aCx, aObject, gKeyRangeConstructors); } // static diff --git a/dom/workers/Events.cpp b/dom/workers/Events.cpp index 7bfe39261c2..fc166010cc1 100644 --- a/dom/workers/Events.cpp +++ b/dom/workers/Events.cpp @@ -36,7 +36,7 @@ class Event : public PrivatizableBase static JSClass sMainRuntimeClass; static const JSPropertySpec sProperties[]; - static JSFunctionSpec sFunctions[]; + static const JSFunctionSpec sFunctions[]; static const JSPropertySpec sStaticProperties[]; protected: @@ -362,7 +362,7 @@ const JSPropertySpec Event::sProperties[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -JSFunctionSpec Event::sFunctions[] = { +const JSFunctionSpec Event::sFunctions[] = { JS_FN("stopPropagation", StopPropagation, 0, FUNCTION_FLAGS), JS_FN("preventDefault", PreventDefault, 0, FUNCTION_FLAGS), JS_FN("initEvent", InitEvent, 3, FUNCTION_FLAGS), @@ -385,7 +385,7 @@ class MessageEvent : public Event static JSClass sMainRuntimeClass; static const JSPropertySpec sProperties[]; - static JSFunctionSpec sFunctions[]; + static const JSFunctionSpec sFunctions[]; protected: uint64_t* mData; @@ -605,7 +605,7 @@ const JSPropertySpec MessageEvent::sProperties[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -JSFunctionSpec MessageEvent::sFunctions[] = { +const JSFunctionSpec MessageEvent::sFunctions[] = { JS_FN("initMessageEvent", InitMessageEvent, 6, FUNCTION_FLAGS), JS_FS_END }; @@ -616,7 +616,7 @@ class ErrorEvent : public Event static JSClass sMainRuntimeClass; static const JSPropertySpec sProperties[]; - static JSFunctionSpec sFunctions[]; + static const JSFunctionSpec sFunctions[]; public: static bool @@ -791,7 +791,7 @@ const JSPropertySpec ErrorEvent::sProperties[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -JSFunctionSpec ErrorEvent::sFunctions[] = { +const JSFunctionSpec ErrorEvent::sFunctions[] = { JS_FN("initErrorEvent", InitErrorEvent, 6, FUNCTION_FLAGS), JS_FS_END }; @@ -800,7 +800,7 @@ class ProgressEvent : public Event { static JSClass sClass; static const JSPropertySpec sProperties[]; - static JSFunctionSpec sFunctions[]; + static const JSFunctionSpec sFunctions[]; public: static JSClass* @@ -965,7 +965,7 @@ const JSPropertySpec ProgressEvent::sProperties[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -JSFunctionSpec ProgressEvent::sFunctions[] = { +const JSFunctionSpec ProgressEvent::sFunctions[] = { JS_FN("initProgressEvent", InitProgressEvent, 6, FUNCTION_FLAGS), JS_FS_END }; diff --git a/dom/workers/Exceptions.cpp b/dom/workers/Exceptions.cpp index 07833209de5..ca06b2ce78e 100644 --- a/dom/workers/Exceptions.cpp +++ b/dom/workers/Exceptions.cpp @@ -30,7 +30,7 @@ class DOMException : public PrivatizableBase { static JSClass sClass; static const JSPropertySpec sProperties[]; - static JSFunctionSpec sFunctions[]; + static const JSFunctionSpec sFunctions[]; static const JSPropertySpec sStaticProperties[]; enum SLOT { @@ -171,7 +171,7 @@ const JSPropertySpec DOMException::sProperties[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -JSFunctionSpec DOMException::sFunctions[] = { +const JSFunctionSpec DOMException::sFunctions[] = { JS_FN("toString", ToString, 0, 0), JS_FS_END }; diff --git a/dom/workers/File.cpp b/dom/workers/File.cpp index 4ff48a22d39..a09f0c6803a 100644 --- a/dom/workers/File.cpp +++ b/dom/workers/File.cpp @@ -37,7 +37,7 @@ class Blob static JSClass sClass; static const JSPropertySpec sProperties[]; - static JSFunctionSpec sFunctions[]; + static const JSFunctionSpec sFunctions[]; public: static JSObject* @@ -213,7 +213,7 @@ const JSPropertySpec Blob::sProperties[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -JSFunctionSpec Blob::sFunctions[] = { +const JSFunctionSpec Blob::sFunctions[] = { JS_FN("slice", Slice, 1, JSPROP_ENUMERATE), JS_FS_END }; diff --git a/dom/workers/Location.cpp b/dom/workers/Location.cpp index 44a543d09d9..2450d62afd0 100644 --- a/dom/workers/Location.cpp +++ b/dom/workers/Location.cpp @@ -21,7 +21,7 @@ class Location { static JSClass sClass; static const JSPropertySpec sProperties[]; - static JSFunctionSpec sFunctions[]; + static const JSFunctionSpec sFunctions[]; enum SLOT { SLOT_href = 0, @@ -173,7 +173,7 @@ const JSPropertySpec Location::sProperties[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -JSFunctionSpec Location::sFunctions[] = { +const JSFunctionSpec Location::sFunctions[] = { JS_FN("toString", ToString, 0, 0), JS_FS_END }; diff --git a/dom/workers/Worker.cpp b/dom/workers/Worker.cpp index 026f8cdf2eb..def8b865014 100644 --- a/dom/workers/Worker.cpp +++ b/dom/workers/Worker.cpp @@ -32,7 +32,7 @@ class Worker static DOMJSClass sClass; static DOMIfaceAndProtoJSClass sProtoClass; static const JSPropertySpec sProperties[]; - static JSFunctionSpec sFunctions[]; + static const JSFunctionSpec sFunctions[]; enum { @@ -262,7 +262,7 @@ private: return false; } - const char*& name = sFunctions[0].name; + const char* name = sFunctions[0].name; WorkerPrivate* worker = GetInstancePrivate(aCx, obj, name); if (!worker) { return !JS_IsExceptionPending(aCx); @@ -279,7 +279,7 @@ private: return false; } - const char*& name = sFunctions[1].name; + const char* name = sFunctions[1].name; WorkerPrivate* worker = GetInstancePrivate(aCx, obj, name); if (!worker) { return !JS_IsExceptionPending(aCx); @@ -350,7 +350,7 @@ const JSPropertySpec Worker::sProperties[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -JSFunctionSpec Worker::sFunctions[] = { +const JSFunctionSpec Worker::sFunctions[] = { JS_FN("terminate", Terminate, 0, FUNCTION_FLAGS), JS_FN("postMessage", PostMessage, 1, FUNCTION_FLAGS), JS_FS_END diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index 709262049e1..6293ac6ca0e 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -60,7 +60,7 @@ class WorkerGlobalScope : public workers::EventTarget { static JSClass sClass; static const JSPropertySpec sProperties[]; - static JSFunctionSpec sFunctions[]; + static const JSFunctionSpec sFunctions[]; enum { @@ -629,7 +629,7 @@ const JSPropertySpec WorkerGlobalScope::sProperties[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -JSFunctionSpec WorkerGlobalScope::sFunctions[] = { +const JSFunctionSpec WorkerGlobalScope::sFunctions[] = { JS_FN("close", Close, 0, FUNCTION_FLAGS), JS_FN("importScripts", ImportScripts, 1, FUNCTION_FLAGS), JS_FN("setTimeout", SetTimeout, 1, FUNCTION_FLAGS), @@ -652,7 +652,7 @@ class DedicatedWorkerGlobalScope : public WorkerGlobalScope static DOMJSClass sClass; static DOMIfaceAndProtoJSClass sProtoClass; static const JSPropertySpec sProperties[]; - static JSFunctionSpec sFunctions[]; + static const JSFunctionSpec sFunctions[]; enum { @@ -854,7 +854,7 @@ private: return false; } - const char*& name = sFunctions[0].name; + const char* name = sFunctions[0].name; DedicatedWorkerGlobalScope* scope = GetInstancePrivate(aCx, obj, name); if (!scope) { return false; @@ -925,7 +925,7 @@ const JSPropertySpec DedicatedWorkerGlobalScope::sProperties[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -JSFunctionSpec DedicatedWorkerGlobalScope::sFunctions[] = { +const JSFunctionSpec DedicatedWorkerGlobalScope::sFunctions[] = { JS_FN("postMessage", PostMessage, 1, FUNCTION_FLAGS), JS_FS_END }; diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp index 8bf71f36aed..940ba1de871 100644 --- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -492,7 +492,7 @@ DumpHeap(JSContext *cx, #endif /* DEBUG */ -JSFunctionSpec gGlobalFunctions[] = +const JSFunctionSpec gGlobalFunctions[] = { JS_FS("print", Print, 0,0), JS_FS("load", Load, 1,0), diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index 8c6b0136af5..4104e334827 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -600,12 +600,12 @@ collator_toSource(JSContext *cx, unsigned argc, Value *vp) } #endif -static JSFunctionSpec collator_static_methods[] = { +static const JSFunctionSpec collator_static_methods[] = { {"supportedLocalesOf", JSOP_NULLWRAPPER, 1, JSFunction::INTERPRETED, "Intl_Collator_supportedLocalesOf"}, JS_FS_END }; -static JSFunctionSpec collator_methods[] = { +static const JSFunctionSpec collator_methods[] = { {"resolvedOptions", JSOP_NULLWRAPPER, 0, JSFunction::INTERPRETED, "Intl_Collator_resolvedOptions"}, #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, collator_toSource, 0, 0), @@ -1078,12 +1078,12 @@ numberFormat_toSource(JSContext *cx, unsigned argc, Value *vp) } #endif -static JSFunctionSpec numberFormat_static_methods[] = { +static const JSFunctionSpec numberFormat_static_methods[] = { {"supportedLocalesOf", JSOP_NULLWRAPPER, 1, JSFunction::INTERPRETED, "Intl_NumberFormat_supportedLocalesOf"}, JS_FS_END }; -static JSFunctionSpec numberFormat_methods[] = { +static const JSFunctionSpec numberFormat_methods[] = { {"resolvedOptions", JSOP_NULLWRAPPER, 0, JSFunction::INTERPRETED, "Intl_NumberFormat_resolvedOptions"}, #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, numberFormat_toSource, 0, 0), @@ -1527,12 +1527,12 @@ dateTimeFormat_toSource(JSContext *cx, unsigned argc, Value *vp) } #endif -static JSFunctionSpec dateTimeFormat_static_methods[] = { +static const JSFunctionSpec dateTimeFormat_static_methods[] = { {"supportedLocalesOf", JSOP_NULLWRAPPER, 1, JSFunction::INTERPRETED, "Intl_DateTimeFormat_supportedLocalesOf"}, JS_FS_END }; -static JSFunctionSpec dateTimeFormat_methods[] = { +static const JSFunctionSpec dateTimeFormat_methods[] = { {"resolvedOptions", JSOP_NULLWRAPPER, 0, JSFunction::INTERPRETED, "Intl_DateTimeFormat_resolvedOptions"}, #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, dateTimeFormat_toSource, 0, 0), @@ -2002,7 +2002,7 @@ intl_toSource(JSContext *cx, unsigned argc, Value *vp) } #endif -static JSFunctionSpec intl_static_methods[] = { +static const JSFunctionSpec intl_static_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, intl_toSource, 0, 0), #endif diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index c5d60b1f869..4632a487747 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -847,7 +847,7 @@ class js::MapIteratorObject : public JSObject { public: enum { TargetSlot, KindSlot, RangeSlot, SlotCount }; - static JSFunctionSpec methods[]; + static const JSFunctionSpec methods[]; static MapIteratorObject *create(JSContext *cx, HandleObject mapobj, ValueMap *data, MapObject::IteratorKind kind); static void finalize(FreeOp *fop, RawObject obj); @@ -881,7 +881,7 @@ Class js::MapIteratorClass = { MapIteratorObject::finalize }; -JSFunctionSpec MapIteratorObject::methods[] = { +const JSFunctionSpec MapIteratorObject::methods[] = { JS_FN("next", next, 0, 0), JS_FS_END }; @@ -1031,7 +1031,7 @@ const JSPropertySpec MapObject::properties[] = { JS_PS_END }; -JSFunctionSpec MapObject::methods[] = { +const JSFunctionSpec MapObject::methods[] = { JS_FN("get", get, 1, 0), JS_FN("has", has, 1, 0), JS_FN("set", set, 2, 0), @@ -1422,7 +1422,7 @@ class js::SetIteratorObject : public JSObject { public: enum { TargetSlot, RangeSlot, SlotCount }; - static JSFunctionSpec methods[]; + static const JSFunctionSpec methods[]; static SetIteratorObject *create(JSContext *cx, HandleObject setobj, ValueSet *data); static void finalize(FreeOp *fop, RawObject obj); @@ -1454,7 +1454,7 @@ Class js::SetIteratorClass = { SetIteratorObject::finalize }; -JSFunctionSpec SetIteratorObject::methods[] = { +const JSFunctionSpec SetIteratorObject::methods[] = { JS_FN("next", next, 0, 0), JS_FS_END }; @@ -1574,7 +1574,7 @@ const JSPropertySpec SetObject::properties[] = { JS_PS_END }; -JSFunctionSpec SetObject::methods[] = { +const JSFunctionSpec SetObject::methods[] = { JS_FN("has", has, 1, 0), JS_FN("add", add, 1, 0), JS_FN("delete", delete_, 1, 0), diff --git a/js/src/builtin/MapObject.h b/js/src/builtin/MapObject.h index a209db5224f..a8842229559 100644 --- a/js/src/builtin/MapObject.h +++ b/js/src/builtin/MapObject.h @@ -87,7 +87,7 @@ class MapObject : public JSObject { static Class class_; private: static const JSPropertySpec properties[]; - static JSFunctionSpec methods[]; + static const JSFunctionSpec methods[]; ValueMap *getData() { return static_cast(getPrivate()); } static ValueMap & extract(CallReceiver call); static void mark(JSTracer *trc, RawObject obj); @@ -124,7 +124,7 @@ class SetObject : public JSObject { static Class class_; private: static const JSPropertySpec properties[]; - static JSFunctionSpec methods[]; + static const JSFunctionSpec methods[]; ValueSet *getData() { return static_cast(getPrivate()); } static ValueSet & extract(CallReceiver call); static void mark(JSTracer *trc, RawObject obj); diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index 8171d873284..b8ea7cd1218 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -976,7 +976,7 @@ obj_isSealed(JSContext *cx, unsigned argc, Value *vp) return true; } -JSFunctionSpec js::object_methods[] = { +const JSFunctionSpec js::object_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, obj_toSource, 0,0), #endif @@ -999,7 +999,7 @@ JSFunctionSpec js::object_methods[] = { JS_FS_END }; -JSFunctionSpec js::object_static_methods[] = { +const JSFunctionSpec js::object_static_methods[] = { JS_FN("getPrototypeOf", obj_getPrototypeOf, 1,0), JS_FN("getOwnPropertyDescriptor", obj_getOwnPropertyDescriptor,2,0), JS_FN("keys", obj_keys, 1,0), diff --git a/js/src/builtin/Object.h b/js/src/builtin/Object.h index c6a29225e95..c939cb27be1 100644 --- a/js/src/builtin/Object.h +++ b/js/src/builtin/Object.h @@ -11,8 +11,8 @@ namespace js { -extern JSFunctionSpec object_methods[]; -extern JSFunctionSpec object_static_methods[]; +extern const JSFunctionSpec object_methods[]; +extern const JSFunctionSpec object_static_methods[]; /* Object constructor native. Exposed only so the JIT can know its address. */ extern JSBool diff --git a/js/src/builtin/ParallelArray.cpp b/js/src/builtin/ParallelArray.cpp index b136e0ac22c..e924243bed4 100644 --- a/js/src/builtin/ParallelArray.cpp +++ b/js/src/builtin/ParallelArray.cpp @@ -26,7 +26,7 @@ using namespace js; FixedHeapPtr ParallelArrayObject::ctorNames[NumCtors]; -JSFunctionSpec ParallelArrayObject::methods[] = { +const JSFunctionSpec ParallelArrayObject::methods[] = { { "map", JSOP_NULLWRAPPER, 2, 0, "ParallelArrayMap" }, { "reduce", JSOP_NULLWRAPPER, 2, 0, "ParallelArrayReduce" }, { "scan", JSOP_NULLWRAPPER, 2, 0, "ParallelArrayScan" }, diff --git a/js/src/builtin/ParallelArray.h b/js/src/builtin/ParallelArray.h index 443ebad5952..a4ad59c9012 100644 --- a/js/src/builtin/ParallelArray.h +++ b/js/src/builtin/ParallelArray.h @@ -20,7 +20,7 @@ namespace js { class ParallelArrayObject : public JSObject { static Class protoClass; - static JSFunctionSpec methods[]; + static const JSFunctionSpec methods[]; static const uint32_t NumFixedSlots = 4; static const uint32_t NumCtors = 4; static FixedHeapPtr ctorNames[NumCtors]; diff --git a/js/src/builtin/Profilers.cpp b/js/src/builtin/Profilers.cpp index 853d61d8911..5b236cec974 100644 --- a/js/src/builtin/Profilers.cpp +++ b/js/src/builtin/Profilers.cpp @@ -359,7 +359,7 @@ DumpCallgrind(JSContext *cx, unsigned argc, jsval *vp) } #endif -static JSFunctionSpec profiling_functions[] = { +static const JSFunctionSpec profiling_functions[] = { JS_FN("startProfiling", StartProfiling, 1,0), JS_FN("stopProfiling", StopProfiling, 1,0), JS_FN("pauseProfilers", PauseProfilers, 1,0), diff --git a/js/src/builtin/RegExp.cpp b/js/src/builtin/RegExp.cpp index 2006929e004..995738c91b7 100644 --- a/js/src/builtin/RegExp.cpp +++ b/js/src/builtin/RegExp.cpp @@ -381,7 +381,7 @@ regexp_toString(JSContext *cx, unsigned argc, Value *vp) return CallNonGenericMethod(cx, args); } -static JSFunctionSpec regexp_methods[] = { +static const JSFunctionSpec regexp_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, regexp_toString, 0,0), #endif diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 1e3fdf45f49..fb9f27f5c5e 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -551,14 +551,14 @@ static const JSPropertySpec sCTypeProps[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -static JSFunctionSpec sCTypeFunctions[] = { +static const JSFunctionSpec sCTypeFunctions[] = { JS_FN("array", CType::CreateArray, 0, CTYPESFN_FLAGS), JS_FN("toString", CType::ToString, 0, CTYPESFN_FLAGS), JS_FN("toSource", CType::ToSource, 0, CTYPESFN_FLAGS), JS_FS_END }; -static JSFunctionSpec sCABIFunctions[] = { +static const JSFunctionSpec sCABIFunctions[] = { JS_FN("toSource", ABI::ToSource, 0, CABIFN_FLAGS), JS_FN("toString", ABI::ToSource, 0, CABIFN_FLAGS), JS_FS_END @@ -570,7 +570,7 @@ static const JSPropertySpec sCDataProps[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -static JSFunctionSpec sCDataFunctions[] = { +static const JSFunctionSpec sCDataFunctions[] = { JS_FN("address", CData::Address, 0, CDATAFN_FLAGS), JS_FN("readString", CData::ReadString, 0, CDATAFN_FLAGS), JS_FN("readStringReplaceMalformed", CData::ReadStringReplaceMalformed, 0, CDATAFN_FLAGS), @@ -583,7 +583,7 @@ static const JSPropertySpec sCDataFinalizerProps[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -static JSFunctionSpec sCDataFinalizerFunctions[] = { +static const JSFunctionSpec sCDataFinalizerFunctions[] = { JS_FN("dispose", CDataFinalizer::Methods::Dispose, 0, CDATAFINALIZERFN_FLAGS), JS_FN("forget", CDataFinalizer::Methods::Forget, 0, CDATAFINALIZERFN_FLAGS), JS_FN("readString",CData::ReadString, 0, CDATAFINALIZERFN_FLAGS), @@ -592,7 +592,7 @@ static JSFunctionSpec sCDataFinalizerFunctions[] = { JS_FS_END }; -static JSFunctionSpec sPointerFunction = +static const JSFunctionSpec sPointerFunction = JS_FN("PointerType", PointerType::Create, 1, CTYPESCTOR_FLAGS); static const JSPropertySpec sPointerProps[] = { @@ -601,7 +601,7 @@ static const JSPropertySpec sPointerProps[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -static JSFunctionSpec sPointerInstanceFunctions[] = { +static const JSFunctionSpec sPointerInstanceFunctions[] = { JS_FN("isNull", PointerType::IsNull, 0, CTYPESFN_FLAGS), JS_FN("increment", PointerType::Increment, 0, CTYPESFN_FLAGS), JS_FN("decrement", PointerType::Decrement, 0, CTYPESFN_FLAGS), @@ -615,7 +615,7 @@ static const JSPropertySpec sPointerInstanceProps[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -static JSFunctionSpec sArrayFunction = +static const JSFunctionSpec sArrayFunction = JS_FN("ArrayType", ArrayType::Create, 1, CTYPESCTOR_FLAGS); static const JSPropertySpec sArrayProps[] = { @@ -626,7 +626,7 @@ static const JSPropertySpec sArrayProps[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -static JSFunctionSpec sArrayInstanceFunctions[] = { +static const JSFunctionSpec sArrayInstanceFunctions[] = { JS_FN("addressOfElement", ArrayType::AddressOfElement, 1, CDATAFN_FLAGS), JS_FS_END }; @@ -637,7 +637,7 @@ static const JSPropertySpec sArrayInstanceProps[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -static JSFunctionSpec sStructFunction = +static const JSFunctionSpec sStructFunction = JS_FN("StructType", StructType::Create, 2, CTYPESCTOR_FLAGS); static const JSPropertySpec sStructProps[] = { @@ -646,17 +646,17 @@ static const JSPropertySpec sStructProps[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -static JSFunctionSpec sStructFunctions[] = { +static const JSFunctionSpec sStructFunctions[] = { JS_FN("define", StructType::Define, 1, CDATAFN_FLAGS), JS_FS_END }; -static JSFunctionSpec sStructInstanceFunctions[] = { +static const JSFunctionSpec sStructInstanceFunctions[] = { JS_FN("addressOfField", StructType::AddressOfField, 1, CDATAFN_FLAGS), JS_FS_END }; -static JSFunctionSpec sFunctionFunction = +static const JSFunctionSpec sFunctionFunction = JS_FN("FunctionType", FunctionType::Create, 2, CTYPESCTOR_FLAGS); static const JSPropertySpec sFunctionProps[] = { @@ -671,7 +671,7 @@ static const JSPropertySpec sFunctionProps[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -static JSFunctionSpec sFunctionInstanceFunctions[] = { +static const JSFunctionSpec sFunctionInstanceFunctions[] = { JS_FN("call", js_fun_call, 1, CDATAFN_FLAGS), JS_FN("apply", js_fun_apply, 2, CDATAFN_FLAGS), JS_FS_END @@ -705,7 +705,7 @@ static JSClass sUInt64Class = { JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize }; -static JSFunctionSpec sInt64StaticFunctions[] = { +static const JSFunctionSpec sInt64StaticFunctions[] = { JS_FN("compare", Int64::Compare, 2, CTYPESFN_FLAGS), JS_FN("lo", Int64::Lo, 1, CTYPESFN_FLAGS), JS_FN("hi", Int64::Hi, 1, CTYPESFN_FLAGS), @@ -713,7 +713,7 @@ static JSFunctionSpec sInt64StaticFunctions[] = { JS_FS_END }; -static JSFunctionSpec sUInt64StaticFunctions[] = { +static const JSFunctionSpec sUInt64StaticFunctions[] = { JS_FN("compare", UInt64::Compare, 2, CTYPESFN_FLAGS), JS_FN("lo", UInt64::Lo, 1, CTYPESFN_FLAGS), JS_FN("hi", UInt64::Hi, 1, CTYPESFN_FLAGS), @@ -721,13 +721,13 @@ static JSFunctionSpec sUInt64StaticFunctions[] = { JS_FS_END }; -static JSFunctionSpec sInt64Functions[] = { +static const JSFunctionSpec sInt64Functions[] = { JS_FN("toString", Int64::ToString, 0, CTYPESFN_FLAGS), JS_FN("toSource", Int64::ToSource, 0, CTYPESFN_FLAGS), JS_FS_END }; -static JSFunctionSpec sUInt64Functions[] = { +static const JSFunctionSpec sUInt64Functions[] = { JS_FN("toString", UInt64::ToString, 0, CTYPESFN_FLAGS), JS_FN("toSource", UInt64::ToSource, 0, CTYPESFN_FLAGS), JS_FS_END @@ -743,7 +743,7 @@ static const JSPropertySpec sModuleProps[] = { { 0, 0, 0, JSOP_NULLWRAPPER, JSOP_NULLWRAPPER } }; -static JSFunctionSpec sModuleFunctions[] = { +static const JSFunctionSpec sModuleFunctions[] = { JS_FN("CDataFinalizer", CDataFinalizer::Construct, 2, CTYPESFN_FLAGS), JS_FN("open", Library::Open, 1, CTYPESFN_FLAGS), JS_FN("cast", CData::Cast, 2, CTYPESFN_FLAGS), diff --git a/js/src/ctypes/Library.cpp b/js/src/ctypes/Library.cpp index 47c38853b4e..8daa03756b8 100644 --- a/js/src/ctypes/Library.cpp +++ b/js/src/ctypes/Library.cpp @@ -41,7 +41,7 @@ static JSClass sLibraryClass = { #define CTYPESFN_FLAGS \ (JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT) -static JSFunctionSpec sLibraryFunctions[] = { +static const JSFunctionSpec sLibraryFunctions[] = { JS_FN("close", Library::Close, 0, CTYPESFN_FLAGS), JS_FN("declare", Library::Declare, 0, CTYPESFN_FLAGS), JS_FS_END diff --git a/js/src/jsapi-tests/testClassGetter.cpp b/js/src/jsapi-tests/testClassGetter.cpp index 5ee3efae034..5631d71b02f 100644 --- a/js/src/jsapi-tests/testClassGetter.cpp +++ b/js/src/jsapi-tests/testClassGetter.cpp @@ -50,7 +50,7 @@ static JSBool test_fn(JSContext *cx, unsigned argc, jsval *vp) return JS_TRUE; } -static JSFunctionSpec ptestFunctions[] = { +static const JSFunctionSpec ptestFunctions[] = { JS_FS( "test_fn", test_fn, 0, 0 ), JS_FS_END }; diff --git a/js/src/jsapi-tests/testOps.cpp b/js/src/jsapi-tests/testOps.cpp index ee7b09ad419..42ef40be0e0 100644 --- a/js/src/jsapi-tests/testOps.cpp +++ b/js/src/jsapi-tests/testOps.cpp @@ -42,7 +42,7 @@ createMyObject(JSContext* context, unsigned argc, jsval *vp) return JS_TRUE; } -static JSFunctionSpec s_functions[] = +static const JSFunctionSpec s_functions[] = { JS_FN("createMyObject", createMyObject, 0, 0), JS_FS_END diff --git a/js/src/jsapi-tests/testProfileStrings.cpp b/js/src/jsapi-tests/testProfileStrings.cpp index a6dd78638af..5cc6d291f69 100644 --- a/js/src/jsapi-tests/testProfileStrings.cpp +++ b/js/src/jsapi-tests/testProfileStrings.cpp @@ -70,7 +70,7 @@ Prof(JSContext* cx, unsigned argc, jsval *vp) return JS_TRUE; } -static JSFunctionSpec ptestFunctions[] = { +static const JSFunctionSpec ptestFunctions[] = { JS_FS("test_fn", test_fn, 0, 0), JS_FS("test_fn2", test_fn2, 0, 0), JS_FS("enable", enable, 0, 0), diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 634c0e98a48..bb0f474fc77 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -5023,7 +5023,7 @@ js_generic_native_method_dispatcher(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JSFunctionSpec *fs = (JSFunctionSpec *) + const JSFunctionSpec *fs = (JSFunctionSpec *) vp->toObject().toFunction()->getExtendedSlot(0).toPrivate(); JS_ASSERT((fs->flags & JSFUN_GENERIC_NATIVE) != 0); diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 593b7ec9171..a34f75a2600 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -2535,7 +2535,7 @@ array_isArray(JSContext *cx, unsigned argc, Value *vp) #define GENERIC JSFUN_GENERIC_NATIVE -static JSFunctionSpec array_methods[] = { +static const JSFunctionSpec array_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, array_toSource, 0,0), #endif @@ -2570,7 +2570,7 @@ static JSFunctionSpec array_methods[] = { JS_FS_END }; -static JSFunctionSpec array_static_methods[] = { +static const JSFunctionSpec array_static_methods[] = { JS_FN("isArray", array_isArray, 1,0), {"lastIndexOf", {NULL, NULL}, 2,0, "ArrayStaticLastIndexOf"}, {"indexOf", {NULL, NULL}, 2,0, "ArrayStaticIndexOf"}, diff --git a/js/src/jsbool.cpp b/js/src/jsbool.cpp index 217572a8031..02ac50c99d4 100644 --- a/js/src/jsbool.cpp +++ b/js/src/jsbool.cpp @@ -118,7 +118,7 @@ bool_valueOf(JSContext *cx, unsigned argc, Value *vp) return CallNonGenericMethod(cx, args); } -static JSFunctionSpec boolean_methods[] = { +static const JSFunctionSpec boolean_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, bool_toSource, 0, 0), #endif diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index d98dc5b9e59..7eac115923c 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -2986,14 +2986,14 @@ date_valueOf(JSContext *cx, unsigned argc, Value *vp) return CallNonGenericMethod(cx, args); } -static JSFunctionSpec date_static_methods[] = { +static const JSFunctionSpec date_static_methods[] = { JS_FN("UTC", date_UTC, MAXARGS,0), JS_FN("parse", date_parse, 1,0), JS_FN("now", date_now, 0,0), JS_FS_END }; -static JSFunctionSpec date_methods[] = { +static const JSFunctionSpec date_methods[] = { JS_FN("getTime", date_getTime, 0,0), JS_FN("getTimezoneOffset", date_getTimezoneOffset, 0,0), JS_FN("getYear", date_getYear, 0,0), diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index d6b8e4add71..57a2710c23e 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -765,7 +765,7 @@ exn_toSource(JSContext *cx, unsigned argc, Value *vp) } #endif -static JSFunctionSpec exception_methods[] = { +static const JSFunctionSpec exception_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, exn_toSource, 0,0), #endif diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 541dc965ce2..65d35197f89 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -1102,7 +1102,7 @@ bool JSFunction::initializeLazyScript(JSContext *cx) { JS_ASSERT(isInterpretedLazy()); - JSFunctionSpec *fs = static_cast(getExtendedSlot(0).toPrivate()); + const JSFunctionSpec *fs = static_cast(getExtendedSlot(0).toPrivate()); Rooted self(cx, this); RootedAtom funAtom(cx, Atomize(cx, fs->selfHostedName, strlen(fs->selfHostedName))); if (!funAtom) @@ -1267,7 +1267,7 @@ OnBadFormal(JSContext *cx, TokenKind tt) return false; } -JSFunctionSpec js::function_methods[] = { +const JSFunctionSpec js::function_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, fun_toSource, 0,0), #endif diff --git a/js/src/jsfun.h b/js/src/jsfun.h index d1cf351dcbc..8e1b6462b1c 100644 --- a/js/src/jsfun.h +++ b/js/src/jsfun.h @@ -440,7 +440,7 @@ ReportIncompatible(JSContext *cx, CallReceiver call); JSBool CallOrConstructBoundFunction(JSContext *, unsigned, js::Value *); -extern JSFunctionSpec function_methods[]; +extern const JSFunctionSpec function_methods[]; } /* namespace js */ diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index 60d9531003c..1f66164de20 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -795,7 +795,7 @@ iterator_next(JSContext *cx, unsigned argc, Value *vp) return CallNonGenericMethod(cx, args); } -static JSFunctionSpec iterator_methods[] = { +static const JSFunctionSpec iterator_methods[] = { JS_FN("iterator", iterator_iterator, 0, 0), JS_FN("next", iterator_next, 0, 0), JS_FS_END @@ -948,7 +948,7 @@ Class js::ElementIteratorClass = { NULL /* finalize */ }; -JSFunctionSpec ElementIteratorObject::methods[] = { +const JSFunctionSpec ElementIteratorObject::methods[] = { JS_FN("next", next, 0, 0), JS_FS_END }; @@ -1744,7 +1744,7 @@ generator_close(JSContext *cx, unsigned argc, Value *vp) #define JSPROP_ROPERM (JSPROP_READONLY | JSPROP_PERMANENT) -static JSFunctionSpec generator_methods[] = { +static const JSFunctionSpec generator_methods[] = { JS_FN("iterator", iterator_iterator, 0, 0), JS_FN("next", generator_next, 0,JSPROP_ROPERM), JS_FN("send", generator_send, 1,JSPROP_ROPERM), diff --git a/js/src/jsiter.h b/js/src/jsiter.h index 6640de90290..3232cd68290 100644 --- a/js/src/jsiter.h +++ b/js/src/jsiter.h @@ -144,7 +144,7 @@ class ElementIteratorObject : public JSObject { public: static JSObject *create(JSContext *cx, Handle target); - static JSFunctionSpec methods[]; + static const JSFunctionSpec methods[]; enum { TargetSlot, diff --git a/js/src/jsmath.cpp b/js/src/jsmath.cpp index 4f87a68bce1..762b76822e1 100644 --- a/js/src/jsmath.cpp +++ b/js/src/jsmath.cpp @@ -702,7 +702,7 @@ math_toSource(JSContext *cx, unsigned argc, Value *vp) } #endif -static JSFunctionSpec math_static_methods[] = { +static const JSFunctionSpec math_static_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, math_toSource, 0, 0), #endif diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index a982b33ca44..9fe7a512819 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -397,7 +397,7 @@ js::num_parseInt(JSContext *cx, unsigned argc, Value *vp) return true; } -static JSFunctionSpec number_functions[] = { +static const JSFunctionSpec number_functions[] = { JS_FN(js_isNaN_str, num_isNaN, 1,0), JS_FN(js_isFinite_str, num_isFinite, 1,0), JS_FN(js_parseFloat_str, num_parseFloat, 1,0), @@ -891,7 +891,7 @@ num_toPrecision(JSContext *cx, unsigned argc, Value *vp) return CallNonGenericMethod(cx, args); } -static JSFunctionSpec number_methods[] = { +static const JSFunctionSpec number_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, num_toSource, 0, 0), #endif @@ -969,7 +969,7 @@ Number_toInteger(JSContext *cx, unsigned argc, Value *vp) } -static JSFunctionSpec number_static_methods[] = { +static const JSFunctionSpec number_static_methods[] = { JS_FN("isFinite", Number_isFinite, 1, 0), JS_FN("isInteger", Number_isInteger, 1, 0), JS_FN("isNaN", Number_isNaN, 1, 0), diff --git a/js/src/json.cpp b/js/src/json.cpp index f58060abc4a..8b9875fb912 100644 --- a/js/src/json.cpp +++ b/js/src/json.cpp @@ -879,7 +879,7 @@ json_toSource(JSContext *cx, unsigned argc, Value *vp) } #endif -static JSFunctionSpec json_static_methods[] = { +static const JSFunctionSpec json_static_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, json_toSource, 0, 0), #endif diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 2d726d7e45e..26dbc47c419 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -3443,7 +3443,7 @@ proxy_createFunction(JSContext *cx, unsigned argc, Value *vp) return true; } -static JSFunctionSpec static_methods[] = { +static const JSFunctionSpec static_methods[] = { JS_FN("create", proxy_create, 2, 0), JS_FN("createFunction", proxy_createFunction, 3, 0), JS_FS_END diff --git a/js/src/jsreflect.cpp b/js/src/jsreflect.cpp index e97e3134441..4a1ec410e03 100644 --- a/js/src/jsreflect.cpp +++ b/js/src/jsreflect.cpp @@ -3094,7 +3094,7 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp) return JS_TRUE; } -static JSFunctionSpec static_methods[] = { +static const JSFunctionSpec static_methods[] = { JS_FN("parse", reflect_parse, 1, 0), JS_FS_END }; diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 976ca4b776a..3b42251e622 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -353,7 +353,7 @@ str_uneval(JSContext *cx, unsigned argc, Value *vp) } #endif -static JSFunctionSpec string_functions[] = { +static const JSFunctionSpec string_functions[] = { JS_FN(js_escape_str, str_escape, 1,0), JS_FN(js_unescape_str, str_unescape, 1,0), #if JS_HAS_UNEVAL @@ -3356,7 +3356,7 @@ str_sub(JSContext *cx, unsigned argc, Value *vp) } #endif /* JS_HAS_STR_HTML_HELPERS */ -static JSFunctionSpec string_methods[] = { +static const JSFunctionSpec string_methods[] = { #if JS_HAS_TOSOURCE JS_FN("quote", str_quote, 0,JSFUN_GENERIC_NATIVE), JS_FN(js_toSource_str, str_toSource, 0,0), @@ -3482,7 +3482,7 @@ js::str_fromCharCode(JSContext *cx, unsigned argc, Value *vp) return JS_TRUE; } -static JSFunctionSpec string_static_methods[] = { +static const JSFunctionSpec string_static_methods[] = { JS_FN("fromCharCode", js::str_fromCharCode, 1, 0), // This must be at the end because of bug 853075: functions listed after diff --git a/js/src/jstypedarray.cpp b/js/src/jstypedarray.cpp index 08d73fd5f1a..7fd586dc8a2 100644 --- a/js/src/jstypedarray.cpp +++ b/js/src/jstypedarray.cpp @@ -2536,55 +2536,55 @@ class Int8Array : public TypedArrayTemplate { public: enum { ACTUAL_TYPE = TYPE_INT8 }; static const JSProtoKey key = JSProto_Int8Array; - static JSFunctionSpec jsfuncs[]; + static const JSFunctionSpec jsfuncs[]; }; class Uint8Array : public TypedArrayTemplate { public: enum { ACTUAL_TYPE = TYPE_UINT8 }; static const JSProtoKey key = JSProto_Uint8Array; - static JSFunctionSpec jsfuncs[]; + static const JSFunctionSpec jsfuncs[]; }; class Int16Array : public TypedArrayTemplate { public: enum { ACTUAL_TYPE = TYPE_INT16 }; static const JSProtoKey key = JSProto_Int16Array; - static JSFunctionSpec jsfuncs[]; + static const JSFunctionSpec jsfuncs[]; }; class Uint16Array : public TypedArrayTemplate { public: enum { ACTUAL_TYPE = TYPE_UINT16 }; static const JSProtoKey key = JSProto_Uint16Array; - static JSFunctionSpec jsfuncs[]; + static const JSFunctionSpec jsfuncs[]; }; class Int32Array : public TypedArrayTemplate { public: enum { ACTUAL_TYPE = TYPE_INT32 }; static const JSProtoKey key = JSProto_Int32Array; - static JSFunctionSpec jsfuncs[]; + static const JSFunctionSpec jsfuncs[]; }; class Uint32Array : public TypedArrayTemplate { public: enum { ACTUAL_TYPE = TYPE_UINT32 }; static const JSProtoKey key = JSProto_Uint32Array; - static JSFunctionSpec jsfuncs[]; + static const JSFunctionSpec jsfuncs[]; }; class Float32Array : public TypedArrayTemplate { public: enum { ACTUAL_TYPE = TYPE_FLOAT32 }; static const JSProtoKey key = JSProto_Float32Array; - static JSFunctionSpec jsfuncs[]; + static const JSFunctionSpec jsfuncs[]; }; class Float64Array : public TypedArrayTemplate { public: enum { ACTUAL_TYPE = TYPE_FLOAT64 }; static const JSProtoKey key = JSProto_Float64Array; - static JSFunctionSpec jsfuncs[]; + static const JSFunctionSpec jsfuncs[]; }; class Uint8ClampedArray : public TypedArrayTemplate { public: enum { ACTUAL_TYPE = TYPE_UINT8_CLAMPED }; static const JSProtoKey key = JSProto_Uint8ClampedArray; - static JSFunctionSpec jsfuncs[]; + static const JSFunctionSpec jsfuncs[]; }; template @@ -3346,7 +3346,7 @@ Class js::ArrayBufferClass = { } }; -JSFunctionSpec ArrayBufferObject::jsfuncs[] = { +const JSFunctionSpec ArrayBufferObject::jsfuncs[] = { JS_FN("slice", ArrayBufferObject::fun_slice, 2, JSFUN_GENERIC_NATIVE), JS_FS_END }; @@ -3357,7 +3357,7 @@ JSFunctionSpec ArrayBufferObject::jsfuncs[] = { #ifdef ENABLE_TYPEDARRAY_MOVE # define IMPL_TYPED_ARRAY_STATICS(_typedArray) \ -JSFunctionSpec _typedArray::jsfuncs[] = { \ +const JSFunctionSpec _typedArray::jsfuncs[] = { \ JS_FN("iterator", JS_ArrayIterator, 0, 0), \ JS_FN("subarray", _typedArray::fun_subarray, 2, JSFUN_GENERIC_NATIVE), \ JS_FN("set", _typedArray::fun_set, 2, JSFUN_GENERIC_NATIVE), \ @@ -3366,7 +3366,7 @@ JSFunctionSpec _typedArray::jsfuncs[] = { \ } #else # define IMPL_TYPED_ARRAY_STATICS(_typedArray) \ -JSFunctionSpec _typedArray::jsfuncs[] = { \ +const JSFunctionSpec _typedArray::jsfuncs[] = { \ JS_FN("iterator", JS_ArrayIterator, 0, 0), \ JS_FN("subarray", _typedArray::fun_subarray, 2, JSFUN_GENERIC_NATIVE), \ JS_FN("set", _typedArray::fun_set, 2, JSFUN_GENERIC_NATIVE), \ @@ -3694,7 +3694,7 @@ Class js::DataViewClass = { JS_NULL_OBJECT_OPS }; -JSFunctionSpec DataViewObject::jsfuncs[] = { +const JSFunctionSpec DataViewObject::jsfuncs[] = { JS_FN("getInt8", DataViewObject::fun_getInt8, 1,0), JS_FN("getUint8", DataViewObject::fun_getUint8, 1,0), JS_FN("getInt16", DataViewObject::fun_getInt16, 2,0), diff --git a/js/src/jstypedarray.h b/js/src/jstypedarray.h index 05cfdec260c..5e3c1e4495b 100644 --- a/js/src/jstypedarray.h +++ b/js/src/jstypedarray.h @@ -34,7 +34,7 @@ class ArrayBufferObject : public JSObject public: static Class protoClass; - static JSFunctionSpec jsfuncs[]; + static const JSFunctionSpec jsfuncs[]; static JSBool byteLengthGetter(JSContext *cx, unsigned argc, Value *vp); @@ -438,7 +438,7 @@ private: static bool write(JSContext *cx, Handle obj, CallArgs &args, const char *method); private: - static JSFunctionSpec jsfuncs[]; + static const JSFunctionSpec jsfuncs[]; }; bool diff --git a/js/src/jsweakmap.cpp b/js/src/jsweakmap.cpp index 07fcbcd0885..fe424e64a21 100644 --- a/js/src/jsweakmap.cpp +++ b/js/src/jsweakmap.cpp @@ -412,7 +412,7 @@ Class js::WeakMapClass = { WeakMap_mark }; -static JSFunctionSpec weak_map_methods[] = { +static const JSFunctionSpec weak_map_methods[] = { JS_FN("has", WeakMap_has, 1, 0), JS_FN("get", WeakMap_get, 2, 0), JS_FN("delete", WeakMap_delete, 1, 0), diff --git a/js/src/perf/jsperf.cpp b/js/src/perf/jsperf.cpp index 80a06ebdc2c..eb4eeef4905 100644 --- a/js/src/perf/jsperf.cpp +++ b/js/src/perf/jsperf.cpp @@ -91,7 +91,7 @@ pm_canMeasureSomething(JSContext* cx, unsigned /*unused*/, jsval* vp) } const uint8_t PM_FATTRS = JSPROP_READONLY | JSPROP_PERMANENT; -static JSFunctionSpec pm_fns[] = { +static const JSFunctionSpec pm_fns[] = { JS_FN("start", pm_start, 0, PM_FATTRS), JS_FN("stop", pm_stop, 0, PM_FATTRS), JS_FN("reset", pm_reset, 0, PM_FATTRS), diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 818973b462e..1031e3c781d 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -4603,7 +4603,7 @@ static const JSPropertySpec dom_props[] = { {NULL,0,0,JSOP_NULLWRAPPER, JSOP_NULLWRAPPER} }; -static JSFunctionSpec dom_methods[] = { +static const JSFunctionSpec dom_methods[] = { JS_FNINFO("doFoo", dom_genericMethod, &doFoo_methodinfo, 3, JSPROP_ENUMERATE), JS_FS_END }; diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 1516d954eeb..23920c97aa9 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -2650,7 +2650,7 @@ const JSPropertySpec Debugger::properties[] = { JS_PS_END }; -JSFunctionSpec Debugger::methods[] = { +const JSFunctionSpec Debugger::methods[] = { JS_FN("addDebuggee", Debugger::addDebuggee, 1, 0), JS_FN("addAllGlobalsAsDebuggees", Debugger::addAllGlobalsAsDebuggees, 0, 0), JS_FN("removeDebuggee", Debugger::removeDebuggee, 1, 0), @@ -3465,7 +3465,7 @@ static const JSPropertySpec DebuggerScript_properties[] = { JS_PS_END }; -static JSFunctionSpec DebuggerScript_methods[] = { +static const JSFunctionSpec DebuggerScript_methods[] = { JS_FN("getChildScripts", DebuggerScript_getChildScripts, 0, 0), JS_FN("getAllOffsets", DebuggerScript_getAllOffsets, 0, 0), JS_FN("getAllColumnOffsets", DebuggerScript_getAllColumnOffsets, 0, 0), @@ -4066,7 +4066,7 @@ static const JSPropertySpec DebuggerFrame_properties[] = { JS_PS_END }; -static JSFunctionSpec DebuggerFrame_methods[] = { +static const JSFunctionSpec DebuggerFrame_methods[] = { JS_FN("eval", DebuggerFrame_eval, 1, 0), JS_FN("evalWithBindings", DebuggerFrame_evalWithBindings, 1, 0), JS_FS_END @@ -4842,7 +4842,7 @@ static const JSPropertySpec DebuggerObject_properties[] = { JS_PS_END }; -static JSFunctionSpec DebuggerObject_methods[] = { +static const JSFunctionSpec DebuggerObject_methods[] = { JS_FN("getOwnPropertyDescriptor", DebuggerObject_getOwnPropertyDescriptor, 1, 0), JS_FN("getOwnPropertyNames", DebuggerObject_getOwnPropertyNames, 0, 0), JS_FN("defineProperty", DebuggerObject_defineProperty, 2, 0), @@ -5175,7 +5175,7 @@ static const JSPropertySpec DebuggerEnv_properties[] = { JS_PS_END }; -static JSFunctionSpec DebuggerEnv_methods[] = { +static const JSFunctionSpec DebuggerEnv_methods[] = { JS_FN("names", DebuggerEnv_names, 0, 0), JS_FN("find", DebuggerEnv_find, 1, 0), JS_FN("getVariable", DebuggerEnv_getVariable, 1, 0), diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h index f0d6a6dca1f..dbcc2578f9a 100644 --- a/js/src/vm/Debugger.h +++ b/js/src/vm/Debugger.h @@ -324,7 +324,7 @@ class Debugger : private mozilla::LinkedListElement static JSBool wrap(JSContext *cx, unsigned argc, Value *vp); static JSBool construct(JSContext *cx, unsigned argc, Value *vp); static const JSPropertySpec properties[]; - static JSFunctionSpec methods[]; + static const JSFunctionSpec methods[]; JSObject *getHook(Hook hook) const; bool hasAnyLiveHooks() const; diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index 47e850f53af..55377c24b33 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -462,7 +462,7 @@ intrinsic_RuntimeDefaultLocale(JSContext *cx, unsigned argc, Value *vp) return true; } -JSFunctionSpec intrinsic_functions[] = { +const JSFunctionSpec intrinsic_functions[] = { JS_FN("ToObject", intrinsic_ToObject, 1,0), JS_FN("ToInteger", intrinsic_ToInteger, 1,0), JS_FN("IsCallable", intrinsic_IsCallable, 1,0), diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index 1532b39c8f8..a025ffbad84 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -326,7 +326,7 @@ Blob(JSContext *cx, unsigned argc, jsval *vp) return true; } -static JSFunctionSpec gGlobalFun[] = { +static const JSFunctionSpec gGlobalFun[] = { JS_FS("dump", Dump, 1,0), JS_FS("debug", Debug, 1,0), JS_FS("atob", Atob, 1,0), diff --git a/js/xpconnect/shell/xpcshell.cpp b/js/xpconnect/shell/xpcshell.cpp index 79492ef16c4..62ab3086137 100644 --- a/js/xpconnect/shell/xpcshell.cpp +++ b/js/xpconnect/shell/xpcshell.cpp @@ -821,7 +821,7 @@ Btoa(JSContext *cx, unsigned argc, jsval *vp) return xpc::Base64Encode(cx, JS_ARGV(cx, vp)[0], &JS_RVAL(cx, vp)); } -static JSFunctionSpec glob_functions[] = { +static const JSFunctionSpec glob_functions[] = { JS_FS("print", Print, 0,0), JS_FS("readline", ReadLine, 1,0), JS_FS("load", Load, 1,0), diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 703a466a4a7..d3530f53f61 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -3057,7 +3057,7 @@ static JSClass SandboxClass = { NULL, NULL, NULL, NULL, TraceXPCGlobal }; -static JSFunctionSpec SandboxFunctions[] = { +static const JSFunctionSpec SandboxFunctions[] = { JS_FS("dump", SandboxDump, 1,0), JS_FS("debug", SandboxDebug, 1,0), JS_FS("importFunction", SandboxImport, 1,0), diff --git a/netwerk/base/src/ProxyAutoConfig.cpp b/netwerk/base/src/ProxyAutoConfig.cpp index dec6ca45614..e856de6260d 100644 --- a/netwerk/base/src/ProxyAutoConfig.cpp +++ b/netwerk/base/src/ProxyAutoConfig.cpp @@ -447,7 +447,7 @@ JSBool PACProxyAlert(JSContext *cx, unsigned int argc, JS::Value *vp) return true; } -static JSFunctionSpec PACGlobalFunctions[] = { +static const JSFunctionSpec PACGlobalFunctions[] = { JS_FS("dnsResolve", PACDnsResolve, 1, 0), JS_FS("myIpAddress", PACMyIpAddress, 0, 0), JS_FS("alert", PACProxyAlert, 1, 0),