Add proxy check in ecma_op_object_put_with_receiver (#4411)

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
This commit is contained in:
kisbg 2021-01-06 08:44:48 +01:00 committed by GitHub
parent 6279670484
commit 2ac3c08c14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 1 deletions

View File

@ -1523,6 +1523,15 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
}
}
#if ENABLED (JERRY_BUILTIN_PROXY)
if (create_new_property
&& ecma_is_value_object (receiver)
&& ECMA_OBJECT_IS_PROXY (ecma_get_object_from_value (receiver)))
{
return ecma_op_object_put_apply_receiver (receiver, property_name_p, value, is_throw);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
if (create_new_property
&& ecma_op_ordinary_object_is_extensible (object_p))
{

View File

@ -0,0 +1,32 @@
// Copyright JS Foundation and other contributors, http://js.foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
var target = Object.create(null);
var p = new Proxy(target, {
defineProperty: function() {
return true;
}
});
Object.preventExtensions(p);
try {
p.prop = null;
assert(false)
}
catch(e)
{
assert(e instanceof TypeError)
}

View File

@ -9655,7 +9655,6 @@
<test id="built-ins/NativeErrors/SyntaxError/proto-from-ctor-realm.js"><reason></reason></test>
<test id="built-ins/NativeErrors/TypeError/proto-from-ctor-realm.js"><reason></reason></test>
<test id="built-ins/NativeErrors/URIError/proto-from-ctor-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/get-fn-realm-recursive.js"><reason></reason></test>
<test id="built-ins/Proxy/get-fn-realm.js"><reason></reason></test>
<test id="built-ins/RegExp/prototype/dotAll/cross-realm.js"><reason></reason></test>