| Index: third_party/WebKit/Source/bindings/core/v8/custom/V8PopStateEventCustom.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8PopStateEventCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8PopStateEventCustom.cpp
|
| index 141a8426f20404c2afa61835d9fdbd345b6510c0..fcb3b305203db6a1672051930d3e502a4e43a5f8 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8PopStateEventCustom.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8PopStateEventCustom.cpp
|
| @@ -32,21 +32,25 @@
|
|
|
| #include "bindings/core/v8/SerializedScriptValue.h"
|
| #include "bindings/core/v8/SerializedScriptValueFactory.h"
|
| -#include "bindings/core/v8/V8HiddenValue.h"
|
| #include "bindings/core/v8/V8History.h"
|
| +#include "bindings/core/v8/V8PrivateProperty.h"
|
| #include "core/events/PopStateEvent.h"
|
| #include "core/frame/History.h"
|
|
|
| namespace blink {
|
|
|
| +namespace {
|
| +// kSymbolKey must be equal to the key in generated V8History.cpp
|
| +constexpr char kSymbolKey[] = "History#State";
|
| +}
|
| +
|
| // Save the state value to a hidden attribute in the V8PopStateEvent, and return
|
| // it, for convenience.
|
| static v8::Local<v8::Value> cacheState(ScriptState* scriptState,
|
| v8::Local<v8::Object> popStateEvent,
|
| v8::Local<v8::Value> state) {
|
| - V8HiddenValue::setHiddenValue(scriptState, popStateEvent,
|
| - V8HiddenValue::state(scriptState->isolate()),
|
| - state);
|
| + V8PrivateProperty::createSymbol(scriptState->isolate(), kSymbolKey)
|
| + .set(popStateEvent, state);
|
| return state;
|
| }
|
|
|
| @@ -54,10 +58,11 @@ void V8PopStateEvent::stateAttributeGetterCustom(
|
| const v8::FunctionCallbackInfo<v8::Value>& info) {
|
| v8::Isolate* isolate = info.GetIsolate();
|
| ScriptState* scriptState = ScriptState::current(isolate);
|
| - v8::Local<v8::Value> result = V8HiddenValue::getHiddenValue(
|
| - scriptState, info.Holder(), V8HiddenValue::state(isolate));
|
| + V8PrivateProperty::Symbol propertySymbol =
|
| + V8PrivateProperty::createSymbol(isolate, kSymbolKey);
|
| + v8::Local<v8::Value> result = propertySymbol.getOrUndefined(info.Holder());
|
|
|
| - if (!result.IsEmpty()) {
|
| + if (!result->IsUndefined()) {
|
| v8SetReturnValue(info, result);
|
| return;
|
| }
|
| @@ -93,17 +98,15 @@ void V8PopStateEvent::stateAttributeGetterCustom(
|
| if (v8HistoryValue.IsEmpty())
|
| return;
|
| v8::Local<v8::Object> v8History = v8HistoryValue.As<v8::Object>();
|
| - if (!history->stateChanged()) {
|
| - result = V8HiddenValue::getHiddenValue(scriptState, v8History,
|
| - V8HiddenValue::state(isolate));
|
| - if (!result.IsEmpty()) {
|
| - v8SetReturnValue(info, cacheState(scriptState, info.Holder(), result));
|
| - return;
|
| - }
|
| + if (!history->stateChanged() && propertySymbol.hasValue(v8History)) {
|
| + v8SetReturnValue(info,
|
| + cacheState(scriptState,
|
| + info.Holder(),
|
| + propertySymbol.getOrUndefined(v8History));
|
| + return;
|
| }
|
| result = event->serializedState()->deserialize(isolate);
|
| - V8HiddenValue::setHiddenValue(scriptState, v8History,
|
| - V8HiddenValue::state(isolate), result);
|
| + propertySymbol.set(v8History, result);
|
| } else {
|
| result = event->serializedState()->deserialize(isolate);
|
| }
|
|
|