Add flush before we find our pres context, to fix media queries tests on ringmark. (Bug 753777) r=bzbarsky

This commit is contained in:
L. David Baron 2012-07-07 21:41:27 -07:00
Родитель 88843c851b
Коммит 5f644a10e6
2 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -3967,6 +3967,14 @@ nsGlobalWindow::MatchMedia(const nsAString& aMediaQueryList,
*aResult = nsnull;
// We need this now to ensure that we have a non-null |presContext|
// when we ought to.
// This is similar to EnsureSizeUpToDate, but only flushes frames.
nsGlobalWindow *parent = static_cast<nsGlobalWindow*>(GetPrivateParent());
if (parent) {
parent->FlushPendingNotifications(Flush_Frames);
}
if (!mDocShell)
return NS_OK;

Просмотреть файл

@ -280,6 +280,19 @@ function run() {
mql.removeListener(null);
})();
/* Bug 753777: test that things work in a freshly-created iframe */
(function() {
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
is(iframe.contentWindow.matchMedia("(min-width: 1px)").matches, true,
"(min-width: 1px) should match in newly-created iframe");
is(iframe.contentWindow.matchMedia("(max-width: 1px)").matches, false,
"(max-width: 1px) should not match in newly-created iframe");
document.body.removeChild(iframe);
})();
/* Bug 716751: listeners lost due to GC */
var gc_received = [];
(function() {