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

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

Issue 2621193004: Allow navigations to frames that aren't being unloaded in the unload handler. (Closed)
Patch Set: Created 3 years, 11 months 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 void History::go(ExecutionContext* context, int delta) { 132 void History::go(ExecutionContext* context, int delta) {
133 if (!frame() || !frame()->loader().client()) 133 if (!frame() || !frame()->loader().client())
134 return; 134 return;
135 135
136 ASSERT(isMainThread()); 136 ASSERT(isMainThread());
137 Document* activeDocument = toDocument(context); 137 Document* activeDocument = toDocument(context);
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 !activeDocument->frame()->isNavigationAllowed() ||
144 !NavigationDisablerForBeforeUnload::isNavigationAllowed()) {
143 return; 145 return;
144 if (!NavigationDisablerForUnload::isNavigationAllowed()) 146 }
145 return;
146 147
147 // We intentionally call reload() for the current frame if delta is zero. 148 // We intentionally call reload() for the current frame if delta is zero.
148 // Otherwise, navigation happens on the root frame. 149 // Otherwise, navigation happens on the root frame.
149 // This behavior is designed in the following spec. 150 // This behavior is designed in the following spec.
150 // https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go 151 // https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go
151 if (delta) 152 if (delta)
152 frame()->loader().client()->navigateBackForward(delta); 153 frame()->loader().client()->navigateBackForward(delta);
153 else 154 else
154 frame()->reload(FrameLoadTypeReload, ClientRedirectPolicy::ClientRedirect); 155 frame()->reload(FrameLoadTypeReload, ClientRedirectPolicy::ClientRedirect);
155 } 156 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 frame()->document()->url().elidedString() + "'."); 214 frame()->document()->url().elidedString() + "'.");
214 return; 215 return;
215 } 216 }
216 217
217 frame()->loader().updateForSameDocumentNavigation( 218 frame()->loader().updateForSameDocumentNavigation(
218 fullURL, SameDocumentNavigationHistoryApi, std::move(data), 219 fullURL, SameDocumentNavigationHistoryApi, std::move(data),
219 restorationType, type, frame()->document()); 220 restorationType, type, frame()->document());
220 } 221 }
221 222
222 } // namespace blink 223 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698