Remove revoked Proxy checks when creating a Proxy (#4261)

In the newer ecma262 standard (post ES11) the ProxyCreate was
changed and the revoked Proxy handler/target is not checked.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
This commit is contained in:
Péter Gál
2020-10-05 10:03:49 +02:00
committed by GitHub
parent 37d6b13891
commit 8edf8d6eea
5 changed files with 31 additions and 60 deletions
+3 -15
View File
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// TODO: Update these tests when the internal routine has been implemented
var target = {}
var handler = {};
var proxy = new Proxy(target, handler);
@@ -43,16 +41,6 @@ try {
assert(e instanceof TypeError);
}
try {
new Proxy({}, rev_proxy);
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
try {
new Proxy(rev_proxy, {});
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
/* In ES11+ the standard changed revoked proxy is a valid input for a new Proxy */
var proxy_rev_handler = new Proxy({}, rev_proxy);
var proxy_rev_target_Br = new Proxy(rev_proxy, {});
+13 -11
View File
@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// TODO: Update these tests when the internal routine has been implemented
var target = function () {};
var handler = { get (name) {
return 5;
@@ -48,17 +46,21 @@ try {
assert(e instanceof TypeError);
}
var p1 = Proxy.revocable({}, proxy);
p1.a = 3;
assert(p1.a == 3);
var p2 = Proxy.revocable(proxy, {});
p2.b = 43;
assert(p2.b == 43);
assert(typeof(target.a) === "undefined");
assert(typeof(target.b) === "undefined");
// Try accessing the "a" property again, it should fail
try {
Proxy.revocable({}, proxy);
proxy.a;
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
try {
Proxy.revocable(proxy, {});
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
+2
View File
@@ -337,4 +337,6 @@
<test id="language/arguments-object/10.6-14-b-1-s.js"><reason>ES11: arguments object no longer has caller property</reason></test>
<test id="language/arguments-object/10.6-14-b-4-s.js"><reason>ES11: arguments object no longer has caller property</reason></test>
<test id="language/statements/class/strict-mode/arguments-caller.js"><reason>ES11: arguments object no longer has caller property</reason></test>
<test id="built-ins/Proxy/create-handler-is-revoked-proxy.js"><reason>ES11+: ProxyCreate does not check Proxy handler and target.</reason></test>
<test id="built-ins/Proxy/create-target-is-revoked-proxy.js"><reason>ES11+: ProxyCreate does not check Proxy handler and target.</reason></test>
</excludeList>
-4
View File
@@ -929,9 +929,7 @@
<test id="built-ins/Proxy/construct/trap-is-not-callable-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/construct/trap-is-undefined-proto-from-cross-realm-newtarget.js"><reason></reason></test>
<test id="built-ins/Proxy/construct/trap-is-undefined-proto-from-newtarget-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/create-handler-is-revoked-proxy.js"><reason></reason></test>
<test id="built-ins/Proxy/create-target-is-revoked-function-proxy.js"><reason></reason></test>
<test id="built-ins/Proxy/create-target-is-revoked-proxy.js"><reason></reason></test>
<test id="built-ins/Proxy/defineProperty/desc-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/defineProperty/null-handler-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/defineProperty/targetdesc-configurable-desc-not-configurable-realm.js"><reason></reason></test>
@@ -956,9 +954,7 @@
<test id="built-ins/Proxy/ownKeys/trap-is-not-callable-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/preventExtensions/trap-is-not-callable-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/preventExtensions/trap-is-undefined-target-is-proxy.js"><reason></reason></test>
<test id="built-ins/Proxy/revocable/handler-is-revoked-proxy.js"><reason></reason></test>
<test id="built-ins/Proxy/revocable/target-is-revoked-function-proxy.js"><reason></reason></test>
<test id="built-ins/Proxy/revocable/target-is-revoked-proxy.js"><reason></reason></test>
<test id="built-ins/Proxy/set/trap-is-not-callable-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/setPrototypeOf/toboolean-trap-result-false.js"><reason></reason></test>
<test id="built-ins/Proxy/setPrototypeOf/trap-is-not-callable-realm.js"><reason></reason></test>