diff --git a/dom/base/WindowNamedPropertiesHandler.cpp b/dom/base/WindowNamedPropertiesHandler.cpp index 83098250e264..90399d4343c0 100644 --- a/dom/base/WindowNamedPropertiesHandler.cpp +++ b/dom/base/WindowNamedPropertiesHandler.cpp @@ -87,6 +87,7 @@ WindowNamedPropertiesHandler::getOwnPropertyDescriptor(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, JS::MutableHandle aDesc) + const { // Note: The infallibleInit call below depends on this check. if (!JSID_IS_STRING(aId)) { @@ -160,7 +161,7 @@ bool WindowNamedPropertiesHandler::defineProperty(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - JS::MutableHandle aDesc) + JS::MutableHandle aDesc) const { ErrorResult rv; rv.ThrowTypeError(MSG_DEFINEPROPERTY_ON_GSP); @@ -172,7 +173,7 @@ bool WindowNamedPropertiesHandler::ownPropNames(JSContext* aCx, JS::Handle aProxy, unsigned flags, - JS::AutoIdVector& aProps) + JS::AutoIdVector& aProps) const { // Grab the DOM window. nsGlobalWindow* win = GetWindowFromGlobal(JS_GetGlobalForObject(aCx, aProxy)); @@ -210,7 +211,7 @@ WindowNamedPropertiesHandler::ownPropNames(JSContext* aCx, bool WindowNamedPropertiesHandler::delete_(JSContext* aCx, JS::Handle aProxy, - JS::Handle aId, bool* aBp) + JS::Handle aId, bool* aBp) const { *aBp = false; return true; diff --git a/dom/base/WindowNamedPropertiesHandler.h b/dom/base/WindowNamedPropertiesHandler.h index d4bf7b3ada48..586264d0377a 100644 --- a/dom/base/WindowNamedPropertiesHandler.h +++ b/dom/base/WindowNamedPropertiesHandler.h @@ -20,7 +20,7 @@ public: { } virtual bool - preventExtensions(JSContext* aCx, JS::Handle aProxy) MOZ_OVERRIDE + preventExtensions(JSContext* aCx, JS::Handle aProxy) const MOZ_OVERRIDE { // Throw a TypeError, per WebIDL. JS_ReportErrorNumber(aCx, js_GetErrorMessage, nullptr, @@ -30,26 +30,27 @@ public: virtual bool getOwnPropertyDescriptor(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - JS::MutableHandle aDesc) MOZ_OVERRIDE; + JS::MutableHandle aDesc) + const MOZ_OVERRIDE; virtual bool defineProperty(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - JS::MutableHandle aDesc) MOZ_OVERRIDE; + JS::MutableHandle aDesc) const MOZ_OVERRIDE; virtual bool ownPropNames(JSContext* aCx, JS::Handle aProxy, unsigned flags, - JS::AutoIdVector& aProps) MOZ_OVERRIDE; + JS::AutoIdVector& aProps) const MOZ_OVERRIDE; virtual bool delete_(JSContext* aCx, JS::Handle aProxy, JS::Handle aId, - bool* aBp) MOZ_OVERRIDE; + bool* aBp) const MOZ_OVERRIDE; virtual bool isExtensible(JSContext* aCx, JS::Handle aProxy, - bool* aIsExtensible) MOZ_OVERRIDE + bool* aIsExtensible) const MOZ_OVERRIDE { *aIsExtensible = true; return true; } virtual const char* - className(JSContext *aCx, JS::Handle aProxy) MOZ_OVERRIDE + className(JSContext *aCx, JS::Handle aProxy) const MOZ_OVERRIDE { return "WindowProperties"; } diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 3b1fb1e72a67..1fecfa3d8a5e 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -601,69 +601,72 @@ class nsOuterWindowProxy : public js::Wrapper public: nsOuterWindowProxy() : js::Wrapper(0) { } - virtual bool finalizeInBackground(JS::Value priv) { + virtual bool finalizeInBackground(JS::Value priv) const MOZ_OVERRIDE { return false; } virtual const char *className(JSContext *cx, - JS::Handle wrapper) MOZ_OVERRIDE; - virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE; + JS::Handle wrapper) const MOZ_OVERRIDE; + virtual void finalize(JSFreeOp *fop, JSObject *proxy) const MOZ_OVERRIDE; // Fundamental traps virtual bool isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) - MOZ_OVERRIDE; + const MOZ_OVERRIDE; virtual bool preventExtensions(JSContext *cx, - JS::Handle proxy) MOZ_OVERRIDE; + JS::Handle proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) + const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) + const MOZ_OVERRIDE; virtual bool defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) + const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool delete_(JSContext *cx, JS::Handle proxy, JS::Handle id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool enumerate(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool watch(JSContext *cx, JS::Handle proxy, - JS::Handle id, JS::Handle callable) MOZ_OVERRIDE; + JS::Handle id, JS::Handle callable) const MOZ_OVERRIDE; virtual bool unwatch(JSContext *cx, JS::Handle proxy, - JS::Handle id) MOZ_OVERRIDE; + JS::Handle id) const MOZ_OVERRIDE; // Derived traps virtual bool has(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) MOZ_OVERRIDE; + JS::Handle id, bool *bp) const MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) MOZ_OVERRIDE; + JS::Handle id, bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, - JS::MutableHandle vp) MOZ_OVERRIDE; + JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, bool strict, - JS::MutableHandle vp) MOZ_OVERRIDE; + JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JS::Handle proxy, unsigned flags, - JS::MutableHandle vp) MOZ_OVERRIDE; + JS::MutableHandle vp) const MOZ_OVERRIDE; static const nsOuterWindowProxy singleton; protected: - nsGlobalWindow* GetWindow(JSObject *proxy) + nsGlobalWindow* GetWindow(JSObject *proxy) const { return nsGlobalWindow::FromSupports( static_cast(js::GetProxyExtra(proxy, 0).toPrivate())); @@ -674,16 +677,16 @@ protected: bool GetSubframeWindow(JSContext *cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle vp, - bool &found); + bool &found) const; // Returns a non-null window only if id is an index and we have a // window at that index. already_AddRefed GetSubframeWindow(JSContext *cx, JS::Handle proxy, - JS::Handle id); + JS::Handle id) const; bool AppendIndexedPropertyNames(JSContext *cx, JSObject *proxy, - JS::AutoIdVector &props); + JS::AutoIdVector &props) const; }; const js::Class OuterWindowProxyClass = @@ -702,7 +705,7 @@ const js::Class OuterWindowProxyClass = bool nsOuterWindowProxy::isExtensible(JSContext *cx, JS::Handle proxy, - bool *extensible) + bool *extensible) const { // If [[Extensible]] could be false, then navigating a window could navigate // to a window that's [[Extensible]] after being at one that wasn't: an @@ -713,7 +716,7 @@ nsOuterWindowProxy::isExtensible(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::preventExtensions(JSContext *cx, - JS::Handle proxy) + JS::Handle proxy) const { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, @@ -722,7 +725,7 @@ nsOuterWindowProxy::preventExtensions(JSContext *cx, } const char * -nsOuterWindowProxy::className(JSContext *cx, JS::Handle proxy) +nsOuterWindowProxy::className(JSContext *cx, JS::Handle proxy) const { MOZ_ASSERT(js::IsProxy(proxy)); @@ -730,7 +733,7 @@ nsOuterWindowProxy::className(JSContext *cx, JS::Handle proxy) } void -nsOuterWindowProxy::finalize(JSFreeOp *fop, JSObject *proxy) +nsOuterWindowProxy::finalize(JSFreeOp *fop, JSObject *proxy) const { nsGlobalWindow* global = GetWindow(proxy); if (global) { @@ -748,7 +751,7 @@ bool nsOuterWindowProxy::getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) + JS::MutableHandle desc) const { // The only thing we can do differently from js::Wrapper is shadow stuff with // our indexed properties, so we can just try getOwnPropertyDescriptor and if @@ -770,6 +773,7 @@ nsOuterWindowProxy::getOwnPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle desc) + const { bool found; if (!GetSubframeWindow(cx, proxy, id, desc.value(), found)) { @@ -789,6 +793,7 @@ nsOuterWindowProxy::defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle desc) + const { int32_t index = GetArrayIndexFromId(cx, id); if (IsArrayIndex(index)) { @@ -805,7 +810,7 @@ nsOuterWindowProxy::defineProperty(JSContext* cx, bool nsOuterWindowProxy::getOwnPropertyNames(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) + JS::AutoIdVector &props) const { // Just our indexed stuff followed by our "normal" own property names. if (!AppendIndexedPropertyNames(cx, proxy, props)) { @@ -821,7 +826,7 @@ nsOuterWindowProxy::getOwnPropertyNames(JSContext *cx, bool nsOuterWindowProxy::delete_(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) + JS::Handle id, bool *bp) const { if (nsCOMPtr frame = GetSubframeWindow(cx, proxy, id)) { // Reject (which means throw if strict, else return false) the delete. @@ -842,7 +847,7 @@ nsOuterWindowProxy::delete_(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::enumerate(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) + JS::AutoIdVector &props) const { // Just our indexed stuff followed by our "normal" own property names. if (!AppendIndexedPropertyNames(cx, proxy, props)) { @@ -858,7 +863,7 @@ nsOuterWindowProxy::enumerate(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::has(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) + JS::Handle id, bool *bp) const { if (nsCOMPtr frame = GetSubframeWindow(cx, proxy, id)) { *bp = true; @@ -870,7 +875,7 @@ nsOuterWindowProxy::has(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::hasOwn(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) + JS::Handle id, bool *bp) const { if (nsCOMPtr frame = GetSubframeWindow(cx, proxy, id)) { *bp = true; @@ -884,7 +889,7 @@ bool nsOuterWindowProxy::get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, - JS::MutableHandle vp) + JS::MutableHandle vp) const { if (id == nsDOMClassInfo::sWrappedJSObject_id && xpc::AccessCheck::isChrome(js::GetContextCompartment(cx))) { @@ -909,7 +914,7 @@ nsOuterWindowProxy::set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, bool strict, - JS::MutableHandle vp) + JS::MutableHandle vp) const { int32_t index = GetArrayIndexFromId(cx, id); if (IsArrayIndex(index)) { @@ -925,7 +930,7 @@ nsOuterWindowProxy::set(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::keys(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) + JS::AutoIdVector &props) const { // BaseProxyHandler::keys seems to do what we want here: call // getOwnPropertyNames and then filter out the non-enumerable properties. @@ -934,7 +939,7 @@ nsOuterWindowProxy::keys(JSContext *cx, JS::Handle proxy, bool nsOuterWindowProxy::iterate(JSContext *cx, JS::Handle proxy, - unsigned flags, JS::MutableHandle vp) + unsigned flags, JS::MutableHandle vp) const { // BaseProxyHandler::iterate seems to do what we want here: fall // back on the property names returned from keys() and enumerate(). @@ -946,7 +951,7 @@ nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle vp, - bool& found) + bool& found) const { nsCOMPtr frame = GetSubframeWindow(cx, proxy, id); if (!frame) { @@ -973,7 +978,7 @@ nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, already_AddRefed nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, JS::Handle proxy, - JS::Handle id) + JS::Handle id) const { int32_t index = GetArrayIndexFromId(cx, id); if (!IsArrayIndex(index)) { @@ -987,7 +992,7 @@ nsOuterWindowProxy::GetSubframeWindow(JSContext *cx, bool nsOuterWindowProxy::AppendIndexedPropertyNames(JSContext *cx, JSObject *proxy, - JS::AutoIdVector &props) + JS::AutoIdVector &props) const { uint32_t length = GetWindow(proxy)->Length(); MOZ_ASSERT(int32_t(length) >= 0); @@ -1003,14 +1008,14 @@ nsOuterWindowProxy::AppendIndexedPropertyNames(JSContext *cx, JSObject *proxy, bool nsOuterWindowProxy::watch(JSContext *cx, JS::Handle proxy, - JS::Handle id, JS::Handle callable) + JS::Handle id, JS::Handle callable) const { return js::WatchGuts(cx, proxy, id, callable); } bool nsOuterWindowProxy::unwatch(JSContext *cx, JS::Handle proxy, - JS::Handle id) + JS::Handle id) const { return js::UnwatchGuts(cx, proxy, id); } @@ -1023,14 +1028,14 @@ class nsChromeOuterWindowProxy : public nsOuterWindowProxy public: nsChromeOuterWindowProxy() : nsOuterWindowProxy() {} - virtual const char *className(JSContext *cx, JS::Handle wrapper) MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, JS::Handle wrapper) const MOZ_OVERRIDE; static const nsChromeOuterWindowProxy singleton; }; const char * nsChromeOuterWindowProxy::className(JSContext *cx, - JS::Handle proxy) + JS::Handle proxy) const { MOZ_ASSERT(js::IsProxy(proxy)); diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 3b274438f786..7f1315121f44 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -9487,7 +9487,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'desc')] ClassMethod.__init__(self, "getOwnPropertyDescriptor", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -9598,7 +9598,7 @@ class CGDOMJSProxyHandler_defineProperty(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'desc'), Argument('bool*', 'defined')] - ClassMethod.__init__(self, "defineProperty", "bool", args, virtual=True, override=True) + ClassMethod.__init__(self, "defineProperty", "bool", args, virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -9679,7 +9679,7 @@ class CGDOMJSProxyHandler_delete(ClassMethod): Argument('JS::Handle', 'id'), Argument('bool*', 'bp')] ClassMethod.__init__(self, "delete_", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -9778,7 +9778,7 @@ class CGDOMJSProxyHandler_ownPropNames(ClassMethod): Argument('unsigned', 'flags'), Argument('JS::AutoIdVector&', 'props')] ClassMethod.__init__(self, "ownPropNames", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -9854,7 +9854,7 @@ class CGDOMJSProxyHandler_hasOwn(ClassMethod): Argument('JS::Handle', 'id'), Argument('bool*', 'bp')] ClassMethod.__init__(self, "hasOwn", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -9936,7 +9936,7 @@ class CGDOMJSProxyHandler_get(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'vp')] ClassMethod.__init__(self, "get", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -10038,7 +10038,7 @@ class CGDOMJSProxyHandler_setCustom(ClassMethod): Argument('JS::Handle', 'id'), Argument('JS::MutableHandle', 'vp'), Argument('bool*', 'done')] - ClassMethod.__init__(self, "setCustom", "bool", args, virtual=True, override=True) + ClassMethod.__init__(self, "setCustom", "bool", args, virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -10101,7 +10101,7 @@ class CGDOMJSProxyHandler_className(ClassMethod): args = [Argument('JSContext*', 'cx'), Argument('JS::Handle', 'proxy')] ClassMethod.__init__(self, "className", "const char*", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -10112,7 +10112,7 @@ class CGDOMJSProxyHandler_finalizeInBackground(ClassMethod): def __init__(self, descriptor): args = [Argument('JS::Value', 'priv')] ClassMethod.__init__(self, "finalizeInBackground", "bool", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -10123,7 +10123,7 @@ class CGDOMJSProxyHandler_finalize(ClassMethod): def __init__(self, descriptor): args = [Argument('JSFreeOp*', 'fop'), Argument('JSObject*', 'proxy')] ClassMethod.__init__(self, "finalize", "void", args, - virtual=True, override=True) + virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): @@ -10140,7 +10140,7 @@ class CGDOMJSProxyHandler_slice(ClassMethod): Argument('uint32_t', 'begin'), Argument('uint32_t', 'end'), Argument('JS::Handle', 'array')] - ClassMethod.__init__(self, "slice", "bool", args, virtual=True, override=True) + ClassMethod.__init__(self, "slice", "bool", args, virtual=True, override=True, const=True) self.descriptor = descriptor def getBody(self): diff --git a/dom/bindings/DOMJSProxyHandler.cpp b/dom/bindings/DOMJSProxyHandler.cpp index 855c82c007f6..25884e7a3d45 100644 --- a/dom/bindings/DOMJSProxyHandler.cpp +++ b/dom/bindings/DOMJSProxyHandler.cpp @@ -146,7 +146,7 @@ DOMProxyHandler::EnsureExpandoObject(JSContext* cx, JS::Handle obj) } bool -DOMProxyHandler::isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) +DOMProxyHandler::isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) const { // always extensible per WebIDL *extensible = true; @@ -154,7 +154,7 @@ DOMProxyHandler::isExtensible(JSContext *cx, JS::Handle proxy, bool * } bool -DOMProxyHandler::preventExtensions(JSContext *cx, JS::Handle proxy) +DOMProxyHandler::preventExtensions(JSContext *cx, JS::Handle proxy) const { // Throw a TypeError, per WebIDL. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, @@ -166,7 +166,7 @@ bool BaseDOMProxyHandler::getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - MutableHandle desc) + MutableHandle desc) const { if (!getOwnPropertyDescriptor(cx, proxy, id, desc)) { return false; @@ -189,7 +189,7 @@ BaseDOMProxyHandler::getPropertyDescriptor(JSContext* cx, bool DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - MutableHandle desc, bool* defined) + MutableHandle desc, bool* defined) const { if (desc.hasGetterObject() && desc.setter() == JS_StrictPropertyStub) { return JS_ReportErrorFlagsAndNumber(cx, @@ -214,7 +214,7 @@ DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle proxy, JS:: bool DOMProxyHandler::set(JSContext *cx, Handle proxy, Handle receiver, - Handle id, bool strict, MutableHandle vp) + Handle id, bool strict, MutableHandle vp) const { MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy), "Should not have a XrayWrapper here"); @@ -230,7 +230,7 @@ DOMProxyHandler::set(JSContext *cx, Handle proxy, Handle r bool DOMProxyHandler::delete_(JSContext* cx, JS::Handle proxy, - JS::Handle id, bool* bp) + JS::Handle id, bool* bp) const { JS::Rooted expando(cx); if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = GetExpandoObject(proxy))) { @@ -243,7 +243,7 @@ DOMProxyHandler::delete_(JSContext* cx, JS::Handle proxy, bool BaseDOMProxyHandler::enumerate(JSContext* cx, JS::Handle proxy, - AutoIdVector& props) + AutoIdVector& props) const { JS::Rooted proto(cx); if (!JS_GetPrototype(cx, proxy, &proto)) { @@ -255,13 +255,13 @@ BaseDOMProxyHandler::enumerate(JSContext* cx, JS::Handle proxy, bool BaseDOMProxyHandler::watch(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::Handle callable) + JS::Handle callable) const { return js::WatchGuts(cx, proxy, id, callable); } bool -BaseDOMProxyHandler::unwatch(JSContext* cx, JS::Handle proxy, JS::Handle id) +BaseDOMProxyHandler::unwatch(JSContext* cx, JS::Handle proxy, JS::Handle id) const { return js::UnwatchGuts(cx, proxy, id); } @@ -269,7 +269,7 @@ BaseDOMProxyHandler::unwatch(JSContext* cx, JS::Handle proxy, JS::Han bool BaseDOMProxyHandler::getOwnPropertyNames(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector& props) + JS::AutoIdVector& props) const { return ownPropNames(cx, proxy, JSITER_OWNONLY | JSITER_HIDDEN, props); } @@ -277,13 +277,13 @@ BaseDOMProxyHandler::getOwnPropertyNames(JSContext* cx, bool BaseDOMProxyHandler::keys(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector& props) + JS::AutoIdVector& props) const { return ownPropNames(cx, proxy, JSITER_OWNONLY, props); } bool -DOMProxyHandler::has(JSContext* cx, JS::Handle proxy, JS::Handle id, bool* bp) +DOMProxyHandler::has(JSContext* cx, JS::Handle proxy, JS::Handle id, bool* bp) const { if (!hasOwn(cx, proxy, id, bp)) { return false; @@ -328,7 +328,7 @@ IdToInt32(JSContext* cx, JS::Handle id) bool DOMProxyHandler::setCustom(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle vp, bool *done) + JS::MutableHandle vp, bool *done) const { *done = false; return true; diff --git a/dom/bindings/DOMJSProxyHandler.h b/dom/bindings/DOMJSProxyHandler.h index d806b37ce347..aa3cad64b5f1 100644 --- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -45,23 +45,23 @@ public: // Implementations of traps that can be implemented in terms of // fundamental traps. bool enumerate(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector& props) MOZ_OVERRIDE; + JS::AutoIdVector& props) const MOZ_OVERRIDE; bool getPropertyDescriptor(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; bool watch(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::Handle callable) MOZ_OVERRIDE; + JS::Handle callable) const MOZ_OVERRIDE; bool unwatch(JSContext* cx, JS::Handle proxy, - JS::Handle id) MOZ_OVERRIDE; + JS::Handle id) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; // We override keys() and implement it directly instead of using the // default implementation, which would getOwnPropertyNames and then // filter out the non-enumerable ones. This avoids doing // unnecessary work during enumeration. virtual bool keys(JSContext* cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; protected: // Hook for subclasses to implement shared getOwnPropertyNames()/keys() @@ -69,7 +69,7 @@ protected: // or JSITER_OWNONLY | JSITER_HIDDEN (for getOwnPropertyNames()). virtual bool ownPropNames(JSContext* cx, JS::Handle proxy, unsigned flags, - JS::AutoIdVector& props) = 0; + JS::AutoIdVector& props) const = 0; }; class DOMProxyHandler : public BaseDOMProxyHandler @@ -80,21 +80,25 @@ public: { } - bool preventExtensions(JSContext *cx, JS::Handle proxy) MOZ_OVERRIDE; + bool preventExtensions(JSContext *cx, JS::Handle proxy) const MOZ_OVERRIDE; bool defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE + JS::MutableHandle desc) const MOZ_OVERRIDE { bool unused; return defineProperty(cx, proxy, id, desc, &unused); } virtual bool defineProperty(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc, bool* defined); + JS::MutableHandle desc, bool* defined) + const; bool set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, - JS::Handle id, bool strict, JS::MutableHandle vp) MOZ_OVERRIDE; + JS::Handle id, bool strict, JS::MutableHandle vp) + const MOZ_OVERRIDE; bool delete_(JSContext* cx, JS::Handle proxy, - JS::Handle id, bool* bp) MOZ_OVERRIDE; - bool has(JSContext* cx, JS::Handle proxy, JS::Handle id, bool* bp) MOZ_OVERRIDE; - bool isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) MOZ_OVERRIDE; + JS::Handle id, bool* bp) const MOZ_OVERRIDE; + bool has(JSContext* cx, JS::Handle proxy, JS::Handle id, + bool* bp) const MOZ_OVERRIDE; + bool isExtensible(JSContext *cx, JS::Handle proxy, bool *extensible) + const MOZ_OVERRIDE; /* * If assigning to proxy[id] hits a named setter with OverrideBuiltins or @@ -102,7 +106,7 @@ public: * *done to false. */ virtual bool setCustom(JSContext* cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle vp, bool *done); + JS::MutableHandle vp, bool *done) const; static JSObject* GetExpandoObject(JSObject* obj) { diff --git a/js/ipc/WrapperOwner.cpp b/js/ipc/WrapperOwner.cpp index 45305bf75612..dc834edbf287 100644 --- a/js/ipc/WrapperOwner.cpp +++ b/js/ipc/WrapperOwner.cpp @@ -54,35 +54,36 @@ class CPOWProxyHandler : public BaseProxyHandler : BaseProxyHandler(&sCPOWProxyHandler) {} virtual ~CPOWProxyHandler() {} - virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE { + virtual bool finalizeInBackground(Value priv) const MOZ_OVERRIDE { return false; } - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) MOZ_OVERRIDE; + HandleId id, MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver, - JS::HandleId id, bool strict, JS::MutableHandleValue vp) MOZ_OVERRIDE; - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; + JS::HandleId id, bool strict, JS::MutableHandleValue vp) const MOZ_OVERRIDE; + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; - virtual bool objectClassIs(HandleObject obj, js::ESClassValue classValue, JSContext *cx) MOZ_OVERRIDE; - virtual const char* className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; - virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool objectClassIs(HandleObject obj, js::ESClassValue classValue, + JSContext *cx) const MOZ_OVERRIDE; + virtual const char* className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + virtual void finalize(JSFreeOp *fop, JSObject *proxy) const MOZ_OVERRIDE; static const CPOWProxyHandler singleton; }; @@ -98,7 +99,7 @@ const CPOWProxyHandler CPOWProxyHandler::singleton; return owner->call args; bool -CPOWProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) +CPOWProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const { FORWARD(preventExtensions, (cx, proxy)); } @@ -119,7 +120,7 @@ WrapperOwner::preventExtensions(JSContext *cx, HandleObject proxy) bool CPOWProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { FORWARD(getPropertyDescriptor, (cx, proxy, id, desc)); } @@ -149,7 +150,7 @@ WrapperOwner::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId bool CPOWProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { FORWARD(getOwnPropertyDescriptor, (cx, proxy, id, desc)); } @@ -179,7 +180,7 @@ WrapperOwner::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, Handle bool CPOWProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { FORWARD(defineProperty, (cx, proxy, id, desc)); } @@ -208,7 +209,8 @@ WrapperOwner::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, } bool -CPOWProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) +CPOWProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, + AutoIdVector &props) const { FORWARD(getOwnPropertyNames, (cx, proxy, props)); } @@ -220,7 +222,7 @@ WrapperOwner::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVecto } bool -CPOWProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +CPOWProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { FORWARD(delete_, (cx, proxy, id, bp)); } @@ -244,7 +246,7 @@ WrapperOwner::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) } bool -CPOWProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) +CPOWProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { FORWARD(enumerate, (cx, proxy, props)); } @@ -256,7 +258,7 @@ WrapperOwner::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) } bool -CPOWProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +CPOWProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { FORWARD(has, (cx, proxy, id, bp)); } @@ -280,7 +282,7 @@ WrapperOwner::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) } bool -CPOWProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +CPOWProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { FORWARD(hasOwn, (cx, proxy, id, bp)); } @@ -305,7 +307,7 @@ WrapperOwner::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) bool CPOWProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { FORWARD(get, (cx, proxy, receiver, id, vp)); } @@ -406,7 +408,7 @@ WrapperOwner::get(JSContext *cx, HandleObject proxy, HandleObject receiver, bool CPOWProxyHandler::set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver, - JS::HandleId id, bool strict, JS::MutableHandleValue vp) + JS::HandleId id, bool strict, JS::MutableHandleValue vp) const { FORWARD(set, (cx, proxy, receiver, id, strict, vp)); } @@ -440,7 +442,7 @@ WrapperOwner::set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiv } bool -CPOWProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) +CPOWProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { FORWARD(keys, (cx, proxy, props)); } @@ -452,7 +454,7 @@ WrapperOwner::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) } bool -CPOWProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +CPOWProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const { FORWARD(isExtensible, (cx, proxy, extensible)); } @@ -472,7 +474,7 @@ WrapperOwner::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) } bool -CPOWProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +CPOWProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const { FORWARD(call, (cx, proxy, args)); } @@ -550,7 +552,7 @@ WrapperOwner::call(JSContext *cx, HandleObject proxy, const CallArgs &args) bool -CPOWProxyHandler::objectClassIs(HandleObject proxy, js::ESClassValue classValue, JSContext *cx) +CPOWProxyHandler::objectClassIs(HandleObject proxy, js::ESClassValue classValue, JSContext *cx) const { FORWARD(objectClassIs, (cx, proxy, classValue)); } @@ -572,7 +574,7 @@ WrapperOwner::objectClassIs(JSContext *cx, HandleObject proxy, js::ESClassValue } const char * -CPOWProxyHandler::className(JSContext *cx, HandleObject proxy) +CPOWProxyHandler::className(JSContext *cx, HandleObject proxy) const { WrapperOwner *parent = OwnerOf(proxy); if (!parent->active()) @@ -595,7 +597,7 @@ WrapperOwner::className(JSContext *cx, HandleObject proxy) } void -CPOWProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) +CPOWProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) const { OwnerOf(proxy)->drop(proxy); } diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 1d5832e14f40..43602631699a 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -92,14 +92,14 @@ BaseProxyHandler::~BaseProxyHandler() bool BaseProxyHandler::enter(JSContext *cx, HandleObject wrapper, HandleId id, Action act, - bool *bp) + bool *bp) const { *bp = true; return true; } bool -BaseProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +BaseProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { assertEnteredPolicy(cx, proxy, id, GET); Rooted desc(cx); @@ -110,7 +110,7 @@ BaseProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) } bool -BaseProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +BaseProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { // Note: Proxy::set needs to invoke hasOwn to determine where the setter // lives, so we allow SET operations to invoke us. @@ -124,7 +124,7 @@ BaseProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *b bool BaseProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, id, GET); @@ -154,7 +154,7 @@ BaseProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, bool BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) + HandleId id, bool strict, MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, id, SET); @@ -224,7 +224,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, } bool -BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) +BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); JS_ASSERT(props.length() == 0); @@ -256,7 +256,8 @@ BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) } bool -BaseProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp) +BaseProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, + MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); @@ -271,25 +272,25 @@ BaseProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, Mut } bool -BaseProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +BaseProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const { MOZ_ASSUME_UNREACHABLE("callable proxies should implement call trap"); } bool -BaseProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) +BaseProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const { MOZ_ASSUME_UNREACHABLE("callable proxies should implement construct trap"); } const char * -BaseProxyHandler::className(JSContext *cx, HandleObject proxy) +BaseProxyHandler::className(JSContext *cx, HandleObject proxy) const { return proxy->isCallable() ? "Function" : "Object"; } JSString * -BaseProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) +BaseProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const { if (proxy->isCallable()) return JS_NewStringCopyZ(cx, "function () {\n [native code]\n}"); @@ -300,27 +301,29 @@ BaseProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned inden bool BaseProxyHandler::regexp_toShared(JSContext *cx, HandleObject proxy, - RegExpGuard *g) + RegExpGuard *g) const { MOZ_ASSUME_UNREACHABLE("This should have been a wrapped regexp"); } bool BaseProxyHandler::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, - MutableHandleValue vp) + MutableHandleValue vp) const { return DefaultValue(cx, proxy, hint, vp); } bool -BaseProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) +BaseProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) const { ReportIncompatible(cx, args); return false; } bool -BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) +BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, + bool *bp) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); RootedValue val(cx, ObjectValue(*proxy.get())); @@ -330,30 +333,30 @@ BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleVa } bool -BaseProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, JSContext *cx) +BaseProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, JSContext *cx) const { return false; } void -BaseProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) +BaseProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) const { } JSObject * -BaseProxyHandler::weakmapKeyDelegate(JSObject *proxy) +BaseProxyHandler::weakmapKeyDelegate(JSObject *proxy) const { return nullptr; } bool -BaseProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) +BaseProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const { MOZ_ASSUME_UNREACHABLE("Must override getPrototypeOf with lazy prototype."); } bool -BaseProxyHandler::setPrototypeOf(JSContext *cx, HandleObject, HandleObject, bool *) +BaseProxyHandler::setPrototypeOf(JSContext *cx, HandleObject, HandleObject, bool *) const { // Disallow sets of protos on proxies with lazy protos, but no hook. // This keeps us away from the footgun of having the first proto set opt @@ -364,7 +367,7 @@ BaseProxyHandler::setPrototypeOf(JSContext *cx, HandleObject, HandleObject, bool } bool -BaseProxyHandler::watch(JSContext *cx, HandleObject proxy, HandleId id, HandleObject callable) +BaseProxyHandler::watch(JSContext *cx, HandleObject proxy, HandleId id, HandleObject callable) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_WATCH, proxy->getClass()->name); @@ -372,14 +375,14 @@ BaseProxyHandler::watch(JSContext *cx, HandleObject proxy, HandleId id, HandleOb } bool -BaseProxyHandler::unwatch(JSContext *cx, HandleObject proxy, HandleId id) +BaseProxyHandler::unwatch(JSContext *cx, HandleObject proxy, HandleId id) const { return true; } bool BaseProxyHandler::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint32_t end, - HandleObject result) + HandleObject result) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); @@ -388,7 +391,7 @@ BaseProxyHandler::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint3 bool DirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { assertEnteredPolicy(cx, proxy, id, GET | SET); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -398,7 +401,7 @@ DirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, Han bool DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { assertEnteredPolicy(cx, proxy, id, GET | SET); RootedObject target(cx, proxy->as().target()); @@ -407,7 +410,7 @@ DirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, bool DirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { assertEnteredPolicy(cx, proxy, id, SET); RootedObject target(cx, proxy->as().target()); @@ -418,7 +421,7 @@ DirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId i bool DirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); RootedObject target(cx, proxy->as().target()); @@ -426,7 +429,7 @@ DirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, } bool -DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { assertEnteredPolicy(cx, proxy, id, SET); RootedObject target(cx, proxy->as().target()); @@ -435,7 +438,7 @@ DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool bool DirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -444,7 +447,7 @@ DirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, } bool -DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedValue target(cx, proxy->as().private_()); @@ -452,7 +455,7 @@ DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args } bool -DirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) +DirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedValue target(cx, proxy->as().private_()); @@ -461,7 +464,7 @@ DirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs bool DirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) + CallArgs args) const { args.setThis(ObjectValue(*args.thisv().toObject().as().target())); if (!test(args.thisv())) { @@ -474,7 +477,7 @@ DirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl bool DirectProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, - bool *bp) + bool *bp) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); bool b; @@ -486,14 +489,14 @@ DirectProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandle } bool -DirectProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) +DirectProxyHandler::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const { RootedObject target(cx, proxy->as().target()); return JSObject::getProto(cx, target, protop); } bool -DirectProxyHandler::setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) +DirectProxyHandler::setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) const { RootedObject target(cx, proxy->as().target()); return JSObject::setProto(cx, target, proto, bp); @@ -501,14 +504,14 @@ DirectProxyHandler::setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObje bool DirectProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue, - JSContext *cx) + JSContext *cx) const { RootedObject target(cx, proxy->as().target()); return ObjectClassIs(target, classValue, cx); } const char * -DirectProxyHandler::className(JSContext *cx, HandleObject proxy) +DirectProxyHandler::className(JSContext *cx, HandleObject proxy) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); RootedObject target(cx, proxy->as().target()); @@ -517,7 +520,7 @@ DirectProxyHandler::className(JSContext *cx, HandleObject proxy) JSString * DirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, - unsigned indent) + unsigned indent) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); RootedObject target(cx, proxy->as().target()); @@ -526,14 +529,14 @@ DirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, bool DirectProxyHandler::regexp_toShared(JSContext *cx, HandleObject proxy, - RegExpGuard *g) + RegExpGuard *g) const { RootedObject target(cx, proxy->as().target()); return RegExpToShared(cx, target, g); } JSObject * -DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy) +DirectProxyHandler::weakmapKeyDelegate(JSObject *proxy) const { return UncheckedUnwrap(proxy); } @@ -545,7 +548,7 @@ DirectProxyHandler::DirectProxyHandler(const void *family, bool hasPrototype, } bool -DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { assertEnteredPolicy(cx, proxy, id, GET); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -558,7 +561,7 @@ DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp } bool -DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { // Note: Proxy::set needs to invoke hasOwn to determine where the setter // lives, so we allow SET operations to invoke us. @@ -573,7 +576,7 @@ DirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool bool DirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, id, GET); RootedObject target(cx, proxy->as().target()); @@ -582,7 +585,7 @@ DirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver bool DirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) + HandleId id, bool strict, MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, id, SET); RootedObject target(cx, proxy->as().target()); @@ -590,7 +593,7 @@ DirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver } bool -DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) +DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); RootedObject target(cx, proxy->as().target()); @@ -599,7 +602,7 @@ DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) bool DirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) + MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. @@ -608,14 +611,14 @@ DirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, } bool -DirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +DirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const { RootedObject target(cx, proxy->as().target()); return JSObject::isExtensible(cx, target, extensible); } bool -DirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) +DirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const { RootedObject target(cx, proxy->as().target()); return JSObject::preventExtensions(cx, target); @@ -738,36 +741,37 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler virtual ~ScriptedIndirectProxyHandler(); /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; - virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props); - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; + virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, + AutoIdVector &props) const MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; /* ES5 Harmony derived proxy traps. */ - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - bool strict, MutableHandleValue vp) MOZ_OVERRIDE; - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; + bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) MOZ_OVERRIDE; - virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) MOZ_OVERRIDE; - virtual bool isScripted() MOZ_OVERRIDE { return true; } + CallArgs args) const MOZ_OVERRIDE; + virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const MOZ_OVERRIDE; + virtual bool isScripted() const MOZ_OVERRIDE { return true; } static const ScriptedIndirectProxyHandler singleton; }; @@ -802,7 +806,8 @@ ScriptedIndirectProxyHandler::~ScriptedIndirectProxyHandler() } bool -ScriptedIndirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +ScriptedIndirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, + bool *extensible) const { // Scripted indirect proxies don't support extensibility changes. *extensible = true; @@ -810,7 +815,7 @@ ScriptedIndirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bo } bool -ScriptedIndirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) +ScriptedIndirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY); @@ -840,7 +845,7 @@ GetIndirectProxyHandlerObject(JSObject *proxy) bool ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -853,7 +858,7 @@ ScriptedIndirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject bool ScriptedIndirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -866,7 +871,7 @@ ScriptedIndirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObje bool ScriptedIndirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -877,7 +882,7 @@ ScriptedIndirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, bool ScriptedIndirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) + AutoIdVector &props) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -887,7 +892,7 @@ ScriptedIndirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject pr } bool -ScriptedIndirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +ScriptedIndirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -897,7 +902,7 @@ ScriptedIndirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleI } bool -ScriptedIndirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) +ScriptedIndirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -907,7 +912,7 @@ ScriptedIndirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoI } bool -ScriptedIndirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +ScriptedIndirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -920,7 +925,7 @@ ScriptedIndirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id } bool -ScriptedIndirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +ScriptedIndirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue fval(cx), value(cx); @@ -934,7 +939,7 @@ ScriptedIndirectProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId bool ScriptedIndirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue idv(cx); @@ -953,7 +958,7 @@ ScriptedIndirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObjec bool ScriptedIndirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) + HandleId id, bool strict, MutableHandleValue vp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue idv(cx); @@ -972,7 +977,7 @@ ScriptedIndirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObjec } bool -ScriptedIndirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) +ScriptedIndirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue value(cx); @@ -986,7 +991,7 @@ ScriptedIndirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVect bool ScriptedIndirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) + MutableHandleValue vp) const { RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy)); RootedValue value(cx); @@ -999,7 +1004,7 @@ ScriptedIndirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigne } bool -ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedObject ccHolder(cx, &proxy->as().extra(0).toObject()); @@ -1010,7 +1015,7 @@ ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const Call } bool -ScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) +ScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedObject ccHolder(cx, &proxy->as().extra(0).toObject()); @@ -1023,13 +1028,13 @@ ScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const bool ScriptedIndirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) + CallArgs args) const { return BaseProxyHandler::nativeCall(cx, test, impl, args); } JSString * -ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) +ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const { assertEnteredPolicy(cx, proxy, JSID_VOID, GET); if (!proxy->isCallable()) { @@ -1052,42 +1057,42 @@ class ScriptedDirectProxyHandler : public DirectProxyHandler { virtual ~ScriptedDirectProxyHandler(); /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; - virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) - MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; + virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, + AutoIdVector &props) const MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE; /* ES5 Harmony derived proxy traps. */ - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE { + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE { return BaseProxyHandler::hasOwn(cx, proxy, id, bp); } virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - bool strict, MutableHandleValue vp) MOZ_OVERRIDE; + bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; // Kick keys out to getOwnPropertyName and then filter. [[GetOwnProperty]] could potentially // change the enumerability of the target's properties. - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE { + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE { return BaseProxyHandler::keys(cx, proxy, props); } virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; /* ES6 Harmony traps */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; /* 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; - virtual bool isScripted() MOZ_OVERRIDE { return true; } + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool isScripted() const MOZ_OVERRIDE { return true; } static const ScriptedDirectProxyHandler singleton; }; @@ -1364,7 +1369,7 @@ ScriptedDirectProxyHandler::~ScriptedDirectProxyHandler() } bool -ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) +ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) const { // step a RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1411,7 +1416,7 @@ ScriptedDirectProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) // FIXME: Move to Proxy::getPropertyDescriptor once ScriptedIndirectProxy is removed bool ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { JS_CHECK_RECURSION(cx, return false); @@ -1432,7 +1437,7 @@ ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject pr // ES6 (5 April 2014) Proxy.[[GetOwnProperty]](P) bool ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { // step 2 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1548,7 +1553,7 @@ ScriptedDirectProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject // ES6 (5 April 2014) Proxy.[[DefineOwnProperty]](O,P) bool ScriptedDirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) + MutableHandle desc) const { // step 2 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1634,7 +1639,7 @@ ScriptedDirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, Ha // ES6 (5 April 2014) Proxy.[[OwnPropertyKeys]](O) bool ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) + AutoIdVector &props) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1676,7 +1681,7 @@ ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject prox // ES6 (5 April 2014) Proxy.[[Delete]](P) bool -ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { // step 2 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1733,7 +1738,7 @@ ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId // 12.6.4 The for-in Statement, step 6 bool -ScriptedDirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) +ScriptedDirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { // step a RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1776,7 +1781,7 @@ ScriptedDirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdV // Proxy.[[HasProperty]](P) bool -ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1838,7 +1843,7 @@ ScriptedDirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, // Proxy.[[GetP]](P, Receiver) bool ScriptedDirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1901,7 +1906,7 @@ ScriptedDirectProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject // Proxy.[[SetP]](P, V, Receiver) bool ScriptedDirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) + HandleId id, bool strict, MutableHandleValue vp) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -1966,7 +1971,7 @@ ScriptedDirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject // ES6 (5 April, 2014) 9.5.3 Proxy.[[IsExtensible]](P) bool -ScriptedDirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +ScriptedDirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const { RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -2002,14 +2007,14 @@ ScriptedDirectProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool bool ScriptedDirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) + MutableHandleValue vp) const { // FIXME: Provide a proper implementation for this trap, see bug 787004 return DirectProxyHandler::iterate(cx, proxy, flags, vp); } bool -ScriptedDirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +ScriptedDirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); @@ -2047,7 +2052,7 @@ ScriptedDirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallAr } bool -ScriptedDirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) +ScriptedDirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const { // step 1 RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index 13e1f3310d8b..6e93043b6b05 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -136,7 +136,7 @@ class JS_FRIEND_API(BaseProxyHandler) return offsetof(BaseProxyHandler, mFamily); } - virtual bool finalizeInBackground(Value priv) { + virtual bool finalizeInBackground(Value priv) const { /* * Called on creation of a proxy to determine whether its finalize * method can be finalized on the background thread. @@ -169,59 +169,59 @@ class JS_FRIEND_API(BaseProxyHandler) }; virtual bool enter(JSContext *cx, HandleObject wrapper, HandleId id, Action act, - bool *bp); + bool *bp) const; /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) = 0; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const = 0; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) = 0; + MutableHandle desc) const = 0; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, - HandleId id, MutableHandle desc) = 0; + HandleId id, MutableHandle desc) const = 0; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) = 0; + MutableHandle desc) const = 0; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) = 0; - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) = 0; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) = 0; + AutoIdVector &props) const = 0; + virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const = 0; + virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const = 0; /* ES5 Harmony derived proxy traps. */ - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); + virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const; + virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const; virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp); + HandleId id, MutableHandleValue vp) const; virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp); - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props); + HandleId id, bool strict, MutableHandleValue vp) const; + virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const; virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp); + MutableHandleValue vp) const; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) = 0; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args); - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args); - virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); - virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp); - virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx); - virtual const char *className(JSContext *cx, HandleObject proxy); - virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent); - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g); - virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp); - virtual void finalize(JSFreeOp *fop, JSObject *proxy); - virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop); - virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp); + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const = 0; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) const; + virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) const; + virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) const; + virtual const char *className(JSContext *cx, HandleObject proxy) const; + virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const; + virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp) const; + virtual void finalize(JSFreeOp *fop, JSObject *proxy) const; + virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const; + virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) const; // These two hooks must be overridden, or not overridden, in tandem -- no // overriding just one! virtual bool watch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, - JS::HandleObject callable); - virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id); + JS::HandleObject callable) const; + virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id) const; virtual bool slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint32_t end, - HandleObject result); + HandleObject result) const; /* See comment for weakmapKeyDelegateOp in js/Class.h. */ - virtual JSObject *weakmapKeyDelegate(JSObject *proxy); - virtual bool isScripted() { return false; } + virtual JSObject *weakmapKeyDelegate(JSObject *proxy) const; + virtual bool isScripted() const { return false; } }; /* @@ -241,52 +241,54 @@ class JS_PUBLIC_API(DirectProxyHandler) : public BaseProxyHandler bool hasSecurityPolicy = false); /* ES5 Harmony fundamental proxy traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool enumerate(JSContext *cx, HandleObject proxy, - AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; /* ES5 Harmony derived proxy traps. */ virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, MutableHandleValue vp) MOZ_OVERRIDE; + HandleId id, MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) MOZ_OVERRIDE; + HandleId id, bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool keys(JSContext *cx, HandleObject proxy, - AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) MOZ_OVERRIDE; + CallArgs args) const MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, - bool *bp) MOZ_OVERRIDE; - virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop); - virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp); + bool *bp) const MOZ_OVERRIDE; + virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, + MutableHandleObject protop) const MOZ_OVERRIDE; + virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, + bool *bp) const MOZ_OVERRIDE; virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, - JSContext *cx) MOZ_OVERRIDE; - virtual const char *className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + JSContext *cx) const MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, - unsigned indent) MOZ_OVERRIDE; + unsigned indent) const MOZ_OVERRIDE; virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, - RegExpGuard *g) MOZ_OVERRIDE; - virtual JSObject *weakmapKeyDelegate(JSObject *proxy); + RegExpGuard *g) const MOZ_OVERRIDE; + virtual JSObject *weakmapKeyDelegate(JSObject *proxy) const MOZ_OVERRIDE; }; /* diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index d562cdcf2119..c57a4ff9d8b8 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -30,7 +30,7 @@ const char js::sWrapperFamily = 0; * 720619. */ bool -Wrapper::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp) +Wrapper::defaultValue(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp) const { vp.set(ObjectValue(*proxy->as().target())); if (hint == JSTYPE_VOID) @@ -180,7 +180,7 @@ CrossCompartmentWrapper::~CrossCompartmentWrapper() { } -bool Wrapper::finalizeInBackground(Value priv) +bool Wrapper::finalizeInBackground(Value priv) const { if (!priv.isObject()) return true; @@ -210,7 +210,7 @@ bool Wrapper::finalizeInBackground(Value priv) #define NOTHING (true) bool -CrossCompartmentWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) +CrossCompartmentWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const { PIERCE(cx, wrapper, NOTHING, @@ -219,7 +219,7 @@ CrossCompartmentWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool } bool -CrossCompartmentWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) +CrossCompartmentWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) const { PIERCE(cx, wrapper, NOTHING, @@ -229,7 +229,7 @@ CrossCompartmentWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) bool CrossCompartmentWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { PIERCE(cx, wrapper, NOTHING, @@ -239,7 +239,7 @@ CrossCompartmentWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapp bool CrossCompartmentWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { PIERCE(cx, wrapper, NOTHING, @@ -249,7 +249,7 @@ CrossCompartmentWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wr bool CrossCompartmentWrapper::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { Rooted desc2(cx, desc); PIERCE(cx, wrapper, @@ -260,7 +260,7 @@ CrossCompartmentWrapper::defineProperty(JSContext *cx, HandleObject wrapper, Han bool CrossCompartmentWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { PIERCE(cx, wrapper, NOTHING, @@ -269,7 +269,7 @@ CrossCompartmentWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper } bool -CrossCompartmentWrapper::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) +CrossCompartmentWrapper::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const { PIERCE(cx, wrapper, NOTHING, @@ -278,7 +278,7 @@ CrossCompartmentWrapper::delete_(JSContext *cx, HandleObject wrapper, HandleId i } bool -CrossCompartmentWrapper::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) +CrossCompartmentWrapper::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const { PIERCE(cx, wrapper, NOTHING, @@ -287,7 +287,7 @@ CrossCompartmentWrapper::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVe } bool -CrossCompartmentWrapper::has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) +CrossCompartmentWrapper::has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const { PIERCE(cx, wrapper, NOTHING, @@ -296,7 +296,7 @@ CrossCompartmentWrapper::has(JSContext *cx, HandleObject wrapper, HandleId id, b } bool -CrossCompartmentWrapper::hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) +CrossCompartmentWrapper::hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const { PIERCE(cx, wrapper, NOTHING, @@ -306,7 +306,7 @@ CrossCompartmentWrapper::hasOwn(JSContext *cx, HandleObject wrapper, HandleId id bool CrossCompartmentWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, MutableHandleValue vp) + HandleId id, MutableHandleValue vp) const { RootedObject receiverCopy(cx, receiver); { @@ -322,7 +322,7 @@ CrossCompartmentWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject r bool CrossCompartmentWrapper::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) + HandleId id, bool strict, MutableHandleValue vp) const { RootedObject receiverCopy(cx, receiver); PIERCE(cx, wrapper, @@ -333,7 +333,7 @@ CrossCompartmentWrapper::set(JSContext *cx, HandleObject wrapper, HandleObject r } bool -CrossCompartmentWrapper::keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) +CrossCompartmentWrapper::keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const { PIERCE(cx, wrapper, NOTHING, @@ -416,7 +416,7 @@ Reify(JSContext *cx, JSCompartment *origin, MutableHandleValue vp) bool CrossCompartmentWrapper::iterate(JSContext *cx, HandleObject wrapper, unsigned flags, - MutableHandleValue vp) + MutableHandleValue vp) const { { AutoCompartment call(cx, wrappedObject(wrapper)); @@ -430,7 +430,7 @@ CrossCompartmentWrapper::iterate(JSContext *cx, HandleObject wrapper, unsigned f } bool -CrossCompartmentWrapper::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) +CrossCompartmentWrapper::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) const { RootedObject wrapped(cx, wrappedObject(wrapper)); @@ -454,7 +454,7 @@ CrossCompartmentWrapper::call(JSContext *cx, HandleObject wrapper, const CallArg } bool -CrossCompartmentWrapper::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) +CrossCompartmentWrapper::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) const { RootedObject wrapped(cx, wrappedObject(wrapper)); { @@ -472,7 +472,7 @@ CrossCompartmentWrapper::construct(JSContext *cx, HandleObject wrapper, const Ca bool CrossCompartmentWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs srcArgs) + CallArgs srcArgs) const { RootedObject wrapper(cx, &srcArgs.thisv().toObject()); JS_ASSERT(srcArgs.thisv().isMagic(JS_IS_CONSTRUCTING) || @@ -521,7 +521,7 @@ CrossCompartmentWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, Native bool CrossCompartmentWrapper::hasInstance(JSContext *cx, HandleObject wrapper, MutableHandleValue v, - bool *bp) + bool *bp) const { AutoCompartment call(cx, wrappedObject(wrapper)); if (!cx->compartment()->wrap(cx, v)) @@ -530,14 +530,14 @@ CrossCompartmentWrapper::hasInstance(JSContext *cx, HandleObject wrapper, Mutabl } const char * -CrossCompartmentWrapper::className(JSContext *cx, HandleObject wrapper) +CrossCompartmentWrapper::className(JSContext *cx, HandleObject wrapper) const { AutoCompartment call(cx, wrappedObject(wrapper)); return Wrapper::className(cx, wrapper); } JSString * -CrossCompartmentWrapper::fun_toString(JSContext *cx, HandleObject wrapper, unsigned indent) +CrossCompartmentWrapper::fun_toString(JSContext *cx, HandleObject wrapper, unsigned indent) const { RootedString str(cx); { @@ -552,7 +552,7 @@ CrossCompartmentWrapper::fun_toString(JSContext *cx, HandleObject wrapper, unsig } bool -CrossCompartmentWrapper::regexp_toShared(JSContext *cx, HandleObject wrapper, RegExpGuard *g) +CrossCompartmentWrapper::regexp_toShared(JSContext *cx, HandleObject wrapper, RegExpGuard *g) const { RegExpGuard wrapperGuard(cx); { @@ -568,7 +568,7 @@ CrossCompartmentWrapper::regexp_toShared(JSContext *cx, HandleObject wrapper, Re bool CrossCompartmentWrapper::defaultValue(JSContext *cx, HandleObject wrapper, JSType hint, - MutableHandleValue vp) + MutableHandleValue vp) const { PIERCE(cx, wrapper, NOTHING, @@ -578,7 +578,7 @@ CrossCompartmentWrapper::defaultValue(JSContext *cx, HandleObject wrapper, JSTyp bool CrossCompartmentWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, - MutableHandleObject protop) + MutableHandleObject protop) const { { RootedObject wrapped(cx, wrappedObject(wrapper)); @@ -594,7 +594,7 @@ CrossCompartmentWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, bool CrossCompartmentWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper, - HandleObject proto, bool *bp) + HandleObject proto, bool *bp) const { RootedObject protoCopy(cx, proto); PIERCE(cx, wrapper, @@ -615,7 +615,7 @@ SecurityWrapper::SecurityWrapper(unsigned flags, bool hasPrototype) template bool -SecurityWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) +SecurityWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const { // Just like BaseProxyHandler, SecurityWrappers claim by default to always // be extensible, so as not to leak information about the state of the @@ -626,7 +626,7 @@ SecurityWrapper::isExtensible(JSContext *cx, HandleObject wrapper, bool *e template bool -SecurityWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) +SecurityWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) const { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); @@ -636,7 +636,7 @@ SecurityWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) template bool SecurityWrapper::enter(JSContext *cx, HandleObject wrapper, HandleId id, - Wrapper::Action act, bool *bp) + Wrapper::Action act, bool *bp) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); *bp = false; @@ -646,7 +646,7 @@ SecurityWrapper::enter(JSContext *cx, HandleObject wrapper, HandleId id, template bool SecurityWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) + CallArgs args) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -655,7 +655,7 @@ SecurityWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, NativeIm template bool SecurityWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper, - HandleObject proto, bool *bp) + HandleObject proto, bool *bp) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -667,21 +667,21 @@ SecurityWrapper::setPrototypeOf(JSContext *cx, HandleObject wrapper, template bool SecurityWrapper::defaultValue(JSContext *cx, HandleObject wrapper, - JSType hint, MutableHandleValue vp) + JSType hint, MutableHandleValue vp) const { return DefaultValue(cx, wrapper, hint, vp); } template bool -SecurityWrapper::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) +SecurityWrapper::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) const { return false; } template bool -SecurityWrapper::regexp_toShared(JSContext *cx, HandleObject obj, RegExpGuard *g) +SecurityWrapper::regexp_toShared(JSContext *cx, HandleObject obj, RegExpGuard *g) const { return Base::regexp_toShared(cx, obj, g); } @@ -689,7 +689,7 @@ SecurityWrapper::regexp_toShared(JSContext *cx, HandleObject obj, RegExpGu template bool SecurityWrapper::defineProperty(JSContext *cx, HandleObject wrapper, - HandleId id, MutableHandle desc) + HandleId id, MutableHandle desc) const { if (desc.getter() || desc.setter()) { JSString *str = IdToString(cx, id); @@ -705,7 +705,7 @@ SecurityWrapper::defineProperty(JSContext *cx, HandleObject wrapper, template bool SecurityWrapper::watch(JSContext *cx, HandleObject proxy, - HandleId id, HandleObject callable) + HandleId id, HandleObject callable) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -714,7 +714,7 @@ SecurityWrapper::watch(JSContext *cx, HandleObject proxy, template bool SecurityWrapper::unwatch(JSContext *cx, HandleObject proxy, - HandleId id) + HandleId id) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNWRAP_DENIED); return false; @@ -730,7 +730,7 @@ DeadObjectProxy::DeadObjectProxy() } bool -DeadObjectProxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +DeadObjectProxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const { // This is kind of meaningless, but dead-object semantics aside, // [[Extensible]] always being true is consistent with other proxy types. @@ -739,7 +739,7 @@ DeadObjectProxy::isExtensible(JSContext *cx, HandleObject proxy, bool *extensibl } bool -DeadObjectProxy::preventExtensions(JSContext *cx, HandleObject proxy) +DeadObjectProxy::preventExtensions(JSContext *cx, HandleObject proxy) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -747,7 +747,7 @@ DeadObjectProxy::preventExtensions(JSContext *cx, HandleObject proxy) bool DeadObjectProxy::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -755,7 +755,7 @@ DeadObjectProxy::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, Hand bool DeadObjectProxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -763,7 +763,7 @@ DeadObjectProxy::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, H bool DeadObjectProxy::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) + MutableHandle desc) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; @@ -771,89 +771,92 @@ DeadObjectProxy::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id bool DeadObjectProxy::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) +DeadObjectProxy::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) +DeadObjectProxy::enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) +DeadObjectProxy::call(JSContext *cx, HandleObject wrapper, const CallArgs &args) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) +DeadObjectProxy::construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) +DeadObjectProxy::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) +DeadObjectProxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, + bool *bp) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) +DeadObjectProxy::objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } const char * -DeadObjectProxy::className(JSContext *cx, HandleObject wrapper) +DeadObjectProxy::className(JSContext *cx, HandleObject wrapper) const { return "DeadObject"; } JSString * -DeadObjectProxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) +DeadObjectProxy::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const { return nullptr; } bool -DeadObjectProxy::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) +DeadObjectProxy::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp) +DeadObjectProxy::defaultValue(JSContext *cx, HandleObject obj, JSType hint, + MutableHandleValue vp) const { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT); return false; } bool -DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) +DeadObjectProxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop) const { protop.set(nullptr); return true; diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h index 08579732383d..648d49c3c404 100644 --- a/js/src/jswrapper.h +++ b/js/src/jswrapper.h @@ -66,7 +66,7 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler }; virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; static JSObject *New(JSContext *cx, JSObject *obj, JSObject *parent, const Wrapper *handler, const WrapperOptions *options = nullptr); @@ -85,7 +85,7 @@ class JS_FRIEND_API(Wrapper) : public DirectProxyHandler virtual ~Wrapper(); - virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE; + virtual bool finalizeInBackground(Value priv) const MOZ_OVERRIDE; static const Wrapper singleton; static const Wrapper singletonWithPrototype; @@ -109,47 +109,47 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper virtual ~CrossCompartmentWrapper(); /* ES5 Harmony fundamental wrapper traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const MOZ_OVERRIDE; /* ES5 Harmony derived wrapper traps. */ - virtual bool has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; + virtual bool has(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool hasOwn(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, MutableHandleValue vp) MOZ_OVERRIDE; + HandleId id, MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, HandleObject wrapper, HandleObject receiver, - HandleId id, bool strict, MutableHandleValue vp) MOZ_OVERRIDE; - virtual bool keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) MOZ_OVERRIDE; + HandleId id, bool strict, MutableHandleValue vp) const MOZ_OVERRIDE; + virtual bool keys(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, HandleObject wrapper, unsigned flags, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject wrapper, const CallArgs &args) MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject wrapper, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject wrapper, const CallArgs &args) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) MOZ_OVERRIDE; + CallArgs args) const MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, HandleObject wrapper, MutableHandleValue v, - bool *bp) MOZ_OVERRIDE; - virtual const char *className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, HandleObject wrapper, - unsigned indent) MOZ_OVERRIDE; - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) MOZ_OVERRIDE; + unsigned indent) const MOZ_OVERRIDE; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, HandleObject wrapper, JSType hint, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, - MutableHandleObject protop) MOZ_OVERRIDE; + MutableHandleObject protop) const MOZ_OVERRIDE; virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; static const CrossCompartmentWrapper singleton; static const CrossCompartmentWrapper singletonWithPrototype; @@ -170,26 +170,26 @@ class JS_FRIEND_API(SecurityWrapper) : public Base public: explicit SecurityWrapper(unsigned flags, bool hasPrototype = false); - virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) MOZ_OVERRIDE; - virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject wrapper, bool *extensible) const MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject wrapper) const MOZ_OVERRIDE; virtual bool enter(JSContext *cx, HandleObject wrapper, HandleId id, Wrapper::Action act, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) MOZ_OVERRIDE; + CallArgs args) const MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, HandleObject wrapper, JSType hint, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, - JSContext *cx) MOZ_OVERRIDE; - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) MOZ_OVERRIDE; + JSContext *cx) const MOZ_OVERRIDE; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool watch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, - JS::HandleObject callable) MOZ_OVERRIDE; - virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id) MOZ_OVERRIDE; + JS::HandleObject callable) const MOZ_OVERRIDE; + virtual bool unwatch(JSContext *cx, JS::HandleObject proxy, JS::HandleId id) const MOZ_OVERRIDE; /* * Allow our subclasses to select the superclass behavior they want without @@ -211,35 +211,35 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler explicit DeadObjectProxy(); /* ES5 Harmony fundamental wrapper traps. */ - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, - MutableHandle desc) MOZ_OVERRIDE; + MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) MOZ_OVERRIDE; + AutoIdVector &props) const MOZ_OVERRIDE; + virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, HandleObject wrapper, AutoIdVector &props) const MOZ_OVERRIDE; /* Spidermonkey extensions. */ - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; - virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE; + virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; + virtual bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, - CallArgs args) MOZ_OVERRIDE; + CallArgs args) const MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool objectClassIs(HandleObject obj, ESClassValue classValue, - JSContext *cx) MOZ_OVERRIDE; - virtual const char *className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; - virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) MOZ_OVERRIDE; - virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) MOZ_OVERRIDE; + JSContext *cx) const MOZ_OVERRIDE; + virtual const char *className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const MOZ_OVERRIDE; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, - MutableHandleValue vp) MOZ_OVERRIDE; + MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, - MutableHandleObject protop) MOZ_OVERRIDE; + MutableHandleObject protop) const MOZ_OVERRIDE; static const DeadObjectProxy singleton; }; diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 9dd94ec8bcee..4b8c312bdc12 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -1141,7 +1141,7 @@ class DebugScopeProxy : public BaseProxyHandler */ bool handleUnaliasedAccess(JSContext *cx, Handle debugScope, Handle scope, jsid id, Action action, - MutableHandleValue vp, AccessResult *accessResult) + MutableHandleValue vp, AccessResult *accessResult) const { JS_ASSERT(&debugScope->scope() == scope); *accessResult = ACCESS_GENERIC; @@ -1318,7 +1318,7 @@ class DebugScopeProxy : public BaseProxyHandler DebugScopeProxy() : BaseProxyHandler(&family) {} - bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE + bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) const MOZ_OVERRIDE { // always [[Extensible]], can't be made non-[[Extensible]], like most // proxies @@ -1326,7 +1326,7 @@ class DebugScopeProxy : public BaseProxyHandler return true; } - bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE + bool preventExtensions(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY); @@ -1334,13 +1334,13 @@ class DebugScopeProxy : public BaseProxyHandler } bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE + MutableHandle desc) const MOZ_OVERRIDE { return getOwnPropertyDescriptor(cx, proxy, id, desc); } bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE + MutableHandle desc) const MOZ_OVERRIDE { Rooted debugScope(cx, &proxy->as()); Rooted scope(cx, &debugScope->scope()); @@ -1388,7 +1388,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - MutableHandleValue vp) MOZ_OVERRIDE + MutableHandleValue vp) const MOZ_OVERRIDE { Rooted debugScope(cx, &proxy->as()); Rooted scope(cx, &proxy->as().scope()); @@ -1430,7 +1430,7 @@ class DebugScopeProxy : public BaseProxyHandler * exceptional cases. */ bool getMaybeSentinelValue(JSContext *cx, Handle debugScope, HandleId id, - MutableHandleValue vp) + MutableHandleValue vp) const { Rooted scope(cx, &debugScope->scope()); @@ -1460,7 +1460,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, bool strict, - MutableHandleValue vp) MOZ_OVERRIDE + MutableHandleValue vp) const MOZ_OVERRIDE { Rooted debugScope(cx, &proxy->as()); Rooted scope(cx, &proxy->as().scope()); @@ -1480,7 +1480,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle desc) MOZ_OVERRIDE + MutableHandle desc) const MOZ_OVERRIDE { Rooted scope(cx, &proxy->as().scope()); @@ -1494,7 +1494,7 @@ class DebugScopeProxy : public BaseProxyHandler } bool getScopePropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props, - unsigned flags) + unsigned flags) const { Rooted scope(cx, &proxy->as().scope()); @@ -1529,17 +1529,17 @@ class DebugScopeProxy : public BaseProxyHandler return true; } - bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE + bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE { return getScopePropertyNames(cx, proxy, props, JSITER_OWNONLY); } - bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE + bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const MOZ_OVERRIDE { return getScopePropertyNames(cx, proxy, props, 0); } - bool has(JSContext *cx, HandleObject proxy, HandleId id_, bool *bp) MOZ_OVERRIDE + bool has(JSContext *cx, HandleObject proxy, HandleId id_, bool *bp) const MOZ_OVERRIDE { RootedId id(cx, id_); ScopeObject &scopeObj = proxy->as().scope(); @@ -1572,7 +1572,7 @@ class DebugScopeProxy : public BaseProxyHandler return true; } - bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE + bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const MOZ_OVERRIDE { RootedValue idval(cx, IdToValue(id)); return js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_CANT_DELETE, diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index 63e2036bebf1..61a4402fd36c 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -522,7 +522,7 @@ xpc::IsSandboxPrototypeProxy(JSObject *obj) bool xpc::SandboxCallableProxyHandler::call(JSContext *cx, JS::Handle proxy, - const JS::CallArgs &args) + const JS::CallArgs &args) const { // We forward the call to our underlying callable. @@ -638,7 +638,7 @@ bool xpc::SandboxProxyHandler::getPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) + JS::MutableHandle desc) const { JS::RootedObject obj(cx, wrappedObject(proxy)); @@ -685,6 +685,7 @@ xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, JS::MutableHandle desc) + const { if (!getPropertyDescriptor(cx, proxy, id, desc)) return false; @@ -702,13 +703,13 @@ xpc::SandboxProxyHandler::getOwnPropertyDescriptor(JSContext *cx, bool xpc::SandboxProxyHandler::has(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) + JS::Handle id, bool *bp) const { return BaseProxyHandler::has(cx, proxy, id, bp); } bool xpc::SandboxProxyHandler::hasOwn(JSContext *cx, JS::Handle proxy, - JS::Handle id, bool *bp) + JS::Handle id, bool *bp) const { return BaseProxyHandler::hasOwn(cx, proxy, id, bp); } @@ -717,7 +718,7 @@ bool xpc::SandboxProxyHandler::get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, - JS::MutableHandle vp) + JS::MutableHandle vp) const { return BaseProxyHandler::get(cx, proxy, receiver, id, vp); } @@ -727,21 +728,21 @@ xpc::SandboxProxyHandler::set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, JS::Handle id, bool strict, - JS::MutableHandle vp) + JS::MutableHandle vp) const { return BaseProxyHandler::set(cx, proxy, receiver, id, strict, vp); } bool xpc::SandboxProxyHandler::keys(JSContext *cx, JS::Handle proxy, - AutoIdVector &props) + AutoIdVector &props) const { return BaseProxyHandler::keys(cx, proxy, props); } bool xpc::SandboxProxyHandler::iterate(JSContext *cx, JS::Handle proxy, - unsigned flags, JS::MutableHandle vp) + unsigned flags, JS::MutableHandle vp) const { return BaseProxyHandler::iterate(cx, proxy, flags, vp); } diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp index 272064e7e2ee..dbbeabc3f568 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.cpp +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.cpp @@ -72,7 +72,7 @@ bool ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - JS::MutableHandle desc) + JS::MutableHandle desc) const { assertEnteredPolicy(cx, wrapper, id, GET | SET); // First, try a lookup on the base wrapper if permitted. @@ -103,7 +103,7 @@ ChromeObjectWrapper::getPropertyDescriptor(JSContext *cx, bool ChromeObjectWrapper::has(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) + HandleId id, bool *bp) const { assertEnteredPolicy(cx, wrapper, id, GET); // Try the lookup on the base wrapper if permitted. @@ -132,7 +132,7 @@ ChromeObjectWrapper::has(JSContext *cx, HandleObject wrapper, bool ChromeObjectWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - MutableHandleValue vp) + MutableHandleValue vp) const { assertEnteredPolicy(cx, wrapper, id, GET); vp.setUndefined(); @@ -167,7 +167,7 @@ ChromeObjectWrapper::get(JSContext *cx, HandleObject wrapper, // contacts. This isn't really ideal, but make it work for now. bool ChromeObjectWrapper::objectClassIs(HandleObject obj, js::ESClassValue classValue, - JSContext *cx) + JSContext *cx) const { return CrossCompartmentWrapper::objectClassIs(obj, classValue, cx); } @@ -178,7 +178,7 @@ ChromeObjectWrapper::objectClassIs(HandleObject obj, js::ESClassValue classValue // whole proto remapping thing for COWs is going to be phased out anyway. bool ChromeObjectWrapper::enter(JSContext *cx, HandleObject wrapper, - HandleId id, js::Wrapper::Action act, bool *bp) + HandleId id, js::Wrapper::Action act, bool *bp) const { if (AllowedByBase(cx, wrapper, id, act)) return true; diff --git a/js/xpconnect/wrappers/ChromeObjectWrapper.h b/js/xpconnect/wrappers/ChromeObjectWrapper.h index dea95d316ea7..28ef04ef0b90 100644 --- a/js/xpconnect/wrappers/ChromeObjectWrapper.h +++ b/js/xpconnect/wrappers/ChromeObjectWrapper.h @@ -31,17 +31,17 @@ class ChromeObjectWrapper : public ChromeObjectWrapperBase /* Custom traps. */ virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool has(JSContext *cx, JS::Handle wrapper, - JS::Handle id, bool *bp) MOZ_OVERRIDE; + JS::Handle id, bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp) MOZ_OVERRIDE; + JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool objectClassIs(JS::Handle obj, js::ESClassValue classValue, - JSContext *cx) MOZ_OVERRIDE; + JSContext *cx) const MOZ_OVERRIDE; virtual bool enter(JSContext *cx, JS::Handle wrapper, JS::Handle id, - js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE; + js::Wrapper::Action act, bool *bp) const MOZ_OVERRIDE; // NB: One might think we'd need to implement enumerate(), keys(), iterate(), // and getPropertyNames() here. However, ES5 built-in properties aren't diff --git a/js/xpconnect/wrappers/FilteringWrapper.cpp b/js/xpconnect/wrappers/FilteringWrapper.cpp index 5b510e904b0f..7ed6284cdf55 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.cpp +++ b/js/xpconnect/wrappers/FilteringWrapper.cpp @@ -60,7 +60,7 @@ template bool FilteringWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - JS::MutableHandle desc) + JS::MutableHandle desc) const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); if (!Base::getPropertyDescriptor(cx, wrapper, id, desc)) @@ -72,7 +72,7 @@ template bool FilteringWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, - JS::MutableHandle desc) + JS::MutableHandle desc) const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); if (!Base::getOwnPropertyDescriptor(cx, wrapper, id, desc)) @@ -83,7 +83,7 @@ FilteringWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleOb template bool FilteringWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return Base::getOwnPropertyNames(cx, wrapper, props) && @@ -93,7 +93,7 @@ FilteringWrapper::getOwnPropertyNames(JSContext *cx, HandleObject template bool FilteringWrapper::enumerate(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return Base::enumerate(cx, wrapper, props) && @@ -103,7 +103,7 @@ FilteringWrapper::enumerate(JSContext *cx, HandleObject wrapper, template bool FilteringWrapper::keys(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return Base::keys(cx, wrapper, props) && @@ -113,7 +113,7 @@ FilteringWrapper::keys(JSContext *cx, HandleObject wrapper, template bool FilteringWrapper::iterate(JSContext *cx, HandleObject wrapper, - unsigned flags, MutableHandleValue vp) + unsigned flags, MutableHandleValue vp) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); // We refuse to trigger the iterator hook across chrome wrappers because @@ -126,7 +126,7 @@ FilteringWrapper::iterate(JSContext *cx, HandleObject wrapper, template bool FilteringWrapper::nativeCall(JSContext *cx, JS::IsAcceptableThis test, - JS::NativeImpl impl, JS::CallArgs args) + JS::NativeImpl impl, JS::CallArgs args) const { if (Policy::allowNativeCall(cx, test, impl)) return Base::Permissive::nativeCall(cx, test, impl, args); @@ -136,7 +136,7 @@ FilteringWrapper::nativeCall(JSContext *cx, JS::IsAcceptableThis t template bool FilteringWrapper::defaultValue(JSContext *cx, HandleObject obj, - JSType hint, MutableHandleValue vp) + JSType hint, MutableHandleValue vp) const { return Base::defaultValue(cx, obj, hint, vp); } @@ -147,7 +147,7 @@ template<> bool FilteringWrapper ::defaultValue(JSContext *cx, HandleObject obj, - JSType hint, MutableHandleValue vp) + JSType hint, MutableHandleValue vp) const { JSString *str = JS_NewStringCopyZ(cx, "[Opaque]"); if (!str) @@ -160,7 +160,7 @@ FilteringWrapper template bool FilteringWrapper::enter(JSContext *cx, HandleObject wrapper, - HandleId id, Wrapper::Action act, bool *bp) + HandleId id, Wrapper::Action act, bool *bp) const { // This is a super ugly hacky to get around Xray Resolve wonkiness. // diff --git a/js/xpconnect/wrappers/FilteringWrapper.h b/js/xpconnect/wrappers/FilteringWrapper.h index 090c0c1df0ae..cb29b388ab42 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.h +++ b/js/xpconnect/wrappers/FilteringWrapper.h @@ -27,25 +27,26 @@ class FilteringWrapper : public Base { virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool enumerate(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JS::Handle wrapper, unsigned flags, - JS::MutableHandle vp) MOZ_OVERRIDE; + JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, JS::IsAcceptableThis test, JS::NativeImpl impl, - JS::CallArgs args) MOZ_OVERRIDE; + JS::CallArgs args) const MOZ_OVERRIDE; - virtual bool defaultValue(JSContext *cx, JS::Handle obj, JSType hint, JS::MutableHandleValue vp) MOZ_OVERRIDE; + virtual bool defaultValue(JSContext *cx, JS::Handle obj, JSType hint, + JS::MutableHandleValue vp) const MOZ_OVERRIDE; virtual bool enter(JSContext *cx, JS::Handle wrapper, JS::Handle id, - js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE; + js::Wrapper::Action act, bool *bp) const MOZ_OVERRIDE; static const FilteringWrapper singleton; }; diff --git a/js/xpconnect/wrappers/WaiveXrayWrapper.cpp b/js/xpconnect/wrappers/WaiveXrayWrapper.cpp index 9c84bbc0e02d..d6893f55ae4b 100644 --- a/js/xpconnect/wrappers/WaiveXrayWrapper.cpp +++ b/js/xpconnect/wrappers/WaiveXrayWrapper.cpp @@ -42,6 +42,7 @@ WaiveXrayWrapper::~WaiveXrayWrapper() bool WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) + const { return CrossCompartmentWrapper::getPropertyDescriptor(cx, wrapper, id, desc) && WrapperFactory::WaiveXrayAndWrap(cx, desc.value()) && WaiveAccessors(cx, desc); @@ -50,6 +51,7 @@ WaiveXrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, bool WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) + const { return CrossCompartmentWrapper::getOwnPropertyDescriptor(cx, wrapper, id, desc) && WrapperFactory::WaiveXrayAndWrap(cx, desc.value()) && WaiveAccessors(cx, desc); @@ -58,21 +60,21 @@ WaiveXrayWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, bool WaiveXrayWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - MutableHandleValue vp) + MutableHandleValue vp) const { return CrossCompartmentWrapper::get(cx, wrapper, receiver, id, vp) && WrapperFactory::WaiveXrayAndWrap(cx, vp); } bool -WaiveXrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) +WaiveXrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const { return CrossCompartmentWrapper::call(cx, wrapper, args) && WrapperFactory::WaiveXrayAndWrap(cx, args.rval()); } bool -WaiveXrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) +WaiveXrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const { return CrossCompartmentWrapper::construct(cx, wrapper, args) && WrapperFactory::WaiveXrayAndWrap(cx, args.rval()); @@ -82,14 +84,14 @@ WaiveXrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallA // nsXBLProtoImplField.cpp. bool WaiveXrayWrapper::nativeCall(JSContext *cx, JS::IsAcceptableThis test, - JS::NativeImpl impl, JS::CallArgs args) + JS::NativeImpl impl, JS::CallArgs args) const { return CrossCompartmentWrapper::nativeCall(cx, test, impl, args) && WrapperFactory::WaiveXrayAndWrap(cx, args.rval()); } bool -WaiveXrayWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, MutableHandleObject protop) +WaiveXrayWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper, MutableHandleObject protop) const { return CrossCompartmentWrapper::getPrototypeOf(cx, wrapper, protop) && (!protop || WrapperFactory::WaiveXrayAndWrap(cx, protop)); diff --git a/js/xpconnect/wrappers/WaiveXrayWrapper.h b/js/xpconnect/wrappers/WaiveXrayWrapper.h index 4c5f1af16359..6de197a80d55 100644 --- a/js/xpconnect/wrappers/WaiveXrayWrapper.h +++ b/js/xpconnect/wrappers/WaiveXrayWrapper.h @@ -20,23 +20,23 @@ class WaiveXrayWrapper : public js::CrossCompartmentWrapper { virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp) MOZ_OVERRIDE; + JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool call(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) MOZ_OVERRIDE; + const JS::CallArgs &args) const MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) MOZ_OVERRIDE; + const JS::CallArgs &args) const MOZ_OVERRIDE; virtual bool nativeCall(JSContext *cx, JS::IsAcceptableThis test, - JS::NativeImpl impl, JS::CallArgs args) MOZ_OVERRIDE; + JS::NativeImpl impl, JS::CallArgs args) const MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, JS::Handle wrapper, - JS::MutableHandle protop) MOZ_OVERRIDE; + JS::MutableHandle protop) const MOZ_OVERRIDE; static const WaiveXrayWrapper singleton; }; diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index d99fb3dc8d7e..3eec7b2a8615 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -185,7 +185,7 @@ public: // on the holder. If the result is not cached, the lookup will happen afresh // for each access, which is the right thing for things like dynamic NodeList // properties. - virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, + virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc); @@ -244,7 +244,7 @@ public: virtual bool resolveNativeProperty(JSContext *cx, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; - virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, + virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, @@ -253,9 +253,9 @@ public: virtual bool enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flags, AutoIdVector &props); static bool call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance); + const JS::CallArgs &args, const js::Wrapper& baseInstance); static bool construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance); + const JS::CallArgs &args, const js::Wrapper& baseInstance); static bool isResolving(JSContext *cx, JSObject *holder, jsid id); @@ -295,7 +295,7 @@ public: virtual bool resolveNativeProperty(JSContext *cx, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; - virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, + virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; bool defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, @@ -306,9 +306,9 @@ public: virtual bool enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flags, AutoIdVector &props); static bool call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance); + const JS::CallArgs &args, const js::Wrapper& baseInstance); static bool construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance); + const JS::CallArgs &args, const js::Wrapper& baseInstance); static bool isResolving(JSContext *cx, JSObject *holder, jsid id) { @@ -339,7 +339,7 @@ public: MOZ_ASSUME_UNREACHABLE("resolveNativeProperty hook should never be called with HasPrototype = 1"); } - virtual bool resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, + virtual bool resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) MOZ_OVERRIDE; @@ -353,7 +353,7 @@ public: AutoIdVector &props); static bool call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance) + const JS::CallArgs &args, const js::Wrapper& baseInstance) { JSXrayTraits &self = JSXrayTraits::singleton; RootedObject holder(cx, self.ensureHolder(cx, wrapper)); @@ -366,7 +366,7 @@ public: } static bool construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance) + const JS::CallArgs &args, const js::Wrapper& baseInstance) { JSXrayTraits &self = JSXrayTraits::singleton; RootedObject holder(cx, self.ensureHolder(cx, wrapper)); @@ -532,7 +532,7 @@ bool JSXrayTraits::getOwnPropertyFromTargetIfSafe(JSContext *cx, } bool -JSXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, +JSXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) @@ -1525,7 +1525,7 @@ wrappedJSObject_getter(JSContext *cx, HandleObject wrapper, HandleId id, Mutable } bool -XrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, +XrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) { @@ -1603,7 +1603,7 @@ XrayTraits::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, Hand } bool -XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, +XPCWrappedNativeXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) @@ -1757,7 +1757,7 @@ XPCWrappedNativeXrayTraits::createHolder(JSContext *cx, JSObject *wrapper) bool XPCWrappedNativeXrayTraits::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args, - js::Wrapper& baseInstance) + const js::Wrapper& baseInstance) { // Run the resolve hook of the wrapped native. XPCWrappedNative *wn = getWN(wrapper); @@ -1783,7 +1783,7 @@ XPCWrappedNativeXrayTraits::call(JSContext *cx, HandleObject wrapper, bool XPCWrappedNativeXrayTraits::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args, - js::Wrapper& baseInstance) + const js::Wrapper& baseInstance) { // Run the resolve hook of the wrapped native. XPCWrappedNative *wn = getWN(wrapper); @@ -1821,7 +1821,7 @@ DOMXrayTraits::resolveNativeProperty(JSContext *cx, HandleObject wrapper, } bool -DOMXrayTraits::resolveOwnProperty(JSContext *cx, Wrapper &jsWrapper, HandleObject wrapper, +DOMXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, HandleObject wrapper, HandleObject holder, HandleId id, MutableHandle desc) { @@ -1912,7 +1912,7 @@ DOMXrayTraits::enumerateNames(JSContext *cx, HandleObject wrapper, unsigned flag bool DOMXrayTraits::call(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance) + const JS::CallArgs &args, const js::Wrapper& baseInstance) { RootedObject obj(cx, getTargetObject(wrapper)); const js::Class* clasp = js::GetObjectClass(obj); @@ -1942,7 +1942,7 @@ DOMXrayTraits::call(JSContext *cx, HandleObject wrapper, bool DOMXrayTraits::construct(JSContext *cx, HandleObject wrapper, - const JS::CallArgs &args, js::Wrapper& baseInstance) + const JS::CallArgs &args, const js::Wrapper& baseInstance) { RootedObject obj(cx, getTargetObject(wrapper)); MOZ_ASSERT(mozilla::dom::HasConstructor(obj)); @@ -2153,7 +2153,8 @@ DEBUG_CheckXBLLookup(JSContext *cx, JSPropertyDescriptor *desc) template bool -XrayWrapper::isExtensible(JSContext *cx, JS::Handle wrapper, bool *extensible) +XrayWrapper::isExtensible(JSContext *cx, JS::Handle wrapper, + bool *extensible) const { // Xray wrappers are supposed to provide a clean view of the target // reflector, hiding any modifications by script in the target scope. So @@ -2166,7 +2167,7 @@ XrayWrapper::isExtensible(JSContext *cx, JS::Handle wra template bool -XrayWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) +XrayWrapper::preventExtensions(JSContext *cx, HandleObject wrapper) const { // See above. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CHANGE_EXTENSIBILITY); @@ -2177,6 +2178,7 @@ template bool XrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) + const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); RootedObject holder(cx, Traits::singleton.ensureHolder(cx, wrapper)); @@ -2309,6 +2311,7 @@ template bool XrayWrapper::getOwnPropertyDescriptor(JSContext *cx, HandleObject wrapper, HandleId id, JS::MutableHandle desc) + const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::GET | BaseProxyHandler::SET); RootedObject holder(cx, Traits::singleton.ensureHolder(cx, wrapper)); @@ -2390,6 +2393,7 @@ template bool XrayWrapper::defineProperty(JSContext *cx, HandleObject wrapper, HandleId id, MutableHandle desc) + const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::SET); @@ -2454,7 +2458,7 @@ XrayWrapper::defineProperty(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); return enumerate(cx, wrapper, JSITER_OWNONLY | JSITER_HIDDEN, props); @@ -2463,7 +2467,7 @@ XrayWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapp template bool XrayWrapper::delete_(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) + HandleId id, bool *bp) const { assertEnteredPolicy(cx, wrapper, id, BaseProxyHandler::SET); @@ -2481,7 +2485,7 @@ XrayWrapper::delete_(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::enumerate(JSContext *cx, HandleObject wrapper, unsigned flags, - AutoIdVector &props) + AutoIdVector &props) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::ENUMERATE); if (!AccessCheck::wrapperSubsumes(wrapper)) { @@ -2505,7 +2509,7 @@ XrayWrapper::enumerate(JSContext *cx, HandleObject wrapper, unsign template bool XrayWrapper::enumerate(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { return enumerate(cx, wrapper, 0, props); } @@ -2514,7 +2518,7 @@ template bool XrayWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - MutableHandleValue vp) + MutableHandleValue vp) const { // Skip our Base if it isn't already ProxyHandler. // NB: None of the functions we call are prepared for the receiver not @@ -2526,7 +2530,7 @@ template bool XrayWrapper::set(JSContext *cx, HandleObject wrapper, HandleObject receiver, HandleId id, - bool strict, MutableHandleValue vp) + bool strict, MutableHandleValue vp) const { // Delegate to Traits. // NB: None of the functions we call are prepared for the receiver not @@ -2537,7 +2541,7 @@ XrayWrapper::set(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::has(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) + HandleId id, bool *bp) const { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::has(cx, wrapper, id, bp); @@ -2546,7 +2550,7 @@ XrayWrapper::has(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::hasOwn(JSContext *cx, HandleObject wrapper, - HandleId id, bool *bp) + HandleId id, bool *bp) const { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::hasOwn(cx, wrapper, id, bp); @@ -2555,7 +2559,7 @@ XrayWrapper::hasOwn(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::keys(JSContext *cx, HandleObject wrapper, - AutoIdVector &props) + AutoIdVector &props) const { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::keys(cx, wrapper, props); @@ -2564,7 +2568,7 @@ XrayWrapper::keys(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::iterate(JSContext *cx, HandleObject wrapper, - unsigned flags, MutableHandleValue vp) + unsigned flags, MutableHandleValue vp) const { // Skip our Base if it isn't already ProxyHandler. return js::BaseProxyHandler::iterate(cx, wrapper, flags, vp); @@ -2572,26 +2576,26 @@ XrayWrapper::iterate(JSContext *cx, HandleObject wrapper, template bool -XrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) +XrayWrapper::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL); // Hard cast the singleton since SecurityWrapper doesn't have one. - return Traits::call(cx, wrapper, args, (js::Wrapper&)Base::singleton); + return Traits::call(cx, wrapper, args, Base::singleton); } template bool -XrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) +XrayWrapper::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args) const { assertEnteredPolicy(cx, wrapper, JSID_VOID, BaseProxyHandler::CALL); // Hard cast the singleton since SecurityWrapper doesn't have one. - return Traits::construct(cx, wrapper, args, (js::Wrapper&)Base::singleton); + return Traits::construct(cx, wrapper, args, Base::singleton); } template bool XrayWrapper::defaultValue(JSContext *cx, HandleObject wrapper, - JSType hint, MutableHandleValue vp) + JSType hint, MutableHandleValue vp) const { // Even if this isn't a security wrapper, Xray semantics dictate that we // run the DefaultValue algorithm directly on the Xray wrapper. @@ -2604,7 +2608,7 @@ XrayWrapper::defaultValue(JSContext *cx, HandleObject wrapper, template bool XrayWrapper::getPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::MutableHandleObject protop) + JS::MutableHandleObject protop) const { // We really only want this override for non-SecurityWrapper-inheriting // |Base|. But doing that statically with templates requires partial method @@ -2635,7 +2639,7 @@ XrayWrapper::getPrototypeOf(JSContext *cx, JS::HandleObject wrappe template bool XrayWrapper::setPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject proto, bool *bp) + JS::HandleObject proto, bool *bp) const { // Do this only for non-SecurityWrapper-inheriting |Base|. See the comment // in getPrototypeOf(). diff --git a/js/xpconnect/wrappers/XrayWrapper.h b/js/xpconnect/wrappers/XrayWrapper.h index e4c6260558e1..d83cc2e63323 100644 --- a/js/xpconnect/wrappers/XrayWrapper.h +++ b/js/xpconnect/wrappers/XrayWrapper.h @@ -69,47 +69,47 @@ class XrayWrapper : public Base { virtual ~XrayWrapper(); /* Fundamental proxy traps. */ - virtual bool isExtensible(JSContext *cx, JS::Handle wrapper, bool *extensible) MOZ_OVERRIDE; - virtual bool preventExtensions(JSContext *cx, JS::Handle wrapper) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext *cx, JS::Handle wrapper, bool *extensible) const MOZ_OVERRIDE; + virtual bool preventExtensions(JSContext *cx, JS::Handle wrapper) const MOZ_OVERRIDE; virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc); + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc); + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool defineProperty(JSContext *cx, JS::Handle wrapper, JS::Handle id, - JS::MutableHandle desc); + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props); + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool delete_(JSContext *cx, JS::Handle wrapper, - JS::Handle id, bool *bp); - virtual bool enumerate(JSContext *cx, JS::Handle wrapper, JS::AutoIdVector &props); + JS::Handle id, bool *bp) const MOZ_OVERRIDE; + virtual bool enumerate(JSContext *cx, JS::Handle wrapper, JS::AutoIdVector &props) const MOZ_OVERRIDE; /* Derived proxy traps. */ virtual bool get(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp); + JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, JS::Handle wrapper, JS::Handle receiver, - JS::Handle id, bool strict, JS::MutableHandle vp); + JS::Handle id, bool strict, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool has(JSContext *cx, JS::Handle wrapper, JS::Handle id, - bool *bp); + bool *bp) const MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, JS::Handle wrapper, JS::Handle id, - bool *bp); + bool *bp) const MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JS::Handle wrapper, - JS::AutoIdVector &props); + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JS::Handle wrapper, unsigned flags, - JS::MutableHandle vp); + JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool call(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) MOZ_OVERRIDE; + const JS::CallArgs &args) const MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JS::Handle wrapper, - const JS::CallArgs &args) MOZ_OVERRIDE; + const JS::CallArgs &args) const MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, JS::HandleObject wrapper, JSType hint, JS::MutableHandleValue vp) - MOZ_OVERRIDE; + const MOZ_OVERRIDE; virtual bool getPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::MutableHandleObject protop) MOZ_OVERRIDE; + JS::MutableHandleObject protop) const MOZ_OVERRIDE; virtual bool setPrototypeOf(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject proto, bool *bp) MOZ_OVERRIDE; + JS::HandleObject proto, bool *bp) const MOZ_OVERRIDE; static const XrayWrapper singleton; @@ -117,26 +117,26 @@ class XrayWrapper : public Base { template typename mozilla::EnableIf::Type getPrototypeOfHelper(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject target, JS::MutableHandleObject protop) + JS::HandleObject target, JS::MutableHandleObject protop) const { return Traits::singleton.getPrototypeOf(cx, wrapper, target, protop); } template typename mozilla::EnableIf::Type getPrototypeOfHelper(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject target, JS::MutableHandleObject protop) + JS::HandleObject target, JS::MutableHandleObject protop) const { return Base::getPrototypeOf(cx, wrapper, protop); } bool getPrototypeOfHelper(JSContext *cx, JS::HandleObject wrapper, - JS::HandleObject target, JS::MutableHandleObject protop) + JS::HandleObject target, JS::MutableHandleObject protop) const { return getPrototypeOfHelper(cx, wrapper, target, protop); } bool enumerate(JSContext *cx, JS::Handle wrapper, unsigned flags, - JS::AutoIdVector &props); + JS::AutoIdVector &props) const; }; #define PermissiveXrayXPCWN xpc::XrayWrapper @@ -154,25 +154,25 @@ public: virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle proxy, JS::Handle id, - JS::MutableHandle desc) MOZ_OVERRIDE; + JS::MutableHandle desc) const MOZ_OVERRIDE; // We just forward the derived traps to the BaseProxyHandler versions which // implement them in terms of the fundamental traps. virtual bool has(JSContext *cx, JS::Handle proxy, JS::Handle id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool hasOwn(JSContext *cx, JS::Handle proxy, JS::Handle id, - bool *bp) MOZ_OVERRIDE; + bool *bp) const MOZ_OVERRIDE; virtual bool get(JSContext *cx, JS::Handle proxy, JS::Handle receiver, - JS::Handle id, JS::MutableHandle vp) MOZ_OVERRIDE; + JS::Handle id, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool set(JSContext *cx, JS::Handle proxy, JS::Handle receiver, - JS::Handle id, bool strict, JS::MutableHandle vp) MOZ_OVERRIDE; + JS::Handle id, bool strict, JS::MutableHandle vp) const MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JS::Handle proxy, - JS::AutoIdVector &props) MOZ_OVERRIDE; + JS::AutoIdVector &props) const MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JS::Handle proxy, unsigned flags, - JS::MutableHandle vp) MOZ_OVERRIDE; + JS::MutableHandle vp) const MOZ_OVERRIDE; }; extern const SandboxProxyHandler sandboxProxyHandler; @@ -187,7 +187,7 @@ public: } virtual bool call(JSContext *cx, JS::Handle proxy, - const JS::CallArgs &args) MOZ_OVERRIDE; + const JS::CallArgs &args) const MOZ_OVERRIDE; }; extern const SandboxCallableProxyHandler sandboxCallableProxyHandler;