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

Unified Diff: Source/bindings/v8/custom/V8MessageEventCustom.cpp

Issue 19457002: Make 'any'-typed attributes of events available in isolated worlds (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Respond to review Created 7 years, 5 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: Source/bindings/v8/custom/V8MessageEventCustom.cpp
diff --git a/Source/bindings/v8/custom/V8MessageEventCustom.cpp b/Source/bindings/v8/custom/V8MessageEventCustom.cpp
index 00de25fb8078306e6d6a7bb61af00a8d83b8431e..f9d9f6dbb44252556c7ccd7a40d725abb0632843 100644
--- a/Source/bindings/v8/custom/V8MessageEventCustom.cpp
+++ b/Source/bindings/v8/custom/V8MessageEventCustom.cpp
@@ -51,8 +51,17 @@ void V8MessageEvent::dataAttrGetterCustom(v8::Local<v8::String> name, const v8::
switch (event->dataType()) {
case MessageEvent::DataTypeScriptValue: {
result = info.Holder()->GetHiddenValue(V8HiddenPropertyName::data());
- if (result.IsEmpty())
- result = v8::Null(info.GetIsolate());
+ if (result.IsEmpty()) {
+ if (!event->dataAsSerializedScriptValue()) {
+ v8::Local<v8::Value> mainWorldData = getHiddenValueFromMainWorldWrapper(info.GetIsolate(), event, V8HiddenPropertyName::data());
+ if (!mainWorldData.IsEmpty())
+ event->setSerializedData(SerializedScriptValue::createAndSwallowExceptions(mainWorldData, info.GetIsolate()));
+ }
+ if (event->dataAsSerializedScriptValue())
+ result = event->dataAsSerializedScriptValue()->deserialize(info.GetIsolate());
+ else
+ result = v8::Null(info.GetIsolate());
+ }
break;
}
@@ -111,8 +120,13 @@ void V8MessageEvent::initMessageEventMethodCustom(const v8::FunctionCallbackInfo
if (!getMessagePortArray(args[7], *portArray, args.GetIsolate()))
return;
}
- args.Holder()->SetHiddenValue(V8HiddenPropertyName::data(), dataArg);
event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, lastEventIdArg, sourceArg, portArray.release());
+
+ if (!dataArg.IsEmpty()) {
+ args.Holder()->SetHiddenValue(V8HiddenPropertyName::data(), dataArg);
+ if (isolatedWorldForIsolate(args.GetIsolate()))
+ event->setSerializedData(SerializedScriptValue::createAndSwallowExceptions(dataArg, args.GetIsolate()));
+ }
}
void V8MessageEvent::webkitInitMessageEventMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)

Powered by Google App Engine
This is Rietveld 408576698