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

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

Issue 22893051: Add support for BeforeUnloadEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix test failures Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/BeforeUnloadEvent.idl ('k') | Source/core/dom/Event.h » ('j') | 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 2323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 return true; 2334 return true;
2335 2335
2336 RefPtr<Document> protect(this); 2336 RefPtr<Document> protect(this);
2337 2337
2338 RefPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent::create(); 2338 RefPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent::create();
2339 m_loadEventProgress = BeforeUnloadEventInProgress; 2339 m_loadEventProgress = BeforeUnloadEventInProgress;
2340 dispatchWindowEvent(beforeUnloadEvent.get(), this); 2340 dispatchWindowEvent(beforeUnloadEvent.get(), this);
2341 m_loadEventProgress = BeforeUnloadEventCompleted; 2341 m_loadEventProgress = BeforeUnloadEventCompleted;
2342 if (!beforeUnloadEvent->defaultPrevented()) 2342 if (!beforeUnloadEvent->defaultPrevented())
2343 defaultEventHandler(beforeUnloadEvent.get()); 2343 defaultEventHandler(beforeUnloadEvent.get());
2344 if (beforeUnloadEvent->result().isNull()) 2344 if (beforeUnloadEvent->returnValue().isNull())
2345 return true; 2345 return true;
2346 2346
2347 if (navigatingDocument->m_didAllowNavigationViaBeforeUnloadConfirmationPanel ) { 2347 if (navigatingDocument->m_didAllowNavigationViaBeforeUnloadConfirmationPanel ) {
2348 addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt t o show multiple 'beforeunload' confirmation panels for a single navigation."); 2348 addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt t o show multiple 'beforeunload' confirmation panels for a single navigation.");
2349 return true; 2349 return true;
2350 } 2350 }
2351 2351
2352 String text = displayStringModifiedByEncoding(beforeUnloadEvent->result()); 2352 String text = displayStringModifiedByEncoding(beforeUnloadEvent->returnValue ());
2353 if (chrome.runBeforeUnloadConfirmPanel(text, m_frame)) { 2353 if (chrome.runBeforeUnloadConfirmPanel(text, m_frame)) {
2354 navigatingDocument->m_didAllowNavigationViaBeforeUnloadConfirmationPanel = true; 2354 navigatingDocument->m_didAllowNavigationViaBeforeUnloadConfirmationPanel = true;
2355 return true; 2355 return true;
2356 } 2356 }
2357 return false; 2357 return false;
2358 } 2358 }
2359 2359
2360 void Document::dispatchUnloadEvents() 2360 void Document::dispatchUnloadEvents()
2361 { 2361 {
2362 RefPtr<Document> protect(this); 2362 RefPtr<Document> protect(this);
(...skipping 2931 matching lines...) Expand 10 before | Expand all | Expand 10 after
5294 { 5294 {
5295 return DocumentLifecycleNotifier::create(this); 5295 return DocumentLifecycleNotifier::create(this);
5296 } 5296 }
5297 5297
5298 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5298 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5299 { 5299 {
5300 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5300 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5301 } 5301 }
5302 5302
5303 } // namespace WebCore 5303 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/BeforeUnloadEvent.idl ('k') | Source/core/dom/Event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698