Bug 1209382 - make Fetch requests show up as XHR in network monitor. r=vporof

This commit is contained in:
Tom Tromey 2015-11-05 14:06:00 +01:00
Родитель 1d33a912f2
Коммит c33ff35148
2 изменённых файлов: 15 добавлений и 1 удалений

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

@ -12,6 +12,9 @@ const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
const TEST_XHR_ERROR_URI = `http://example.com/404.html?${Date.now()}`;
const TEST_IMAGE = "http://example.com/browser/devtools/client/webconsole/" +
"test/test-image.png";
"use strict";
var test = asyncTest(function*() {
@ -61,6 +64,9 @@ function consoleOpened(hud) {
xhrErr.open("get", TEST_XHR_ERROR_URI, true);
xhrErr.send();
// Check that Fetch requests are categorized as "XHR".
fetch(TEST_IMAGE).then(() => { console.log("fetch loaded"); });
return waitForMessages({
webconsole: hud,
messages: [
@ -102,6 +108,13 @@ function consoleOpened(hud) {
severity: SEVERITY_ERROR,
isXhr: true,
},
{
name: "network message",
text: "test-image.png",
category: CATEGORY_NETWORK,
severity: SEVERITY_INFO,
isXhr: true,
},
],
});
}

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

@ -838,7 +838,8 @@ NetworkMonitor.prototype = {
// Determine if this is an XHR request.
httpActivity.isXHR = event.isXHR =
(aChannel.loadInfo.externalContentPolicyType === Ci.nsIContentPolicy.TYPE_XMLHTTPREQUEST);
(aChannel.loadInfo.externalContentPolicyType === Ci.nsIContentPolicy.TYPE_XMLHTTPREQUEST ||
aChannel.loadInfo.externalContentPolicyType === Ci.nsIContentPolicy.TYPE_FETCH);
// Determine the HTTP version.
let httpVersionMaj = {};