Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index f4b33bdbf979b63655eae795cbfd430c283a84a7..3bcbf135c3f96d261e1a6b533d7023a260a9c7d9 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -2517,15 +2517,9 @@ void Document::explicitClose() |
void Document::implicitClose() |
{ |
ASSERT(!inStyleRecalc()); |
- |
- bool wasLocationChangePending = frame() && frame()->navigationScheduler().locationChangePending(); |
- bool doload = !parsing() && m_parser && !processingLoadEvent() && !wasLocationChangePending; |
- |
- // If the load was blocked because of a pending location change and the location change triggers a same document |
- // navigation, don't fire load events after the same document navigation completes (unless there's an explicit open). |
- m_loadEventProgress = LoadEventTried; |
- |
- if (!doload) |
+ if (processingLoadEvent() || !m_parser) |
+ return; |
+ if (frame() && frame()->navigationScheduler().locationChangePending()) |
return; |
// The call to dispatchWindowLoadEvent can detach the LocalDOMWindow and cause it (and its |
@@ -2653,7 +2647,10 @@ void Document::dispatchUnloadEvents() |
if (m_parser) |
m_parser->stopParsing(); |
- if (m_loadEventProgress >= LoadEventTried && m_loadEventProgress <= UnloadEventInProgress) { |
+ if (m_loadEventProgress == LoadEventNotRun) |
+ return; |
+ |
+ if (m_loadEventProgress <= UnloadEventInProgress) { |
Element* currentFocusedElement = focusedElement(); |
if (isHTMLInputElement(currentFocusedElement)) |
toHTMLInputElement(*currentFocusedElement).endEditing(); |