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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 void V8PopStateEvent::stateAttrGetterCustom(v8::Local<v8::String> name, const v8
::PropertyCallbackInfo<v8::Value>& info) | 49 void V8PopStateEvent::stateAttrGetterCustom(v8::Local<v8::String> name, const v8
::PropertyCallbackInfo<v8::Value>& info) |
50 { | 50 { |
51 v8::Handle<v8::Value> result = info.Holder()->GetHiddenValue(V8HiddenPropert
yName::state()); | 51 v8::Handle<v8::Value> result = info.Holder()->GetHiddenValue(V8HiddenPropert
yName::state()); |
52 | 52 |
53 if (!result.IsEmpty()) { | 53 if (!result.IsEmpty()) { |
54 v8SetReturnValue(info, result); | 54 v8SetReturnValue(info, result); |
55 return; | 55 return; |
56 } | 56 } |
57 | 57 |
58 PopStateEvent* event = V8PopStateEvent::toNative(info.Holder()); | 58 PopStateEvent* event = V8PopStateEvent::toNative(info.Holder()); |
59 if (!event->state().hasNoValue()) { | |
60 v8SetReturnValue(info, cacheState(info.Holder(), event->state().v8Value(
))); | |
61 return; | |
62 } | |
63 | |
64 History* history = event->history(); | 59 History* history = event->history(); |
65 if (!history || !event->serializedState()) { | 60 if (!history || !event->serializedState()) { |
66 v8SetReturnValue(info, cacheState(info.Holder(), v8::Null(info.GetIsolat
e()))); | 61 v8SetReturnValue(info, cacheState(info.Holder(), v8::Null(info.GetIsolat
e()))); |
67 return; | 62 return; |
68 } | 63 } |
69 | 64 |
70 // There's no cached value from a previous invocation, nor a state value was
provided by the | 65 // There's no cached value from a previous invocation, nor a state value was
provided by the |
71 // event, but there is a history object, so first we need to see if the stat
e object has been | 66 // event, but there is a history object, so first we need to see if the stat
e object has been |
72 // deserialized through the history object already. | 67 // deserialized through the history object already. |
73 // The current history state object might've changed in the meantime, so we
need to take care | 68 // The current history state object might've changed in the meantime, so we
need to take care |
(...skipping 12 matching lines...) Expand all Loading... |
86 } | 81 } |
87 result = event->serializedState()->deserialize(info.GetIsolate()); | 82 result = event->serializedState()->deserialize(info.GetIsolate()); |
88 v8History->SetHiddenValue(V8HiddenPropertyName::state(), result); | 83 v8History->SetHiddenValue(V8HiddenPropertyName::state(), result); |
89 } else | 84 } else |
90 result = event->serializedState()->deserialize(info.GetIsolate()); | 85 result = event->serializedState()->deserialize(info.GetIsolate()); |
91 | 86 |
92 v8SetReturnValue(info, cacheState(info.Holder(), result)); | 87 v8SetReturnValue(info, cacheState(info.Holder(), result)); |
93 } | 88 } |
94 | 89 |
95 } // namespace WebCore | 90 } // namespace WebCore |
OLD | NEW |