Bug 972655 - Console should show XMLHttpRequests - Add XHR filter to webconsole. r=past

This commit is contained in:
Ian Moody 2015-01-21 10:39:45 -08:00
Родитель 5824001e4d
Коммит 3f55cb1b2e
8 изменённых файлов: 36 добавлений и 17 удалений

Просмотреть файл

@ -1496,6 +1496,7 @@ pref("devtools.gcli.underscoreSrc", "https://cdnjs.cloudflare.com/ajax/libs/unde
pref("devtools.webconsole.filter.network", true);
pref("devtools.webconsole.filter.networkinfo", false);
pref("devtools.webconsole.filter.netwarn", true);
pref("devtools.webconsole.filter.netxhr", false);
pref("devtools.webconsole.filter.csserror", true);
pref("devtools.webconsole.filter.cssparser", false);
pref("devtools.webconsole.filter.csslog", false);
@ -1513,6 +1514,7 @@ pref("devtools.webconsole.filter.secwarn", true);
pref("devtools.browserconsole.filter.network", true);
pref("devtools.browserconsole.filter.networkinfo", false);
pref("devtools.browserconsole.filter.netwarn", true);
pref("devtools.browserconsole.filter.netxhr", false);
pref("devtools.browserconsole.filter.csserror", true);
pref("devtools.browserconsole.filter.cssparser", false);
pref("devtools.browserconsole.filter.csslog", false);

Просмотреть файл

@ -256,6 +256,7 @@ run-if = os == "win"
[browser_webconsole_bug_632347_iterators_generators.js]
skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
[browser_webconsole_bug_632817.js]
skip-if = e10s # Bug 1042253 - webconsole tests disabled with e10s
[browser_webconsole_bug_642108_pruneTest.js]
[browser_webconsole_autocomplete_and_selfxss.js]
[browser_webconsole_bug_644419_log_limits.js]

Просмотреть файл

@ -80,7 +80,7 @@ function consoleOpened(hud)
name: "network message",
text: "test-console.html",
category: CATEGORY_NETWORK,
severity: SEVERITY_LOG,
severity: SEVERITY_INFO,
},
],
});

Просмотреть файл

