Commit c97fc777 authored by ap@apple.com's avatar ap@apple.com

Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=29510
        Active DOM objects should be suspended while a modal dialog is displayed

        * manual-tests/js-timers-beneath-modal-dialog.html: Added a test for JS timers.

        * page/PageGroupLoadDeferrer.cpp:
        (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer):
        (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer):
        Match other platforms, and make Mac also suspend active DOM objects. Since a page that
        currently displays a modal dialog cannot go into page cache, there is no danger of suspending
        an object twice.        



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bff0b2dd
2009-09-18 Alexey Proskuryakov <ap@apple.com>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=29510
Active DOM objects should be suspended while a modal dialog is displayed
* manual-tests/js-timers-beneath-modal-dialog.html: Added a test for JS timers.
* page/PageGroupLoadDeferrer.cpp:
(WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer):
(WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer):
Match other platforms, and make Mac also suspend active DOM objects. Since a page that
currently displays a modal dialog cannot go into page cache, there is no danger of suspending
an object twice.
2009-09-18 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
Reviewed by Eric Seidel.
<p>JS timers should be paused while a modal dialog (or alert) is displayed.</p>
<p>Please disable popup blocker for this test.</p>
<div>0</div>
<script>
function f()
{
var d = document.getElementsByTagName("div")[0];
d.innerHTML = parseInt(d.innerHTML) + 1;
}
var timerId = setInterval(f, 100);
alert("Numbers in main window should not increase while this alert is displayed");
showModalDialog("data:text/html,<p>Numbers in main window should not increase while this modal dialog is displayed</p>");
document.getElementsByTagName("div")[0].innerHTML = "DONE";
clearInterval(timerId);
</script>
......@@ -41,10 +41,10 @@ PageGroupLoadDeferrer::PageGroupLoadDeferrer(Page* page, bool deferSelf)
if (!otherPage->defersLoading())
m_deferredFrames.append(otherPage->mainFrame());
#if !PLATFORM(MAC)
// 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()->suspendActiveDOMObjects();
#endif
}
}
......@@ -60,10 +60,8 @@ PageGroupLoadDeferrer::~PageGroupLoadDeferrer()
if (Page* page = m_deferredFrames[i]->page()) {
page->setDefersLoading(false);
#if !PLATFORM(MAC)
for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
frame->document()->resumeActiveDOMObjects();
#endif
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment