Title: [198699] tags/Safari-602.1.25.0.1

Diff

Modified: tags/Safari-602.1.25.0.1/LayoutTests/ChangeLog (198698 => 198699)


--- tags/Safari-602.1.25.0.1/LayoutTests/ChangeLog	2016-03-25 23:23:17 UTC (rev 198698)
+++ tags/Safari-602.1.25.0.1/LayoutTests/ChangeLog	2016-03-25 23:27:18 UTC (rev 198699)
@@ -1,3 +1,26 @@
+2016-03-25  Babak Shafiei  <[email protected]>
+
+        Merge r198698.
+
+    2016-03-25  Mark Lam  <[email protected]>
+
+            ES6's throwing of TypeErrors on access of RegExp.prototype flag properties breaks websites.
+            https://bugs.webkit.org/show_bug.cgi?id=155904
+
+            Reviewed by Geoffrey Garen.
+
+            * ietestcenter/_javascript_/TestCases/15.10.7.2-1.js:
+            (ES5Harness.registerTest.test):
+            * ietestcenter/_javascript_/TestCases/15.10.7.3-1.js:
+            (ES5Harness.registerTest.test):
+            * ietestcenter/_javascript_/TestCases/15.10.7.4-1.js:
+            (ES5Harness.registerTest.test):
+            - updated these tests to not expect a TypeError due to the workaround.
+
+            * js/pic/cached-named-property-getter.html:
+            - updated this test to use the source property (which still throws a TypeError)
+              instead of the ignoreCase property which no longer does.
+
 2016-03-22  Eric Carlson  <[email protected]>
 
         [OSX] Rebase media/media-document-audio-repaint.html

Modified: tags/Safari-602.1.25.0.1/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.2-1.js (198698 => 198699)


--- tags/Safari-602.1.25.0.1/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.2-1.js	2016-03-25 23:23:17 UTC (rev 198698)
+++ tags/Safari-602.1.25.0.1/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.2-1.js	2016-03-25 23:27:18 UTC (rev 198699)
@@ -27,11 +27,8 @@
 description: "RegExp.prototype.global should throw because RegExp.prototype is not a RegExp",
 
 test: function testcase() {
-    try {
-        RegExp.prototype.global;
-        return false;
-    } catch (e) {
+    if ((typeof(RegExp.prototype.global)) === 'undefined')
         return true;
-    }
+    return false;
  }
 });

Modified: tags/Safari-602.1.25.0.1/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.3-1.js (198698 => 198699)


--- tags/Safari-602.1.25.0.1/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.3-1.js	2016-03-25 23:23:17 UTC (rev 198698)
+++ tags/Safari-602.1.25.0.1/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.3-1.js	2016-03-25 23:27:18 UTC (rev 198699)
@@ -27,11 +27,8 @@
 description: "RegExp.prototype.ignoreCase should throw because RegExp.prototype is not a RegExp",
 
 test: function testcase() {
-    try {
-        RegExp.prototype.ignoreCase;
-        return false;
-    } catch (e) {
+    if ((typeof(RegExp.prototype.ignoreCase)) === 'undefined')
         return true;
-    }
+    return false;
  }
 });

Modified: tags/Safari-602.1.25.0.1/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.4-1.js (198698 => 198699)


--- tags/Safari-602.1.25.0.1/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.4-1.js	2016-03-25 23:23:17 UTC (rev 198698)
+++ tags/Safari-602.1.25.0.1/LayoutTests/ietestcenter/_javascript_/TestCases/15.10.7.4-1.js	2016-03-25 23:27:18 UTC (rev 198699)
@@ -27,11 +27,8 @@
 description: "RegExp.prototype.multiline should throw because RegExp.prototype is not a RegExp",
 
 test: function testcase() {
-    try {
-        RegExp.prototype.multiline;
-        return false;
-    } catch (e) {
+    if ((typeof(RegExp.prototype.multiline)) === 'undefined')
         return true;
-    }
+    return false;
  }
 });

Modified: tags/Safari-602.1.25.0.1/LayoutTests/js/pic/cached-named-property-getter.html (198698 => 198699)


--- tags/Safari-602.1.25.0.1/LayoutTests/js/pic/cached-named-property-getter.html	2016-03-25 23:23:17 UTC (rev 198698)
+++ tags/Safari-602.1.25.0.1/LayoutTests/js/pic/cached-named-property-getter.html	2016-03-25 23:27:18 UTC (rev 198699)
@@ -64,7 +64,7 @@
     
     function testCustomGetter(o) {
         for (var i = 0; i < 10; i++)
-            o.ignoreCase;
+            o.source;
     }
     var r=/a/;
     testCustomGetter(r);

Modified: tags/Safari-602.1.25.0.1/Source/_javascript_Core/ChangeLog (198698 => 198699)


