mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 622303 - Web Console should remember filter settings; r=msucan
This commit is contained in:
parent
8d0cb9d34b
commit
8d4b048644
@ -1038,6 +1038,18 @@ pref("devtools.hud.height", 0);
|
||||
// window - in a separate window/popup panel.
|
||||
pref("devtools.webconsole.position", "above");
|
||||
|
||||
// Remember the Web Console filters
|
||||
pref("devtools.webconsole.filter.network", true);
|
||||
pref("devtools.webconsole.filter.networkinfo", true);
|
||||
pref("devtools.webconsole.filter.csserror", true);
|
||||
pref("devtools.webconsole.filter.cssparser", true);
|
||||
pref("devtools.webconsole.filter.exception", true);
|
||||
pref("devtools.webconsole.filter.jswarn", true);
|
||||
pref("devtools.webconsole.filter.error", true);
|
||||
pref("devtools.webconsole.filter.warn", true);
|
||||
pref("devtools.webconsole.filter.info", true);
|
||||
pref("devtools.webconsole.filter.log", true);
|
||||
|
||||
// The number of lines that are displayed in the web console for the Net,
|
||||
// CSS, JS and Web Developer categories.
|
||||
pref("devtools.hud.loglimit.network", 200);
|
||||
|
@ -1638,6 +1638,7 @@ HUD_SERVICE.prototype =
|
||||
{
|
||||
this.filterPrefs[aHUDId][aToggleType] = aState;
|
||||
this.adjustVisibilityForMessageType(aHUDId, aToggleType, aState);
|
||||
Services.prefs.setBoolPref(PREFS_PREFIX + aToggleType, aState);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -6338,8 +6339,7 @@ HeadsUpDisplayUICommands = {
|
||||
var prefs = Services.prefs;
|
||||
|
||||
const GLOBAL_STORAGE_INDEX_ID = "GLOBAL_CONSOLE";
|
||||
const PREFS_BRANCH_PREF = "devtools.hud.display.filter";
|
||||
const PREFS_PREFIX = "devtools.hud.display.filter.";
|
||||
const PREFS_PREFIX = "devtools.webconsole.filter.";
|
||||
const PREFS = { network: PREFS_PREFIX + "network",
|
||||
networkinfo: PREFS_PREFIX + "networkinfo",
|
||||
csserror: PREFS_PREFIX + "csserror",
|
||||
@ -6350,7 +6350,6 @@ const PREFS = { network: PREFS_PREFIX + "network",
|
||||
info: PREFS_PREFIX + "info",
|
||||
warn: PREFS_PREFIX + "warn",
|
||||
log: PREFS_PREFIX + "log",
|
||||
global: PREFS_PREFIX + "global",
|
||||
};
|
||||
|
||||
function ConsoleStorage()
|
||||
@ -6365,89 +6364,22 @@ function ConsoleStorage()
|
||||
// TODO: need to create a method that truncates the message
|
||||
// see bug 570543
|
||||
|
||||
// store an index of display prefs
|
||||
this.displayPrefs = {};
|
||||
|
||||
// check prefs for existence, create & load if absent, load them if present
|
||||
let filterPrefs;
|
||||
let defaultDisplayPrefs;
|
||||
|
||||
try {
|
||||
filterPrefs = prefs.getBoolPref(PREFS_BRANCH_PREF);
|
||||
}
|
||||
catch (ex) {
|
||||
filterPrefs = false;
|
||||
}
|
||||
|
||||
// TODO: for FINAL release,
|
||||
// use the sitePreferencesService to save specific site prefs
|
||||
// see bug 570545
|
||||
|
||||
if (filterPrefs) {
|
||||
defaultDisplayPrefs = {
|
||||
network: (prefs.getBoolPref(PREFS.network) ? true: false),
|
||||
networkinfo: (prefs.getBoolPref(PREFS.networkinfo) ? true: false),
|
||||
csserror: (prefs.getBoolPref(PREFS.csserror) ? true: false),
|
||||
cssparser: (prefs.getBoolPref(PREFS.cssparser) ? true: false),
|
||||
exception: (prefs.getBoolPref(PREFS.exception) ? true: false),
|
||||
jswarn: (prefs.getBoolPref(PREFS.jswarn) ? true: false),
|
||||
error: (prefs.getBoolPref(PREFS.error) ? true: false),
|
||||
info: (prefs.getBoolPref(PREFS.info) ? true: false),
|
||||
warn: (prefs.getBoolPref(PREFS.warn) ? true: false),
|
||||
log: (prefs.getBoolPref(PREFS.log) ? true: false),
|
||||
global: (prefs.getBoolPref(PREFS.global) ? true: false),
|
||||
};
|
||||
}
|
||||
else {
|
||||
prefs.setBoolPref(PREFS_BRANCH_PREF, false);
|
||||
// default prefs for each HeadsUpDisplay
|
||||
prefs.setBoolPref(PREFS.network, true);
|
||||
prefs.setBoolPref(PREFS.networkinfo, true);
|
||||
prefs.setBoolPref(PREFS.csserror, true);
|
||||
prefs.setBoolPref(PREFS.cssparser, true);
|
||||
prefs.setBoolPref(PREFS.exception, true);
|
||||
prefs.setBoolPref(PREFS.jswarn, true);
|
||||
prefs.setBoolPref(PREFS.error, true);
|
||||
prefs.setBoolPref(PREFS.info, true);
|
||||
prefs.setBoolPref(PREFS.warn, true);
|
||||
prefs.setBoolPref(PREFS.log, true);
|
||||
prefs.setBoolPref(PREFS.global, false);
|
||||
|
||||
defaultDisplayPrefs = {
|
||||
network: prefs.getBoolPref(PREFS.network),
|
||||
networkinfo: prefs.getBoolPref(PREFS.networkinfo),
|
||||
csserror: prefs.getBoolPref(PREFS.csserror),
|
||||
cssparser: prefs.getBoolPref(PREFS.cssparser),
|
||||
exception: prefs.getBoolPref(PREFS.exception),
|
||||
jswarn: prefs.getBoolPref(PREFS.jswarn),
|
||||
error: prefs.getBoolPref(PREFS.error),
|
||||
info: prefs.getBoolPref(PREFS.info),
|
||||
warn: prefs.getBoolPref(PREFS.warn),
|
||||
log: prefs.getBoolPref(PREFS.log),
|
||||
global: prefs.getBoolPref(PREFS.global),
|
||||
};
|
||||
}
|
||||
this.defaultDisplayPrefs = defaultDisplayPrefs;
|
||||
this.defaultDisplayPrefs = {
|
||||
network: prefs.getBoolPref(PREFS.network),
|
||||
networkinfo: prefs.getBoolPref(PREFS.networkinfo),
|
||||
csserror: prefs.getBoolPref(PREFS.csserror),
|
||||
cssparser: prefs.getBoolPref(PREFS.cssparser),
|
||||
exception: prefs.getBoolPref(PREFS.exception),
|
||||
jswarn: prefs.getBoolPref(PREFS.jswarn),
|
||||
error: prefs.getBoolPref(PREFS.error),
|
||||
info: prefs.getBoolPref(PREFS.info),
|
||||
warn: prefs.getBoolPref(PREFS.warn),
|
||||
log: prefs.getBoolPref(PREFS.log),
|
||||
};
|
||||
}
|
||||
|
||||
ConsoleStorage.prototype = {
|
||||
|
||||
updateDefaultDisplayPrefs:
|
||||
function CS_updateDefaultDisplayPrefs(aPrefsObject) {
|
||||
prefs.setBoolPref(PREFS.network, (aPrefsObject.network ? true : false));
|
||||
prefs.setBoolPref(PREFS.networkinfo,
|
||||
(aPrefsObject.networkinfo ? true : false));
|
||||
prefs.setBoolPref(PREFS.csserror, (aPrefsObject.csserror ? true : false));
|
||||
prefs.setBoolPref(PREFS.cssparser, (aPrefsObject.cssparser ? true : false));
|
||||
prefs.setBoolPref(PREFS.exception, (aPrefsObject.exception ? true : false));
|
||||
prefs.setBoolPref(PREFS.jswarn, (aPrefsObject.jswarn ? true : false));
|
||||
prefs.setBoolPref(PREFS.error, (aPrefsObject.error ? true : false));
|
||||
prefs.setBoolPref(PREFS.info, (aPrefsObject.info ? true : false));
|
||||
prefs.setBoolPref(PREFS.warn, (aPrefsObject.warn ? true : false));
|
||||
prefs.setBoolPref(PREFS.log, (aPrefsObject.log ? true : false));
|
||||
prefs.setBoolPref(PREFS.global, (aPrefsObject.global ? true : false));
|
||||
},
|
||||
|
||||
sequenceId: function CS_sequencerId()
|
||||
{
|
||||
if (!this.sequencer) {
|
||||
|
@ -150,6 +150,7 @@ _BROWSER_TEST_FILES = \
|
||||
browser_gcli_require.js \
|
||||
browser_gcli_web.js \
|
||||
browser_webconsole_bug_658368_time_methods.js \
|
||||
browser_webconsole_bug_622303_persistent_filters.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
|
@ -27,15 +27,14 @@ function onContentLoaded()
|
||||
|
||||
executeSoon(
|
||||
function (){
|
||||
HUDService.setFilterState(hudId, "cssparser", false);
|
||||
|
||||
let msg = "the unknown CSS property warning is not displayed, " +
|
||||
"after filtering";
|
||||
testLogEntry(outputNode, "foobarCssParser", msg, true, true);
|
||||
|
||||
HUDService.setFilterState(hudId, "cssparser", true);
|
||||
finishTest();
|
||||
}
|
||||
);
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,6 +54,9 @@ function tabReload(aEvent) {
|
||||
ok(scrollBox.scrollTop >= scrollBox.scrollHeight - scrollBox.clientHeight -
|
||||
nodeHeight * 2, "scroll location is correct");
|
||||
|
||||
HUDService.setFilterState(hud.hudId, "network", true);
|
||||
HUDService.setFilterState(hud.hudId, "networkinfo", true);
|
||||
|
||||
executeSoon(finishTest);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,59 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
let prefService = Services.prefs;
|
||||
let prefs = [
|
||||
"network",
|
||||
"networkinfo",
|
||||
"csserror",
|
||||
"cssparser",
|
||||
"exception",
|
||||
"jswarn",
|
||||
"error",
|
||||
"warn",
|
||||
"info",
|
||||
"log"
|
||||
];
|
||||
|
||||
//Set all prefs to true
|
||||
prefs.forEach(function(pref) {
|
||||
prefService.setBoolPref("devtools.webconsole.filter." + pref, true);
|
||||
});
|
||||
|
||||
addTab("about:blank");
|
||||
openConsole();
|
||||
|
||||
let hud = HUDService.getHudByWindow(content);
|
||||
let hudId = HUDService.getHudIdByWindow(content);
|
||||
|
||||
//Check if the filters menuitems exists and is checked
|
||||
prefs.forEach(function(pref) {
|
||||
let checked = hud.HUDBox.querySelector("menuitem[prefKey=" + pref + "]").
|
||||
getAttribute("checked");
|
||||
is(checked, "true", "menuitem for " + pref + " exists and is checked");
|
||||
});
|
||||
|
||||
//Set all prefs to false
|
||||
prefs.forEach(function(pref) {
|
||||
HUDService.setFilterState(hudId, pref, false);
|
||||
});
|
||||
|
||||
//Re-init the console
|
||||
closeConsole();
|
||||
openConsole();
|
||||
|
||||
hud = HUDService.getHudByWindow(content);
|
||||
|
||||
//Check if filters menuitems exists and are unchecked
|
||||
prefs.forEach(function(pref) {
|
||||
let checked = hud.HUDBox.querySelector("menuitem[prefKey=" + pref + "]").
|
||||
getAttribute("checked");
|
||||
is(checked, "false", "menuitem for " + pref + " exists and is not checked");
|
||||
prefService.clearUserPref("devtools.webconsole.filter." + pref);
|
||||
});
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
finish();
|
||||
}
|
Loading…
Reference in New Issue
Block a user