Title: [118445] trunk
Revision
118445
Author
[email protected]
Date
2012-05-24 16:55:55 -0700 (Thu, 24 May 2012)

Log Message

postMessage and webkitPostMessage should behave the same way
https://bugs.webkit.org/show_bug.cgi?id=87384

Patch by Christophe Dumez <[email protected]> on 2012-05-24
Reviewed by Adam Barth.

Source/WebCore:

Make postMessage behave the same way as webkitPostMessage, meaning
that it supports transfer of MessagePorts and ArrayBuffers as per
the spec. Both V8 and JSC implementations have been updated.

Test: fast/dom/Window/window-postmessage-args.html

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::handlePostMessage):
(WebCore::JSDOMWindow::postMessage):
(WebCore::JSDOMWindow::webkitPostMessage):
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::handlePostMessageCallback):
(WebCore::V8DOMWindow::postMessageCallback):
(WebCore::V8DOMWindow::webkitPostMessageCallback):
* bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp:
(WebCore::handlePostMessageCallback):
(WebCore::V8DedicatedWorkerContext::postMessageCallback):
(WebCore::V8DedicatedWorkerContext::webkitPostMessageCallback):
* bindings/v8/custom/V8MessagePortCustom.cpp:
(WebCore::handlePostMessageCallback):
(WebCore::V8MessagePort::postMessageCallback):
(WebCore::V8MessagePort::webkitPostMessageCallback):
* bindings/v8/custom/V8WorkerCustom.cpp:
(WebCore::handlePostMessageCallback):
(WebCore::V8Worker::postMessageCallback):
(WebCore::V8Worker::webkitPostMessageCallback):

LayoutTests:

Update global test expectation for
fast/dom/Window/window-postmessage-args.html now that JSC's
postMessage implementation supports transfer of MessagePorts.

* fast/dom/Window/window-postmessage-args-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (118444 => 118445)


--- trunk/LayoutTests/ChangeLog	2012-05-24 23:51:21 UTC (rev 118444)
+++ trunk/LayoutTests/ChangeLog	2012-05-24 23:55:55 UTC (rev 118445)
@@ -1,3 +1,16 @@
+2012-05-24  Christophe Dumez  <[email protected]>
+
+        postMessage and webkitPostMessage should behave the same way
+        https://bugs.webkit.org/show_bug.cgi?id=87384
+
+        Reviewed by Adam Barth.
+
+        Update global test expectation for
+        fast/dom/Window/window-postmessage-args.html now that JSC's
+        postMessage implementation supports transfer of MessagePorts.
+
+        * fast/dom/Window/window-postmessage-args-expected.txt:
+
 2012-05-24  Pablo Flouret  <[email protected]>
 
         Submit button doesn't submit the form if the form is wrapped by an anchor tag

Modified: trunk/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt (118444 => 118445)


--- trunk/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt	2012-05-24 23:51:21 UTC (rev 118444)
+++ trunk/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt	2012-05-24 23:55:55 UTC (rev 118445)
@@ -39,8 +39,8 @@
 Received message '7' with 2 ports.
 Received message '2147483648' with 0 ports.
 Received message '2147483648' with 0 ports.
-Received message '[object Object]' with 2 ports.
 Received message '[object MessagePort]' with 2 ports.
+Received message '[object MessagePort]' with 2 ports.
 Received message '[object MessagePort],[object MessagePort]' with 2 ports.
 Received message '[object ArrayBuffer]' with 0 ports.
 Received message 'done' with 0 ports.

Modified: trunk/Source/WebCore/ChangeLog (118444 => 118445)


