Bug 407080: Disallow print-preview while page is loading. (Re-landing with broken mochitest disabled) r+sr=roc, a=blocking1.9+

This commit is contained in:
dholbert@cs.stanford.edu 2008-03-13 14:12:55 -07:00
parent fa69f38301
commit 2e437c0b98
2 changed files with 17 additions and 1 deletions

View File

@ -85,12 +85,14 @@ _TEST_FILES = \
test_bug386575.xhtml \
test_bug388019.html \
test_bug394057.html \
test_bug396024.html \
test_bug399284.html \
test_bug399951.html \
test_bug404209.xhtml \
test_bug416896.html \
$(NULL)
# test_bug396024.html is currently disabled because it interacts badly with
# the "You can't print-preview while the page is loading" dialog.
# (See bug 407080)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

View File

@ -729,6 +729,20 @@ nsPrintEngine::PrintPreview(nsIPrintSettings* aPrintSettings,
nsIDOMWindow *aChildDOMWin,
nsIWebProgressListener* aWebProgressListener)
{
// Get the DocShell and see if it is busy
// (We can't Print Preview this document if it is still busy)
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(mContainer));
NS_ASSERTION(docShell, "This has to be a docshell");
PRUint32 busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
if (NS_FAILED(docShell->GetBusyFlags(&busyFlags)) ||
busyFlags != nsIDocShell::BUSY_FLAGS_NONE) {
CloseProgressDialog(aWebProgressListener);
ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP, PR_FALSE);
return NS_ERROR_FAILURE;
}
// Document is not busy -- go ahead with the Print Preview
return CommonPrint(PR_TRUE, aPrintSettings, aWebProgressListener);
}