| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "core/frame/History.h" | 26 #include "core/frame/History.h" |
| 27 | 27 |
| 28 #include "bindings/core/v8/ExceptionState.h" | 28 #include "bindings/core/v8/ExceptionState.h" |
| 29 #include "bindings/core/v8/ScriptState.h" |
| 29 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
| 30 #include "core/frame/LocalFrame.h" | 31 #include "core/frame/LocalFrame.h" |
| 31 #include "core/loader/DocumentLoader.h" | 32 #include "core/loader/DocumentLoader.h" |
| 32 #include "core/loader/FrameLoader.h" | 33 #include "core/loader/FrameLoader.h" |
| 33 #include "core/loader/FrameLoaderClient.h" | 34 #include "core/loader/FrameLoaderClient.h" |
| 34 #include "core/loader/HistoryItem.h" | 35 #include "core/loader/HistoryItem.h" |
| 35 #include "core/loader/NavigationScheduler.h" | 36 #include "core/loader/NavigationScheduler.h" |
| 36 #include "core/page/Page.h" | 37 #include "core/page/Page.h" |
| 37 #include "platform/RuntimeEnabledFeatures.h" | 38 #include "platform/RuntimeEnabledFeatures.h" |
| 38 #include "platform/weborigin/KURL.h" | 39 #include "platform/weborigin/KURL.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 115 } |
| 115 | 116 |
| 116 bool History::stateChanged() const { | 117 bool History::stateChanged() const { |
| 117 return m_lastStateObjectRequested != stateInternal(); | 118 return m_lastStateObjectRequested != stateInternal(); |
| 118 } | 119 } |
| 119 | 120 |
| 120 bool History::isSameAsCurrentState(SerializedScriptValue* state) const { | 121 bool History::isSameAsCurrentState(SerializedScriptValue* state) const { |
| 121 return state == stateInternal(); | 122 return state == stateInternal(); |
| 122 } | 123 } |
| 123 | 124 |
| 124 void History::back(ExecutionContext* context) { | 125 void History::back(ScriptState* scriptState) { |
| 125 go(context, -1); | 126 go(scriptState, -1); |
| 126 } | 127 } |
| 127 | 128 |
| 128 void History::forward(ExecutionContext* context) { | 129 void History::forward(ScriptState* scriptState) { |
| 129 go(context, 1); | 130 go(scriptState, 1); |
| 130 } | 131 } |
| 131 | 132 |
| 132 void History::go(ExecutionContext* context, int delta) { | 133 void History::go(ScriptState* scriptState, int delta) { |
| 133 if (!frame() || !frame()->loader().client()) | 134 if (!frame() || !frame()->loader().client()) |
| 134 return; | 135 return; |
| 135 | 136 |
| 136 DCHECK(isMainThread()); | 137 DCHECK(isMainThread()); |
| 137 Document* activeDocument = toDocument(context); | 138 Document* activeDocument = toDocument(scriptState->getExecutionContext()); |
| 138 if (!activeDocument) | 139 if (!activeDocument) |
| 139 return; | 140 return; |
| 140 | 141 |
| 141 if (!activeDocument->frame() || | 142 if (!activeDocument->frame() || |
| 142 !activeDocument->frame()->canNavigate(*frame())) { | 143 !activeDocument->frame()->canNavigate(*frame())) { |
| 143 return; | 144 return; |
| 144 } | 145 } |
| 145 if (!NavigationDisablerForUnload::isNavigationAllowed()) | 146 if (!NavigationDisablerForUnload::isNavigationAllowed()) |
| 146 return; | 147 return; |
| 147 | 148 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 frame()->document()->url().elidedString() + "'."); | 221 frame()->document()->url().elidedString() + "'."); |
| 221 return; | 222 return; |
| 222 } | 223 } |
| 223 | 224 |
| 224 frame()->loader().updateForSameDocumentNavigation( | 225 frame()->loader().updateForSameDocumentNavigation( |
| 225 fullURL, SameDocumentNavigationHistoryApi, std::move(data), | 226 fullURL, SameDocumentNavigationHistoryApi, std::move(data), |
| 226 restorationType, type, frame()->document()); | 227 restorationType, type, frame()->document()); |
| 227 } | 228 } |
| 228 | 229 |
| 229 } // namespace blink | 230 } // namespace blink |
| OLD | NEW |