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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 RefPtrWillBeRawPtr<DocumentLoader> documentLoader(m_frame->document()->loade
r()); | 322 RefPtrWillBeRawPtr<DocumentLoader> documentLoader(m_frame->document()->loade
r()); |
323 | 323 |
324 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc
riptURL); | 324 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc
riptURL); |
325 | 325 |
326 // Prepare a DocumentInit before clearing the frame, because it may need to | 326 // Prepare a DocumentInit before clearing the frame, because it may need to |
327 // inherit an aliased security context. | 327 // inherit an aliased security context. |
328 DocumentInit init(m_frame->document()->url(), m_frame); | 328 DocumentInit init(m_frame->document()->url(), m_frame); |
329 init.withNewRegistrationContext(); | 329 init.withNewRegistrationContext(); |
330 | 330 |
331 stopAllLoaders(); | 331 stopAllLoaders(); |
| 332 // Don't allow any new child frames to load in this frame: attaching a new |
| 333 // child frame during or after detaching children results in an attached |
| 334 // frame on a detached DOM tree, which is bad. |
| 335 SubframeLoadingDisabler disabler(m_frame->document()); |
332 m_frame->detachChildren(); | 336 m_frame->detachChildren(); |
333 m_frame->document()->detach(); | 337 m_frame->document()->detach(); |
334 clear(); | 338 clear(); |
335 | 339 |
336 // detachChildren() potentially detaches the frame from the document. The | 340 // detachChildren() potentially detaches the frame from the document. The |
337 // loading cannot continue in that case. | 341 // loading cannot continue in that case. |
338 if (!m_frame->page()) | 342 if (!m_frame->page()) |
339 return; | 343 return; |
340 | 344 |
341 client()->transitionToCommittedForNewPage(); | 345 client()->transitionToCommittedForNewPage(); |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 int nodeCount = static_cast<int>(totalNodeCount); | 1039 int nodeCount = static_cast<int>(totalNodeCount); |
1036 for (Document* document : Document::liveDocumentSet()) { | 1040 for (Document* document : Document::liveDocumentSet()) { |
1037 if (document != m_frame->document()) | 1041 if (document != m_frame->document()) |
1038 nodeCount -= document->nodeCount(); | 1042 nodeCount -= document->nodeCount(); |
1039 } | 1043 } |
1040 ASSERT(nodeCount >= 0); | 1044 ASSERT(nodeCount >= 0); |
1041 float ratio = static_cast<float>(nodeCount) / totalNodeCount; | 1045 float ratio = static_cast<float>(nodeCount) / totalNodeCount; |
1042 ThreadState::current()->schedulePageNavigationGCIfNeeded(ratio); | 1046 ThreadState::current()->schedulePageNavigationGCIfNeeded(ratio); |
1043 } | 1047 } |
1044 | 1048 |
| 1049 // Don't allow any new child frames to load in this frame: attaching a new |
| 1050 // child frame during or after detaching children results in an attached |
| 1051 // frame on a detached DOM tree, which is bad. |
| 1052 SubframeLoadingDisabler disabler(m_frame->document()); |
1045 if (m_documentLoader) { | 1053 if (m_documentLoader) { |
1046 client()->dispatchWillClose(); | 1054 client()->dispatchWillClose(); |
1047 dispatchUnloadEvent(); | 1055 dispatchUnloadEvent(); |
1048 } | 1056 } |
1049 m_frame->detachChildren(); | 1057 m_frame->detachChildren(); |
1050 // The previous calls to dispatchUnloadEvent() and detachChildren() can | 1058 // The previous calls to dispatchUnloadEvent() and detachChildren() can |
1051 // execute arbitrary script via things like unload events. If the executed | 1059 // execute arbitrary script via things like unload events. If the executed |
1052 // script intiates a new load or causes the current frame to be detached, | 1060 // script intiates a new load or causes the current frame to be detached, |
1053 // we need to abandon the current load. | 1061 // we need to abandon the current load. |
1054 if (pdl != m_provisionalDocumentLoader) | 1062 if (pdl != m_provisionalDocumentLoader) |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 // FIXME: We need a way to propagate insecure requests policy flags to | 1558 // FIXME: We need a way to propagate insecure requests policy flags to |
1551 // out-of-process frames. For now, we'll always use default behavior. | 1559 // out-of-process frames. For now, we'll always use default behavior. |
1552 if (!parentFrame->isLocalFrame()) | 1560 if (!parentFrame->isLocalFrame()) |
1553 return nullptr; | 1561 return nullptr; |
1554 | 1562 |
1555 ASSERT(toLocalFrame(parentFrame)->document()); | 1563 ASSERT(toLocalFrame(parentFrame)->document()); |
1556 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1564 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
1557 } | 1565 } |
1558 | 1566 |
1559 } // namespace blink | 1567 } // namespace blink |
OLD | NEW |