mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 828462 - Root Proxy/Wrapper delete. r=terrence
This commit is contained in:
parent
097f3a1110
commit
b8e3b65fa7
@ -554,7 +554,8 @@ public:
|
|||||||
virtual bool getOwnPropertyNames(JSContext *cx,
|
virtual bool getOwnPropertyNames(JSContext *cx,
|
||||||
JS::Handle<JSObject *> proxy,
|
JS::Handle<JSObject *> proxy,
|
||||||
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
virtual bool delete_(JSContext *cx, JSObject *proxy, jsid id,
|
virtual bool delete_(JSContext *cx, JS::Handle<JSObject *> proxy,
|
||||||
|
JS::Handle<jsid> id,
|
||||||
bool *bp) MOZ_OVERRIDE;
|
bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool enumerate(JSContext *cx, JSObject *proxy,
|
virtual bool enumerate(JSContext *cx, JSObject *proxy,
|
||||||
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
JS::AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
@ -692,8 +693,8 @@ nsOuterWindowProxy::getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject *> pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsOuterWindowProxy::delete_(JSContext *cx, JSObject *proxy, jsid id,
|
nsOuterWindowProxy::delete_(JSContext *cx, JS::Handle<JSObject *> proxy,
|
||||||
bool *bp)
|
JS::Handle<jsid> id, bool *bp)
|
||||||
{
|
{
|
||||||
if (nsCOMPtr<nsIDOMWindow> frame = GetSubframeWindow(cx, proxy, id)) {
|
if (nsCOMPtr<nsIDOMWindow> frame = GetSubframeWindow(cx, proxy, id)) {
|
||||||
// Reject (which means throw if strict, else return false) the delete.
|
// Reject (which means throw if strict, else return false) the delete.
|
||||||
|
@ -6212,8 +6212,8 @@ class CGDOMJSProxyHandler_defineProperty(ClassMethod):
|
|||||||
|
|
||||||
class CGDOMJSProxyHandler_delete(ClassMethod):
|
class CGDOMJSProxyHandler_delete(ClassMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
args = [Argument('JSContext*', 'cx'), Argument('JSObject*', 'proxy'),
|
args = [Argument('JSContext*', 'cx'), Argument('JS::Handle<JSObject *>', 'proxy'),
|
||||||
Argument('jsid', 'id'),
|
Argument('JS::Handle<jsid>', 'id'),
|
||||||
Argument('bool*', 'bp')]
|
Argument('bool*', 'bp')]
|
||||||
ClassMethod.__init__(self, "delete_", "bool", args)
|
ClassMethod.__init__(self, "delete_", "bool", args)
|
||||||
self.descriptor = descriptor
|
self.descriptor = descriptor
|
||||||
|
@ -124,7 +124,8 @@ DOMProxyHandler::defineProperty(JSContext* cx, JS::Handle<JSObject *> proxy, JS:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DOMProxyHandler::delete_(JSContext* cx, JSObject* proxy, jsid id, bool* bp)
|
DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject *> proxy,
|
||||||
|
JS::Handle<jsid> id, bool* bp)
|
||||||
{
|
{
|
||||||
JSBool b = true;
|
JSBool b = true;
|
||||||
|
|
||||||
|
@ -40,7 +40,8 @@ public:
|
|||||||
unsigned flags) MOZ_OVERRIDE;
|
unsigned flags) MOZ_OVERRIDE;
|
||||||
bool defineProperty(JSContext* cx, JS::Handle<JSObject *> proxy, JS::Handle<jsid> id,
|
bool defineProperty(JSContext* cx, JS::Handle<JSObject *> proxy, JS::Handle<jsid> id,
|
||||||
JSPropertyDescriptor* desc) MOZ_OVERRIDE;
|
JSPropertyDescriptor* desc) MOZ_OVERRIDE;
|
||||||
bool delete_(JSContext* cx, JSObject* proxy, jsid id, bool* bp) MOZ_OVERRIDE;
|
bool delete_(JSContext* cx, JS::Handle<JSObject *> proxy,
|
||||||
|
JS::Handle<jsid> id, bool* bp) MOZ_OVERRIDE;
|
||||||
bool enumerate(JSContext* cx, JSObject* proxy, JS::AutoIdVector& props) MOZ_OVERRIDE;
|
bool enumerate(JSContext* cx, JSObject* proxy, JS::AutoIdVector& props) MOZ_OVERRIDE;
|
||||||
bool fix(JSContext* cx, JSObject* proxy, JS::Value* vp);
|
bool fix(JSContext* cx, JSObject* proxy, JS::Value* vp);
|
||||||
bool has(JSContext* cx, JSObject* proxy, jsid id, bool* bp) MOZ_OVERRIDE;
|
bool has(JSContext* cx, JSObject* proxy, jsid id, bool* bp) MOZ_OVERRIDE;
|
||||||
|
@ -498,11 +498,11 @@ DirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DirectProxyHandler::delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp)
|
DirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp)
|
||||||
{
|
{
|
||||||
RootedValue v(cx);
|
|
||||||
assertEnteredPolicy(cx, proxy, id);
|
assertEnteredPolicy(cx, proxy, id);
|
||||||
RootedObject target(cx, GetProxyTargetObject(proxy));
|
RootedObject target(cx, GetProxyTargetObject(proxy));
|
||||||
|
RootedValue v(cx);
|
||||||
if (!JS_DeletePropertyById2(cx, target, id, v.address()))
|
if (!JS_DeletePropertyById2(cx, target, id, v.address()))
|
||||||
return false;
|
return false;
|
||||||
JSBool b;
|
JSBool b;
|
||||||
@ -810,7 +810,7 @@ class ScriptedIndirectProxyHandler : public BaseProxyHandler {
|
|||||||
virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
|
virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
|
||||||
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
||||||
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props);
|
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props);
|
||||||
virtual bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp) MOZ_OVERRIDE;
|
virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &props) MOZ_OVERRIDE;
|
virtual bool enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
|
|
||||||
/* ES5 Harmony derived proxy traps. */
|
/* ES5 Harmony derived proxy traps. */
|
||||||
@ -912,10 +912,9 @@ ScriptedIndirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ScriptedIndirectProxyHandler::delete_(JSContext *cx, JSObject *proxy, jsid id_, bool *bp)
|
ScriptedIndirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp)
|
||||||
{
|
{
|
||||||
RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy));
|
RootedObject handler(cx, GetIndirectProxyHandlerObject(proxy));
|
||||||
RootedId id(cx, id_);
|
|
||||||
RootedValue fval(cx), value(cx);
|
RootedValue fval(cx), value(cx);
|
||||||
return GetFundamentalTrap(cx, handler, cx->names().delete_, &fval) &&
|
return GetFundamentalTrap(cx, handler, cx->names().delete_, &fval) &&
|
||||||
Trap1(cx, handler, fval, id, value.address()) &&
|
Trap1(cx, handler, fval, id, value.address()) &&
|
||||||
@ -1070,7 +1069,7 @@ class ScriptedDirectProxyHandler : public DirectProxyHandler {
|
|||||||
virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
|
virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id,
|
||||||
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
||||||
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props);
|
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props);
|
||||||
virtual bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp) MOZ_OVERRIDE;
|
virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &props) MOZ_OVERRIDE;
|
virtual bool enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
|
|
||||||
/* ES5 Harmony derived proxy traps. */
|
/* ES5 Harmony derived proxy traps. */
|
||||||
@ -1726,11 +1725,8 @@ ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject prox
|
|||||||
|
|
||||||
// Proxy.[[Delete]](P, Throw)
|
// Proxy.[[Delete]](P, Throw)
|
||||||
bool
|
bool
|
||||||
ScriptedDirectProxyHandler::delete_(JSContext *cx, JSObject *proxy_, jsid id_, bool *bp)
|
ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp)
|
||||||
{
|
{
|
||||||
RootedObject proxy(cx, proxy_);
|
|
||||||
RootedId id(cx, id_);
|
|
||||||
|
|
||||||
// step 1
|
// step 1
|
||||||
RootedObject handler(cx, GetDirectProxyHandlerObject(proxy));
|
RootedObject handler(cx, GetDirectProxyHandlerObject(proxy));
|
||||||
|
|
||||||
@ -2336,12 +2332,10 @@ Proxy::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &prop
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Proxy::delete_(JSContext *cx, JSObject *proxy_, jsid id_, bool *bp)
|
Proxy::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp)
|
||||||
{
|
{
|
||||||
JS_CHECK_RECURSION(cx, return false);
|
JS_CHECK_RECURSION(cx, return false);
|
||||||
BaseProxyHandler *handler = GetProxyHandler(proxy_);
|
BaseProxyHandler *handler = GetProxyHandler(proxy);
|
||||||
RootedObject proxy(cx, proxy_);
|
|
||||||
RootedId id(cx, id_);
|
|
||||||
*bp = true; // default result if we refuse to perform this action
|
*bp = true; // default result if we refuse to perform this action
|
||||||
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true);
|
AutoEnterPolicy policy(cx, handler, proxy, id, BaseProxyHandler::SET, true);
|
||||||
if (!policy.allowed())
|
if (!policy.allowed())
|
||||||
|
@ -113,7 +113,7 @@ class JS_FRIEND_API(BaseProxyHandler) {
|
|||||||
PropertyDescriptor *desc) = 0;
|
PropertyDescriptor *desc) = 0;
|
||||||
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy,
|
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy,
|
||||||
AutoIdVector &props) = 0;
|
AutoIdVector &props) = 0;
|
||||||
virtual bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp) = 0;
|
virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) = 0;
|
||||||
virtual bool enumerate(JSContext *cx, JSObject *proxy,
|
virtual bool enumerate(JSContext *cx, JSObject *proxy,
|
||||||
AutoIdVector &props) = 0;
|
AutoIdVector &props) = 0;
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ public:
|
|||||||
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
||||||
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy,
|
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy,
|
||||||
AutoIdVector &props) MOZ_OVERRIDE;
|
AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
virtual bool delete_(JSContext *cx, JSObject *proxy, jsid id,
|
virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id,
|
||||||
bool *bp) MOZ_OVERRIDE;
|
bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool enumerate(JSContext *cx, JSObject *proxy,
|
virtual bool enumerate(JSContext *cx, JSObject *proxy,
|
||||||
AutoIdVector &props) MOZ_OVERRIDE;
|
AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
@ -218,7 +218,7 @@ class Proxy {
|
|||||||
static bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, PropertyDescriptor *desc);
|
static bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, PropertyDescriptor *desc);
|
||||||
static bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, HandleValue v);
|
static bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, HandleValue v);
|
||||||
static bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props);
|
static bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props);
|
||||||
static bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
|
static bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp);
|
||||||
static bool enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &props);
|
static bool enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &props);
|
||||||
|
|
||||||
/* ES5 Harmony derived proxy traps. */
|
/* ES5 Harmony derived proxy traps. */
|
||||||
|
@ -276,12 +276,12 @@ CrossCompartmentWrapper::getOwnPropertyNames(JSContext *cx, HandleObject wrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CrossCompartmentWrapper::delete_(JSContext *cx, JSObject *wrapperArg, jsid id, bool *bp)
|
CrossCompartmentWrapper::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp)
|
||||||
{
|
{
|
||||||
RootedObject wrapper(cx, wrapperArg);
|
RootedId idCopy(cx, id);
|
||||||
PIERCE(cx, wrapper,
|
PIERCE(cx, wrapper,
|
||||||
cx->compartment->wrapId(cx, &id),
|
cx->compartment->wrapId(cx, idCopy.address()),
|
||||||
Wrapper::delete_(cx, wrapper, id, bp),
|
Wrapper::delete_(cx, wrapper, idCopy, bp),
|
||||||
NOTHING);
|
NOTHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,7 +734,7 @@ DeadObjectProxy::getOwnPropertyNames(JSContext *cx, HandleObject wrapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DeadObjectProxy::delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
|
DeadObjectProxy::delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp)
|
||||||
{
|
{
|
||||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_DEAD_OBJECT);
|
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_DEAD_OBJECT);
|
||||||
return false;
|
return false;
|
||||||
|
@ -94,7 +94,7 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
|
|||||||
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
||||||
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper,
|
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper,
|
||||||
AutoIdVector &props) MOZ_OVERRIDE;
|
AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
virtual bool delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp) MOZ_OVERRIDE;
|
virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &props) MOZ_OVERRIDE;
|
virtual bool enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
|
|
||||||
/* ES5 Harmony derived wrapper traps. */
|
/* ES5 Harmony derived wrapper traps. */
|
||||||
@ -171,7 +171,7 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler
|
|||||||
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
PropertyDescriptor *desc) MOZ_OVERRIDE;
|
||||||
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper,
|
virtual bool getOwnPropertyNames(JSContext *cx, HandleObject wrapper,
|
||||||
AutoIdVector &props) MOZ_OVERRIDE;
|
AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
virtual bool delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp) MOZ_OVERRIDE;
|
virtual bool delete_(JSContext *cx, HandleObject wrapper, HandleId id, bool *bp) MOZ_OVERRIDE;
|
||||||
virtual bool enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &props) MOZ_OVERRIDE;
|
virtual bool enumerate(JSContext *cx, JSObject *wrapper, AutoIdVector &props) MOZ_OVERRIDE;
|
||||||
|
|
||||||
/* Spidermonkey extensions. */
|
/* Spidermonkey extensions. */
|
||||||
|
@ -1469,7 +1469,7 @@ class DebugScopeProxy : public BaseProxyHandler
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp) MOZ_OVERRIDE
|
bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
RootedValue idval(cx, IdToValue(id));
|
RootedValue idval(cx, IdToValue(id));
|
||||||
return js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_CANT_DELETE,
|
return js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_CANT_DELETE,
|
||||||
|
@ -1668,7 +1668,8 @@ XrayWrapper<Base, Traits>::getOwnPropertyNames(JSContext *cx, JS::Handle<JSObjec
|
|||||||
|
|
||||||
template <typename Base, typename Traits>
|
template <typename Base, typename Traits>
|
||||||
bool
|
bool
|
||||||
XrayWrapper<Base, Traits>::delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
|
XrayWrapper<Base, Traits>::delete_(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
||||||
|
JS::Handle<jsid> id, bool *bp)
|
||||||
{
|
{
|
||||||
assertEnteredPolicy(cx, wrapper, id);
|
assertEnteredPolicy(cx, wrapper, id);
|
||||||
// Redirect access straight to the wrapper if we should be transparent.
|
// Redirect access straight to the wrapper if we should be transparent.
|
||||||
|
@ -75,7 +75,8 @@ class XrayWrapper : public Base {
|
|||||||
js::PropertyDescriptor *desc);
|
js::PropertyDescriptor *desc);
|
||||||
virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
virtual bool getOwnPropertyNames(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
||||||
js::AutoIdVector &props);
|
js::AutoIdVector &props);
|
||||||
virtual bool delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp);
|
virtual bool delete_(JSContext *cx, JS::Handle<JSObject *> wrapper,
|
||||||
|
JS::Handle<jsid> id, bool *bp);
|
||||||
virtual bool enumerate(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props);
|
virtual bool enumerate(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props);
|
||||||
|
|
||||||
/* Derived proxy traps. */
|
/* Derived proxy traps. */
|
||||||
|
Loading…
Reference in New Issue
Block a user