Fix apply receiver operation for Proxy objects (#3730)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2020-05-11 16:56:41 +02:00
committed by GitHub
parent 050fbfc130
commit df7e303145
2 changed files with 40 additions and 0 deletions
+10
View File
@@ -1194,6 +1194,16 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
return result;
}
#if ENABLED (JERRY_ES2015_BUILTIN_PROXY)
if (ECMA_OBJECT_IS_PROXY (receiver_obj_p))
{
ecma_property_descriptor_t desc;
desc.flags = ECMA_NAME_DATA_PROPERTY_DESCRIPTOR_BITS;
desc.value = value;
return ecma_proxy_object_define_own_property (receiver_obj_p, property_name_p, &desc);
}
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROXY) */
if (JERRY_UNLIKELY (ecma_op_object_is_fast_array (receiver_obj_p)))
{
ecma_fast_array_convert_to_normal (receiver_obj_p);
@@ -0,0 +1,30 @@
// 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 get = [];
var p = new Proxy({
exec: function() {
return null;
}
}, {
get: function(o, k) {
get.push(k);
return o[k];
}
});
RegExp.prototype[Symbol.match].call(p);
p.global = true;
RegExp.prototype[Symbol.match].call(p);
assert(get + '' === "global,exec,global,unicode,exec");