--- trunk/Source/WebCore/ChangeLog	2012-05-24 23:51:21 UTC (rev 118444)
+++ trunk/Source/WebCore/ChangeLog	2012-05-24 23:55:55 UTC (rev 118445)
@@ -1,3 +1,37 @@
+2012-05-24  Christophe Dumez  <[email protected]>
+
+        postMessage and webkitPostMessage should behave the same way
+        https://bugs.webkit.org/show_bug.cgi?id=87384
+
+        Reviewed by Adam Barth.
+
+        Make postMessage behave the same way as webkitPostMessage, meaning
+        that it supports transfer of MessagePorts and ArrayBuffers as per
+        the spec. Both V8 and JSC implementations have been updated.
+
+        Test: fast/dom/Window/window-postmessage-args.html
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::handlePostMessage):
+        (WebCore::JSDOMWindow::postMessage):
+        (WebCore::JSDOMWindow::webkitPostMessage):
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::handlePostMessageCallback):
+        (WebCore::V8DOMWindow::postMessageCallback):
+        (WebCore::V8DOMWindow::webkitPostMessageCallback):
+        * bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp:
+        (WebCore::handlePostMessageCallback):
+        (WebCore::V8DedicatedWorkerContext::postMessageCallback):
+        (WebCore::V8DedicatedWorkerContext::webkitPostMessageCallback):
+        * bindings/v8/custom/V8MessagePortCustom.cpp:
+        (WebCore::handlePostMessageCallback):
+        (WebCore::V8MessagePort::postMessageCallback):
+        (WebCore::V8MessagePort::webkitPostMessageCallback):
+        * bindings/v8/custom/V8WorkerCustom.cpp:
+        (WebCore::handlePostMessageCallback):
+        (WebCore::V8Worker::postMessageCallback):
+        (WebCore::V8Worker::webkitPostMessageCallback):
+
 2012-05-24  Pablo Flouret  <[email protected]>
 
         Submit button doesn't submit the form if the form is wrapped by an anchor tag

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (118444 => 118445)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2012-05-24 23:51:21 UTC (rev 118444)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2012-05-24 23:55:55 UTC (rev 118445)
@@ -542,7 +542,7 @@
     return handler.returnValue();
 }
 
-static JSValue handlePostMessage(DOMWindow* impl, ExecState* exec, bool doTransfer)
+static JSValue handlePostMessage(DOMWindow* impl, ExecState* exec)
 {
     MessagePortArray messagePorts;
     ArrayBufferArray arrayBuffers;
@@ -566,8 +566,8 @@
         return jsUndefined();
 
     RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(exec, exec->argument(0),
-                                                                         doTransfer ? &messagePorts : 0,
-                                                                         doTransfer ? &arrayBuffers : 0);
+                                                                         &messagePorts,
+                                                                         &arrayBuffers);
 
     if (exec->hadException())
         return jsUndefined();
@@ -585,12 +585,12 @@
 
 JSValue JSDOMWindow::postMessage(ExecState* exec)
 {
-    return handlePostMessage(impl(), exec, false);
+    return handlePostMessage(impl(), exec);
 }
 
 JSValue JSDOMWindow::webkitPostMessage(ExecState* exec)
 {
-    return handlePostMessage(impl(), exec, true);
+    return handlePostMessage(impl(), exec);
 }
 
 JSValue JSDOMWindow::setTimeout(ExecState* exec)

Modified: trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp (118444 => 118445)


--- trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp	2012-05-24 23:51:21 UTC (rev 118444)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp	2012-05-24 23:55:55 UTC (rev 118445)
@@ -297,7 +297,7 @@
 }
 
 
-static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args, bool extendedTransfer)
+static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args)
 {
     // None of these need to be RefPtr because args and context are guaranteed
     // to hold on to them.
@@ -336,7 +336,7 @@
     RefPtr<SerializedScriptValue> message =
         SerializedScriptValue::create(args[0],
                                       &portArray,
-                                      extendedTransfer ? &arrayBufferArray : 0,
+                                      &arrayBufferArray,
                                       didThrow,
                                       args.GetIsolate());
     if (didThrow)
@@ -350,13 +350,13 @@
 v8::Handle<v8::Value> V8DOMWindow::postMessageCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.DOMWindow.postMessage()");
-    return handlePostMessageCallback(args, false);
+    return handlePostMessageCallback(args);
 }
 
 v8::Handle<v8::Value> V8DOMWindow::webkitPostMessageCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.DOMWindow.webkitPostMessage()");
