String.match should return on error. (#1560)

Fixes #1546.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg 2017-02-03 15:16:49 +01:00 committed by GitHub
parent a43186db41
commit 589f2dec92
2 changed files with 17 additions and 1 deletions

View File

@ -1522,7 +1522,8 @@ ecma_builtin_helper_split_match (ecma_value_t input_string, /**< first argument
ret_value = ecma_regexp_exec_helper (regexp_value, ecma_make_string_value (substr_str_p), true);
if (!ecma_is_value_null (ret_value))
if (!ECMA_IS_VALUE_ERROR (ret_value)
&& !ecma_is_value_null (ret_value))
{
ecma_object_t *obj_p = ecma_get_object_from_value (ret_value);
ecma_string_t *magic_index_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_INDEX);

View File

@ -0,0 +1,15 @@
// 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.
String.prototype.split(RegExp.prototype);