| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "bindings/core/v8/ScriptState.h" | 29 #include "bindings/core/v8/ScriptState.h" |
| 30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
| 31 #include "core/frame/LocalFrame.h" | 31 #include "core/frame/LocalFrame.h" |
| 32 #include "core/loader/DocumentLoader.h" | 32 #include "core/loader/DocumentLoader.h" |
| 33 #include "core/loader/FrameLoader.h" | 33 #include "core/loader/FrameLoader.h" |
| 34 #include "core/loader/FrameLoaderClient.h" | 34 #include "core/loader/FrameLoaderClient.h" |
| 35 #include "core/loader/HistoryItem.h" | 35 #include "core/loader/HistoryItem.h" |
| 36 #include "core/loader/NavigationScheduler.h" | 36 #include "core/loader/NavigationScheduler.h" |
| 37 #include "core/page/Page.h" | 37 #include "core/page/Page.h" |
| 38 #include "platform/RuntimeEnabledFeatures.h" | 38 #include "platform/RuntimeEnabledFeatures.h" |
| 39 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 39 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 40 #include "platform/weborigin/SecurityOrigin.h" | 41 #include "platform/weborigin/SecurityOrigin.h" |
| 41 #include "wtf/text/StringView.h" | 42 #include "wtf/text/StringView.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 namespace { | 46 namespace { |
| 46 | 47 |
| 47 bool equalIgnoringPathQueryAndFragment(const KURL& a, const KURL& b) { | 48 bool equalIgnoringPathQueryAndFragment(const KURL& a, const KURL& b) { |
| 48 return StringView(a.getString(), 0, a.pathStart()) == | 49 return StringView(a.getString(), 0, a.pathStart()) == |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // This behavior is designed in the following spec. | 155 // This behavior is designed in the following spec. |
| 155 // https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go | 156 // https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go |
| 156 FrameLoadType reloadType = | 157 FrameLoadType reloadType = |
| 157 RuntimeEnabledFeatures::fasterLocationReloadEnabled() | 158 RuntimeEnabledFeatures::fasterLocationReloadEnabled() |
| 158 ? FrameLoadTypeReloadMainResource | 159 ? FrameLoadTypeReloadMainResource |
| 159 : FrameLoadTypeReload; | 160 : FrameLoadTypeReload; |
| 160 frame()->reload(reloadType, ClientRedirectPolicy::ClientRedirect); | 161 frame()->reload(reloadType, ClientRedirectPolicy::ClientRedirect); |
| 161 } | 162 } |
| 162 } | 163 } |
| 163 | 164 |
| 165 void History::pushState(PassRefPtr<SerializedScriptValue> data, |
| 166 const String& title, |
| 167 const String& url, |
| 168 ExceptionState& exceptionState) { |
| 169 TRACE_EVENT0("blink", "History::pushState"); |
| 170 stateObjectAdded(std::move(data), title, url, scrollRestorationInternal(), |
| 171 FrameLoadTypeStandard, exceptionState); |
| 172 } |
| 173 |
| 164 KURL History::urlForState(const String& urlString) { | 174 KURL History::urlForState(const String& urlString) { |
| 165 Document* document = frame()->document(); | 175 Document* document = frame()->document(); |
| 166 | 176 |
| 167 if (urlString.isNull()) | 177 if (urlString.isNull()) |
| 168 return document->url(); | 178 return document->url(); |
| 169 if (urlString.isEmpty()) | 179 if (urlString.isEmpty()) |
| 170 return document->baseURL(); | 180 return document->baseURL(); |
| 171 | 181 |
| 172 return KURL(document->baseURL(), urlString); | 182 return KURL(document->baseURL(), urlString); |
| 173 } | 183 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 frame()->document()->url().elidedString() + "'."); | 231 frame()->document()->url().elidedString() + "'."); |
| 222 return; | 232 return; |
| 223 } | 233 } |
| 224 | 234 |
| 225 frame()->loader().updateForSameDocumentNavigation( | 235 frame()->loader().updateForSameDocumentNavigation( |
| 226 fullURL, SameDocumentNavigationHistoryApi, std::move(data), | 236 fullURL, SameDocumentNavigationHistoryApi, std::move(data), |
| 227 restorationType, type, frame()->document()); | 237 restorationType, type, frame()->document()); |
| 228 } | 238 } |
| 229 | 239 |
| 230 } // namespace blink | 240 } // namespace blink |
| OLD | NEW |