-    return handlePostMessageCallback(args, true);
+    return handlePostMessageCallback(args);
 }
 
 // FIXME(fqian): returning string is cheating, and we should

Modified: trunk/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp (118444 => 118445)


--- trunk/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp	2012-05-24 23:51:21 UTC (rev 118444)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp	2012-05-24 23:55:55 UTC (rev 118445)
@@ -43,7 +43,7 @@
 
 namespace WebCore {
 
-static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args, bool extendedTransfer)
+static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args)
 {
     DedicatedWorkerContext* workerContext = V8DedicatedWorkerContext::toNative(args.Holder());
     MessagePortArray ports;
@@ -56,7 +56,7 @@
     RefPtr<SerializedScriptValue> message =
         SerializedScriptValue::create(args[0],
                                       &ports,
-                                      extendedTransfer ? &arrayBuffers : 0,
+                                      &arrayBuffers,
                                       didThrow,
                                       args.GetIsolate());
     if (didThrow)
@@ -69,13 +69,13 @@
 v8::Handle<v8::Value> V8DedicatedWorkerContext::postMessageCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.DedicatedWorkerContext.postMessage");
-    return handlePostMessageCallback(args, false);
+    return handlePostMessageCallback(args);
 }
 
 v8::Handle<v8::Value> V8DedicatedWorkerContext::webkitPostMessageCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.DedicatedWorkerContext.postMessage");
-    return handlePostMessageCallback(args, true);
+    return handlePostMessageCallback(args);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp (118444 => 118445)


--- trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp	2012-05-24 23:51:21 UTC (rev 118444)
+++ trunk/Source/WebCore/bindings/v8/custom/V8MessagePortCustom.cpp	2012-05-24 23:55:55 UTC (rev 118445)
@@ -42,7 +42,7 @@
 
 namespace WebCore {
 
-static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args, bool extendedTransfer)
+static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args)
 {
     MessagePort* messagePort = V8MessagePort::toNative(args.Holder());
     MessagePortArray portArray;
@@ -55,7 +55,7 @@
     RefPtr<SerializedScriptValue> message =
         SerializedScriptValue::create(args[0],
                                       &portArray,
-                                      extendedTransfer ? &arrayBufferArray : 0,
+                                      &arrayBufferArray,
                                       didThrow,
                                       args.GetIsolate());
     if (didThrow)
@@ -68,13 +68,13 @@
 v8::Handle<v8::Value> V8MessagePort::postMessageCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.MessagePort.postMessage");
-    return handlePostMessageCallback(args, false);
+    return handlePostMessageCallback(args);
 }
 
 v8::Handle<v8::Value> V8MessagePort::webkitPostMessageCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.MessagePort.webkitPostMessage");
-    return handlePostMessageCallback(args, true);
+    return handlePostMessageCallback(args);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp (118444 => 118445)


--- trunk/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp	2012-05-24 23:51:21 UTC (rev 118444)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WorkerCustom.cpp	2012-05-24 23:55:55 UTC (rev 118445)
@@ -47,7 +47,7 @@
 
 namespace WebCore {
 
-static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args, bool extendedTransfer)
+static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.Worker.postMessage");
     Worker* worker = V8Worker::toNative(args.Holder());
@@ -61,7 +61,7 @@
     RefPtr<SerializedScriptValue> message =
         SerializedScriptValue::create(args[0],
                                       &ports,
-                                      extendedTransfer ? &arrayBuffers : 0,
+                                      &arrayBuffers,
                                       didThrow,
                                       args.GetIsolate());
     if (didThrow)
@@ -74,13 +74,13 @@
 v8::Handle<v8::Value> V8Worker::postMessageCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.Worker.postMessage");
-    return handlePostMessageCallback(args, false);
+    return handlePostMessageCallback(args);
 }
 
 v8::Handle<v8::Value> V8Worker::webkitPostMessageCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.Worker.webkitPostMessage");
-    return handlePostMessageCallback(args, true);
+    return handlePostMessageCallback(args);
 }
 
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to