Skip to content

Commit df7e303

Browse files
authored
Fix apply receiver operation for Proxy objects (#3730)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
1 parent 050fbfc commit df7e303

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

jerry-core/ecma/operations/ecma-objects.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,16 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
11941194
return result;
11951195
}
11961196

1197+
#if ENABLED (JERRY_ES2015_BUILTIN_PROXY)
1198+
if (ECMA_OBJECT_IS_PROXY (receiver_obj_p))
1199+
{
1200+
ecma_property_descriptor_t desc;
1201+
desc.flags = ECMA_NAME_DATA_PROPERTY_DESCRIPTOR_BITS;
1202+
desc.value = value;
1203+
return ecma_proxy_object_define_own_property (receiver_obj_p, property_name_p, &desc);
1204+
}
1205+
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROXY) */
1206+
11971207
if (JERRY_UNLIKELY (ecma_op_object_is_fast_array (receiver_obj_p)))
11981208
{
11991209
ecma_fast_array_convert_to_normal (receiver_obj_p);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright JS Foundation and other contributors, http://js.foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
var get = [];
16+
var p = new Proxy({
17+
exec: function() {
18+
return null;
19+
}
20+
}, {
21+
get: function(o, k) {
22+
get.push(k);
23+
return o[k];
24+
}
25+
});
26+
RegExp.prototype[Symbol.match].call(p);
27+
p.global = true;
28+
RegExp.prototype[Symbol.match].call(p);
29+
30+
assert(get + '' === "global,exec,global,unicode,exec");

0 commit comments

Comments
 (0)