- Revision
- 229451
- Author
- [email protected]
- Date
- 2018-03-08 23:12:15 -0800 (Thu, 08 Mar 2018)
Log Message
Safari not handling undefined global variables with same name as element Id correctly.
https://bugs.webkit.org/show_bug.cgi?id=183087
<rdar://problem/37927596>
Reviewed by Ryosuke Niwa.
Source/_javascript_Core:
global variables (var foo;) should not be hidden by:
- Named properties
- Properties on the prototype chain
Therefore, we now have JSGlobalObject::addVar() call JSGlobalObject::addGlobalVar()
if !hasOwnProperty() instead of !hasProperty.
This aligns our behavior with Chrome and Firefox.
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::addVar):
LayoutTests:
* fast/dom/Window/es52-globals-expected.txt:
Rebaseline test now that we are passing more checks. This covers the code change.
* fast/forms/listbox-visible-size.html:
* js/dom/var-declarations-shadowing-expected.txt:
* js/dom/var-declarations-shadowing.html:
Tweak existing tests due to behavior change. I have checked that these tests
were failing in other browsers as well.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (229450 => 229451)
--- trunk/LayoutTests/ChangeLog 2018-03-09 07:00:37 UTC (rev 229450)
+++ trunk/LayoutTests/ChangeLog 2018-03-09 07:12:15 UTC (rev 229451)
@@ -1,5 +1,22 @@
2018-03-08 Chris Dumez <[email protected]>
+ Safari not handling undefined global variables with same name as element Id correctly.
+ https://bugs.webkit.org/show_bug.cgi?id=183087
+ <rdar://problem/37927596>
+
+ Reviewed by Ryosuke Niwa.
+
+ * fast/dom/Window/es52-globals-expected.txt:
+ Rebaseline test now that we are passing more checks. This covers the code change.
+
+ * fast/forms/listbox-visible-size.html:
+ * js/dom/var-declarations-shadowing-expected.txt:
+ * js/dom/var-declarations-shadowing.html:
+ Tweak existing tests due to behavior change. I have checked that these tests
+ were failing in other browsers as well.
+
+2018-03-08 Chris Dumez <[email protected]>
+
fast/events/before-unload-returnValue.html times out with async policy delegates
https://bugs.webkit.org/show_bug.cgi?id=183472
Modified: trunk/LayoutTests/fast/dom/Window/es52-globals-expected.txt (229450 => 229451)
--- trunk/LayoutTests/fast/dom/Window/es52-globals-expected.txt 2018-03-09 07:00:37 UTC (rev 229450)
+++ trunk/LayoutTests/fast/dom/Window/es52-globals-expected.txt 2018-03-09 07:12:15 UTC (rev 229451)
@@ -8,9 +8,9 @@
PASS window.hasOwnProperty("a") is false
PASS Element is not undefined
PASS x is 1
-FAIL y should be undefined. Was 2
-FAIL f should be undefined. Was [object Window]
-FAIL div should be undefined. Was [object HTMLDivElement]
+PASS y is undefined.
+PASS f is undefined.
+PASS div is undefined.
PASS a is undefined.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/fast/forms/listbox-visible-size.html (229450 => 229451)
--- trunk/LayoutTests/fast/forms/listbox-visible-size.html 2018-03-09 07:00:37 UTC (rev 229450)
+++ trunk/LayoutTests/fast/forms/listbox-visible-size.html 2018-03-09 07:12:15 UTC (rev 229451)
@@ -22,10 +22,9 @@
</select>
<script>
var targetTop = 28;
- var select;
+ var select = document.getElementById('select');
function scrollSelect(newTop)
{
- var select = document.getElementById('select');
select.scrollTop = newTop;
}
Modified: trunk/LayoutTests/js/dom/var-declarations-shadowing-expected.txt (229450 => 229451)
--- trunk/LayoutTests/js/dom/var-declarations-shadowing-expected.txt 2018-03-09 07:00:37 UTC (rev 229450)
+++ trunk/LayoutTests/js/dom/var-declarations-shadowing-expected.txt 2018-03-09 07:12:15 UTC (rev 229451)
@@ -6,8 +6,8 @@
PASS: eval('Node == undefined') should be false and is.
PASS: Element == undefined should be false and is.
PASS: eval('Element == undefined') should be false and is.
-PASS: toString == undefined should be false and is.
-PASS: eval('toString == undefined') should be false and is.
+PASS: toString != undefined should be false and is.
+PASS: eval('toString != undefined') should be false and is.
PASS: valueOf == undefined should be false and is.
PASS: eval('valueOf == undefined') should be false and is.
-----
Modified: trunk/LayoutTests/js/dom/var-declarations-shadowing.html (229450 => 229451)
--- trunk/LayoutTests/js/dom/var-declarations-shadowing.html 2018-03-09 07:00:37 UTC (rev 229450)
+++ trunk/LayoutTests/js/dom/var-declarations-shadowing.html 2018-03-09 07:12:15 UTC (rev 229451)
@@ -41,8 +41,8 @@
shouldBe(Element == undefined, "Element == undefined", false);
shouldBe(eval('Element == undefined'), "eval('Element == undefined')", false);
-shouldBe(toString == undefined, "toString == undefined", false);
-shouldBe(eval('toString == undefined'), "eval('toString == undefined')", false);
+shouldBe(toString != undefined, "toString != undefined", false);
+shouldBe(eval('toString != undefined'), "eval('toString != undefined')", false);
shouldBe(valueOf == undefined, "valueOf == undefined", false);
shouldBe(eval('valueOf == undefined'), "eval('valueOf == undefined')", false);
Modified: trunk/Source/_javascript_Core/ChangeLog (229450 => 229451)
--- trunk/Source/_javascript_Core/ChangeLog 2018-03-09 07:00:37 UTC (rev 229450)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-03-09 07:12:15 UTC (rev 229451)
@@ -1,3 +1,23 @@
+2018-03-08 Chris Dumez <[email protected]>
+
+ Safari not handling undefined global variables with same name as element Id correctly.
+ https://bugs.webkit.org/show_bug.cgi?id=183087
+ <rdar://problem/37927596>
+
+ Reviewed by Ryosuke Niwa.
+
+ global variables (var foo;) should not be hidden by:
+ - Named properties
+ - Properties on the prototype chain
+
+ Therefore, we now have JSGlobalObject::addVar() call JSGlobalObject::addGlobalVar()
+ if !hasOwnProperty() instead of !hasProperty.
+
+ This aligns our behavior with Chrome and Firefox.
+
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::addVar):
+
2018-03-08 Commit Queue <[email protected]>
Unreviewed, rolling out r229354 and r229364.
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (229450 => 229451)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2018-03-09 07:00:37 UTC (rev 229450)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2018-03-09 07:12:15 UTC (rev 229451)
@@ -511,7 +511,7 @@
void addVar(ExecState* exec, const Identifier& propertyName)
{
- if (!hasProperty(exec, propertyName))
+ if (!hasOwnProperty(exec, propertyName))
addGlobalVar(propertyName);
}
void addFunction(ExecState*, const Identifier&);