| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // There's no cached value from a previous invocation, nor a state value was
provided by the | 77 // There's no cached value from a previous invocation, nor a state value was
provided by the |
| 78 // event, but there is a history object, so first we need to see if the stat
e object has been | 78 // event, but there is a history object, so first we need to see if the stat
e object has been |
| 79 // deserialized through the history object already. | 79 // deserialized through the history object already. |
| 80 // The current history state object might've changed in the meantime, so we
need to take care | 80 // The current history state object might've changed in the meantime, so we
need to take care |
| 81 // of using the correct one, and always share the same deserialization with
history.state. | 81 // of using the correct one, and always share the same deserialization with
history.state. |
| 82 | 82 |
| 83 bool isSameState = history->isSameAsCurrentState(event->serializedState()); | 83 bool isSameState = history->isSameAsCurrentState(event->serializedState()); |
| 84 | 84 |
| 85 if (isSameState) { | 85 if (isSameState) { |
| 86 v8::Local<v8::Object> v8History = toV8(history, info.Holder(), info.GetI
solate()).As<v8::Object>(); | 86 v8::Local<v8::Value> v8HistoryValue = toV8(history, info.Holder(), info.
GetIsolate()); |
| 87 if (v8HistoryValue.IsEmpty()) |
| 88 return; |
| 89 v8::Local<v8::Object> v8History = v8HistoryValue.As<v8::Object>(); |
| 87 if (!history->stateChanged()) { | 90 if (!history->stateChanged()) { |
| 88 result = V8HiddenValue::getHiddenValue(info.GetIsolate(), v8History,
V8HiddenValue::state(info.GetIsolate())); | 91 result = V8HiddenValue::getHiddenValue(info.GetIsolate(), v8History,
V8HiddenValue::state(info.GetIsolate())); |
| 89 if (!result.IsEmpty()) { | 92 if (!result.IsEmpty()) { |
| 90 v8SetReturnValue(info, cacheState(info.Holder(), result, info.Ge
tIsolate())); | 93 v8SetReturnValue(info, cacheState(info.Holder(), result, info.Ge
tIsolate())); |
| 91 return; | 94 return; |
| 92 } | 95 } |
| 93 } | 96 } |
| 94 result = event->serializedState()->deserialize(info.GetIsolate()); | 97 result = event->serializedState()->deserialize(info.GetIsolate()); |
| 95 V8HiddenValue::setHiddenValue(info.GetIsolate(), v8History, V8HiddenValu
e::state(info.GetIsolate()), result); | 98 V8HiddenValue::setHiddenValue(info.GetIsolate(), v8History, V8HiddenValu
e::state(info.GetIsolate()), result); |
| 96 } else { | 99 } else { |
| 97 result = event->serializedState()->deserialize(info.GetIsolate()); | 100 result = event->serializedState()->deserialize(info.GetIsolate()); |
| 98 } | 101 } |
| 99 | 102 |
| 100 v8SetReturnValue(info, cacheState(info.Holder(), result, info.GetIsolate()))
; | 103 v8SetReturnValue(info, cacheState(info.Holder(), result, info.GetIsolate()))
; |
| 101 } | 104 } |
| 102 | 105 |
| 103 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |