| Index: Source/bindings/core/v8/custom/V8CustomEventCustom.cpp
|
| diff --git a/Source/bindings/core/v8/custom/V8CustomEventCustom.cpp b/Source/bindings/core/v8/custom/V8CustomEventCustom.cpp
|
| index 29f8d8e26a8d1a0f09c99721ac89f69890f91410..6582206313410403d41cb3a0d143f19a0223234e 100644
|
| --- a/Source/bindings/core/v8/custom/V8CustomEventCustom.cpp
|
| +++ b/Source/bindings/core/v8/custom/V8CustomEventCustom.cpp
|
| @@ -61,27 +61,21 @@ void V8CustomEvent::detailAttributeGetterCustom(const v8::PropertyCallbackInfo<v
|
| return;
|
| }
|
|
|
| - if (!event->serializedDetail()) {
|
| - // If we're in an isolated world and the event was created in the main world,
|
| - // we need to find the 'detail' property on the main world wrapper and clone it.
|
| - v8::Local<v8::Value> mainWorldDetail = V8HiddenValue::getHiddenValueFromMainWorldWrapper(info.GetIsolate(), event, V8HiddenValue::detail(info.GetIsolate()));
|
| - if (!mainWorldDetail.IsEmpty())
|
| - event->setSerializedDetail(SerializedScriptValueFactory::instance().createAndSwallowExceptions(info.GetIsolate(), mainWorldDetail));
|
| - }
|
| -
|
| - if (event->serializedDetail()) {
|
| - result = event->serializedDetail()->deserialize();
|
| - v8SetReturnValue(info, cacheState(info.GetIsolate(), info.Holder(), result));
|
| - return;
|
| - }
|
| -
|
| - v8SetReturnValue(info, cacheState(info.GetIsolate(), info.Holder(), v8::Null(info.GetIsolate())));
|
| + // Be careful not to return a V8 value which is created in different world.
|
| + v8::Local<v8::Value> detail;
|
| + if (SerializedScriptValue* serializedValue = event->serializedDetail())
|
| + detail = serializedValue->deserialize();
|
| + else
|
| + detail = event->detail().v8ValueFor(ScriptState::current(info.GetIsolate()));
|
| + // |detail| should be null when it is an empty handle because its default value is null.
|
| + if (detail.IsEmpty())
|
| + detail = v8::Null(info.GetIsolate());
|
| + v8SetReturnValue(info, cacheState(info.GetIsolate(), info.Holder(), detail));
|
| }
|
|
|
| void V8CustomEvent::initCustomEventMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| CustomEvent* event = V8CustomEvent::toImpl(info.Holder());
|
| - ASSERT(!event->serializedDetail());
|
|
|
| TOSTRING_VOID(V8StringResource<>, typeArg, info[0]);
|
| bool canBubbleArg;
|
| @@ -92,12 +86,7 @@ void V8CustomEvent::initCustomEventMethodCustom(const v8::FunctionCallbackInfo<v
|
| v8::Local<v8::Value> detailsArg = info[3];
|
|
|
| event->initEvent(typeArg, canBubbleArg, cancelableArg);
|
| -
|
| - if (!detailsArg.IsEmpty()) {
|
| - V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::detail(info.GetIsolate()), detailsArg);
|
| - if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld())
|
| - event->setSerializedDetail(SerializedScriptValueFactory::instance().createAndSwallowExceptions(info.GetIsolate(), detailsArg));
|
| - }
|
| + event->setDetail(ScriptValue(ScriptState::current(info.GetIsolate()), detailsArg));
|
| }
|
|
|
| } // namespace blink
|
|
|