OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 24 matching lines...) Expand all Loading... |
35 #include "bindings/core/v8/SerializedScriptValue.h" | 35 #include "bindings/core/v8/SerializedScriptValue.h" |
36 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 36 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
37 #include "bindings/core/v8/V8Binding.h" | 37 #include "bindings/core/v8/V8Binding.h" |
38 #include "bindings/core/v8/V8HiddenValue.h" | 38 #include "bindings/core/v8/V8HiddenValue.h" |
39 #include "bindings/core/v8/V8Window.h" | 39 #include "bindings/core/v8/V8Window.h" |
40 #include "core/dom/ExceptionCode.h" | 40 #include "core/dom/ExceptionCode.h" |
41 #include "core/frame/History.h" | 41 #include "core/frame/History.h" |
42 | 42 |
43 namespace blink { | 43 namespace blink { |
44 | 44 |
45 void V8History::pushStateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) | 45 void V8History::pushStateMethodEpilogueCustom(const v8::FunctionCallbackInfo<v8:
:Value>& info, History*) |
46 { | 46 { |
47 ExceptionState exceptionState(ExceptionState::ExecutionContext, "pushState",
"History", info.Holder(), info.GetIsolate()); | |
48 | |
49 if (UNLIKELY(info.Length() < 2)) { | |
50 setMinimumArityTypeError(exceptionState, 2, info.Length()); | |
51 exceptionState.throwIfNeeded(); | |
52 return; | |
53 } | |
54 | |
55 RefPtr<SerializedScriptValue> historyState = SerializedScriptValueFactory::i
nstance().create(info[0], 0, 0, exceptionState, info.GetIsolate()); | |
56 if (exceptionState.throwIfNeeded()) | |
57 return; | |
58 | |
59 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, title, in
fo[1]); | |
60 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, url, info
[2]); | |
61 | |
62 History* history = V8History::toImpl(info.Holder()); | |
63 history->stateObjectAdded(historyState.release(), title, url, FrameLoadTypeS
tandard, exceptionState); | |
64 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenV
alue::state(info.GetIsolate())); | 47 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenV
alue::state(info.GetIsolate())); |
65 exceptionState.throwIfNeeded(); | |
66 } | 48 } |
67 | 49 |
68 void V8History::replaceStateMethodCustom(const v8::FunctionCallbackInfo<v8::Valu
e>& info) | 50 void V8History::replaceStateMethodEpilogueCustom(const v8::FunctionCallbackInfo<
v8::Value>& info, History*) |
69 { | 51 { |
70 ExceptionState exceptionState(ExceptionState::ExecutionContext, "replaceStat
e", "History", info.Holder(), info.GetIsolate()); | |
71 | |
72 if (UNLIKELY(info.Length() < 2)) { | |
73 setMinimumArityTypeError(exceptionState, 2, info.Length()); | |
74 exceptionState.throwIfNeeded(); | |
75 return; | |
76 } | |
77 | |
78 RefPtr<SerializedScriptValue> historyState = SerializedScriptValueFactory::i
nstance().create(info[0], 0, 0, exceptionState, info.GetIsolate()); | |
79 if (exceptionState.throwIfNeeded()) | |
80 return; | |
81 | |
82 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, title, in
fo[1]); | |
83 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, url, info
[2]); | |
84 | |
85 History* history = V8History::toImpl(info.Holder()); | |
86 history->stateObjectAdded(historyState.release(), title, url, FrameLoadTypeR
edirectWithLockedBackForwardList, exceptionState); | |
87 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenV
alue::state(info.GetIsolate())); | 52 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenV
alue::state(info.GetIsolate())); |
88 exceptionState.throwIfNeeded(); | |
89 } | 53 } |
90 | 54 |
91 } // namespace blink | 55 } // namespace blink |
OLD | NEW |