Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 if (page == exclusion || page->defersLoading()) | 39 if (page == exclusion || page->defersLoading()) |
| 40 continue; | 40 continue; |
| 41 | 41 |
| 42 if (page->mainFrame()->isLocalFrame()) { | 42 if (page->mainFrame()->isLocalFrame()) { |
| 43 m_deferredFrames.append(page->deprecatedLocalMainFrame()); | 43 m_deferredFrames.append(page->deprecatedLocalMainFrame()); |
| 44 | 44 |
| 45 // Ensure that we notify the client if the initial empty document is accessed before | 45 // Ensure that we notify the client if the initial empty document is accessed before |
| 46 // showing anything modal, to prevent spoofs while the modal window or sheet is visible. | 46 // showing anything modal, to prevent spoofs while the modal window or sheet is visible. |
| 47 page->deprecatedLocalMainFrame()->loader().notifyIfInitialDocumentAc cessed(); | 47 page->deprecatedLocalMainFrame()->loader().notifyIfInitialDocumentAc cessed(); |
| 48 } | 48 } |
| 49 | |
| 50 // This code is not logically part of load deferring, but we do not want JS code executed | |
| 51 // beneath modal windows or sheets, which is exactly when ScopedPageLoad Deferrer is used. | |
| 52 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().trav erseNext()) { | |
| 53 if (frame->isLocalFrame()) | |
| 54 toLocalFrame(frame)->document()->suspendScheduledTasks(); | |
|
João Eiras
2014/10/06 12:14:31
I moved this code into FrameLoader::setDefersLoadi
| |
| 55 } | |
| 56 } | 49 } |
| 57 | 50 |
| 58 size_t count = m_deferredFrames.size(); | 51 size_t count = m_deferredFrames.size(); |
| 59 for (size_t i = 0; i < count; ++i) { | 52 for (size_t i = 0; i < count; ++i) { |
| 60 if (Page* page = m_deferredFrames[i]->page()) | 53 if (Page* page = m_deferredFrames[i]->page()) |
| 61 page->setDefersLoading(true); | 54 page->setDefersLoading(true); |
| 62 } | 55 } |
| 63 } | 56 } |
| 64 | 57 |
| 65 void ScopedPageLoadDeferrer::detach() | 58 void ScopedPageLoadDeferrer::detach() |
| 66 { | 59 { |
| 67 for (size_t i = 0; i < m_deferredFrames.size(); ++i) { | 60 for (size_t i = 0; i < m_deferredFrames.size(); ++i) { |
| 68 if (Page* page = m_deferredFrames[i]->page()) { | 61 if (Page* page = m_deferredFrames[i]->page()) |
| 69 page->setDefersLoading(false); | 62 page->setDefersLoading(false); |
| 70 | |
| 71 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree(). traverseNext()) { | |
| 72 if (frame->isLocalFrame()) | |
| 73 toLocalFrame(frame)->document()->resumeScheduledTasks(); | |
| 74 } | |
| 75 } | |
| 76 } | 63 } |
| 77 } | 64 } |
| 78 | 65 |
| 79 #if ENABLE(OILPAN) | 66 #if ENABLE(OILPAN) |
| 80 void ScopedPageLoadDeferrer::dispose() | 67 void ScopedPageLoadDeferrer::dispose() |
| 81 { | 68 { |
| 82 detach(); | 69 detach(); |
| 83 m_deferredFrames.clear(); | 70 m_deferredFrames.clear(); |
| 84 } | 71 } |
| 85 #endif | 72 #endif |
| 86 | 73 |
| 87 ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer() | 74 ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer() |
| 88 { | 75 { |
| 89 detach(); | 76 detach(); |
| 90 } | 77 } |
| 91 | 78 |
| 92 void ScopedPageLoadDeferrer::trace(Visitor* visitor) | 79 void ScopedPageLoadDeferrer::trace(Visitor* visitor) |
| 93 { | 80 { |
| 94 #if ENABLE(OILPAN) | 81 #if ENABLE(OILPAN) |
| 95 visitor->trace(m_deferredFrames); | 82 visitor->trace(m_deferredFrames); |
| 96 #endif | 83 #endif |
| 97 } | 84 } |
| 98 | 85 |
| 99 } // namespace blink | 86 } // namespace blink |
| OLD | NEW |