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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2206843003: Disable navigations in the unload handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: testharness.js Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 m_currentItem->setVisualViewportScrollPoint(m_frame->host()->visualViewport( ).visibleRect().location()); 267 m_currentItem->setVisualViewportScrollPoint(m_frame->host()->visualViewport( ).visibleRect().location());
268 268
269 if (m_frame->isMainFrame()) 269 if (m_frame->isMainFrame())
270 m_currentItem->setPageScaleFactor(m_frame->page()->pageScaleFactor()); 270 m_currentItem->setPageScaleFactor(m_frame->page()->pageScaleFactor());
271 271
272 client()->didUpdateCurrentHistoryItem(); 272 client()->didUpdateCurrentHistoryItem();
273 } 273 }
274 274
275 void FrameLoader::dispatchUnloadEvent() 275 void FrameLoader::dispatchUnloadEvent()
276 { 276 {
277 NavigationCounterForUnload counter; 277 NavigationDisablerForUnload navigationDisabler;
278 278
279 // If the frame is unloading, the provisional loader should no longer be 279 // If the frame is unloading, the provisional loader should no longer be
280 // protected. It will be detached soon. 280 // protected. It will be detached soon.
281 m_protectProvisionalLoader = false; 281 m_protectProvisionalLoader = false;
282 saveScrollState(); 282 saveScrollState();
283 283
284 if (m_frame->document() && !SVGImage::isInSVGImage(m_frame->document())) 284 if (m_frame->document() && !SVGImage::isInSVGImage(m_frame->document()))
285 m_frame->document()->dispatchUnloadEvents(); 285 m_frame->document()->dispatchUnloadEvents();
286 } 286 }
287 287
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 HeapVector<Member<LocalFrame>> targetFrames; 1344 HeapVector<Member<LocalFrame>> targetFrames;
1345 targetFrames.append(m_frame); 1345 targetFrames.append(m_frame);
1346 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().traverseNext(m_frame)) { 1346 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().traverseNext(m_frame)) {
1347 // FIXME: There is not yet any way to dispatch events to out-of-process frames. 1347 // FIXME: There is not yet any way to dispatch events to out-of-process frames.
1348 if (child->isLocalFrame()) 1348 if (child->isLocalFrame())
1349 targetFrames.append(toLocalFrame(child)); 1349 targetFrames.append(toLocalFrame(child));
1350 } 1350 }
1351 1351
1352 bool shouldClose = false; 1352 bool shouldClose = false;
1353 { 1353 {
1354 NavigationDisablerForBeforeUnload navigationDisabler; 1354 NavigationDisablerForUnload navigationDisabler;
1355 size_t i; 1355 size_t i;
1356 1356
1357 bool didAllowNavigation = false; 1357 bool didAllowNavigation = false;
1358 for (i = 0; i < targetFrames.size(); i++) { 1358 for (i = 0; i < targetFrames.size(); i++) {
1359 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) 1359 if (!targetFrames[i]->tree().isDescendantOf(m_frame))
1360 continue; 1360 continue;
1361 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch romeClient(), isReload, didAllowNavigation)) 1361 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch romeClient(), isReload, didAllowNavigation))
1362 break; 1362 break;
1363 } 1363 }
1364 1364
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String()); 1619 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String());
1620 return tracedValue; 1620 return tracedValue;
1621 } 1621 }
1622 1622
1623 inline void FrameLoader::takeObjectSnapshot() const 1623 inline void FrameLoader::takeObjectSnapshot() const
1624 { 1624 {
1625 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value()); 1625 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value());
1626 } 1626 }
1627 1627
1628 } // namespace blink 1628 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | third_party/WebKit/Source/core/loader/NavigationScheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698