Skip to content

Commit 0db82a5

Browse files
Fix exception handling in opfunc_native_call (OPCODE_NATIVE_CALL_PRINT case).
Related issue: #122 JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
1 parent 81d13b0 commit 0db82a5

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

jerry-core/vm/opcodes-native-call.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */
6969
case OPCODE_NATIVE_CALL_PRINT:
7070
{
7171
for (ecma_length_t arg_index = 0;
72-
arg_index < args_read;
72+
ecma_is_completion_value_empty (ret_value) && arg_index < args_read;
7373
arg_index++)
7474
{
7575
ECMA_TRY_CATCH (str_value,
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2015 Samsung Electronics Co., Ltd.
2+
// Copyright 2015 University of Szeged.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
16+
try
17+
{
18+
print(this, []);
19+
assert (false);
20+
}
21+
catch (e)
22+
{
23+
assert (e instanceof TypeError);
24+
}

0 commit comments

Comments
 (0)