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

Powered by Google App Engine
This is Rietveld 408576698