| 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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 client()->dispatchWillClose(); | 965 client()->dispatchWillClose(); |
| 966 dispatchUnloadEvent(); | 966 dispatchUnloadEvent(); |
| 967 } | 967 } |
| 968 m_frame->detachChildren(); | 968 m_frame->detachChildren(); |
| 969 // The previous calls to dispatchUnloadEvent() and detachChildren() can | 969 // The previous calls to dispatchUnloadEvent() and detachChildren() can |
| 970 // execute arbitrary script via things like unload events. If the executed | 970 // execute arbitrary script via things like unload events. If the executed |
| 971 // script intiates a new load or causes the current frame to be detached, | 971 // script intiates a new load or causes the current frame to be detached, |
| 972 // we need to abandon the current load. | 972 // we need to abandon the current load. |
| 973 if (pdl != m_provisionalDocumentLoader) | 973 if (pdl != m_provisionalDocumentLoader) |
| 974 return; | 974 return; |
| 975 if (m_documentLoader) | 975 if (m_documentLoader) { |
| 976 FrameNavigationDisabler navigationDisabler(m_frame); |
| 976 m_documentLoader->detachFromFrame(); | 977 m_documentLoader->detachFromFrame(); |
| 978 } |
| 977 // detachFromFrame() will abort XHRs that haven't completed, which can | 979 // detachFromFrame() will abort XHRs that haven't completed, which can |
| 978 // trigger event listeners for 'abort'. These event listeners might detach | 980 // trigger event listeners for 'abort'. These event listeners might detach |
| 979 // the frame. | 981 // the frame. |
| 980 // TODO(dcheng): Investigate if this can be moved above the check that | 982 // TODO(dcheng): Investigate if this can be moved above the check that |
| 981 // m_provisionalDocumentLoader hasn't changed. | 983 // m_provisionalDocumentLoader hasn't changed. |
| 982 if (!m_frame->client()) | 984 if (!m_frame->client()) |
| 983 return; | 985 return; |
| 984 // No more events will be dispatched so detach the Document. | 986 // No more events will be dispatched so detach the Document. |
| 985 if (m_frame->document()) | 987 if (m_frame->document()) |
| 986 m_frame->document()->detach(); | 988 m_frame->document()->detach(); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 WillBeHeapVector<RefPtrWillBeMember<LocalFrame>> targetFrames; | 1170 WillBeHeapVector<RefPtrWillBeMember<LocalFrame>> targetFrames; |
| 1169 targetFrames.append(m_frame); | 1171 targetFrames.append(m_frame); |
| 1170 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().traverseNext(m_frame)) { | 1172 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().traverseNext(m_frame)) { |
| 1171 // FIXME: There is not yet any way to dispatch events to out-of-process
frames. | 1173 // FIXME: There is not yet any way to dispatch events to out-of-process
frames. |
| 1172 if (child->isLocalFrame()) | 1174 if (child->isLocalFrame()) |
| 1173 targetFrames.append(toLocalFrame(child)); | 1175 targetFrames.append(toLocalFrame(child)); |
| 1174 } | 1176 } |
| 1175 | 1177 |
| 1176 bool shouldClose = false; | 1178 bool shouldClose = false; |
| 1177 { | 1179 { |
| 1178 NavigationDisablerForBeforeUnload navigationDisabler; | 1180 NavigationDisabler navigationDisabler; |
| 1179 size_t i; | 1181 size_t i; |
| 1180 | 1182 |
| 1181 bool didAllowNavigation = false; | 1183 bool didAllowNavigation = false; |
| 1182 for (i = 0; i < targetFrames.size(); i++) { | 1184 for (i = 0; i < targetFrames.size(); i++) { |
| 1183 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) | 1185 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) |
| 1184 continue; | 1186 continue; |
| 1185 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch
romeClient(), didAllowNavigation)) | 1187 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch
romeClient(), didAllowNavigation)) |
| 1186 break; | 1188 break; |
| 1187 } | 1189 } |
| 1188 | 1190 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 // FIXME: We need a way to propagate insecure requests policy flags to | 1439 // FIXME: We need a way to propagate insecure requests policy flags to |
| 1438 // out-of-process frames. For now, we'll always use default behavior. | 1440 // out-of-process frames. For now, we'll always use default behavior. |
| 1439 if (!parentFrame->isLocalFrame()) | 1441 if (!parentFrame->isLocalFrame()) |
| 1440 return nullptr; | 1442 return nullptr; |
| 1441 | 1443 |
| 1442 ASSERT(toLocalFrame(parentFrame)->document()); | 1444 ASSERT(toLocalFrame(parentFrame)->document()); |
| 1443 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1445 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
| 1444 } | 1446 } |
| 1445 | 1447 |
| 1446 } // namespace blink | 1448 } // namespace blink |
| OLD | NEW |