Fix handling of an exception raised during arguments list evaluation.

Related issues: #260, #261, #262, #263, #264, #265, #266, #267

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
Ruben Ayrapetyan 2015-06-29 22:58:45 +03:00 committed by Evgeny Gavrin
parent fd9ff8e3bd
commit 2aa04859ef
10 changed files with 229 additions and 5 deletions

View File

@ -37,8 +37,8 @@ fill_varg_list (int_data_t *int_data, /**< interpreter context */
ecma_length_t arg_index; ecma_length_t arg_index;
for (arg_index = 0; for (arg_index = 0;
arg_index < args_number; arg_index < args_number && ecma_is_completion_value_empty (ret_value);
arg_index++) )
{ {
ecma_completion_value_t evaluate_arg_completion = vm_loop (int_data, NULL); ecma_completion_value_t evaluate_arg_completion = vm_loop (int_data, NULL);
@ -54,7 +54,7 @@ fill_varg_list (int_data_t *int_data, /**< interpreter context */
if (ecma_is_completion_value_normal (get_arg_completion)) if (ecma_is_completion_value_normal (get_arg_completion))
{ {
arg_values[arg_index] = ecma_get_completion_value_value (get_arg_completion); arg_values[arg_index++] = ecma_get_completion_value_value (get_arg_completion);
} }
else else
{ {
@ -68,8 +68,6 @@ fill_varg_list (int_data_t *int_data, /**< interpreter context */
JERRY_ASSERT (ecma_is_completion_value_throw (evaluate_arg_completion)); JERRY_ASSERT (ecma_is_completion_value_throw (evaluate_arg_completion));
ret_value = evaluate_arg_completion; ret_value = evaluate_arg_completion;
break;
} }
int_data->pos++; int_data->pos++;

View File

@ -44,3 +44,12 @@ for(i = 11; i <= 20; i++)
{ {
f1(i); f1(i);
} }
try {
f1 ({});
f1 (undefined_variable);
assert (false);
}
catch (e) {
assert (e instanceof ReferenceError);
}

View File

@ -0,0 +1,18 @@
// Copyright 2015 Samsung Electronics Co., Ltd.
// Copyright 2015 University of Szeged.
//
// 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.
try {
isNaN(__proto__);
} catch (e) {}

View File

@ -0,0 +1,19 @@
// Copyright 2015 Samsung Electronics Co., Ltd.
// Copyright 2015 University of Szeged.
//
// 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.
try {
SyntaxError(RegExp());
isFinite(foo);
} catch (e) {}

View File

@ -0,0 +1,19 @@
// Copyright 2015 Samsung Electronics Co., Ltd.
// Copyright 2015 University of Szeged.
//
// 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.
try {
RegExp("");
eval(encodeURI(isNaN(__proto__)));
} catch (e) { }

View File

@ -0,0 +1,43 @@
// Copyright 2015 Samsung Electronics Co., Ltd.
// Copyright 2015 University of Szeged.
//
// 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.
try {
Boolean(decodeURI(decodeURIComponent(Number())));
} catch(err) {}
try {
ReferenceError(isNaN(__proto__));
} catch(err) {}
try {
isNaN(__proto__);
} catch(err) {}
try {
load();
} catch(err) {}
try {
RegExp("\n");
} catch(err) {}
try {} catch(err) {}
try {
ReferenceError(performance.__proto__.isPrototypeOf(arguments.map(os)));
} catch(err) {}
try {
Float64Array(performance,WeakSet(),Infinity.valueOf());
} catch(err) {}
try {
arguments.push(Int8Array(Boolean(isFinite(quit())),ArrayBuffer(os.system()),Array(read())));
} catch(err) {}
try {
Boolean(encodeURI(DataView(ArrayBuffer(os),parseFloat(Set()),URIError(Object(Int8Array(Function(parseInt(write(),RangeError(__proto__.valueOf()))),Int16Array(Map(),__proto__.valueOf(),readbuffer()),Math))))));
} catch(err) {}

View File

@ -0,0 +1,45 @@
// Copyright 2015 Samsung Electronics Co., Ltd.
// Copyright 2015 University of Szeged.
//
// 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.
try {
Boolean(decodeURI(decodeURIComponent(Number())));
} catch(err) {}
try {
ReferenceError(isNaN(__proto__));
} catch(err) {}
try {
isNaN(__proto__);
} catch(err) {}
try {
load();
} catch(err) {}
try {
RegExp("\n");
} catch(err) {}
try {
Set();
} catch(err) {}
try {
ReferenceError(performance.__proto__.isPrototypeOf(arguments.map(os)));
} catch(err) {}
try {
Float64Array(performance,WeakSet(),Infinity.valueOf());
} catch(err) {}
try {
arguments.push(Int8Array(Boolean(isFinite(quit())),ArrayBuffer(os.system()),Array(read())));
} catch(err) {}
try {
Boolean(encodeURI(DataView(ArrayBuffer(os),parseFloat(Set()),URIError(Object(Int8Array(Function(parseInt(write(),RangeError(__proto__.valueOf()))),Int16Array(Map(),__proto__.valueOf(),readbuffer()),Math))))));
} catch(err) {}

View File

@ -0,0 +1,28 @@
// Copyright 2015 Samsung Electronics Co., Ltd.
// Copyright 2015 University of Szeged.
//
// 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.
parseInt(NaN,RegExp("54"));
try {
parseInt(ArrayBuffer());
} catch(err) {}
try {
isNaN(__proto__);
} catch(err) {}
try {
RangeError(parseInt(Infinity,readbuffer()));
} catch (err) {}

View File

@ -0,0 +1,23 @@
// Copyright 2015 Samsung Electronics Co., Ltd.
// Copyright 2015 University of Szeged.
//
// 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.
try {
String("test");
isNaN(__proto__);
} catch(err) {}
try {
SyntaxError(RegExp("[/]"));
} catch(err) {}

View File

@ -0,0 +1,22 @@
// Copyright 2015 Samsung Electronics Co., Ltd.
// Copyright 2015 University of Szeged.
//
// 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.
try {
RegExp("\u2029");
} catch(err) {}
try {
URIError(isNaN(__proto__));
} catch(err) {}