May be to clarify.
"Config Export" extension proposed by therube is exactly what I was looking for.
Just be warned it is only compatible with Firefox 31.0 - 56.*
Script investigation is then still necessary for 57 and above.
Extract all keys/values from about:config
- Diorser
- Posts: 1009
- Joined: June 22nd, 2005, 6:57 am
- Diorser
- Posts: 1009
- Joined: June 22nd, 2005, 6:57 am
Re: Extract all keys/values from about:config
Now for Fx 57 (then no extension available), could you summarize what you call the "dickvl code" on which you apply a patch for Firefox 57 ?morat wrote:I got dickvl code working in Fx 57 with a little tweak. (remove "2" in nsIPrefBranch2)
Looks a little bit confusing.
-
- Posts: 6435
- Joined: February 3rd, 2009, 6:29 pm
Re: Extract all keys/values from about:config
Instructions for running dickvl's code in Fx 57:
* open about:config
* set browser.tabs.remote.autostart.2 preference to false
* set devtools.chrome.enabled preference to true
* restart
* open about:support
* is multiprocess windows disabled?
* if yes, then continue
* open browser console (ctrl+shift+j) in tools > web developer
* copy and paste code into browser console
* press enter to run
There is no need to fix the nsIPrefBranch2 issue. The author fixed it.
Browser Console command line
http://developer.mozilla.org/en-US/docs ... mmand_line
Preferences Printing
http://kb.mozillazine.org/User:Dickvl/J ... s_Printing
* open about:config
* set browser.tabs.remote.autostart.2 preference to false
* set devtools.chrome.enabled preference to true
* restart
* open about:support
* is multiprocess windows disabled?
* if yes, then continue
* open browser console (ctrl+shift+j) in tools > web developer
* copy and paste code into browser console
* press enter to run
There is no need to fix the nsIPrefBranch2 issue. The author fixed it.
Browser Console command line
http://developer.mozilla.org/en-US/docs ... mmand_line
Preferences Printing
http://kb.mozillazine.org/User:Dickvl/J ... s_Printing
- Diorser
- Posts: 1009
- Joined: June 22nd, 2005, 6:57 am
Re: Extract all keys/values from about:config
You previously missed the point I looked for clarity in your previous messages related to patches.
"The code" which works without any patch for Fx57 is then the this one :
Thanks.
"The code" which works without any patch for Fx57 is then the this one :
Thanks.
Code: Select all
(function(){
/* Display the Preferences in TABLE format - dickvl@kb.mozillazine.org */
const Cc=Components.classes, Ci=Components.interfaces;
const nsIPrefLocalizedString = Ci.nsIPrefLocalizedString;
const nsISupportsString = Ci.nsISupportsString;
const nsIPrefBranch = Ci.nsIPrefBranch;
const nsIPrefService = Ci.nsIPrefService;
const nsPrefService_CONTRACTID = "@mozilla.org/preferences-service;1";
const gPrefService = Cc[nsPrefService_CONTRACTID].getService(nsIPrefService);
const gPrefBranch = gPrefService.getBranch(null).QueryInterface(Ci.nsIPrefBranch);
const PREF_IS_DEFAULT_VALUE = 0;
const PREF_IS_USER_SET = 1;
const PREF_IS_LOCKED = 2;
const SHOW_USER = false; /* use SHOW_USER = true; to only display prefs that are "user set" */
function prefColSortFunction(x, y)
{
if (x.prefCol > y.prefCol) return gSortDirection;
if (x.prefCol < y.prefCol) return -gSortDirection;
return 0;
}
function lockColSortFunction(x, y)
{
if (x.lockCol != y.lockCol) return gSortDirection * (y.lockCol - x.lockCol);
return prefColSortFunction(x, y);
}
function typeColSortFunction(x, y)
{
if (x.typeCol != y.typeCol) return gSortDirection * (y.typeCol - x.typeCol);
return prefColSortFunction(x, y);
}
function valueColSortFunction(x, y)
{
if (x.valueCol > y.valueCol) return gSortDirection;
if (x.valueCol < y.valueCol) return -gSortDirection;
return prefColSortFunction(x, y);
}
const gSortFunctions =
{
prefCol: prefColSortFunction,
lockCol: lockColSortFunction,
typeCol: typeColSortFunction,
valueCol: valueColSortFunction
};
var gSortedColumn = "prefCol";
var gSortFunction = gSortFunctions[gSortedColumn];
var gSortDirection = 1;
var gPrefArray = [];
function prefObject(prefName, prefIndex)
{
this.prefCol = prefName;
}
prefObject.prototype =
{
lockCol: PREF_IS_DEFAULT_VALUE,
typeCol: nsIPrefBranch.PREF_STRING,
valueCol: ""
};
function fetchPref(prefName, prefIndex)
{
var pref = new prefObject(prefName);
gPrefArray[prefIndex] = pref;
if (gPrefBranch.prefIsLocked(prefName))
pref.lockCol = PREF_IS_LOCKED;
else if (gPrefBranch.prefHasUserValue(prefName))
pref.lockCol = PREF_IS_USER_SET;
try {
switch (gPrefBranch.getPrefType(prefName)) {
case gPrefBranch.PREF_BOOL:
pref.typeCol = gPrefBranch.PREF_BOOL;
pref.valueCol = gPrefBranch.getBoolPref(prefName).toString();
break;
case gPrefBranch.PREF_INT:
pref.typeCol = gPrefBranch.PREF_INT;
pref.valueCol = gPrefBranch.getIntPref(prefName).toString();
break;
default:
case gPrefBranch.PREF_STRING:
pref.valueCol = gPrefBranch.getComplexValue(prefName, nsISupportsString).data;
if (pref.lockCol == PREF_IS_DEFAULT_VALUE &&
/^chrome:\/\/.+\/locale\/.+\.properties/.test(pref.valueCol))
pref.valueCol = gPrefBranch.getComplexValue(prefName, nsIPrefLocalizedString).data;
break;
}
} catch (e) {}
}
var gLockStrs = [];
var gTypeStrs = [];
gLockStrs[PREF_IS_DEFAULT_VALUE] = "default";
gLockStrs[PREF_IS_USER_SET] = "user set";
gLockStrs[PREF_IS_LOCKED] = "locked";
gTypeStrs[nsIPrefBranch.PREF_STRING] = "string";
gTypeStrs[nsIPrefBranch.PREF_INT] = "integer";
gTypeStrs[nsIPrefBranch.PREF_BOOL] = "boolean";
var prefCount = {value:0};
var prefBranch = "", CAPS = false; /* CAPS = (prefBranch == "capability"); */
/* var prefBranch = "capability", CAPS = true; */
var prefArray = gPrefBranch.getChildList(prefBranch, prefCount);
for (var i=0;i<prefCount.value;i++)
{
var prefName = prefArray[i]; if (!CAPS && /^capability[.]/.test(prefName)) continue;
fetchPref(prefName, gPrefArray.length);
}
gPrefArray.sort(gSortFunction);
var gT='', gP;
for (var i=0;gP=gPrefArray[i];i++) {
if (SHOW_USER && gP.lockCol != PREF_IS_USER_SET) continue;
gT+='<tr><td class="name">' + gP.prefCol + '<td class="other">' + gLockStrs[gP.lockCol] + '<td class="other">' + gTypeStrs[gP.typeCol] + '<td class="value"><table class="wrap"><tr><td>' + gP.valueCol + '</table>';
}
var dataTxt = '<html><head></head><body></body></html>';
var headTxt = '<title>Preferences '+'('+prefCount.value+')'+'</title>'+
'<style type="text/css">'+
'body {background-color:#ffa; margin: 1em 1em;}'+
'table {background-color:#ffb; empty-cells:show;}'+
'td {font-family: Verdana,Arial,Sans-Serif; font-size: 100%; padding: 1px 2px; vertical-align:top;}'+
'.header {background-color:#ffd;}'+
'.name, .other {white-space:nowrap;}'+
'.value {padding:0;}'+
'.wrap {table-layout:fixed; width:100%; overflow:hidden; word-wrap:break-word; border-spacing:0;}'+
'</style>';
var bodyTxt = '<b>Preferences</b>'+
'<p>HTML code generated via the <i>"Tools > Error Console: Code field"</i> - dickvl@kb.mozillazine.org<br>'+
'</p><p class="ZGlja3Zs">'+
'<table border="1" cellspacing="0">'+
'<tr class="header"><td><b>Pref</b><td><b>Status</b><td><b>Type</b><td><b>Value</b>'+gT+
'</table>'+
'</p>';
var dataURI='data:text/html;charset=utf-8,'+dataTxt;
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
var mW = wm.getMostRecentWindow("navigator:browser"), gB, tab;
if(mW){
gB = mW.gBrowser; tab = gB.addTab(dataURI); gB.selectedTab = tab;
setTimeout(function(){
var d = gB.selectedBrowser.contentDocument;
d.getElementsByTagName('HEAD')[0].innerHTML = headTxt;
d.body.innerHTML = bodyTxt; },500);
}
})();
-
- Posts: 6435
- Joined: February 3rd, 2009, 6:29 pm
Re: Extract all keys/values from about:config
Revision Historymorat wrote:There is no need to fix the nsIPrefBranch2 issue. The author fixed it.
http://kb.mozillazine.org/index.php?tit ... on=history