| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 if (page == exclusion || page->defersLoading()) | 36 if (page == exclusion || page->defersLoading()) |
| 37 continue; | 37 continue; |
| 38 | 38 |
| 39 if (page->mainFrame()->isLocalFrame()) { | 39 if (page->mainFrame()->isLocalFrame()) { |
| 40 m_deferredFrames.append(page->deprecatedLocalMainFrame()); | 40 m_deferredFrames.append(page->deprecatedLocalMainFrame()); |
| 41 | 41 |
| 42 // Ensure that we notify the client if the initial empty document is
accessed before | 42 // Ensure that we notify the client if the initial empty document is
accessed before |
| 43 // showing anything modal, to prevent spoofs while the modal window
or sheet is visible. | 43 // showing anything modal, to prevent spoofs while the modal window
or sheet is visible. |
| 44 page->deprecatedLocalMainFrame()->loader().notifyIfInitialDocumentAc
cessed(); | 44 page->deprecatedLocalMainFrame()->loader().notifyIfInitialDocumentAc
cessed(); |
| 45 } | 45 } |
| 46 | |
| 47 // This code is not logically part of load deferring, but we do not want
JS code executed | |
| 48 // beneath modal windows or sheets, which is exactly when ScopedPageLoad
Deferrer is used. | |
| 49 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().trav
erseNext()) { | |
| 50 if (frame->isLocalFrame()) | |
| 51 toLocalFrame(frame)->document()->suspendScheduledTasks(); | |
| 52 } | |
| 53 } | 46 } |
| 54 | 47 |
| 55 size_t count = m_deferredFrames.size(); | 48 size_t count = m_deferredFrames.size(); |
| 56 for (size_t i = 0; i < count; ++i) { | 49 for (size_t i = 0; i < count; ++i) { |
| 57 if (Page* page = m_deferredFrames[i]->page()) | 50 if (Page* page = m_deferredFrames[i]->page()) |
| 58 page->setDefersLoading(true); | 51 page->setDefersLoading(true); |
| 59 } | 52 } |
| 60 } | 53 } |
| 61 | 54 |
| 62 void ScopedPageLoadDeferrer::detach() | 55 void ScopedPageLoadDeferrer::detach() |
| 63 { | 56 { |
| 64 for (size_t i = 0; i < m_deferredFrames.size(); ++i) { | 57 for (size_t i = 0; i < m_deferredFrames.size(); ++i) { |
| 65 if (Page* page = m_deferredFrames[i]->page()) { | 58 if (Page* page = m_deferredFrames[i]->page()) |
| 66 page->setDefersLoading(false); | 59 page->setDefersLoading(false); |
| 67 | |
| 68 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().
traverseNext()) { | |
| 69 if (frame->isLocalFrame()) | |
| 70 toLocalFrame(frame)->document()->resumeScheduledTasks(); | |
| 71 } | |
| 72 } | |
| 73 } | 60 } |
| 74 } | 61 } |
| 75 | 62 |
| 76 #if ENABLE(OILPAN) | 63 #if ENABLE(OILPAN) |
| 77 void ScopedPageLoadDeferrer::dispose() | 64 void ScopedPageLoadDeferrer::dispose() |
| 78 { | 65 { |
| 79 detach(); | 66 detach(); |
| 80 m_deferredFrames.clear(); | 67 m_deferredFrames.clear(); |
| 81 } | 68 } |
| 82 #endif | 69 #endif |
| 83 | 70 |
| 84 ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer() | 71 ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer() |
| 85 { | 72 { |
| 86 detach(); | 73 detach(); |
| 87 } | 74 } |
| 88 | 75 |
| 89 void ScopedPageLoadDeferrer::trace(Visitor* visitor) | 76 void ScopedPageLoadDeferrer::trace(Visitor* visitor) |
| 90 { | 77 { |
| 91 #if ENABLE(OILPAN) | 78 #if ENABLE(OILPAN) |
| 92 visitor->trace(m_deferredFrames); | 79 visitor->trace(m_deferredFrames); |
| 93 #endif | 80 #endif |
| 94 } | 81 } |
| 95 | 82 |
| 96 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |