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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1659013003: Don't reset LoadEventProgress if frame unload has already started. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 4 years, 10 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 2458 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 m_frame->loader().stopAllLoaders(); 2469 m_frame->loader().stopAllLoaders();
2470 } 2470 }
2471 2471
2472 removeAllEventListenersRecursively(); 2472 removeAllEventListenersRecursively();
2473 implicitOpen(ForceSynchronousParsing); 2473 implicitOpen(ForceSynchronousParsing);
2474 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) 2474 if (ScriptableDocumentParser* parser = scriptableDocumentParser())
2475 parser->setWasCreatedByScript(true); 2475 parser->setWasCreatedByScript(true);
2476 2476
2477 if (m_frame) 2477 if (m_frame)
2478 m_frame->loader().didExplicitOpen(); 2478 m_frame->loader().didExplicitOpen();
2479 if (m_loadEventProgress != LoadEventInProgress && pageDismissalEventBeingDis patched() == NoDismissal) 2479 // TODO(dcheng): According to the spec, document.open() during frame detach
2480 // should be completely ignored. Add a UMA to measure how often this
2481 // happens, and whether or not we can change this behavior to match spec.
2482 if (m_loadEventProgress != LoadEventInProgress && !unloadStarted() && !proce ssingBeforeUnload())
2480 m_loadEventProgress = LoadEventNotRun; 2483 m_loadEventProgress = LoadEventNotRun;
2481 } 2484 }
2482 2485
2483 void Document::detachParser() 2486 void Document::detachParser()
2484 { 2487 {
2485 if (!m_parser) 2488 if (!m_parser)
2486 return; 2489 return;
2487 m_parser->detach(); 2490 m_parser->detach();
2488 m_parser.clear(); 2491 m_parser.clear();
2489 } 2492 }
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2762 return false; 2765 return false;
2763 } 2766 }
2764 2767
2765 void Document::dispatchUnloadEvents() 2768 void Document::dispatchUnloadEvents()
2766 { 2769 {
2767 PluginScriptForbiddenScope forbidPluginDestructorScripting; 2770 PluginScriptForbiddenScope forbidPluginDestructorScripting;
2768 RefPtrWillBeRawPtr<Document> protect(this); 2771 RefPtrWillBeRawPtr<Document> protect(this);
2769 if (m_parser) 2772 if (m_parser)
2770 m_parser->stopParsing(); 2773 m_parser->stopParsing();
2771 2774
2772 if (m_loadEventProgress == LoadEventNotRun) 2775 if (m_loadEventProgress == LoadEventNotRun) {
2776 m_loadEventProgress = UnloadEventHandled;
dcheng 2016/02/03 03:13:29 This was the original fix proposed in the bug. I b
2773 return; 2777 return;
2778 }
2774 2779
2775 if (m_loadEventProgress <= UnloadEventInProgress) { 2780 if (m_loadEventProgress <= UnloadEventInProgress) {
2776 Element* currentFocusedElement = focusedElement(); 2781 Element* currentFocusedElement = focusedElement();
2777 if (isHTMLInputElement(currentFocusedElement)) 2782 if (isHTMLInputElement(currentFocusedElement))
2778 toHTMLInputElement(*currentFocusedElement).endEditing(); 2783 toHTMLInputElement(*currentFocusedElement).endEditing();
2779 if (m_loadEventProgress < PageHideInProgress) { 2784 if (m_loadEventProgress < PageHideInProgress) {
2780 m_loadEventProgress = PageHideInProgress; 2785 m_loadEventProgress = PageHideInProgress;
2781 if (LocalDOMWindow* window = domWindow()) 2786 if (LocalDOMWindow* window = domWindow())
2782 window->dispatchEvent(PageTransitionEvent::create(EventTypeNames ::pagehide, false), this); 2787 window->dispatchEvent(PageTransitionEvent::create(EventTypeNames ::pagehide, false), this);
2783 if (!m_frame) 2788 if (!m_frame)
(...skipping 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after
5950 #ifndef NDEBUG 5955 #ifndef NDEBUG
5951 using namespace blink; 5956 using namespace blink;
5952 void showLiveDocumentInstances() 5957 void showLiveDocumentInstances()
5953 { 5958 {
5954 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5959 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5955 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5960 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5956 for (Document* document : set) 5961 for (Document* document : set)
5957 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5962 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5958 } 5963 }
5959 #endif 5964 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698