Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

Issue 8883032: Merge 102317 - https://bugs.webkit.org/show_bug.cgi?id=74038 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
===================================================================
--- Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp (revision 102380)
+++ Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp (working copy)
@@ -286,6 +286,14 @@
return v8::Undefined();
}
+static bool isLegacyTargetOriginDesignation(v8::Handle<v8::Value> value)
+{
+ if (value->IsString() || value->IsStringObject())
+ return true;
+ return false;
+}
+
+
static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args, bool extendedTransfer)
{
DOMWindow* window = V8DOMWindow::toNative(args.Holder());
@@ -293,20 +301,28 @@
DOMWindow* source = V8Proxy::retrieveFrameForCallingContext()->domWindow();
ASSERT(source->frame());
- // This function has variable arguments and can either be:
- // postMessage(message, port, targetOrigin);
- // or
- // postMessage(message, targetOrigin);
+ // This function has variable arguments and can be:
+ // Per current spec:
+ // postMessage(message, targetOrigin)
+ // postMessage(message, targetOrigin, {sequence of transferrables})
+ // Legacy non-standard implementations in webkit allowed:
+ // postMessage(message, {sequence of transferrables}, targetOrigin);
MessagePortArray portArray;
ArrayBufferArray arrayBufferArray;
String targetOrigin;
{
v8::TryCatch tryCatch;
+ int targetOriginArgIndex = 1;
if (args.Length() > 2) {
- if (!extractTransferables(args[2], portArray, arrayBufferArray))
+ int transferablesArgIndex = 2;
+ if (isLegacyTargetOriginDesignation(args[2])) {
+ targetOriginArgIndex = 2;
+ transferablesArgIndex = 1;
+ }
+ if (!extractTransferables(args[transferablesArgIndex], portArray, arrayBufferArray))
return v8::Undefined();
}
- targetOrigin = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
+ targetOrigin = toWebCoreStringWithNullOrUndefinedCheck(args[targetOriginArgIndex]);
if (tryCatch.HasCaught())
return v8::Undefined();
« no previous file with comments | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698