Commit 453e1dfa authored by jkummerow's avatar jkummerow Committed by Commit bot

[proxies] Fix HasProperty and getOwnPropertySymbols

JSProxy::HasProperty was missing an early "return Nothing<bool>".
KeyAccumulator's FilterProxyKeys() didn't handle SKIP_STRINGS correctly.

BUG=v8:1543
LOG=n
R=cbruni@chromium.org

Review URL: https://codereview.chromium.org/1505253002

Cr-Commit-Position: refs/heads/master@{#32699}
parent c51e4f1b
......@@ -231,12 +231,7 @@ MaybeHandle<FixedArray> FilterProxyKeys(Isolate* isolate, Handle<JSProxy> owner,
int store_position = 0;
for (int i = 0; i < keys->length(); ++i) {
Handle<Name> key(Name::cast(keys->get(i)), isolate);
if (key->IsSymbol()) {
if ((filter & SKIP_SYMBOLS) || Handle<Symbol>::cast(key)->is_private()) {
continue; // Skip this key.
}
}
if (filter & SKIP_STRINGS) continue; // Skip this key.
if (key->FilterKey(filter)) continue; // Skip this key.
if (filter & ONLY_ENUMERABLE) {
PropertyDescriptor desc;
bool found =
......
......@@ -292,9 +292,9 @@ bool Object::FilterKey(PropertyFilter filter) {
if (IsSymbol()) {
if (filter & SKIP_SYMBOLS) return true;
if (Symbol::cast(this)->is_private()) return true;
} else {
if (filter & SKIP_STRINGS) return true;
}
if ((filter & SKIP_STRINGS) && !IsSymbol()) return true;
return false;
}
......
......@@ -4669,6 +4669,7 @@ Maybe<bool> JSProxy::HasProperty(Isolate* isolate, Handle<JSProxy> proxy,
if (!extensible_target) {
isolate->Throw(*isolate->factory()->NewTypeError(
MessageTemplate::kProxyTargetNotExtensible));
return Nothing<bool>();
}
}
}
......
......@@ -50,7 +50,7 @@ assertThrows("Object.defineProperty(proxy, 'foo', desc)", TypeError);
// Step 15a: Trap returns true for adding a property to a non-extensible target.
handler.defineProperty = function(t, n, d) { return true; }
Object.freeze(target);
Object.preventExtensions(target);
assertThrows("Object.defineProperty(proxy, 'foo', desc)", TypeError);
// Step 15b: Trap returns true for adding a non-configurable property.
......
......@@ -49,7 +49,7 @@ assertThrows("'nonconf' in proxy", TypeError);
// Step 9b iii. Trap result must confirm presence of all own properties of
// non-extensible targets.
Object.freeze(target);
Object.preventExtensions(target);
assertThrows("'nonconf' in proxy", TypeError);
assertThrows("'target_one' in proxy", TypeError);
assertFalse("target_two" in proxy);
......
......@@ -74,7 +74,7 @@ keys = ["nonconf"];
assertEquals(keys, Reflect.ownKeys(proxy));
// Step 19a: The trap result must all keys of a non-extensible target.
Object.freeze(target);
Object.preventExtensions(target);
assertThrows("Reflect.ownKeys(proxy)", TypeError);
keys = ["nonconf", "target_one"];
assertEquals(keys, Reflect.ownKeys(proxy));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment