Title: [120783] trunk
- Revision
- 120783
- Author
- [email protected]
- Date
- 2012-06-19 18:04:00 -0700 (Tue, 19 Jun 2012)
Log Message
[V8] Fix issue where a callback got a null calling context
https://bugs.webkit.org/show_bug.cgi?id=89532
Reviewed by Kentaro Hara.
Source/WebCore:
Test: fast/dom/Window/post-message-crash.html
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::handlePostMessageCallback): Check the calling context and throw a type error (like JSC) if it is null.
LayoutTests:
* fast/dom/Window/post-message-crash-expected.txt: Added.
* fast/dom/Window/post-message-crash.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (120782 => 120783)
--- trunk/LayoutTests/ChangeLog 2012-06-20 00:54:16 UTC (rev 120782)
+++ trunk/LayoutTests/ChangeLog 2012-06-20 01:04:00 UTC (rev 120783)
@@ -1,3 +1,13 @@
+2012-06-19 Erik Arvidsson <[email protected]>
+
+ [V8] Fix issue where a callback got a null calling context
+ https://bugs.webkit.org/show_bug.cgi?id=89532
+
+ Reviewed by Kentaro Hara.
+
+ * fast/dom/Window/post-message-crash-expected.txt: Added.
+ * fast/dom/Window/post-message-crash.html: Added.
+
2012-06-19 Kenneth Russell <[email protected]>
[Chromium] Unreviewed test expectations update.
Added: trunk/LayoutTests/fast/dom/Window/post-message-crash-expected.txt (0 => 120783)
--- trunk/LayoutTests/fast/dom/Window/post-message-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/post-message-crash-expected.txt 2012-06-20 01:04:00 UTC (rev 120783)
@@ -0,0 +1,3 @@
+This ensures that postMessage called in a callback does not crash.
+
+PASS
Added: trunk/LayoutTests/fast/dom/Window/post-message-crash.html (0 => 120783)
--- trunk/LayoutTests/fast/dom/Window/post-message-crash.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/post-message-crash.html 2012-06-20 01:04:00 UTC (rev 120783)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<body>
+
+<p>This ensures that postMessage called in a callback does not crash.
+
+<pre>FAIL</pre>
+
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+var n = 0;
+
+window._onerror_ = function() {
+ if (++n === 2) {
+ document.querySelector('pre').textContent = 'PASS';
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ return true;
+};
+
+webkitRequestAnimationFrame(webkitPostMessage);
+setTimeout(webkitPostMessage);
+
+if (window.testRunner)
+ testRunner.display();
+
+setTimeout(function() {
+ if (window.testRunner)
+ testRunner.notifyDone();
+}, 50);
+
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (120782 => 120783)
--- trunk/Source/WebCore/ChangeLog 2012-06-20 00:54:16 UTC (rev 120782)
+++ trunk/Source/WebCore/ChangeLog 2012-06-20 01:04:00 UTC (rev 120783)
@@ -1,3 +1,15 @@
+2012-06-19 Erik Arvidsson <[email protected]>
+
+ [V8] Fix issue where a callback got a null calling context
+ https://bugs.webkit.org/show_bug.cgi?id=89532
+
+ Reviewed by Kentaro Hara.
+
+ Test: fast/dom/Window/post-message-crash.html
+
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ (WebCore::handlePostMessageCallback): Check the calling context and throw a type error (like JSC) if it is null.
+
2012-06-19 Tony Chang <[email protected]>
Refactor RenderFlexibleBox terminology to use grow/shrink instead of positive/negative
Modified: trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp (120782 => 120783)
--- trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp 2012-06-20 00:54:16 UTC (rev 120782)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp 2012-06-20 01:04:00 UTC (rev 120783)
@@ -304,6 +304,10 @@
DOMWindow* window = V8DOMWindow::toNative(args.Holder());
DOMWindow* source = V8Proxy::retrieveWindowForCallingContext();
+ // If called directly by WebCore we don't have a calling context.
+ if (!source)
+ return V8Proxy::throwTypeError(0, args.GetIsolate());
+
// This function has variable arguments and can be:
// Per current spec:
// postMessage(message, targetOrigin)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes