Closed Bug 285497 Opened 19 years ago Closed 19 years ago

Disable Useless Error Popups on Windows

Categories

(Toolkit :: Startup and Profile System, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8beta2

People

(Reporter: alex, Assigned: benjamin)

Details

Attachments

(1 file, 1 obsolete file)

By default, when some Win32 calls encounter an error (for example when trying to
load an invalid dll using LoadLibrary) Windows displays an error dialog box.
This error box usually has a very cryptic and not user friendly message. To
disable this behavior and make the functions fail gracefully, the following
function should be called on application startup:
   ::SetErrorMode(SEM_FAILCRITICALERRORS);

I believe the best place to make this call is the xre_main() function. 

See bug 278328 and bug 153377 for additional information.
Assignee: nobody → benjamin
Attached patch Call SetErrorMode() at XRE_main (obsolete) — Splinter Review
Attachment #180598 - Flags: first-review?(darin)
Attachment #180598 - Flags: first-review?(darin) → first-review+
Comment on attachment 180598 [details] [diff] [review]
Call SetErrorMode() at XRE_main

I'm sorry I have to veto this patch.

SetErrorMode(SEM_FAILCRITICALERRORS) should be called
whether the DEBUG macro is defined or not.
wtc: why? I presume that builders using debug builds would want a warning if a
dependent library were not available.
These error popups are useless if the application
developers check the return value of the Win32
functions in question and take appropriate
actions.  This is exactly what we want: we want
to handle the errors in user friendly ways and
suppress the error popups from Windows.

For example, whether the error popups are
suppressed or not, the Win32 LoadLibrary function
fails with the same error code if the library
can't be loaded.  So we don't need to see the
error popups in debug builds, either.
I'm sorry, I did not look at the comments in this bug to see that there was an
ongoing discussion about what should be done in DEBUG mode.  I myself am less
concerned about the dialog appearing in DEBUG builds.  Perhaps we could output a
textual warning to the console in DEBUG builds in place of the default windows
dialog.  I personally find it useful to see a warning about libraries failing to
load when trying to debug something.  For example, we might want to place such a
warning in the XPCOM native component loader.
The other way is ok too.
Attachment #180598 - Attachment is obsolete: true
Attachment #180607 - Flags: first-review+
Attachment #180607 - Flags: approval1.8b2?
Comment on attachment 180607 [details] [diff] [review]
Call SetErrorMode() at XRE_main, both debug and non-debug

a=asa
Attachment #180607 - Flags: approval1.8b2? → approval1.8b2+
Darin, it's fine by me for debug builds to output textual
warning messages to the console.  These error popups are
very annoying -- you need to click on buttons to dismiss
them.  Also, users usually associate them with serious errors,
but it should be the Mozilla apps, not Windows, that decide
whether a library loading failure is a serious error.
Fixed on trunk.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8beta2
Flags: in-testsuite?
Component: XRE Startup → Startup and Profile System
QA Contact: nobody → startup
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: