Index: Source/core/loader/NavigationScheduler.cpp |
diff --git a/Source/core/loader/NavigationScheduler.cpp b/Source/core/loader/NavigationScheduler.cpp |
index 2bb2bd6fa2bc93d59d3b926e6df27b947951b101..dfe02dd72e2e5f5fa8af765c1586df0aebcd5a5e 100644 |
--- a/Source/core/loader/NavigationScheduler.cpp |
+++ b/Source/core/loader/NavigationScheduler.cpp |
@@ -294,8 +294,11 @@ bool NavigationScheduler::mustLockBackForwardList(LocalFrame* targetFrame) |
// Navigation of a subframe during loading of an ancestor frame does not create a new back/forward item. |
// The definition of "during load" is any time before all handlers for the load event have been run. |
// See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motivation for this. |
- Frame* parentFrame = targetFrame->tree().parent(); |
- return parentFrame && parentFrame->isLocalFrame() && !toLocalFrame(parentFrame)->loader().allAncestorsAreComplete(); |
+ for (Frame* parentFrame = targetFrame->tree().parent(); parentFrame; parentFrame = parentFrame->tree().parent()) { |
+ if (!parentFrame->isLocalFrame() || !toLocalFrame(parentFrame)->document()->loadEventFinished()) |
+ return true; |
+ } |
+ return false; |
} |
void NavigationScheduler::scheduleLocationChange(Document* originDocument, const String& url, const Referrer& referrer, bool lockBackForwardList) |