2019-03-11 17:38:10 +00:00
|
|
|
// Copyright 2019 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
|
2019-06-12 14:00:50 +00:00
|
|
|
let target = {0: 42, a: 42};
|
2019-03-11 17:38:10 +00:00
|
|
|
|
|
|
|
let proxy = new Proxy(target, {
|
2019-06-12 14:00:50 +00:00
|
|
|
has: function() {
|
|
|
|
return false;
|
|
|
|
}
|
2019-03-11 17:38:10 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
Object.preventExtensions(target);
|
|
|
|
|
|
|
|
function testLookupElementInProxy() {
|
|
|
|
0 in proxy;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 9.5.7 [[HasProperty]] 9. states that if the trap returns false, and the
|
|
|
|
// target hasOwnProperty, and the target is non-extensible, throw a type error.
|
2019-06-12 14:00:50 +00:00
|
|
|
;
|
|
|
|
%PrepareFunctionForOptimization(testLookupElementInProxy);
|
2019-03-11 17:38:10 +00:00
|
|
|
assertThrows(testLookupElementInProxy, TypeError);
|
|
|
|
assertThrows(testLookupElementInProxy, TypeError);
|
|
|
|
%OptimizeFunctionOnNextCall(testLookupElementInProxy);
|
|
|
|
assertThrows(testLookupElementInProxy, TypeError);
|
|
|
|
|
2019-06-12 14:00:50 +00:00
|
|
|
function testLookupPropertyInProxy() {
|
2019-03-11 17:38:10 +00:00
|
|
|
"a" in proxy;
|
2019-06-12 14:00:50 +00:00
|
|
|
};
|
|
|
|
%PrepareFunctionForOptimization(testLookupPropertyInProxy);
|
2019-03-11 17:38:10 +00:00
|
|
|
assertThrows(testLookupPropertyInProxy, TypeError);
|
|
|
|
assertThrows(testLookupPropertyInProxy, TypeError);
|
|
|
|
%OptimizeFunctionOnNextCall(testLookupPropertyInProxy);
|
|
|
|
assertThrows(testLookupPropertyInProxy, TypeError);
|