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