| 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 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 } | 1101 } |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 String FrameLoader::userAgent(const KURL& url) const | 1104 String FrameLoader::userAgent(const KURL& url) const |
| 1105 { | 1105 { |
| 1106 String userAgent = client()->userAgent(url); | 1106 String userAgent = client()->userAgent(url); |
| 1107 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); | 1107 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); |
| 1108 return userAgent; | 1108 return userAgent; |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 void FrameLoader::detachFromParent() | 1111 void FrameLoader::detach() |
| 1112 { | 1112 { |
| 1113 #if !ENABLE(OILPAN) | 1113 #if !ENABLE(OILPAN) |
| 1114 // The caller must protect a reference to m_frame. | 1114 // The caller must protect a reference to m_frame. |
| 1115 ASSERT(m_frame->refCount() > 1); | 1115 ASSERT(m_frame->refCount() > 1); |
| 1116 #endif | 1116 #endif |
| 1117 | |
| 1118 InspectorInstrumentation::frameDetachedFromParent(m_frame); | |
| 1119 | |
| 1120 if (m_documentLoader) | 1117 if (m_documentLoader) |
| 1121 m_documentLoader->detachFromFrame(); | 1118 m_documentLoader->detachFromFrame(); |
| 1122 m_documentLoader = nullptr; | 1119 m_documentLoader = nullptr; |
| 1123 | 1120 |
| 1124 if (!client()) | |
| 1125 return; | |
| 1126 | |
| 1127 // FIXME: All this code belongs up in Page. | |
| 1128 Frame* parent = m_frame->tree().parent(); | 1121 Frame* parent = m_frame->tree().parent(); |
| 1129 if (parent && parent->isLocalFrame()) { | 1122 if (parent && parent->isLocalFrame()) |
| 1130 m_frame->setView(nullptr); | |
| 1131 // FIXME: Shouldn't need to check if page() is null here. | |
| 1132 if (m_frame->owner() && m_frame->page()) | |
| 1133 m_frame->page()->decrementSubframeCount(); | |
| 1134 m_frame->willDetachFrameHost(); | |
| 1135 detachClient(); | |
| 1136 toLocalFrame(parent)->loader().scheduleCheckCompleted(); | 1123 toLocalFrame(parent)->loader().scheduleCheckCompleted(); |
| 1137 } else { | |
| 1138 m_frame->setView(nullptr); | |
| 1139 m_frame->willDetachFrameHost(); | |
| 1140 detachClient(); | |
| 1141 } | |
| 1142 m_frame->detachFromFrameHost(); | |
| 1143 } | |
| 1144 | |
| 1145 void FrameLoader::detachClient() | |
| 1146 { | |
| 1147 ASSERT(client()); | |
| 1148 | |
| 1149 // Finish all cleanup work that might require talking to the embedder. | |
| 1150 m_progressTracker->dispose(); | 1124 m_progressTracker->dispose(); |
| 1151 m_progressTracker.clear(); | 1125 m_progressTracker.clear(); |
| 1152 setOpener(0); | 1126 setOpener(0); |
| 1153 // Notify ScriptController that the frame is closing, since its cleanup ends
up calling | |
| 1154 // back to FrameLoaderClient via WindowProxy. | |
| 1155 m_frame->script().clearForClose(); | |
| 1156 | |
| 1157 // client() should never be null because that means we somehow re-entered | |
| 1158 // the frame detach code... but it is sometimes. | |
| 1159 // FIXME: Understand why this is happening so we can document this insanity. | |
| 1160 if (client()) { | |
| 1161 // After this, we must no longer talk to the client since this clears | |
| 1162 // its owning reference back to our owning LocalFrame. | |
| 1163 client()->detachedFromParent(); | |
| 1164 m_frame->clearClient(); | |
| 1165 } | |
| 1166 } | 1127 } |
| 1167 | 1128 |
| 1168 void FrameLoader::receivedMainResourceError(const ResourceError& error) | 1129 void FrameLoader::receivedMainResourceError(const ResourceError& error) |
| 1169 { | 1130 { |
| 1170 // Retain because the stop may release the last reference to it. | 1131 // Retain because the stop may release the last reference to it. |
| 1171 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 1132 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
| 1172 | 1133 |
| 1173 if (m_frame->document()->parser()) | 1134 if (m_frame->document()->parser()) |
| 1174 m_frame->document()->parser()->stopParsing(); | 1135 m_frame->document()->parser()->stopParsing(); |
| 1175 | 1136 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 // 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. |
| 1480 Frame* parentFrame = m_frame->tree().parent(); | 1441 Frame* parentFrame = m_frame->tree().parent(); |
| 1481 if (parentFrame && parentFrame->isLocalFrame()) | 1442 if (parentFrame && parentFrame->isLocalFrame()) |
| 1482 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1443 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
| 1483 if (FrameOwner* frameOwner = m_frame->owner()) | 1444 if (FrameOwner* frameOwner = m_frame->owner()) |
| 1484 flags |= frameOwner->sandboxFlags(); | 1445 flags |= frameOwner->sandboxFlags(); |
| 1485 return flags; | 1446 return flags; |
| 1486 } | 1447 } |
| 1487 | 1448 |
| 1488 } // namespace blink | 1449 } // namespace blink |
| OLD | NEW |