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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp

Issue 2295863002: Remove window.postMessage(message, transferables, targetOrigin) legacy overload (Closed)
Patch Set: leave milestoneString alone Created 4 years, 3 months 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
Index: third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp
index 1dc4d07e5b6b59d90009866ff1edb0f78280470a..2689e4738e6bf5d8698aeee1bd91ebb95689a6ff 100644
--- a/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp
@@ -150,14 +150,6 @@ void V8Window::openerAttributeSetterCustom(v8::Local<v8::Value> value, const v8:
}
}
-static bool isLegacyTargetOriginDesignation(v8::Local<v8::Value> value)
-{
- if (value->IsString() || value->IsStringObject())
- return true;
- return false;
-}
-
-
void V8Window::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage", "Window", info.Holder(), info.GetIsolate());
@@ -185,24 +177,21 @@ void V8Window::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value>
}
// 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);
+ // TODO(foolip): Type checking of the arguments should happen in order, so
+ // that e.g. postMessage({}, { toString: () => { throw Error(); } }, 0)
+ // throws the Error from toString, not the TypeError for argument 3.
Transferables transferables;
- int targetOriginArgIndex = 1;
+ const int targetOriginArgIndex = 1;
if (info.Length() > 2) {
- int transferablesArgIndex = 2;
- if (isLegacyTargetOriginDesignation(info[2])) {
- Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), window->document(), UseCounter::WindowPostMessageWithLegacyTargetOriginArgument);
- targetOriginArgIndex = 2;
- transferablesArgIndex = 1;
- }
+ const int transferablesArgIndex = 2;
if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info[transferablesArgIndex], transferablesArgIndex, transferables, exceptionState)) {
return;
}
}
+ // TODO(foolip): targetOrigin should be a USVString in IDL and treated as
+ // such here, without TreatNullAndUndefinedAsNullString.
TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, targetOrigin, info[targetOriginArgIndex]);
RefPtr<SerializedScriptValue> message = SerializedScriptValue::serialize(info.GetIsolate(), info[0], &transferables, nullptr, exceptionState);

Powered by Google App Engine
This is Rietveld 408576698