|
|
|
Lines 1727-1747
ScriptedDirectProxyHandler::delete_(JSCo
|
Link Here
|
|---|
|
| 1727 |
} |
1727 |
} |
| 1728 |
|
1728 |
|
| 1729 |
// step 8 |
1729 |
// step 8 |
| 1730 |
// FIXME: API does not include a Throw parameter |
1730 |
// FIXME: API does not include a Throw parameter |
| 1731 |
*bp = false; |
1731 |
*bp = false; |
| 1732 |
return true; |
1732 |
return true; |
| 1733 |
} |
1733 |
} |
| 1734 |
|
1734 |
|
|
|
1735 |
// 12.6.4 The for-in Statement, step 6 |
| 1735 |
bool |
1736 |
bool |
| 1736 |
ScriptedDirectProxyHandler::enumerate(JSContext *cx, JSObject *proxy, AutoIdVector &props) |
1737 |
ScriptedDirectProxyHandler::enumerate(JSContext *cx, JSObject *proxy_, AutoIdVector &props) |
| 1737 |
{ |
1738 |
{ |
| 1738 |
JS_NOT_REACHED("not yet implemented"); |
1739 |
RootedObject proxy(cx, proxy_); |
| 1739 |
return false; |
1740 |
|
|
|
1741 |
// step a |
| 1742 |
RootedObject handler(cx, GetDirectProxyHandlerObject(proxy)); |
| 1743 |
|
| 1744 |
// step b |
| 1745 |
RootedObject target(cx, GetProxyTargetObject(proxy)); |
| 1746 |
|
| 1747 |
// step c |
| 1748 |
RootedValue trap(cx); |
| 1749 |
if (!handler->getProperty(cx, ATOM(enumerate), &trap)) |
| 1750 |
return false; |
| 1751 |
|
| 1752 |
// step d |
| 1753 |
if (trap.isUndefined()) |
| 1754 |
return DirectProxyHandler::enumerate(cx, proxy_, props); |
| 1755 |
|
| 1756 |
// step e |
| 1757 |
Value argv[] = { |
| 1758 |
ObjectOrNullValue(target) |
| 1759 |
}; |
| 1760 |
RootedValue trapResult(cx); |
| 1761 |
if (!Invoke(cx, ObjectValue(*handler), trap, 1, argv, trapResult.address())) |
| 1762 |
return false; |
| 1763 |
|
| 1764 |
// step f |
| 1765 |
if (trapResult.isPrimitive()) { |
| 1766 |
JSAutoByteString bytes; |
| 1767 |
if (!js_AtomToPrintableString(cx, ATOM(enumerate), &bytes)) |
| 1768 |
return false; |
| 1769 |
RootedValue v(cx, ObjectOrNullValue(proxy)); |
| 1770 |
js_ReportValueError2(cx, JSMSG_INVALID_TRAP_RESULT, JSDVG_SEARCH_STACK, |
| 1771 |
v, NullPtr(), bytes.ptr()); |
| 1772 |
return false; |
| 1773 |
} |
| 1774 |
|
| 1775 |
// steps g-m are shared |
| 1776 |
// FIXME: the trap should return an iterator object, see bug 783826 |
| 1777 |
return ArrayToIdVector(cx, proxy, target, trapResult, props, ATOM(enumerate)); |
| 1740 |
} |
1778 |
} |
| 1741 |
|
1779 |
|
| 1742 |
bool |
1780 |
bool |
| 1743 |
ScriptedDirectProxyHandler::has(JSContext *cx, JSObject *proxy, jsid id, bool *bp) |
1781 |
ScriptedDirectProxyHandler::has(JSContext *cx, JSObject *proxy, jsid id, bool *bp) |
| 1744 |
{ |
1782 |
{ |
| 1745 |
JS_NOT_REACHED("not yet implemented"); |
1783 |
JS_NOT_REACHED("not yet implemented"); |
| 1746 |
return false; |
1784 |
return false; |
| 1747 |
} |
1785 |
} |