| OLD | NEW |
| 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 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 // Store all references to each subframe in advance since beforeunload's eve
nt handler may modify frame | 1344 // Store all references to each subframe in advance since beforeunload's eve
nt handler may modify frame |
| 1345 HeapVector<Member<LocalFrame>> targetFrames; | 1345 HeapVector<Member<LocalFrame>> targetFrames; |
| 1346 targetFrames.append(m_frame); | 1346 targetFrames.append(m_frame); |
| 1347 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().traverseNext(m_frame)) { | 1347 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().traverseNext(m_frame)) { |
| 1348 // FIXME: There is not yet any way to dispatch events to out-of-process
frames. | 1348 // FIXME: There is not yet any way to dispatch events to out-of-process
frames. |
| 1349 if (child->isLocalFrame()) | 1349 if (child->isLocalFrame()) |
| 1350 targetFrames.append(toLocalFrame(child)); | 1350 targetFrames.append(toLocalFrame(child)); |
| 1351 } | 1351 } |
| 1352 | 1352 |
| 1353 bool shouldClose = false; | 1353 bool shouldClose = false; |
| 1354 bool eventListenerCalled = false; |
| 1354 { | 1355 { |
| 1355 NavigationDisablerForBeforeUnload navigationDisabler; | 1356 NavigationDisablerForBeforeUnload navigationDisabler; |
| 1356 size_t i; | 1357 size_t i; |
| 1357 | 1358 |
| 1358 bool didAllowNavigation = false; | 1359 bool didAllowNavigation = false; |
| 1359 for (i = 0; i < targetFrames.size(); i++) { | 1360 for (i = 0; i < targetFrames.size(); i++) { |
| 1360 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) | 1361 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) |
| 1361 continue; | 1362 continue; |
| 1362 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch
romeClient(), isReload, didAllowNavigation)) | 1363 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch
romeClient(), isReload, didAllowNavigation, eventListenerCalled)) |
| 1363 break; | 1364 break; |
| 1364 } | 1365 } |
| 1365 | 1366 |
| 1366 if (i == targetFrames.size()) | 1367 if (i == targetFrames.size()) |
| 1367 shouldClose = true; | 1368 shouldClose = true; |
| 1368 } | 1369 } |
| 1369 | 1370 |
| 1371 if (shouldClose) { |
| 1372 for (size_t i = 0; i < targetFrames.size(); ++i) { |
| 1373 if (auto* client = targetFrames[i]->loader().client()) |
| 1374 client->dispatchDidHandleOnBeforeUnloadEvent(eventListenerCalled
); |
| 1375 } |
| 1376 } |
| 1377 |
| 1370 return shouldClose; | 1378 return shouldClose; |
| 1371 } | 1379 } |
| 1372 | 1380 |
| 1373 bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque
st, const SubstituteData& substituteData, | 1381 bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque
st, const SubstituteData& substituteData, |
| 1374 DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorl
dContentSecurityPolicy, | 1382 DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorl
dContentSecurityPolicy, |
| 1375 NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryIte
m, bool isClientRedirect) | 1383 NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryIte
m, bool isClientRedirect) |
| 1376 { | 1384 { |
| 1377 // Don't ask if we are loading an empty URL. | 1385 // Don't ask if we are loading an empty URL. |
| 1378 if (request.url().isEmpty() || substituteData.isValid()) | 1386 if (request.url().isEmpty() || substituteData.isValid()) |
| 1379 return true; | 1387 return true; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa
der->url() : String()); | 1626 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa
der->url() : String()); |
| 1619 return tracedValue; | 1627 return tracedValue; |
| 1620 } | 1628 } |
| 1621 | 1629 |
| 1622 inline void FrameLoader::takeObjectSnapshot() const | 1630 inline void FrameLoader::takeObjectSnapshot() const |
| 1623 { | 1631 { |
| 1624 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced
Value()); | 1632 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced
Value()); |
| 1625 } | 1633 } |
| 1626 | 1634 |
| 1627 } // namespace blink | 1635 } // namespace blink |
| OLD | NEW |