Update proxy to ES2020 (#4085)

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
This commit is contained in:
kisbg
2020-08-06 11:25:29 +02:00
committed by GitHub
parent c76736eadf
commit 7d479ad91b
5 changed files with 95 additions and 3 deletions
@@ -174,3 +174,27 @@ try {
} catch (e) {
assert(e instanceof TypeError);
}
var trapCalls = 0;
var p = new Proxy({}, {
defineProperty: function(t, prop, desc) {
Object.defineProperty(t, prop, {
configurable: false,
writable: true,
});
trapCalls++;
return true;
},
});
try {
Reflect.defineProperty (p, "prop", {
writable: false,
});
assert (false);
} catch (e) {
assert (e instanceof TypeError);
}
assert (trapCalls == 1)
+18
View File
@@ -162,3 +162,21 @@ try {
} catch (e) {
assert(e instanceof TypeError);
}
var trapCalls = 0;
var p = new Proxy({prop: 1}, {
deleteProperty: function(t, prop) {
Object.preventExtensions(t);
trapCalls++;
return true;
},
});
try {
Reflect.deleteProperty (p, "prop");
assert (false);
} catch (e) {
assert (e instanceof TypeError);
}
assert (trapCalls == 1);
@@ -282,3 +282,30 @@ Object.assign({}, proxy);
assert(result.length === 2);
assert(result[0] === "foo");
assert(result[1] === "bar");
var trapCalls = 0;
var p = new Proxy({}, {
getOwnPropertyDescriptor: function(t, prop) {
Object.defineProperty(t, prop, {
configurable: false,
writable: true,
});
trapCalls++;
return {
configurable: false,
writable: false,
};
},
});
try
{
Object.getOwnPropertyDescriptor(p, "prop");
assert (false)
}
catch (e)
{
assert(e instanceof TypeError)
}
-3
View File
@@ -1341,12 +1341,10 @@
<test id="built-ins/Proxy/defineProperty/targetdesc-configurable-desc-not-configurable-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/defineProperty/targetdesc-not-compatible-descriptor-not-configurable-target-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/defineProperty/targetdesc-not-compatible-descriptor-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/defineProperty/targetdesc-not-configurable-writable-desc-not-writable.js"><reason></reason></test>
<test id="built-ins/Proxy/defineProperty/targetdesc-undefined-not-configurable-descriptor-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/defineProperty/targetdesc-undefined-target-is-not-extensible-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/defineProperty/trap-is-not-callable-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/defineProperty/trap-is-undefined-target-is-proxy.js"><reason></reason></test>
<test id="built-ins/Proxy/deleteProperty/targetdesc-is-configurable-target-is-not-extensible.js"><reason></reason></test>
<test id="built-ins/Proxy/deleteProperty/trap-is-missing-target-is-proxy.js"><reason></reason></test>
<test id="built-ins/Proxy/deleteProperty/trap-is-not-callable-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/deleteProperty/trap-is-null-target-is-proxy.js"><reason></reason></test>
@@ -1355,7 +1353,6 @@
<test id="built-ins/Proxy/get-fn-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/get/trap-is-not-callable-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/getOwnPropertyDescriptor/result-type-is-not-object-nor-undefined-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/getOwnPropertyDescriptor/resultdesc-is-not-configurable-not-writable-targetdesc-is-writable.js"><reason></reason></test>
<test id="built-ins/Proxy/getOwnPropertyDescriptor/trap-is-not-callable-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/getPrototypeOf/trap-is-not-callable-realm.js"><reason></reason></test>
<test id="built-ins/Proxy/has/trap-is-not-callable-realm.js"><reason></reason></test>