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.

4 Kommentare:

  1. Hallo !

    Sind Sie sicher, dass es funktioniert, bei meinen Tests erhalte ich zwar keine Safemode-Dialog mehr, allerdings starte der Fuchs in eben solchem. Nur wenn ich die Shifttaste kurz gedrückt halte, gehts im Norm-Modus, wenn ich diese jedoch "wie blöd" gedrückt halte > Safemode ...

    AntwortenLöschen
  2. Sorry I'm a total beginner. How and where do I create the "distribution" folder on mac?

    AntwortenLöschen
    Antworten
    1. Sorry, i am not familiar with Mac but on Windows the distribution folder have to be integrated in Firefox program folder.

      Löschen