Diff
Modified: trunk/LayoutTests/ChangeLog (121375 => 121376)
--- trunk/LayoutTests/ChangeLog 2012-06-27 21:50:49 UTC (rev 121375)
+++ trunk/LayoutTests/ChangeLog 2012-06-27 22:00:55 UTC (rev 121376)
@@ -1,3 +1,23 @@
+2012-06-27 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.
+
+ This is the second (third?) try. Last time there was a bug in the V8 code related to the split window.
+ I added a test that tests the failure that caused this to be rolled back last time.
+
+ * fast/dom/Window/es52-globals-expected.txt: Added.
+ * fast/dom/Window/es52-globals.html: Added.
+ * fast/dom/Window/window-property-shadowing-onclick-expected.txt: Added.
+ * fast/dom/Window/window-property-shadowing-onclick.html: Added.
+ * platform/chromium/fast/dom/Window/es52-globals-expected.txt: Added.
+ * platform/chromium/fast/dom/Window/window-property-shadowing-name-expected.txt: Added.
+ * platform/chromium/fast/dom/Window/window-property-shadowing-onclick-expected.txt: Added.
+
2012-06-27 W. James MacLean <[email protected]>
[chromium] ScrollbarLayerChromium should support painting forward-track and back-track in different styles.
Added: trunk/LayoutTests/fast/dom/Window/es52-globals-expected.txt (0 => 121376)
--- trunk/LayoutTests/fast/dom/Window/es52-globals-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/es52-globals-expected.txt 2012-06-27 22:00:55 UTC (rev 121376)
@@ -0,0 +1,16 @@
+PASS window.hasOwnProperty("Element") is true
+PASS window.hasOwnProperty("x") is true
+FAIL window.hasOwnProperty("y") should be false. Was true.
+PASS window.hasOwnProperty("f") is true
+PASS window.hasOwnProperty("div") is true
+FAIL window.hasOwnProperty("a") should be true. Was 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 a is undefined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/Window/es52-globals.html (0 => 121376)
--- trunk/LayoutTests/fast/dom/Window/es52-globals.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/es52-globals.html 2012-06-27 22:00:55 UTC (rev 121376)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<script src=""
+<div id="div"></div>
+<iframe name="f"></iframe>
+<a href="" name="a"></a>
+<script>
+
+window.x = 1;
+Object.getPrototypeOf(window).y = 2;
+
+</script>
+<script>
+
+shouldBeTrue('window.hasOwnProperty("Element")');
+shouldBeTrue('window.hasOwnProperty("x")');
+shouldBeFalse('window.hasOwnProperty("y")');
+shouldBeTrue('window.hasOwnProperty("f")');
+shouldBeTrue('window.hasOwnProperty("div")');
+shouldBeTrue('window.hasOwnProperty("a")');
+
+</script>
+<script>
+
+var Element;
+shouldNotBe('Element', 'undefined');
+
+var x;
+shouldBe('x', '1');
+
+var y;
+shouldBeUndefined('y');
+
+var f;
+shouldBeUndefined('f');
+
+var div;
+shouldBeUndefined('div');
+
+var a;
+shouldBeUndefined('a');
+
+</script>
+<script src=""
\ No newline at end of file
Added: trunk/LayoutTests/fast/dom/Window/window-property-shadowing-onclick-expected.txt (0 => 121376)
--- 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-27 22:00:55 UTC (rev 121376)
@@ -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 => 121376)
--- trunk/LayoutTests/fast/dom/Window/window-property-shadowing-onclick.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/window-property-shadowing-onclick.html 2012-06-27 22:00:55 UTC (rev 121376)
@@ -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=""
Added: trunk/LayoutTests/platform/chromium/fast/dom/Window/es52-globals-expected.txt (0 => 121376)
--- trunk/LayoutTests/platform/chromium/fast/dom/Window/es52-globals-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/dom/Window/es52-globals-expected.txt 2012-06-27 22:00:55 UTC (rev 121376)
@@ -0,0 +1,16 @@
+PASS window.hasOwnProperty("Element") is true
+PASS window.hasOwnProperty("x") is true
+PASS window.hasOwnProperty("y") is false
+FAIL window.hasOwnProperty("f") should be true. Was false.
+FAIL window.hasOwnProperty("div") should be true. Was false.
+FAIL window.hasOwnProperty("a") should be true. Was false.
+PASS Element is not undefined
+PASS x is 1
+PASS y is undefined.
+PASS f is undefined.
+PASS div is undefined.
+PASS a is undefined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/chromium/fast/dom/Window/window-property-shadowing-name-expected.txt (0 => 121376)
--- 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-27 22:00:55 UTC (rev 121376)
@@ -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 => 121376)
--- 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-27 22:00:55 UTC (rev 121376)
@@ -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 (121375 => 121376)
--- trunk/Source/WebCore/ChangeLog 2012-06-27 21:50:49 UTC (rev 121375)
+++ trunk/Source/WebCore/ChangeLog 2012-06-27 22:00:55 UTC (rev 121376)
@@ -1,3 +1,23 @@
+2012-06-27 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.
+
+ This is the second (third?) try. Last time there was a bug in the V8 code related to the split window.
+ I added a test that tests the failure that caused this to be rolled back last time.
+
+ Tests: fast/dom/Window/es52-globals.html
+ fast/dom/Window/window-property-shadowing-onclick.html
+
+ * bindings/v8/V8DOMWindowShell.cpp:
+ (WebCore::V8DOMWindowShell::initContextIfNeeded):
+ * bindings/v8/WorkerContextExecutionProxy.cpp:
+ (WebCore::WorkerContextExecutionProxy::initIsolate):
+
2012-06-27 James Robinson <[email protected]>
[chromium] Use categorized TRACE_EVENTN() macros in compositor code
Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (121375 => 121376)
--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2012-06-27 21:50:49 UTC (rev 121375)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2012-06-27 22:00:55 UTC (rev 121376)
@@ -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 (121375 => 121376)
--- trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp 2012-06-27 21:50:49 UTC (rev 121375)
+++ trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp 2012-06-27 22:00:55 UTC (rev 121376)
@@ -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*));