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 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1081 if (m_frame->isMainFrame()) { | 1081 if (m_frame->isMainFrame()) { |
1082 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) | 1082 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) |
1083 scrollingCoordinator->frameViewRootLayerDidChange(view); | 1083 scrollingCoordinator->frameViewRootLayerDidChange(view); |
1084 } | 1084 } |
1085 } | 1085 } |
1086 | 1086 |
1087 // Called every time a resource is completely loaded or an error is received. | 1087 // Called every time a resource is completely loaded or an error is received. |
1088 void FrameLoader::checkLoadComplete() | 1088 void FrameLoader::checkLoadComplete() |
1089 { | 1089 { |
1090 ASSERT(client()->hasWebView()); | 1090 ASSERT(client()->hasWebView()); |
1091 if (Page* page = m_frame->page()) { | 1091 Frame* top = m_frame->tree().top(); |
dcheng
2014/09/25 23:35:43
Was this a necessary change or just a cleanup chan
Nate Chapin
2014/09/25 23:57:50
I think it might have been necessary as a result o
| |
1092 if (page->mainFrame()->isLocalFrame()) | 1092 if (top->isLocalFrame()) |
1093 page->deprecatedLocalMainFrame()->loader().checkLoadCompleteForThisF rame(); | 1093 toLocalFrame(top)->loader().checkLoadCompleteForThisFrame(); |
1094 } | |
1095 } | 1094 } |
1096 | 1095 |
1097 String FrameLoader::userAgent(const KURL& url) const | 1096 String FrameLoader::userAgent(const KURL& url) const |
1098 { | 1097 { |
1099 String userAgent = client()->userAgent(url); | 1098 String userAgent = client()->userAgent(url); |
1100 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); | 1099 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); |
1101 return userAgent; | 1100 return userAgent; |
1102 } | 1101 } |
1103 | 1102 |
1104 void FrameLoader::detachFromParent() | 1103 void FrameLoader::detach() |
1105 { | 1104 { |
1106 #if !ENABLE(OILPAN) | 1105 #if !ENABLE(OILPAN) |
1107 // The caller must protect a reference to m_frame. | 1106 // The caller must protect a reference to m_frame. |
1108 ASSERT(m_frame->refCount() > 1); | 1107 ASSERT(m_frame->refCount() > 1); |
1109 #endif | 1108 #endif |
1110 | |
1111 InspectorInstrumentation::frameDetachedFromParent(m_frame); | |
1112 | |
1113 if (m_documentLoader) | 1109 if (m_documentLoader) |
1114 m_documentLoader->detachFromFrame(); | 1110 m_documentLoader->detachFromFrame(); |
1115 m_documentLoader = nullptr; | 1111 m_documentLoader = nullptr; |
1116 | 1112 |
1117 if (!client()) | |
1118 return; | |
1119 | |
1120 // FIXME: All this code belongs up in Page. | |
1121 Frame* parent = m_frame->tree().parent(); | 1113 Frame* parent = m_frame->tree().parent(); |
1122 if (parent && parent->isLocalFrame()) { | 1114 if (parent && parent->isLocalFrame()) |
1123 m_frame->setView(nullptr); | |
1124 // FIXME: Shouldn't need to check if page() is null here. | |
1125 if (m_frame->owner() && m_frame->page()) | |
1126 m_frame->page()->decrementSubframeCount(); | |
1127 m_frame->willDetachFrameHost(); | |
1128 detachClient(); | |
1129 toLocalFrame(parent)->loader().scheduleCheckCompleted(); | 1115 toLocalFrame(parent)->loader().scheduleCheckCompleted(); |
1130 } else { | |
1131 m_frame->setView(nullptr); | |
1132 m_frame->willDetachFrameHost(); | |
1133 detachClient(); | |
1134 } | |
1135 m_frame->detachFromFrameHost(); | |
1136 } | |
1137 | |
1138 void FrameLoader::detachClient() | |
1139 { | |
1140 ASSERT(client()); | |
1141 | |
1142 // Finish all cleanup work that might require talking to the embedder. | |
1143 m_progressTracker.clear(); | 1116 m_progressTracker.clear(); |
1144 setOpener(0); | 1117 setOpener(0); |
1145 // Notify ScriptController that the frame is closing, since its cleanup ends up calling | |
1146 // back to FrameLoaderClient via WindowProxy. | |
1147 m_frame->script().clearForClose(); | |
1148 | |
1149 // client() should never be null because that means we somehow re-entered | |
1150 // the frame detach code... but it is sometimes. | |
1151 // FIXME: Understand why this is happening so we can document this insanity. | |
1152 if (client()) { | |
1153 // After this, we must no longer talk to the client since this clears | |
1154 // its owning reference back to our owning LocalFrame. | |
1155 client()->detachedFromParent(); | |
1156 m_frame->clearClient(); | |
1157 } | |
1158 } | 1118 } |
1159 | 1119 |
1160 void FrameLoader::receivedMainResourceError(const ResourceError& error) | 1120 void FrameLoader::receivedMainResourceError(const ResourceError& error) |
1161 { | 1121 { |
1162 // Retain because the stop may release the last reference to it. | 1122 // Retain because the stop may release the last reference to it. |
1163 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 1123 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
1164 | 1124 |
1165 if (m_frame->document()->parser()) | 1125 if (m_frame->document()->parser()) |
1166 m_frame->document()->parser()->stopParsing(); | 1126 m_frame->document()->parser()->stopParsing(); |
1167 | 1127 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1480 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1440 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
1481 Frame* parentFrame = m_frame->tree().parent(); | 1441 Frame* parentFrame = m_frame->tree().parent(); |
1482 if (parentFrame && parentFrame->isLocalFrame()) | 1442 if (parentFrame && parentFrame->isLocalFrame()) |
1483 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1443 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
1484 if (FrameOwner* frameOwner = m_frame->owner()) | 1444 if (FrameOwner* frameOwner = m_frame->owner()) |
1485 flags |= frameOwner->sandboxFlags(); | 1445 flags |= frameOwner->sandboxFlags(); |
1486 return flags; | 1446 return flags; |
1487 } | 1447 } |
1488 | 1448 |
1489 } // namespace blink | 1449 } // namespace blink |
OLD | NEW |