Create /usr/lib/firefox/defaults/pref/autoconfig.js
1
2
3
| pref("general.config.filename", "firefox.cfg"); // our configuration file is called firefox.cfg at the roor directory of firefox lib
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false); // after testing, it is needed to disable sanbox
|
Create /usr/lib/firefox/firefox.cfg
You can simply put your configuration here, but I recommend you to use it as an intermediate.
1
2
3
4
5
| // IMPORTANT: Start your code on the 2nd line. The first line is forced to be a comment
var home = getenv("HOME");
// your configuration should be placed at ~/.mozilla/firefox/user.js
lockPref("autoadmin.global_config_url", "file:" + home + "/.mozilla/firefox/user.js");
|
Create ~/.mozilla/firefox/user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| // disable ctrl+w
try {
let {classes:Cc, interfaces:Ci, manager:Cm, utils:Cu} = Components;
const {Services} = Cu.import('resource://gre/modules/Services.jsm');
function ConfigJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
ConfigJS.prototype = {
observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); },
handleEvent: function (aEvent) {
let document = aEvent.originalTarget;
let window = document.defaultView;
let location = window.location;
if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {
if (window._gBrowser) {
let attr, elm, key, mbo;
let KEYS = ['key_close'];
let ATTR = ['key','modifiers','command','oncommand'];
for (key in KEYS){
elm = window.document.getElementById(KEYS[key]);
if (elm) for (attr in ATTR) if (ATTR[attr] in elm.attributes) elm.removeAttribute(ATTR[attr]);
}
}
}
}
};
if (!Services.appinfo.inSafeMode) { new ConfigJS(); }
} catch(e) {Cu.reportError(e);}
|