Created attachment 369434 [details] Testcase Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090324 Minefield/3.6a1pre ID:20090324044213 Calling exitPrintPreview()during print preview crashes Firefox @ nsPrintData::DoOnProgressChange Testcase based on attachment 290345 [details] by Martijn with a call to exitPrintPreview() in the listener for onStateChange. Requires enhanced priveleges. I guess this is a bit evil because this is exiting print preview before the preview has completed. I'm guessing that the listener is removed before doCommonPrint() completes and sends the final notification. (There seem to be two notifications - one on print preview progress dialog close and one on print preview completion.) Sample crash report: bp-c406136d-c0c4-49ca-81d5-1a0e22090325 Stack: Frame Module Signature [Expand] Source 0 ntdll.dll ntdll.dll@0xe4f4 1 kernel32.dll kernel32.dll@0x2541 2 xul.dll google_breakpad::ExceptionHandler::WriteMinidumpOnHandlerThread toolkit/crashreporter/google-breakpad/src/client/windows/handler/exception_handler.cc:562 3 xul.dll google_breakpad::ExceptionHandler::HandlePureVirtualCall toolkit/crashreporter/google-breakpad/src/client/windows/handler/exception_handler.cc:506 4 mozcrt19.dll _purecall obj-firefox/memory/jemalloc/src/purevirt.c:47 5 xul.dll nsPrintData::DoOnProgressChange layout/printing/nsPrintData.cpp:154 6 xul.dll nsPrintData::OnEndPrinting layout/printing/nsPrintData.cpp:141 7 xul.dll nsPrintEngine::FinishPrintPreview layout/printing/nsPrintEngine.cpp:3184 8 xul.dll nsPrintEngine::Observe layout/printing/nsPrintEngine.cpp:3234 9 xul.dll nsPrintProgress::DoneIniting embedding/components/printingui/src/win/nsPrintProgress.cpp:221 10 xul.dll NS_InvokeByIndex_P xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp:101 11 xul.dll XPCWrappedNative::CallMethod js/src/xpconnect/src/xpcwrappednative.cpp:2463 Variations of the testcase crash with slightly different stacks, e.g. bp-e0ff9ebf-e9e1-4ca1-ab59-6ee0c2090324 nsPrintData::DoOnProgressChange bp-c09fc744-a229-46f0-a2a1-5c85e2090324 nsVoidArray::Count Doesn't seem to be a regression (also crashes Fx2)
(In reply to comment #0) > I guess this is a bit evil because this is exiting print preview before the > preview has completed. This is indeed evil. Exiting print preview before it is completed is ok in some cases but not if it happens in nsIWebProgessListener::onStateChange. Is this bug blocking some other work? Otherwise I think we could just document that nsIWebProgessListener must not cancel print preview.
Actually, I think we could make exitPrintPreview() to return some error code when it is not possible to exit. Taking.
one example in firefox 4 bp-9c6ba1f4-2a08-4ff3-9b61-9d3722110325