Title: [119514] trunk
Revision
119514
Author
[email protected]
Date
2012-06-05 12:22:46 -0700 (Tue, 05 Jun 2012)

Log Message

[V8] Improve variable resolution order on window
https://bugs.webkit.org/show_bug.cgi?id=84247

Reviewed by Ojan Vafai.

This changes the V8 flag to turn on es52_globals and updates the layout tests to reflect the fixed behavior.

Source/WebCore:

Test: fast/dom/Window/window-property-shadowing-onclick.html

* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::initContextIfNeeded): Set the flag as we initialize V8.
* bindings/v8/WorkerContextExecutionProxy.cpp:
(WebCore::WorkerContextExecutionProxy::initIsolate): Ditto.

LayoutTests:

* fast/dom/Window/window-property-shadowing-name-expected.txt: The expectation is now reversed.
* fast/dom/Window/window-property-shadowing-name.html: JSC fails so this test says fail. Bug 75575 tracks JSC.
* fast/dom/Window/window-property-shadowing-onclick-expected.txt: Added.
* fast/dom/Window/window-property-shadowing-onclick.html: Added.
* platform/chromium/fast/dom/Window/window-property-shadowing-name-expected.txt: Copied from LayoutTests/fast/dom/Window/window-property-shadowing-name-expected.txt.
* platform/chromium/fast/dom/Window/window-property-shadowing-onclick-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (119513 => 119514)


--- trunk/LayoutTests/ChangeLog	2012-06-05 19:16:55 UTC (rev 119513)
+++ trunk/LayoutTests/ChangeLog	2012-06-05 19:22:46 UTC (rev 119514)
@@ -1,3 +1,19 @@
+2012-06-05  Erik Arvidsson  <[email protected]>
+
+        [V8] Improve variable resolution order on window
+        https://bugs.webkit.org/show_bug.cgi?id=84247
+
+        Reviewed by Ojan Vafai.
+
+        This changes the V8 flag to turn on es52_globals and updates the layout tests to reflect the fixed behavior.
+
+        * fast/dom/Window/window-property-shadowing-name-expected.txt: The expectation is now reversed.
+        * fast/dom/Window/window-property-shadowing-name.html: JSC fails so this test says fail. Bug 75575 tracks JSC.
+        * fast/dom/Window/window-property-shadowing-onclick-expected.txt: Added.
+        * fast/dom/Window/window-property-shadowing-onclick.html: Added.
+        * platform/chromium/fast/dom/Window/window-property-shadowing-name-expected.txt: Copied from LayoutTests/fast/dom/Window/window-property-shadowing-name-expected.txt.
+        * platform/chromium/fast/dom/Window/window-property-shadowing-onclick-expected.txt: Added.
+
 2012-06-05  Emil A Eklund  <[email protected]>
 
         Change fast/sub-pixel/float-containing-block-with-margin.html to pixel test

Modified: trunk/LayoutTests/fast/dom/Window/window-property-shadowing-name-expected.txt (119513 => 119514)


--- trunk/LayoutTests/fast/dom/Window/window-property-shadowing-name-expected.txt	2012-06-05 19:16:55 UTC (rev 119513)
+++ trunk/LayoutTests/fast/dom/Window/window-property-shadowing-name-expected.txt	2012-06-05 19:22:46 UTC (rev 119514)
@@ -1,3 +1,3 @@
 This page tests whether declaring a variable named "name" changes the window's name in the DOM. If the test passes, you'll see a PASS message below.
 
-PASS
+FAIL

Modified: trunk/LayoutTests/fast/dom/Window/window-property-shadowing-name.html (119513 => 119514)


--- trunk/LayoutTests/fast/dom/Window/window-property-shadowing-name.html	2012-06-05 19:16:55 UTC (rev 119513)
+++ trunk/LayoutTests/fast/dom/Window/window-property-shadowing-name.html	2012-06-05 19:22:46 UTC (rev 119514)
@@ -7,6 +7,9 @@
 
 <script>
 
