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 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 if (m_frame->isMainFrame()) { | 1068 if (m_frame->isMainFrame()) { |
1069 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll
ingCoordinator()) | 1069 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll
ingCoordinator()) |
1070 scrollingCoordinator->frameViewRootLayerDidChange(view); | 1070 scrollingCoordinator->frameViewRootLayerDidChange(view); |
1071 } | 1071 } |
1072 } | 1072 } |
1073 | 1073 |
1074 // Called every time a resource is completely loaded or an error is received. | 1074 // Called every time a resource is completely loaded or an error is received. |
1075 void FrameLoader::checkLoadComplete() | 1075 void FrameLoader::checkLoadComplete() |
1076 { | 1076 { |
1077 ASSERT(client()->hasWebView()); | 1077 ASSERT(client()->hasWebView()); |
1078 if (Page* page = m_frame->page()) { | 1078 Frame* top = m_frame->tree().top(); |
1079 if (page->mainFrame()->isLocalFrame()) | 1079 if (top->isLocalFrame()) |
1080 page->deprecatedLocalMainFrame()->loader().checkLoadCompleteForThisF
rame(); | 1080 toLocalFrame(top)->loader().checkLoadCompleteForThisFrame(); |
1081 } | |
1082 } | 1081 } |
1083 | 1082 |
1084 String FrameLoader::userAgent(const KURL& url) const | 1083 String FrameLoader::userAgent(const KURL& url) const |
1085 { | 1084 { |
1086 String userAgent = client()->userAgent(url); | 1085 String userAgent = client()->userAgent(url); |
1087 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); | 1086 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); |
1088 return userAgent; | 1087 return userAgent; |
1089 } | 1088 } |
1090 | 1089 |
1091 void FrameLoader::detachFromParent() | 1090 void FrameLoader::detach() |
1092 { | 1091 { |
1093 // The caller must protect a reference to m_frame. | |
1094 ASSERT(m_frame->refCount() > 1); | |
1095 | |
1096 InspectorInstrumentation::frameDetachedFromParent(m_frame); | |
1097 | |
1098 if (m_documentLoader) | 1092 if (m_documentLoader) |
1099 m_documentLoader->detachFromFrame(); | 1093 m_documentLoader->detachFromFrame(); |
1100 m_documentLoader = nullptr; | 1094 m_documentLoader = nullptr; |
1101 | 1095 |
1102 if (!client()) | |
1103 return; | |
1104 | |
1105 // FIXME: All this code belongs up in Page. | |
1106 Frame* parent = m_frame->tree().parent(); | 1096 Frame* parent = m_frame->tree().parent(); |
1107 if (parent && parent->isLocalFrame()) { | 1097 if (parent && parent->isLocalFrame()) |
1108 m_frame->setView(nullptr); | |
1109 // FIXME: Shouldn't need to check if page() is null here. | |
1110 if (m_frame->owner() && m_frame->page()) | |
1111 m_frame->page()->decrementSubframeCount(); | |
1112 m_frame->willDetachFrameHost(); | |
1113 detachClient(); | |
1114 toLocalFrame(parent)->loader().scheduleCheckCompleted(); | 1098 toLocalFrame(parent)->loader().scheduleCheckCompleted(); |
1115 } else { | |
1116 m_frame->setView(nullptr); | |
1117 m_frame->willDetachFrameHost(); | |
1118 detachClient(); | |
1119 } | |
1120 m_frame->detachFromFrameHost(); | |
1121 } | |
1122 | |
1123 void FrameLoader::detachClient() | |
1124 { | |
1125 ASSERT(client()); | |
1126 | |
1127 // Finish all cleanup work that might require talking to the embedder. | |
1128 m_progressTracker.clear(); | 1099 m_progressTracker.clear(); |
1129 setOpener(0); | 1100 setOpener(0); |
1130 // Notify ScriptController that the frame is closing, since its cleanup ends
up calling | |
1131 // back to FrameLoaderClient via WindowProxy. | |
1132 m_frame->script().clearForClose(); | |
1133 | |
1134 // client() should never be null because that means we somehow re-entered | |
1135 // the frame detach code... but it is sometimes. | |
1136 // FIXME: Understand why this is happening so we can document this insanity. | |
1137 if (client()) { | |
1138 // After this, we must no longer talk to the client since this clears | |
1139 // its owning reference back to our owning LocalFrame. | |
1140 client()->detachedFromParent(); | |
1141 m_frame->clearClient(); | |
1142 } | |
1143 } | 1101 } |
1144 | 1102 |
1145 void FrameLoader::receivedMainResourceError(const ResourceError& error) | 1103 void FrameLoader::receivedMainResourceError(const ResourceError& error) |
1146 { | 1104 { |
1147 // Retain because the stop may release the last reference to it. | 1105 // Retain because the stop may release the last reference to it. |
1148 RefPtr<LocalFrame> protect(m_frame); | 1106 RefPtr<LocalFrame> protect(m_frame); |
1149 | 1107 |
1150 if (m_frame->document()->parser()) | 1108 if (m_frame->document()->parser()) |
1151 m_frame->document()->parser()->stopParsing(); | 1109 m_frame->document()->parser()->stopParsing(); |
1152 | 1110 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1423 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
1466 Frame* parentFrame = m_frame->tree().parent(); | 1424 Frame* parentFrame = m_frame->tree().parent(); |
1467 if (parentFrame && parentFrame->isLocalFrame()) | 1425 if (parentFrame && parentFrame->isLocalFrame()) |
1468 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1426 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
1469 if (FrameOwner* frameOwner = m_frame->owner()) | 1427 if (FrameOwner* frameOwner = m_frame->owner()) |
1470 flags |= frameOwner->sandboxFlags(); | 1428 flags |= frameOwner->sandboxFlags(); |
1471 return flags; | 1429 return flags; |
1472 } | 1430 } |
1473 | 1431 |
1474 } // namespace blink | 1432 } // namespace blink |
OLD | NEW |