summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-10-26 13:08:45 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-10-26 16:19:04 +0200
commitc59c9682d351e641f184e1f8095f399fee179f62 (patch)
tree137c732cac39f8cf80ed7e682a4c834c6997d390 /js
parent565ae72f5af3bcc9fb85945233e2a7afa115d435 (diff)
downloadUXP-c59c9682d351e641f184e1f8095f399fee179f62.tar
UXP-c59c9682d351e641f184e1f8095f399fee179f62.tar.gz
UXP-c59c9682d351e641f184e1f8095f399fee179f62.tar.lz
UXP-c59c9682d351e641f184e1f8095f399fee179f62.tar.xz
UXP-c59c9682d351e641f184e1f8095f399fee179f62.zip
Issue #1257 - Part1: Remove watch class-hook and proxy trap.
Diffstat (limited to 'js')
-rw-r--r--js/public/Class.h14
-rw-r--r--js/public/Proxy.h6
-rw-r--r--js/src/builtin/TypedObject.cpp1
-rw-r--r--js/src/jsobj.cpp6
-rw-r--r--js/src/jsobj.h2
-rw-r--r--js/src/jswrapper.h7
-rw-r--r--js/src/proxy/BaseProxyHandler.cpp14
-rw-r--r--js/src/proxy/Proxy.cpp27
-rw-r--r--js/src/proxy/Proxy.h3
-rw-r--r--js/src/proxy/SecurityWrapper.cpp19
-rw-r--r--js/src/vm/EnvironmentObject.cpp3
-rw-r--r--js/xpconnect/src/XPCWrappedNativeJSOps.cpp2
12 files changed, 2 insertions, 102 deletions
diff --git a/js/public/Class.h b/js/public/Class.h
index 3b5023875..f7533654b 100644
--- a/js/public/Class.h
+++ b/js/public/Class.h
@@ -425,12 +425,6 @@ typedef bool
(* DeletePropertyOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id,
JS::ObjectOpResult& result);
-typedef bool
-(* WatchOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JS::HandleObject callable);
-
-typedef bool
-(* UnwatchOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id);
-
class JS_FRIEND_API(ElementAdder)
{
public:
@@ -670,8 +664,6 @@ struct ObjectOps
SetPropertyOp setProperty;
GetOwnPropertyOp getOwnPropertyDescriptor;
DeletePropertyOp deleteProperty;
- WatchOp watch;
- UnwatchOp unwatch;
GetElementsOp getElements;
JSNewEnumerateOp enumerate;
JSFunToStringOp funToString;
@@ -822,8 +814,8 @@ struct Class
* Objects of this class aren't native objects. They don't have Shapes that
* describe their properties and layout. Classes using this flag must
* provide their own property behavior, either by being proxy classes (do
- * this) or by overriding all the ObjectOps except getElements, watch and
- * unwatch (don't do this).
+ * this) or by overriding all the ObjectOps except getElements
+ * (don't do this).
*/
static const uint32_t NON_NATIVE = JSCLASS_INTERNAL_FLAG2;
@@ -900,8 +892,6 @@ struct Class
const { return oOps ? oOps->getOwnPropertyDescriptor
: nullptr; }
DeletePropertyOp getOpsDeleteProperty() const { return oOps ? oOps->deleteProperty : nullptr; }
- WatchOp getOpsWatch() const { return oOps ? oOps->watch : nullptr; }
- UnwatchOp getOpsUnwatch() const { return oOps ? oOps->unwatch : nullptr; }
GetElementsOp getOpsGetElements() const { return oOps ? oOps->getElements : nullptr; }
JSNewEnumerateOp getOpsEnumerate() const { return oOps ? oOps->enumerate : nullptr; }
JSFunToStringOp getOpsFunToString() const { return oOps ? oOps->funToString : nullptr; }
diff --git a/js/public/Proxy.h b/js/public/Proxy.h
index 5acb91b26..f40772fb0 100644
--- a/js/public/Proxy.h
+++ b/js/public/Proxy.h
@@ -341,12 +341,6 @@ class JS_FRIEND_API(BaseProxyHandler)
virtual bool isCallable(JSObject* obj) const;
virtual bool isConstructor(JSObject* obj) 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) const;
- virtual bool unwatch(JSContext* cx, JS::HandleObject proxy, JS::HandleId id) const;
-
virtual bool getElements(JSContext* cx, HandleObject proxy, uint32_t begin, uint32_t end,
ElementAdder* adder) const;
diff --git a/js/src/builtin/TypedObject.cpp b/js/src/builtin/TypedObject.cpp
index ff3680774..50bf0b836 100644
--- a/js/src/builtin/TypedObject.cpp
+++ b/js/src/builtin/TypedObject.cpp
@@ -2215,7 +2215,6 @@ const ObjectOps TypedObject::objectOps_ = {
TypedObject::obj_setProperty,
TypedObject::obj_getOwnPropertyDescriptor,
TypedObject::obj_deleteProperty,
- nullptr, nullptr, /* watch/unwatch */
nullptr, /* getElements */
TypedObject::obj_enumerate,
nullptr, /* thisValue */
diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp
index 6f9596924..ee66addc9 100644
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -2836,9 +2836,6 @@ js::UnwatchGuts(JSContext* cx, JS::HandleObject origObj, JS::HandleId id)
bool
js::WatchProperty(JSContext* cx, HandleObject obj, HandleId id, HandleObject callable)
{
- if (WatchOp op = obj->getOpsWatch())
- return op(cx, obj, id, callable);
-
if (!obj->isNative() || obj->is<TypedArrayObject>()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_CANT_WATCH,
obj->getClass()->name);
@@ -2851,9 +2848,6 @@ js::WatchProperty(JSContext* cx, HandleObject obj, HandleId id, HandleObject cal
bool
js::UnwatchProperty(JSContext* cx, HandleObject obj, HandleId id)
{
- if (UnwatchOp op = obj->getOpsUnwatch())
- return op(cx, obj, id);
-
return UnwatchGuts(cx, obj, id);
}
diff --git a/js/src/jsobj.h b/js/src/jsobj.h
index db2c22b76..8a41d155e 100644
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -141,8 +141,6 @@ class JSObject : public js::gc::Cell
js::GetOwnPropertyOp getOpsGetOwnPropertyDescriptor()
const { return getClass()->getOpsGetOwnPropertyDescriptor(); }
js::DeletePropertyOp getOpsDeleteProperty() const { return getClass()->getOpsDeleteProperty(); }
- js::WatchOp getOpsWatch() const { return getClass()->getOpsWatch(); }
- js::UnwatchOp getOpsUnwatch() const { return getClass()->getOpsUnwatch(); }
js::GetElementsOp getOpsGetElements() const { return getClass()->getOpsGetElements(); }
JSNewEnumerateOp getOpsEnumerate() const { return getClass()->getOpsEnumerate(); }
JSFunToStringOp getOpsFunToString() const { return getClass()->getOpsFunToString(); }
diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h
index 5f3704e32..32336c68b 100644
--- a/js/src/jswrapper.h
+++ b/js/src/jswrapper.h
@@ -315,13 +315,6 @@ class JS_FRIEND_API(SecurityWrapper) : public Base
virtual bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g) const override;
virtual bool boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp) const override;
- // Allow isCallable and isConstructor. They used to be class-level, and so could not be guarded
- // against.
-
- virtual bool watch(JSContext* cx, JS::HandleObject proxy, JS::HandleId id,
- JS::HandleObject callable) const override;
- virtual bool unwatch(JSContext* cx, JS::HandleObject proxy, JS::HandleId id) const override;
-
/*
* Allow our subclasses to select the superclass behavior they want without
* needing to specify an exact superclass.
diff --git a/js/src/proxy/BaseProxyHandler.cpp b/js/src/proxy/BaseProxyHandler.cpp
index 8d5f30a19..423aa8671 100644
--- a/js/src/proxy/BaseProxyHandler.cpp
+++ b/js/src/proxy/BaseProxyHandler.cpp
@@ -419,20 +419,6 @@ BaseProxyHandler::setImmutablePrototype(JSContext* cx, HandleObject proxy, bool*
}
bool
-BaseProxyHandler::watch(JSContext* cx, HandleObject proxy, HandleId id, HandleObject callable) const
-{
- JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_CANT_WATCH,
- proxy->getClass()->name);
- return false;
-}
-
-bool
-BaseProxyHandler::unwatch(JSContext* cx, HandleObject proxy, HandleId id) const
-{
- return true;
-}
-
-bool
BaseProxyHandler::getElements(JSContext* cx, HandleObject proxy, uint32_t begin, uint32_t end,
ElementAdder* adder) const
{
diff --git a/js/src/proxy/Proxy.cpp b/js/src/proxy/Proxy.cpp
index 2c1cffb77..6b3a3d1e9 100644
--- a/js/src/proxy/Proxy.cpp
+++ b/js/src/proxy/Proxy.cpp
@@ -505,20 +505,6 @@ Proxy::boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp
JSObject * const TaggedProto::LazyProto = reinterpret_cast<JSObject*>(0x1);
/* static */ bool
-Proxy::watch(JSContext* cx, JS::HandleObject proxy, JS::HandleId id, JS::HandleObject callable)
-{
- JS_CHECK_RECURSION(cx, return false);
- return proxy->as<ProxyObject>().handler()->watch(cx, proxy, id, callable);
-}
-
-/* static */ bool
-Proxy::unwatch(JSContext* cx, JS::HandleObject proxy, JS::HandleId id)
-{
- JS_CHECK_RECURSION(cx, return false);
- return proxy->as<ProxyObject>().handler()->unwatch(cx, proxy, id);
-}
-
-/* static */ bool
Proxy::getElements(JSContext* cx, HandleObject proxy, uint32_t begin, uint32_t end,
ElementAdder* adder)
{
@@ -699,18 +685,6 @@ js::proxy_Construct(JSContext* cx, unsigned argc, Value* vp)
}
bool
-js::proxy_Watch(JSContext* cx, HandleObject obj, HandleId id, HandleObject callable)
-{
- return Proxy::watch(cx, obj, id, callable);
-}
-
-bool
-js::proxy_Unwatch(JSContext* cx, HandleObject obj, HandleId id)
-{
- return Proxy::unwatch(cx, obj, id);
-}
-
-bool
js::proxy_GetElements(JSContext* cx, HandleObject proxy, uint32_t begin, uint32_t end,
ElementAdder* adder)
{
@@ -750,7 +724,6 @@ const ObjectOps js::ProxyObjectOps = {
js::proxy_SetProperty,
js::proxy_GetOwnPropertyDescriptor,
js::proxy_DeleteProperty,
- js::proxy_Watch, js::proxy_Unwatch,
js::proxy_GetElements,
nullptr, /* enumerate */
js::proxy_FunToString
diff --git a/js/src/proxy/Proxy.h b/js/src/proxy/Proxy.h
index 89909a085..4a8ecf8ab 100644
--- a/js/src/proxy/Proxy.h
+++ b/js/src/proxy/Proxy.h
@@ -65,9 +65,6 @@ class Proxy
static bool regexp_toShared(JSContext* cx, HandleObject proxy, RegExpGuard* g);
static bool boxedValue_unbox(JSContext* cx, HandleObject proxy, MutableHandleValue vp);
- static bool watch(JSContext* cx, HandleObject proxy, HandleId id, HandleObject callable);
- static bool unwatch(JSContext* cx, HandleObject proxy, HandleId id);
-
static bool getElements(JSContext* cx, HandleObject obj, uint32_t begin, uint32_t end,
ElementAdder* adder);
diff --git a/js/src/proxy/SecurityWrapper.cpp b/js/src/proxy/SecurityWrapper.cpp
index 710faf9b0..71d22fca6 100644
--- a/js/src/proxy/SecurityWrapper.cpp
+++ b/js/src/proxy/SecurityWrapper.cpp
@@ -130,24 +130,5 @@ SecurityWrapper<Base>::defineProperty(JSContext* cx, HandleObject wrapper, Handl
return Base::defineProperty(cx, wrapper, id, desc, result);
}
-template <class Base>
-bool
-SecurityWrapper<Base>::watch(JSContext* cx, HandleObject proxy,
- HandleId id, HandleObject callable) const
-{
- ReportUnwrapDenied(cx);
- return false;
-}
-
-template <class Base>
-bool
-SecurityWrapper<Base>::unwatch(JSContext* cx, HandleObject proxy,
- HandleId id) const
-{
- ReportUnwrapDenied(cx);
- return false;
-}
-
-
template class js::SecurityWrapper<Wrapper>;
template class js::SecurityWrapper<CrossCompartmentWrapper>;
diff --git a/js/src/vm/EnvironmentObject.cpp b/js/src/vm/EnvironmentObject.cpp
index a5aac2ab4..3680c5b7b 100644
--- a/js/src/vm/EnvironmentObject.cpp
+++ b/js/src/vm/EnvironmentObject.cpp
@@ -408,7 +408,6 @@ const ObjectOps ModuleEnvironmentObject::objectOps_ = {
ModuleEnvironmentObject::setProperty,
ModuleEnvironmentObject::getOwnPropertyDescriptor,
ModuleEnvironmentObject::deleteProperty,
- nullptr, nullptr, /* watch/unwatch */
nullptr, /* getElements */
ModuleEnvironmentObject::enumerate,
nullptr
@@ -790,7 +789,6 @@ static const ObjectOps WithEnvironmentObjectOps = {
with_SetProperty,
with_GetOwnPropertyDescriptor,
with_DeleteProperty,
- nullptr, nullptr, /* watch/unwatch */
nullptr, /* getElements */
nullptr, /* enumerate (native enumeration of target doesn't work) */
nullptr,
@@ -1159,7 +1157,6 @@ static const ObjectOps RuntimeLexicalErrorObjectObjectOps = {
lexicalError_SetProperty,
lexicalError_GetOwnPropertyDescriptor,
lexicalError_DeleteProperty,
- nullptr, nullptr, /* watch/unwatch */
nullptr, /* getElements */
nullptr, /* enumerate (native enumeration of target doesn't work) */
nullptr, /* this */
diff --git a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
index 12b203b70..08ba8241a 100644
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -924,8 +924,6 @@ const js::ObjectOps XPC_WN_ObjectOpsWithEnumerate = {
nullptr, // setProperty
nullptr, // getOwnPropertyDescriptor
nullptr, // deleteProperty
- nullptr, // watch
- nullptr, // unwatch
nullptr, // getElements
XPC_WN_JSOp_Enumerate,
nullptr, // funToString