+// ECMAScript 5.2 fixes this behavior to better match Internet Explorer and Firefox.
+// https://bugs.ecmascript.org/show_bug.cgi?id=78
+
 function log(result)
 {
     document.querySelector("pre").textContent = result;
@@ -19,8 +22,8 @@
 var name = "test";
 var w = window.open("_javascript_:void 0", "test");
 if (w === window)
+    log("FAIL");
+else
     log("PASS");
-else
-    log("FAIL");
 
 </script>

Added: trunk/LayoutTests/fast/dom/Window/window-property-shadowing-onclick-expected.txt (0 => 119514)


--- trunk/LayoutTests/fast/dom/Window/window-property-shadowing-onclick-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/window-property-shadowing-onclick-expected.txt	2012-06-05 19:22:46 UTC (rev 119514)
@@ -0,0 +1,7 @@
+This tests the ES5.2 behavior where global variables should not trigger setters on the Window object
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL onClickCalled should be false. Was true.
+

Added: trunk/LayoutTests/fast/dom/Window/window-property-shadowing-onclick.html (0 => 119514)


--- trunk/LayoutTests/fast/dom/Window/window-property-shadowing-onclick.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/window-property-shadowing-onclick.html	2012-06-05 19:22:46 UTC (rev 119514)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<script src=""
+<script>
+
+description('This tests the ES5.2 behavior where global variables should not trigger setters on the Window object');
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+var _onClickCalled_ = false;
+
+var _onclick_ = function(e) {
+    _onClickCalled_ = true;
+};
+
+var e = document.createEvent('MouseEvents');
+e.initMouseEvent('click', true, true, window,
+                 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+document.dispatchEvent(e);
+
+shouldBeFalse('onClickCalled');
+
+</script>
+<script src=""

Copied: trunk/LayoutTests/platform/chromium/fast/dom/Window/window-property-shadowing-name-expected.txt (from rev 119513, trunk/LayoutTests/fast/dom/Window/window-property-shadowing-name-expected.txt) (0 => 119514)


--- trunk/LayoutTests/platform/chromium/fast/dom/Window/window-property-shadowing-name-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/dom/Window/window-property-shadowing-name-expected.txt	2012-06-05 19:22:46 UTC (rev 119514)
@@ -0,0 +1,3 @@
+This page tests whether declaring a variable named "name" changes the window's name in the DOM. If the test passes, you'll see a PASS message below.
+
+PASS

Added: trunk/LayoutTests/platform/chromium/fast/dom/Window/window-property-shadowing-onclick-expected.txt (0 => 119514)


--- trunk/LayoutTests/platform/chromium/fast/dom/Window/window-property-shadowing-onclick-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/dom/Window/window-property-shadowing-onclick-expected.txt	2012-06-05 19:22:46 UTC (rev 119514)
@@ -0,0 +1,7 @@
+This tests the ES5.2 behavior where global variables should not trigger setters on the Window object
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS onClickCalled is false
+

Modified: trunk/Source/WebCore/ChangeLog (119513 => 119514)


--- trunk/Source/WebCore/ChangeLog	2012-06-05 19:16:55 UTC (rev 119513)
+++ trunk/Source/WebCore/ChangeLog	2012-06-05 19:22:46 UTC (rev 119514)
@@ -1,3 +1,19 @@
+2012-06-05  Erik Arvidsson  <[email protected]>
+
+        [V8] Improve variable resolution order on window
+        https://bugs.webkit.org/show_bug.cgi?id=84247
+
+        Reviewed by Ojan Vafai.
+
+        This changes the V8 flag to turn on es52_globals and updates the layout tests to reflect the fixed behavior.
+
+        Test: fast/dom/Window/window-property-shadowing-onclick.html
+
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::V8DOMWindowShell::initContextIfNeeded): Set the flag as we initialize V8.
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        (WebCore::WorkerContextExecutionProxy::initIsolate): Ditto.
+
 2012-06-05  Ojan Vafai  <[email protected]>
 
         Delete dead code from RenderBox::computeLogicalWidthInRegion

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (119513 => 119514)


--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2012-06-05 19:16:55 UTC (rev 119513)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2012-06-05 19:22:46 UTC (rev 119514)
@@ -300,6 +300,10 @@
 #endif
         V8BindingPerIsolateData::ensureInitialized(v8::Isolate::GetCurrent());
 
+        // FIXME: Remove the following 2 lines when V8 default has changed.
+        const char es52GlobalsFlag[] = "--es52_globals";
+        v8::V8::SetFlagsFromString(es52GlobalsFlag, sizeof(es52GlobalsFlag));
+
         isV8Initialized = true;
     }
 

Modified: trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp (119513 => 119514)


--- trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp	2012-06-05 19:16:55 UTC (rev 119513)
+++ trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp	2012-06-05 19:22:46 UTC (rev 119514)
@@ -122,6 +122,10 @@
     v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue);
     v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue);
 
+    // FIXME: Remove the following 2 lines when V8 default has changed.
+    const char es52GlobalsFlag[] = "--es52_globals";
+    v8::V8::SetFlagsFromString(es52GlobalsFlag, sizeof(es52GlobalsFlag));
+
     v8::ResourceConstraints resource_constraints;
     uint32_t here;
     resource_constraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uint32_t*));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to