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

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

Issue 2487403002: Allow navigations to frames that aren't being unloaded in the unload handler. (Closed)
Patch Set: fix 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 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 return; 143 !activeDocument->frame()->isNavigationAllowed() ||
144 if (!NavigationDisablerForUnload::isNavigationAllowed()) 144 !NavigationDisablerForBeforeUnload::isNavigationAllowed())
145 return; 145 return;
146 146
147 // We intentionally call reload() for the current frame if delta is zero. 147 // We intentionally call reload() for the current frame if delta is zero.
148 // Otherwise, navigation happens on the root frame. 148 // Otherwise, navigation happens on the root frame.
149 // This behavior is designed in the following spec. 149 // This behavior is designed in the following spec.
150 // https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go 150 // https://html.spec.whatwg.org/multipage/browsers.html#dom-history-go
151 if (delta) 151 if (delta)
152 frame()->loader().client()->navigateBackForward(delta); 152 frame()->loader().client()->navigateBackForward(delta);
153 else 153 else
154 frame()->reload(FrameLoadTypeReload, ClientRedirectPolicy::ClientRedirect); 154 frame()->reload(FrameLoadTypeReload, ClientRedirectPolicy::ClientRedirect);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 frame()->document()->url().elidedString() + "'."); 213 frame()->document()->url().elidedString() + "'.");
214 return; 214 return;
215 } 215 }
216 216
217 frame()->loader().updateForSameDocumentNavigation( 217 frame()->loader().updateForSameDocumentNavigation(
218 fullURL, SameDocumentNavigationHistoryApi, std::move(data), 218 fullURL, SameDocumentNavigationHistoryApi, std::move(data),
219 restorationType, type, frame()->document()); 219 restorationType, type, frame()->document());
220 } 220 }
221 221
222 } // namespace blink 222 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698