@ -5,7 +5,8 @@ const prefs = {
"net": [
"network",
"netwarn",
"networkinfo",
"netxhr",
"networkinfo"
],
"css": [
"csserror",

Просмотреть файл

@ -21,10 +21,13 @@ function test()
{
const PREF = "devtools.webconsole.persistlog";
let original = Services.prefs.getBoolPref("devtools.webconsole.filter.networkinfo");
let originalXhr = Services.prefs.getBoolPref("devtools.webconsole.filter.netxhr");
Services.prefs.setBoolPref("devtools.webconsole.filter.networkinfo", true);
Services.prefs.setBoolPref("devtools.webconsole.filter.netxhr", true);
Services.prefs.setBoolPref(PREF, true);
registerCleanupFunction(() => {
Services.prefs.setBoolPref("devtools.webconsole.filter.networkinfo", original);
Services.prefs.setBoolPref("devtools.webconsole.filter.netxhr", originalXhr);
Services.prefs.clearUserPref(PREF);
});
@ -139,7 +142,7 @@ function testFormSubmission()
{
text: "test-data.json",
category: CATEGORY_NETWORK,
severity: SEVERITY_LOG,
severity: SEVERITY_INFO,
count: 2,
},
],

Просмотреть файл

@ -106,7 +106,7 @@ const SEVERITY_CLASS_FRAGMENTS = [
// division of message type into "category" and "severity".
const MESSAGE_PREFERENCE_KEYS = [
// Error Warning Info Log
[ "network", "netwarn", null, "networkinfo", ], // Network
[ "network", "netwarn", "netxhr", "networkinfo", ], // Network
[ "csserror", "cssparser", null, "csslog", ], // CSS
[ "exception", "jswarn", null, "jslog", ], // JS
[ "error", "warn", "info", "log", ], // Web Developer
@ -547,25 +547,29 @@ WebConsoleFrame.prototype = {
});
}
let saveBodiesDisabled = !this.getFilterState("networkinfo") &&
!this.getFilterState("netxhr") &&
!this.getFilterState("network");
let saveBodies = doc.getElementById("saveBodies");
saveBodies.addEventListener("command", reverseSaveBodiesPref);
saveBodies.disabled = !this.getFilterState("networkinfo") &&
!this.getFilterState("network");
saveBodies.disabled = saveBodiesDisabled;
let saveBodiesContextMenu = doc.getElementById("saveBodiesContextMenu");
saveBodiesContextMenu.addEventListener("command", reverseSaveBodiesPref);
saveBodiesContextMenu.disabled = !this.getFilterState("networkinfo") &&
!this.getFilterState("network");
saveBodiesContextMenu.disabled = saveBodiesDisabled;
saveBodies.parentNode.addEventListener("popupshowing", () => {
updateSaveBodiesPrefUI(saveBodies);
saveBodies.disabled = !this.getFilterState("networkinfo") &&
!this.getFilterState("netxhr") &&
!this.getFilterState("network");
});
saveBodiesContextMenu.parentNode.addEventListener("popupshowing", () => {
updateSaveBodiesPrefUI(saveBodiesContextMenu);
saveBodiesContextMenu.disabled = !this.getFilterState("networkinfo") &&
!this.getFilterState("netxhr") &&
!this.getFilterState("network");
});
@ -624,7 +628,7 @@ WebConsoleFrame.prototype = {
{
let prefs = ["network", "networkinfo", "csserror", "cssparser", "csslog",
"exception", "jswarn", "jslog", "error", "info", "warn", "log",
"secerror", "secwarn", "netwarn"];
"secerror", "secwarn", "netwarn", "netxhr"];
for (let pref of prefs) {
this.filterPrefs[pref] = Services.prefs
.getBoolPref(this._filterPrefsPrefix + pref);
@ -883,8 +887,9 @@ WebConsoleFrame.prototype = {
this.setFilterState(prefKey, state);
// Disable the log response and request body if network logging is off.
if (prefKey == "networkinfo" || prefKey == "network") {
if (prefKey == "networkinfo" || prefKey == "netxhr" || prefKey == "network") {
let checkState = !this.getFilterState("networkinfo") &&
!this.getFilterState("netxhr") &&
!this.getFilterState("network");
this.document.getElementById("saveBodies").disabled = checkState;
this.document.getElementById("saveBodiesContextMenu").disabled = checkState;
@ -1493,6 +1498,9 @@ WebConsoleFrame.prototype = {
let request = networkInfo.request;
let clipboardText = request.method + " " + request.url;
let severity = SEVERITY_LOG;
if (networkInfo.isXHR) {
severity = SEVERITY_INFO;
}
let mixedRequest =
WebConsoleUtils.isMixedHTTPSRequest(request.url, this.contentLocation);
if (mixedRequest) {
@ -1750,6 +1758,7 @@ WebConsoleFrame.prototype = {
url: aActor.url,
method: aActor.method,
},
isXHR: aActor.isXHR,
response: {},
timings: {},
updates: [], // track the list of network event updates

Просмотреть файл

@ -98,6 +98,8 @@ function goUpdateConsoleCommands() {
prefKey="network"/>
<menuitem label="&btnConsoleWarnings;" type="checkbox" autocheck="false"
prefKey="netwarn"/>
<menuitem label="&btnConsoleXhr;" type="checkbox" autocheck="false"
prefKey="netxhr"/>
<menuitem label="&btnConsoleLog;" type="checkbox" autocheck="false"
prefKey="networkinfo"/>
<menuseparator id="saveBodiesSeparator" />

Просмотреть файл

@ -73,6 +73,7 @@
<!ENTITY btnConsoleInfo "Info">
<!ENTITY btnConsoleWarnings "Warnings">
<!ENTITY btnConsoleLog "Log">
<!ENTITY btnConsoleXhr "XHR">
<!ENTITY btnConsoleReflows "Reflows">
<!ENTITY filterOutput.placeholder "Filter output">