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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 RefPtr<SerializedScriptValue> serialized = history->state(); | 56 RefPtr<SerializedScriptValue> serialized = history->state(); |
57 value = serialized ? serialized->deserialize(info.GetIsolate()) : v8::Handle
<v8::Value>(v8::Null(info.GetIsolate())); | 57 value = serialized ? serialized->deserialize(info.GetIsolate()) : v8::Handle
<v8::Value>(v8::Null(info.GetIsolate())); |
58 V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValu
e::state(info.GetIsolate()), value); | 58 V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValu
e::state(info.GetIsolate()), value); |
59 | 59 |
60 v8SetReturnValue(info, value); | 60 v8SetReturnValue(info, value); |
61 } | 61 } |
62 | 62 |
63 void V8History::pushStateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) | 63 void V8History::pushStateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
info) |
64 { | 64 { |
65 ExceptionState exceptionState(ExceptionState::ExecutionContext, "pushState",
"History", info.Holder(), info.GetIsolate()); | 65 ExceptionState exceptionState(ExceptionState::ExecutionContext, "pushState",
"History", info.Holder(), info.GetIsolate()); |
| 66 |
| 67 if (UNLIKELY(info.Length() < 2)) { |
| 68 setMinimumArityTypeError(exceptionState, 2, info.Length()); |
| 69 exceptionState.throwIfNeeded(); |
| 70 return; |
| 71 } |
| 72 |
66 RefPtr<SerializedScriptValue> historyState = SerializedScriptValueFactory::i
nstance().create(info[0], 0, 0, exceptionState, info.GetIsolate()); | 73 RefPtr<SerializedScriptValue> historyState = SerializedScriptValueFactory::i
nstance().create(info[0], 0, 0, exceptionState, info.GetIsolate()); |
67 if (exceptionState.throwIfNeeded()) | 74 if (exceptionState.throwIfNeeded()) |
68 return; | 75 return; |
69 | 76 |
70 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, title, in
fo[1]); | 77 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, title, in
fo[1]); |
71 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, url, info
[2]); | 78 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, url, info
[2]); |
72 | 79 |
73 History* history = V8History::toImpl(info.Holder()); | 80 History* history = V8History::toImpl(info.Holder()); |
74 history->stateObjectAdded(historyState.release(), title, url, FrameLoadTypeS
tandard, exceptionState); | 81 history->stateObjectAdded(historyState.release(), title, url, FrameLoadTypeS
tandard, exceptionState); |
75 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenV
alue::state(info.GetIsolate())); | 82 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenV
alue::state(info.GetIsolate())); |
76 exceptionState.throwIfNeeded(); | 83 exceptionState.throwIfNeeded(); |
77 } | 84 } |
78 | 85 |
79 void V8History::replaceStateMethodCustom(const v8::FunctionCallbackInfo<v8::Valu
e>& info) | 86 void V8History::replaceStateMethodCustom(const v8::FunctionCallbackInfo<v8::Valu
e>& info) |
80 { | 87 { |
81 ExceptionState exceptionState(ExceptionState::ExecutionContext, "replaceStat
e", "History", info.Holder(), info.GetIsolate()); | 88 ExceptionState exceptionState(ExceptionState::ExecutionContext, "replaceStat
e", "History", info.Holder(), info.GetIsolate()); |
| 89 |
| 90 if (UNLIKELY(info.Length() < 2)) { |
| 91 setMinimumArityTypeError(exceptionState, 2, info.Length()); |
| 92 exceptionState.throwIfNeeded(); |
| 93 return; |
| 94 } |
| 95 |
82 RefPtr<SerializedScriptValue> historyState = SerializedScriptValueFactory::i
nstance().create(info[0], 0, 0, exceptionState, info.GetIsolate()); | 96 RefPtr<SerializedScriptValue> historyState = SerializedScriptValueFactory::i
nstance().create(info[0], 0, 0, exceptionState, info.GetIsolate()); |
83 if (exceptionState.throwIfNeeded()) | 97 if (exceptionState.throwIfNeeded()) |
84 return; | 98 return; |
85 | 99 |
86 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, title, in
fo[1]); | 100 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, title, in
fo[1]); |
87 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, url, info
[2]); | 101 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, url, info
[2]); |
88 | 102 |
89 History* history = V8History::toImpl(info.Holder()); | 103 History* history = V8History::toImpl(info.Holder()); |
90 history->stateObjectAdded(historyState.release(), title, url, FrameLoadTypeR
edirectWithLockedBackForwardList, exceptionState); | 104 history->stateObjectAdded(historyState.release(), title, url, FrameLoadTypeR
edirectWithLockedBackForwardList, exceptionState); |
91 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenV
alue::state(info.GetIsolate())); | 105 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenV
alue::state(info.GetIsolate())); |
92 exceptionState.throwIfNeeded(); | 106 exceptionState.throwIfNeeded(); |
93 } | 107 } |
94 | 108 |
95 } // namespace blink | 109 } // namespace blink |
OLD | NEW |