| Index: Source/core/page/ScopedPageLoadDeferrer.cpp
|
| diff --git a/Source/core/page/PageGroupLoadDeferrer.cpp b/Source/core/page/ScopedPageLoadDeferrer.cpp
|
| similarity index 61%
|
| rename from Source/core/page/PageGroupLoadDeferrer.cpp
|
| rename to Source/core/page/ScopedPageLoadDeferrer.cpp
|
| index be7e7c24508ced1cdffa0f0ecfd9b3a66730e1b7..05c991ac78415a295ec0a97e180c56124ad1c17b 100644
|
| --- a/Source/core/page/PageGroupLoadDeferrer.cpp
|
| +++ b/Source/core/page/ScopedPageLoadDeferrer.cpp
|
| @@ -19,11 +19,11 @@
|
| */
|
|
|
| #include "config.h"
|
| -#include "core/page/PageGroupLoadDeferrer.h"
|
| +#include "core/page/ScopedPageLoadDeferrer.h"
|
|
|
| #include "core/dom/Document.h"
|
| -#include "core/loader/FrameLoader.h"
|
| #include "core/frame/Frame.h"
|
| +#include "core/loader/FrameLoader.h"
|
| #include "core/page/Page.h"
|
| #include "core/page/PageGroup.h"
|
| #include "wtf/HashSet.h"
|
| @@ -32,36 +32,36 @@ namespace WebCore {
|
|
|
| using namespace std;
|
|
|
| -PageGroupLoadDeferrer::PageGroupLoadDeferrer(Page* page, bool deferSelf)
|
| +ScopedPageLoadDeferrer::ScopedPageLoadDeferrer(Page* exclusion)
|
| {
|
| - const HashSet<Page*>& pages = page->group().pages();
|
| + const HashSet<Page*>& pages = PageGroup::sharedGroup()->pages();
|
|
|
| HashSet<Page*>::const_iterator end = pages.end();
|
| for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
|
| - Page* otherPage = *it;
|
| - if ((deferSelf || otherPage != page)) {
|
| - if (!otherPage->defersLoading()) {
|
| - m_deferredFrames.append(otherPage->mainFrame());
|
| + Page* page = *it;
|
| + if (page == exclusion || page->defersLoading())
|
| + continue;
|
|
|
| - // Ensure that we notify the client if the initial empty document is accessed before showing anything
|
| - // modal, to prevent spoofs while the modal window or sheet is visible.
|
| - otherPage->mainFrame()->loader().notifyIfInitialDocumentAccessed();
|
| + m_deferredFrames.append(page->mainFrame());
|
|
|
| - // This code is not logically part of load deferring, but we do not want JS code executed beneath modal
|
| - // windows or sheets, which is exactly when PageGroupLoadDeferrer is used.
|
| - for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tree().traverseNext())
|
| - frame->document()->suspendScheduledTasks();
|
| - }
|
| - }
|
| + // Ensure that we notify the client if the initial empty document is accessed before
|
| + // showing anything modal, to prevent spoofs while the modal window or sheet is visible.
|
| + page->mainFrame()->loader().notifyIfInitialDocumentAccessed();
|
| +
|
| + // This code is not logically part of load deferring, but we do not want JS code executed
|
| + // beneath modal windows or sheets, which is exactly when ScopedPageLoadDeferrer is used.
|
| + for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext())
|
| + frame->document()->suspendScheduledTasks();
|
| }
|
|
|
| size_t count = m_deferredFrames.size();
|
| - for (size_t i = 0; i < count; ++i)
|
| + for (size_t i = 0; i < count; ++i) {
|
| if (Page* page = m_deferredFrames[i]->page())
|
| page->setDefersLoading(true);
|
| + }
|
| }
|
|
|
| -PageGroupLoadDeferrer::~PageGroupLoadDeferrer()
|
| +ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer()
|
| {
|
| for (size_t i = 0; i < m_deferredFrames.size(); ++i) {
|
| if (Page* page = m_deferredFrames[i]->page()) {
|
| @@ -73,5 +73,4 @@ PageGroupLoadDeferrer::~PageGroupLoadDeferrer()
|
| }
|
| }
|
|
|
| -
|
| } // namespace WebCore
|
|
|