Skip to content

Commit aafc314

Browse files
author
Myles Borins
committed
deps: cherry-pick 34880eb3dc from V8 upstream
Original commit message: Revert of Put RegExp js code in strict mode (patchset #2 id:20001 of https://codereview.chromium.org/1776883005/ ) Reason for revert: Found to break SAP Web IDE, and these semantics are not shipped in any other browser. Revert to legacy semantics while assessing web compatibility. BUG=chromium:624318 Original issue's description: > Put RegExp js code in strict mode > > src/js/regexp.js was one of the few files that was left in sloppy > mode. The ES2017 draft specification requires that writes to > lastIndex throw when the property is non-writable, and test262 > tests enforce this behavior. This patch puts that file in strict > mode. > > BUG=v8:4504 > [email protected] > LOG=Y > > Committed: https://crrev.com/80b1b2a45bbd9bf3d08e4e6516acfaaa8f438213 > Cr-Commit-Position: refs/heads/master@{#34801} [email protected],[email protected] Review-Url: https://codereview.chromium.org/2112713003 Cr-Commit-Position: refs/heads/master@{#37449} PR-URL: #8673 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 97406ba commit aafc314

File tree

4 files changed

+19
-23
lines changed

4 files changed

+19
-23
lines changed

deps/v8/src/js/regexp.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
(function(global, utils) {
66

7-
'use strict';
8-
97
%CheckIsBootstrapping();
108

119
// -------------------------------------------------------------------

deps/v8/test/mjsunit/regexp-lastIndex.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

deps/v8/test/test262/test262.status

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,22 @@
131131
'built-ins/RegExp/prototype/Symbol.replace/y-init-lastindex': [FAIL],
132132
'built-ins/RegExp/prototype/Symbol.replace/y-set-lastindex': [FAIL],
133133

134+
# https://code.google.com/p/v8/issues/detail?id=4504
135+
# https://bugs.chromium.org/p/chromium/issues/detail?id=624318
136+
'built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex-err': [PASS, FAIL],
137+
'built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-set-lastindex-err': [PASS, FAIL],
138+
'built-ins/RegExp/prototype/Symbol.match/builtin-success-g-set-lastindex-err': [SKIP],
139+
'built-ins/RegExp/prototype/Symbol.match/builtin-success-y-set-lastindex-err': [PASS, FAIL],
140+
'built-ins/RegExp/prototype/Symbol.match/g-init-lastindex-err': [PASS, FAIL],
141+
'built-ins/RegExp/prototype/Symbol.match/g-match-empty-set-lastindex-err': [PASS, FAIL],
142+
'built-ins/RegExp/prototype/Symbol.match/y-fail-lastindex-no-write': [PASS, FAIL],
143+
'built-ins/RegExp/prototype/Symbol.replace/g-init-lastindex-err': [PASS, FAIL],
144+
'built-ins/RegExp/prototype/Symbol.replace/y-fail-lastindex-no-write': [PASS, FAIL],
145+
'built-ins/RegExp/prototype/Symbol.search/set-lastindex-init-err': [PASS, FAIL],
146+
'built-ins/RegExp/prototype/Symbol.search/set-lastindex-restore-err': [PASS, FAIL],
147+
'built-ins/RegExp/prototype/exec/y-fail-lastindex-no-write': [PASS, FAIL],
148+
'built-ins/RegExp/prototype/test/y-fail-lastindex-no-write': [PASS, FAIL],
149+
134150
# SKIP rather than FAIL, as the test checks for an exception which
135151
# happens to be thrown for some other reason.
136152
'built-ins/RegExp/prototype/Symbol.split/str-result-get-length-err': [SKIP],

deps/v8/test/webkit/fast/regex/lastIndex-expected.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ PASS var re = Object.defineProperty(/x/, 'lastIndex', {value:42}); re.lastIndex
4242
PASS Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writable:false}), 'lastIndex', {writable:true}); true threw exception TypeError: Cannot redefine property: lastIndex.
4343
PASS Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writable:false}), 'lastIndex', {value:42}); true threw exception TypeError: Cannot redefine property: lastIndex.
4444
PASS Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writable:false}), 'lastIndex', {value:0}); true is true
45-
FAIL Object.defineProperty(/x/, 'lastIndex', {writable:false}).exec('') should be null. Threw exception TypeError: Cannot assign to read only property 'lastIndex' of object '[object RegExp]'
45+
PASS Object.defineProperty(/x/, 'lastIndex', {writable:false}).exec('') is null
4646
PASS Object.defineProperty(/x/, 'lastIndex', {writable:false}).exec('x') is ["x"]
47-
PASS Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('') threw exception TypeError: Cannot assign to read only property 'lastIndex' of object '[object RegExp]'.
48-
PASS Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('x') threw exception TypeError: Cannot assign to read only property 'lastIndex' of object '[object RegExp]'.
47+
FAIL Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('') should throw an exception. Was null.
48+
FAIL Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('x') should throw an exception. Was x.
4949
PASS var re = /x/; Object.freeze(re); Object.isFrozen(re); is true
5050
PASS successfullyParsed is true
5151

0 commit comments

Comments
 (0)