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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 PopStateEvent* event = V8PopStateEvent::toImpl(info.Holder()); | 71 PopStateEvent* event = V8PopStateEvent::toImpl(info.Holder()); |
72 History* history = event->GetHistory(); | 72 History* history = event->GetHistory(); |
73 if (!history || !event->SerializedState()) { | 73 if (!history || !event->SerializedState()) { |
74 // If the event doesn't have serializedState(), it means that the | 74 // If the event doesn't have serializedState(), it means that the |
75 // event was initialized with PopStateEventInit. In such case, we need | 75 // event was initialized with PopStateEventInit. In such case, we need |
76 // to get a v8 value for the current world from state(). | 76 // to get a v8 value for the current world from state(). |
77 if (event->SerializedState()) | 77 if (event->SerializedState()) |
78 result = event->SerializedState()->Deserialize(isolate); | 78 result = event->SerializedState()->Deserialize(isolate); |
79 else | 79 else |
80 result = event->state().V8ValueFor(script_state); | 80 result = event->state(script_state).V8Value(); |
81 if (result.IsEmpty()) | 81 if (result.IsEmpty()) |
82 result = v8::Null(isolate); | 82 result = v8::Null(isolate); |
83 V8SetReturnValue(info, CacheState(script_state, info.Holder(), result)); | 83 V8SetReturnValue(info, CacheState(script_state, info.Holder(), result)); |
84 return; | 84 return; |
85 } | 85 } |
86 | 86 |
87 // There's no cached value from a previous invocation, nor a state value was | 87 // There's no cached value from a previous invocation, nor a state value was |
88 // provided by the event, but there is a history object, so first we need to | 88 // provided by the event, but there is a history object, so first we need to |
89 // see if the state object has been deserialized through the history object | 89 // see if the state object has been deserialized through the history object |
90 // already. | 90 // already. |
(...skipping 19 matching lines...) Expand all Loading... |
110 result = event->SerializedState()->Deserialize(isolate); | 110 result = event->SerializedState()->Deserialize(isolate); |
111 history_state.Set(v8_history, result); | 111 history_state.Set(v8_history, result); |
112 } else { | 112 } else { |
113 result = event->SerializedState()->Deserialize(isolate); | 113 result = event->SerializedState()->Deserialize(isolate); |
114 } | 114 } |
115 | 115 |
116 V8SetReturnValue(info, CacheState(script_state, info.Holder(), result)); | 116 V8SetReturnValue(info, CacheState(script_state, info.Holder(), result)); |
117 } | 117 } |
118 | 118 |
119 } // namespace blink | 119 } // namespace blink |
OLD | NEW |