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

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

Issue 19457002: Make 'any'-typed attributes of events available in isolated worlds (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Properly refactored 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/V8CustomEventCustom.cpp
diff --git a/Source/bindings/v8/custom/V8CustomEventCustom.cpp b/Source/bindings/v8/custom/V8CustomEventCustom.cpp
index d03eb673ddfdd238e5d9d7ed20aeedc7f7f1d504..270d5a1ab6d3b6d62a8629820947585f4d99bae2 100644
--- a/Source/bindings/v8/custom/V8CustomEventCustom.cpp
+++ b/Source/bindings/v8/custom/V8CustomEventCustom.cpp
@@ -34,7 +34,7 @@
#include "V8Event.h"
#include "bindings/v8/Dictionary.h"
#include "bindings/v8/ScriptState.h"
-#include "bindings/v8/ScriptValue.h"
+#include "bindings/v8/SerializedScriptValue.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8DOMWrapper.h"
#include "bindings/v8/V8HiddenPropertyName.h"
@@ -63,9 +63,14 @@ void V8CustomEvent::detailAttrGetterCustom(v8::Local<v8::String> name, const v8:
return;
}
- SerializedScriptValue* serialized = event->serializedScriptValue();
- if (serialized) {
- result = serialized->deserialize();
+ if (!event->serializedScriptValue()) {
+ v8::Local<v8::Value> mainWorldDetail = getHiddenValueFromMainWorldWrapper(info.GetIsolate(), event, V8HiddenPropertyName::detail());
+ if (!mainWorldDetail.IsEmpty())
+ event->setSerializedDetail(SerializedScriptValue::createSwallowExceptions(mainWorldDetail, info.GetIsolate()));
haraken 2013/07/18 00:00:29 What happens if SerializedScriptValue::createSwall
adamk 2013/07/18 01:09:14 I don't believe that's possible. Is it? Even if it
haraken 2013/07/18 01:28:01 I thought it might be possible in a situation wher
+ }
+
+ if (event->serializedScriptValue()) {
+ result = event->serializedScriptValue()->deserialize();
haraken 2013/07/18 00:00:29 Would it be possible to avoid deserializing the Se
adamk 2013/07/18 01:09:14 The entire point of the patch is to force a serial
haraken 2013/07/18 01:28:01 sorry, I was confused. Now got it! (You might want
adamk 2013/07/18 16:48:32 I think it's my fault, this CL came out of an in-p
v8SetReturnValue(info, cacheState(info.Holder(), result));
return;
}
@@ -83,8 +88,13 @@ void V8CustomEvent::initCustomEventMethodCustom(const v8::FunctionCallbackInfo<v
V8TRYCATCH_VOID(bool, cancelableArg, args[2]->BooleanValue());
v8::Handle<v8::Value> detailsArg = args[3];
- args.Holder()->SetHiddenValue(V8HiddenPropertyName::detail(), detailsArg);
event->initEvent(typeArg, canBubbleArg, cancelableArg);
+
+ if (!detailsArg.IsEmpty()) {
+ args.Holder()->SetHiddenValue(V8HiddenPropertyName::detail(), detailsArg);
+ if (isolatedWorldForIsolate(args.GetIsolate()))
+ event->setSerializedDetail(SerializedScriptValue::createSwallowExceptions(detailsArg, args.GetIsolate()));
+ }
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698