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

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

Issue 703383002: Prevent firing BeforeUnloadEvents re-entrantly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/misc/resources/reentrant-beforeunload-helper.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 } 2574 }
2575 2575
2576 bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, bool& didAllowNavigatio n) 2576 bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, bool& didAllowNavigatio n)
2577 { 2577 {
2578 if (!m_domWindow) 2578 if (!m_domWindow)
2579 return true; 2579 return true;
2580 2580
2581 if (!body()) 2581 if (!body())
2582 return true; 2582 return true;
2583 2583
2584 if (processingBeforeUnload())
2585 return false;
2586
2584 RefPtrWillBeRawPtr<Document> protect(this); 2587 RefPtrWillBeRawPtr<Document> protect(this);
2585 2588
2586 RefPtrWillBeRawPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent: :create(); 2589 RefPtrWillBeRawPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent: :create();
2587 m_loadEventProgress = BeforeUnloadEventInProgress; 2590 m_loadEventProgress = BeforeUnloadEventInProgress;
2588 m_domWindow->dispatchEvent(beforeUnloadEvent.get(), this); 2591 m_domWindow->dispatchEvent(beforeUnloadEvent.get(), this);
2589 m_loadEventProgress = BeforeUnloadEventCompleted; 2592 m_loadEventProgress = BeforeUnloadEventCompleted;
2590 if (!beforeUnloadEvent->defaultPrevented()) 2593 if (!beforeUnloadEvent->defaultPrevented())
2591 defaultEventHandler(beforeUnloadEvent.get()); 2594 defaultEventHandler(beforeUnloadEvent.get());
2592 if (beforeUnloadEvent->returnValue().isNull()) 2595 if (beforeUnloadEvent->returnValue().isNull())
2593 return true; 2596 return true;
(...skipping 3228 matching lines...) Expand 10 before | Expand all | Expand 10 after
5822 #ifndef NDEBUG 5825 #ifndef NDEBUG
5823 using namespace blink; 5826 using namespace blink;
5824 void showLiveDocumentInstances() 5827 void showLiveDocumentInstances()
5825 { 5828 {
5826 WeakDocumentSet& set = liveDocumentSet(); 5829 WeakDocumentSet& set = liveDocumentSet();
5827 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5830 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5828 for (Document* document : set) 5831 for (Document* document : set)
5829 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5832 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5830 } 5833 }
5831 #endif 5834 #endif
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/misc/resources/reentrant-beforeunload-helper.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698