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

Unified Diff: Source/bindings/v8/custom/V8PopStateEventCustom.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/V8PopStateEventCustom.cpp
diff --git a/Source/bindings/v8/custom/V8PopStateEventCustom.cpp b/Source/bindings/v8/custom/V8PopStateEventCustom.cpp
index ba93201f6fbc55512f4108480b737ee5fc722a43..af14e0b84a8bbf4a842b6411189a2940e1e93358 100644
--- a/Source/bindings/v8/custom/V8PopStateEventCustom.cpp
+++ b/Source/bindings/v8/custom/V8PopStateEventCustom.cpp
@@ -58,7 +58,16 @@ void V8PopStateEvent::stateAttrGetterCustom(v8::Local<v8::String> name, const v8
PopStateEvent* event = V8PopStateEvent::toNative(info.Holder());
History* history = event->history();
if (!history || !event->serializedState()) {
- v8SetReturnValue(info, cacheState(info.Holder(), v8::Null(info.GetIsolate())));
+ if (!event->serializedState()) {
+ v8::Local<v8::Value> mainWorldState = getHiddenValueFromMainWorldWrapper(info.GetIsolate(), event, V8HiddenPropertyName::state());
+ if (!mainWorldState.IsEmpty())
+ event->setSerializedState(SerializedScriptValue::createSwallowExceptions(mainWorldState, info.GetIsolate()));
+ }
+ if (event->serializedState())
+ result = event->serializedState()->deserialize();
+ else
+ result = v8::Null(info.GetIsolate());
+ v8SetReturnValue(info, cacheState(info.Holder(), result));
return;
}
@@ -81,8 +90,9 @@ void V8PopStateEvent::stateAttrGetterCustom(v8::Local<v8::String> name, const v8
}
result = event->serializedState()->deserialize(info.GetIsolate());
v8History->SetHiddenValue(V8HiddenPropertyName::state(), result);
- } else
+ } else {
result = event->serializedState()->deserialize(info.GetIsolate());
+ }
v8SetReturnValue(info, cacheState(info.Holder(), result));
}

Powered by Google App Engine
This is Rietveld 408576698