Skip to content

Commit 4c53c94

Browse files
authored
Fix value release in vm_loop for Proxy for-in cases (#3874)
Fixes #3868 JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi [email protected]
1 parent 90fd881 commit 4c53c94

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

jerry-core/vm/vm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3419,6 +3419,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
34193419
instruction.
34203420
- For other objects we should keep the current implementation due to performance reasons.*/
34213421
result = ecma_raise_type_error (ECMA_ERR_MSG ("UNIMPLEMENTED: Proxy support in for-in."));
3422+
ecma_free_value (value);
34223423
goto error;
34233424
}
34243425
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROXY) */
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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 a = new Proxy({}, {});
16+
17+
try {
18+
for (var $ in a);
19+
assert(false);
20+
} catch (e) {
21+
assert(e instanceof TypeError);
22+
}

0 commit comments

Comments
 (0)