--- tags/Safari-602.1.25.0.1/Source/_javascript_Core/ChangeLog	2016-03-25 23:23:17 UTC (rev 198698)
+++ tags/Safari-602.1.25.0.1/Source/_javascript_Core/ChangeLog	2016-03-25 23:27:18 UTC (rev 198699)
@@ -1,3 +1,48 @@
+2016-03-25  Babak Shafiei  <[email protected]>
+
+        Merge r198698.
+
+    2016-03-25  Mark Lam  <[email protected]>
+
+            ES6's throwing of TypeErrors on access of RegExp.prototype flag properties breaks websites.
+            https://bugs.webkit.org/show_bug.cgi?id=155904
+
+            Reviewed by Geoffrey Garen.
+
+            There exists a JS library XRegExp (see http://xregexp.com) that extends the regexp
+            implementation.  XRegExp does feature testing by comparing RegExp.prototype.sticky
+            to undefined.  See:
+
+            Example 1. https://github.com/slevithan/xregexp/blob/28a2b033c5951477bed8c7c867ddf7e89c431cd4/tests/perf/index.html
+                ...
+                } else if (knownVersion[version]) {
+                    // Hack around ES6 incompatibility in XRegExp versions prior to 3.0.0
+                    if (parseInt(version, 10) < 3) {
+                        delete RegExp.prototype.sticky;
+                }
+                ...
+
+            Example 2. https://github.com/slevithan/xregexp/blob/d0e665d4068cec4d15919215b098b2373f1f12e9/tests/perf/versions/xregexp-all-v2.0.0.js
+                ...
+                // Check for flag y support (Firefox 3+)
+                    hasNativeY = RegExp.prototype.sticky !== undef,
+                ...
+
+            The ES6 spec states that we should throw a TypeError here because RegExp.prototype
+            is not a RegExp object, and the sticky getter is only allowed to be called on
+            RegExp objects.  See https://tc39.github.io/ecma262/2016/#sec-get-regexp.prototype.sticky.
+            As a result, websites that uses XRegExp can break (e.g. some Atlassian tools).
+
+            As a workaround, we'll return undefined instead of throwing on access of these
+            flag properties that may be used for feature testing.
+
+            * runtime/RegExpPrototype.cpp:
+            (JSC::regExpProtoGetterGlobal):
+            (JSC::regExpProtoGetterIgnoreCase):
+            (JSC::regExpProtoGetterMultiline):
+            (JSC::regExpProtoGetterSticky):
+            (JSC::regExpProtoGetterUnicode):
+
 2016-03-21  Yusuke Suzuki  <[email protected]>
 
         [JSC] Clean up Math.floor thunk and use SSE round instruction

Modified: tags/Safari-602.1.25.0.1/Source/_javascript_Core/runtime/RegExpPrototype.cpp (198698 => 198699)


--- tags/Safari-602.1.25.0.1/Source/_javascript_Core/runtime/RegExpPrototype.cpp	2016-03-25 23:23:17 UTC (rev 198698)
+++ tags/Safari-602.1.25.0.1/Source/_javascript_Core/runtime/RegExpPrototype.cpp	2016-03-25 23:27:18 UTC (rev 198699)
@@ -241,7 +241,7 @@
 {
     JSValue thisValue = exec->thisValue();
     if (!thisValue.inherits(RegExpObject::info()))
-        return throwVMTypeError(exec);
+        return JSValue::encode(jsUndefined());
 
     return JSValue::encode(jsBoolean(asRegExpObject(thisValue)->regExp()->global()));
 }
@@ -250,7 +250,7 @@
 {
     JSValue thisValue = exec->thisValue();
     if (!thisValue.inherits(RegExpObject::info()))
-        return throwVMTypeError(exec);
+        return JSValue::encode(jsUndefined());
 
     return JSValue::encode(jsBoolean(asRegExpObject(thisValue)->regExp()->ignoreCase()));
 }
@@ -259,7 +259,7 @@
 {
     JSValue thisValue = exec->thisValue();
     if (!thisValue.inherits(RegExpObject::info()))
-        return throwVMTypeError(exec);
+        return JSValue::encode(jsUndefined());
 
     return JSValue::encode(jsBoolean(asRegExpObject(thisValue)->regExp()->multiline()));
 }
@@ -268,7 +268,7 @@
 {
     JSValue thisValue = exec->thisValue();
     if (!thisValue.inherits(RegExpObject::info()))
-        return throwVMTypeError(exec);
+        return JSValue::encode(jsUndefined());
     
     return JSValue::encode(jsBoolean(asRegExpObject(thisValue)->regExp()->sticky()));
 }
@@ -277,7 +277,7 @@
 {
     JSValue thisValue = exec->thisValue();
     if (!thisValue.inherits(RegExpObject::info()))
-        return throwVMTypeError(exec);
+        return JSValue::encode(jsUndefined());
     
     return JSValue::encode(jsBoolean(asRegExpObject(thisValue)->regExp()->unicode()));
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to