Chromium Code Reviews| 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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 993 } | 993 } |
| 994 | 994 |
| 995 void FrameLoader::notifyIfInitialDocumentAccessed() | 995 void FrameLoader::notifyIfInitialDocumentAccessed() |
| 996 { | 996 { |
| 997 if (m_didAccessInitialDocumentTimer.isActive()) { | 997 if (m_didAccessInitialDocumentTimer.isActive()) { |
| 998 m_didAccessInitialDocumentTimer.stop(); | 998 m_didAccessInitialDocumentTimer.stop(); |
| 999 didAccessInitialDocumentTimerFired(0); | 999 didAccessInitialDocumentTimerFired(0); |
| 1000 } | 1000 } |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 void FrameLoader::commitProvisionalLoad() | 1003 bool FrameLoader::prepareForCommit() |
| 1004 { | 1004 { |
| 1005 ASSERT(client()->hasWebView()); | |
| 1006 PluginScriptForbiddenScope forbidPluginDestructorScripting; | 1005 PluginScriptForbiddenScope forbidPluginDestructorScripting; |
| 1007 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; | 1006 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; |
| 1008 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | |
| 1009 | |
| 1010 // Check if the destination page is allowed to access the previous page's ti ming information. | |
| 1011 if (m_frame->document()) { | |
| 1012 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->requ est().url()); | |
| 1013 pdl->timing().setHasSameOriginAsPreviousDocument(securityOrigin->canRequ est(m_frame->document()->url())); | |
| 1014 } | |
| 1015 | 1007 |
| 1016 if (m_documentLoader) { | 1008 if (m_documentLoader) { |
| 1017 client()->dispatchWillClose(); | 1009 client()->dispatchWillClose(); |
| 1018 dispatchUnloadEvent(); | 1010 dispatchUnloadEvent(); |
| 1019 } | 1011 } |
| 1020 m_frame->detachChildren(); | 1012 m_frame->detachChildren(); |
| 1021 // The previous calls to dispatchUnloadEvent() and detachChildren() can | 1013 // The previous calls to dispatchUnloadEvent() and detachChildren() can |
| 1022 // execute arbitrary script via things like unload events. If the executed | 1014 // execute arbitrary script via things like unload events. If the executed |
| 1023 // script intiates a new load or causes the current frame to be detached, | 1015 // script intiates a new load or causes the current frame to be detached, |
| 1024 // we need to abandon the current load. | 1016 // we need to abandon the current load. |
| 1025 if (pdl != m_provisionalDocumentLoader) | 1017 if (pdl != m_provisionalDocumentLoader) |
| 1026 return; | 1018 return false; |
| 1027 if (m_documentLoader) { | 1019 if (m_documentLoader) { |
| 1028 FrameNavigationDisabler navigationDisabler(m_frame); | 1020 FrameNavigationDisabler navigationDisabler(m_frame); |
| 1029 m_documentLoader->detachFromFrame(); | 1021 m_documentLoader->detachFromFrame(); |
| 1030 } | 1022 } |
| 1031 // detachFromFrame() will abort XHRs that haven't completed, which can | 1023 // detachFromFrame() will abort XHRs that haven't completed, which can |
| 1032 // trigger event listeners for 'abort'. These event listeners might detach | 1024 // trigger event listeners for 'abort'. These event listeners might detach |
| 1033 // the frame. | 1025 // the frame. |
| 1034 // TODO(dcheng): Investigate if this can be moved above the check that | 1026 // TODO(dcheng): Investigate if this can be moved above the check that |
| 1035 // m_provisionalDocumentLoader hasn't changed. | 1027 // m_provisionalDocumentLoader hasn't changed. |
| 1036 if (!m_frame->client()) | 1028 if (!m_frame->client()) |
| 1037 return; | 1029 return false; |
| 1038 // No more events will be dispatched so detach the Document. | 1030 // No more events will be dispatched so detach the Document. |
| 1039 if (m_frame->document()) | 1031 if (m_frame->document()) |
| 1040 m_frame->document()->detach(); | 1032 m_frame->document()->detach(); |
| 1041 m_documentLoader = m_provisionalDocumentLoader.release(); | 1033 m_documentLoader = m_provisionalDocumentLoader.release(); |
| 1042 | 1034 |
| 1035 return true; | |
| 1036 } | |
| 1037 | |
| 1038 void FrameLoader::commitProvisionalLoad() | |
| 1039 { | |
| 1040 ASSERT(client()->hasWebView()); | |
| 1041 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; | |
|
dcheng
2015/06/10 19:56:29
Do we still need this protector? JS events don't r
lfg
2015/06/10 22:43:35
No, we don't need it. Removed.
| |
| 1042 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | |
| 1043 | |
| 1044 // Check if the destination page is allowed to access the previous page's ti ming information. | |
| 1045 if (m_frame->document()) { | |
| 1046 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->requ est().url()); | |
| 1047 pdl->timing().setHasSameOriginAsPreviousDocument(securityOrigin->canRequ est(m_frame->document()->url())); | |
| 1048 } | |
| 1049 | |
| 1050 if (!prepareForCommit()) | |
| 1051 return; | |
| 1052 | |
| 1043 if (isLoadingMainFrame()) | 1053 if (isLoadingMainFrame()) |
| 1044 m_frame->page()->chromeClient().needTouchEvents(false); | 1054 m_frame->page()->chromeClient().needTouchEvents(false); |
| 1045 | 1055 |
| 1046 client()->transitionToCommittedForNewPage(); | 1056 client()->transitionToCommittedForNewPage(); |
| 1047 m_frame->navigationScheduler().cancel(); | 1057 m_frame->navigationScheduler().cancel(); |
| 1048 m_frame->editor().clearLastEditCommand(); | 1058 m_frame->editor().clearLastEditCommand(); |
| 1049 | 1059 |
| 1050 // If we are still in the process of initializing an empty document then | 1060 // If we are still in the process of initializing an empty document then |
| 1051 // its frame is not in a consistent state for rendering, so avoid setJSStatu sBarText | 1061 // its frame is not in a consistent state for rendering, so avoid setJSStatu sBarText |
| 1052 // since it may cause clients to attempt to render the frame. | 1062 // since it may cause clients to attempt to render the frame. |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1475 // FIXME: We need a way to propagate insecure requests policy flags to | 1485 // FIXME: We need a way to propagate insecure requests policy flags to |
| 1476 // out-of-process frames. For now, we'll always use default behavior. | 1486 // out-of-process frames. For now, we'll always use default behavior. |
| 1477 if (!parentFrame->isLocalFrame()) | 1487 if (!parentFrame->isLocalFrame()) |
| 1478 return nullptr; | 1488 return nullptr; |
| 1479 | 1489 |
| 1480 ASSERT(toLocalFrame(parentFrame)->document()); | 1490 ASSERT(toLocalFrame(parentFrame)->document()); |
| 1481 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; | 1491 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; |
| 1482 } | 1492 } |
| 1483 | 1493 |
| 1484 } // namespace blink | 1494 } // namespace blink |
| OLD | NEW |