Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/Source/core/frame/History.cpp

Issue 2555963003: FasterLocationReload: use ReloadMainResource for JS exposed reloads (Closed)
Patch Set: test Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if (!activeDocument) 138 if (!activeDocument)
139 return; 139 return;
140 140
141 if (!activeDocument->frame() || 141 if (!activeDocument->frame() ||
142 !activeDocument->frame()->canNavigate(*frame())) { 142 !activeDocument->frame()->canNavigate(*frame())) {
143 return; 143 return;
144 } 144 }
145 if (!NavigationDisablerForUnload::isNavigationAllowed()) 145 if (!NavigationDisablerForUnload::isNavigationAllowed())
146 return; 146 return;
147 147
148 // We intentionally call reload() for the current frame if delta is zero. 148 if (delta) {
149 // Otherwise, navigation happens on the root frame.
150 // This behavior is designed in the following spec.
151 // https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go
152 if (delta)
153 frame()->loader().client()->navigateBackForward(delta); 149 frame()->loader().client()->navigateBackForward(delta);
154 else 150 } else {
155 frame()->reload(FrameLoadTypeReload, ClientRedirectPolicy::ClientRedirect); 151 // We intentionally call reload() for the current frame if delta is zero.
152 // Otherwise, navigation happens on the root frame.
153 // This behavior is designed in the following spec.
154 // https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go
155 FrameLoadType reloadType =
156 RuntimeEnabledFeatures::fasterLocationReloadEnabled()
157 ? FrameLoadTypeReloadMainResource
158 : FrameLoadTypeReload;
159 frame()->reload(reloadType, ClientRedirectPolicy::ClientRedirect);
160 }
156 } 161 }
157 162
158 KURL History::urlForState(const String& urlString) { 163 KURL History::urlForState(const String& urlString) {
159 Document* document = frame()->document(); 164 Document* document = frame()->document();
160 165
161 if (urlString.isNull()) 166 if (urlString.isNull())
162 return document->url(); 167 return document->url();
163 if (urlString.isEmpty()) 168 if (urlString.isEmpty())
164 return document->baseURL(); 169 return document->baseURL();
165 170
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 frame()->document()->url().elidedString() + "'."); 220 frame()->document()->url().elidedString() + "'.");
216 return; 221 return;
217 } 222 }
218 223
219 frame()->loader().updateForSameDocumentNavigation( 224 frame()->loader().updateForSameDocumentNavigation(
220 fullURL, SameDocumentNavigationHistoryApi, std::move(data), 225 fullURL, SameDocumentNavigationHistoryApi, std::move(data),
221 restorationType, type, frame()->document()); 226 restorationType, type, frame()->document());
222 } 227 }
223 228
224 } // namespace blink 229 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698