mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 978240 - Update step number comments for ES6 Proxy.[[Delete]]. (r=jorendorff)
DONTBUILD because comment onlu
This commit is contained in:
parent
acbc9e91fe
commit
2008fd98cd
@ -1802,26 +1802,28 @@ ScriptedDirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject prox
|
|||||||
cx->names().getOwnPropertyNames);
|
cx->names().getOwnPropertyNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proxy.[[Delete]](P, Throw)
|
// ES6 (5 April 2014) Proxy.[[Delete]](P)
|
||||||
bool
|
bool
|
||||||
ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp)
|
ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp)
|
||||||
{
|
{
|
||||||
// step 1
|
// step 2
|
||||||
RootedObject handler(cx, GetDirectProxyHandlerObject(proxy));
|
RootedObject handler(cx, GetDirectProxyHandlerObject(proxy));
|
||||||
|
|
||||||
// step 2
|
// TODO: step 3: Implement revocation semantics
|
||||||
|
|
||||||
|
// step 4
|
||||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||||
|
|
||||||
// step 3
|
// step 5
|
||||||
RootedValue trap(cx);
|
RootedValue trap(cx);
|
||||||
if (!JSObject::getProperty(cx, handler, handler, cx->names().deleteProperty, &trap))
|
if (!JSObject::getProperty(cx, handler, handler, cx->names().deleteProperty, &trap))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step 4
|
// step 7
|
||||||
if (trap.isUndefined())
|
if (trap.isUndefined())
|
||||||
return DirectProxyHandler::delete_(cx, proxy, id, bp);
|
return DirectProxyHandler::delete_(cx, proxy, id, bp);
|
||||||
|
|
||||||
// step 5
|
// step 8
|
||||||
RootedValue value(cx);
|
RootedValue value(cx);
|
||||||
if (!IdToExposableValue(cx, id, &value))
|
if (!IdToExposableValue(cx, id, &value))
|
||||||
return false;
|
return false;
|
||||||
@ -1833,24 +1835,26 @@ ScriptedDirectProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId
|
|||||||
if (!Invoke(cx, ObjectValue(*handler), trap, ArrayLength(argv), argv, &trapResult))
|
if (!Invoke(cx, ObjectValue(*handler), trap, ArrayLength(argv), argv, &trapResult))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// step 6-7
|
// step 9
|
||||||
if (ToBoolean(trapResult)) {
|
if (ToBoolean(trapResult)) {
|
||||||
|
// step 12
|
||||||
Rooted<PropertyDescriptor> desc(cx);
|
Rooted<PropertyDescriptor> desc(cx);
|
||||||
if (!GetOwnPropertyDescriptor(cx, target, id, &desc))
|
if (!GetOwnPropertyDescriptor(cx, target, id, &desc))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// step 14-15
|
||||||
if (desc.object() && desc.isPermanent()) {
|
if (desc.object() && desc.isPermanent()) {
|
||||||
RootedValue v(cx, IdToValue(id));
|
RootedValue v(cx, IdToValue(id));
|
||||||
js_ReportValueError(cx, JSMSG_CANT_DELETE, JSDVG_IGNORE_STACK, v, js::NullPtr());
|
js_ReportValueError(cx, JSMSG_CANT_DELETE, JSDVG_IGNORE_STACK, v, js::NullPtr());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// step 16
|
||||||
*bp = true;
|
*bp = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// step 8
|
// step 11
|
||||||
// FIXME: API does not include a Throw parameter
|
|
||||||
*bp = false;
|
*bp = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user