Mittwoch, 5. September 2012

Customizing Firefox - Disabling Safe Mode

Some changes for disable safe mode Add-on

If you use selenium tests case with grid component you sometimes get safemode dialogs in firefox. On http://mike.kaply.com/2012/04/10/customizing-firefox-disabling-safe-mode/ you can find a great solution to fix that dialogs but this integrated Disable Safe Mode Firefox Add-on seems to not be working with current Firefox Version (15.0).

The reason is, that the "onOK()" method in safeMode.js (http://dxr.mozilla.org/mozilla-central/browser/base/content/safeMode.js.html) has been removed.

Following changes helped to get it working again.

chrome.manifest (in distribution/bundles/disablesafemode)


content disablesafemode content/

overlay chrome://browser/content/safeMode.xul chrome://disablesafemode/content/safeMode.xul
override chrome://browser/content/safeMode.js chrome://disablesafemode/content/safeMode.js


safeMode.xul (in distribution/bundles/disablesafemode/content)


<?xml version="1.0" encoding="UTF-8"?>
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<dialog hidden="true" id="safeModeDialog" onload="onExtra1()"/>
</overlay>


The last change is to copy the content of safeMode.js (http://dxr.mozilla.org/mozilla-central/browser/base/content/safeMode.js.html) in safeMode.js (in distribution/bundles/disablesafemode/content) an set 

defaultToReset = true //line 12


You can test it by starting Firefox with the -safe-mode parameter or holding down the shift key on Windows or option key on Mac. You'll see the safe mode window show up for a second (sized very small) and then the browser will restart.