diff --git a/js/src/builtin/RegExp.js b/js/src/builtin/RegExp.js index 156183bcf49f..96a08420233e 100644 --- a/js/src/builtin/RegExp.js +++ b/js/src/builtin/RegExp.js @@ -579,6 +579,7 @@ function IsRegExpSplitOptimizable(rx, C) { // If RegExpPrototypeOptimizable succeeds, `RegExpProto.exec` is guaranteed // to be a data property. return RegExpPrototypeOptimizable(RegExpProto) && + RegExpInstanceOptimizable(rx, RegExpProto) && RegExpProto.exec === RegExp_prototype_Exec; } diff --git a/js/src/tests/ecma_6/RegExp/split-prop-access.js b/js/src/tests/ecma_6/RegExp/split-prop-access.js new file mode 100644 index 000000000000..73c5bebb31e4 --- /dev/null +++ b/js/src/tests/ecma_6/RegExp/split-prop-access.js @@ -0,0 +1,19 @@ +var BUGNUMBER = 1287525; +var summary = 'String.prototype.split should call ToUint32(limit) before ToString(separator).'; + +print(BUGNUMBER + ": " + summary); + +var accessed = false; + +var rx = /a/; +Object.defineProperty(rx, Symbol.match, { + get() { + accessed = true; + } +}); +rx[Symbol.split]("abba"); + +assertEq(accessed, true); + +if (typeof reportCompare === "function") + reportCompare(true, true);