зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1252807 - Fix eslint warnings in the Net panel. r=pbro
This commit is contained in:
Родитель
a83efd2468
Коммит
e9b03dfbcf
|
@ -3,9 +3,9 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const { Cu, Ci, Cc } = require("chrome");
|
||||
const { Cu, Ci } = require("chrome");
|
||||
const { Class } = require("sdk/core/heritage");
|
||||
const { defer, resolve } = require("promise");
|
||||
const { resolve } = require("promise");
|
||||
const Services = require("Services");
|
||||
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
@ -20,7 +20,7 @@ const prefDomain = "devtools.netmonitor.har.";
|
|||
const trace = {
|
||||
log: function(...args) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This object is responsible for automated HAR export. It listens
|
||||
|
@ -77,7 +77,7 @@ var HarAutomation = Class({
|
|||
this.tabWatcher.connect();
|
||||
},
|
||||
|
||||
pageLoadBegin: function(aResponse) {
|
||||
pageLoadBegin: function(response) {
|
||||
this.resetCollector();
|
||||
},
|
||||
|
||||
|
@ -106,8 +106,8 @@ var HarAutomation = Class({
|
|||
* The additional traffic can be exported by executing
|
||||
* triggerExport on this object.
|
||||
*/
|
||||
pageLoadDone: function(aResponse) {
|
||||
trace.log("HarAutomation.pageLoadDone; ", aResponse);
|
||||
pageLoadDone: function(response) {
|
||||
trace.log("HarAutomation.pageLoadDone; ", response);
|
||||
|
||||
if (this.collector) {
|
||||
this.collector.waitForHarLoad().then(collector => {
|
||||
|
@ -128,7 +128,7 @@ var HarAutomation = Class({
|
|||
// into a file and use all the default options.
|
||||
let data = {
|
||||
fileName: Services.prefs.getCharPref(prefDomain + "defaultFileName"),
|
||||
}
|
||||
};
|
||||
|
||||
return this.executeExport(data);
|
||||
},
|
||||
|
@ -169,7 +169,7 @@ var HarAutomation = Class({
|
|||
getString: this.getString.bind(this),
|
||||
view: this,
|
||||
items: items,
|
||||
}
|
||||
};
|
||||
|
||||
options.defaultFileName = data.fileName;
|
||||
options.compress = data.compress;
|
||||
|
@ -198,39 +198,43 @@ var HarAutomation = Class({
|
|||
/**
|
||||
* Fetches the full text of a string.
|
||||
*/
|
||||
getString: function(aStringGrip) {
|
||||
return this.webConsoleClient.getString(aStringGrip);
|
||||
getString: function(stringGrip) {
|
||||
return this.webConsoleClient.getString(stringGrip);
|
||||
},
|
||||
|
||||
/**
|
||||
* Extracts any urlencoded form data sections (e.g. "?foo=bar&baz=42") from a
|
||||
* POST request.
|
||||
*
|
||||
* @param object aHeaders
|
||||
* @param object headers
|
||||
* The "requestHeaders".
|
||||
* @param object aUploadHeaders
|
||||
* @param object uploadHeaders
|
||||
* The "requestHeadersFromUploadStream".
|
||||
* @param object aPostData
|
||||
* @param object postData
|
||||
* The "requestPostData".
|
||||
* @return array
|
||||
* A promise that is resolved with the extracted form data.
|
||||
*/
|
||||
_getFormDataSections: Task.async(function*(aHeaders, aUploadHeaders, aPostData) {
|
||||
_getFormDataSections: Task.async(function*(headers, uploadHeaders, postData) {
|
||||
let formDataSections = [];
|
||||
|
||||
let { headers: requestHeaders } = aHeaders;
|
||||
let { headers: payloadHeaders } = aUploadHeaders;
|
||||
let { headers: requestHeaders } = headers;
|
||||
let { headers: payloadHeaders } = uploadHeaders;
|
||||
let allHeaders = [...payloadHeaders, ...requestHeaders];
|
||||
|
||||
let contentTypeHeader = allHeaders.find(e => e.name.toLowerCase() == "content-type");
|
||||
let contentTypeLongString = contentTypeHeader ? contentTypeHeader.value : "";
|
||||
let contentTypeHeader = allHeaders.find(e => {
|
||||
return e.name.toLowerCase() == "content-type";
|
||||
});
|
||||
|
||||
let contentTypeLongString = contentTypeHeader ?
|
||||
contentTypeHeader.value : "";
|
||||
let contentType = yield this.getString(contentTypeLongString);
|
||||
|
||||
if (contentType.includes("x-www-form-urlencoded")) {
|
||||
let postDataLongString = aPostData.postData.text;
|
||||
let postData = yield this.getString(postDataLongString);
|
||||
let postDataLongString = postData.postData.text;
|
||||
let data = yield this.getString(postDataLongString);
|
||||
|
||||
for (let section of postData.split(/\r\n|\r|\n/)) {
|
||||
for (let section of data.split(/\r\n|\r|\n/)) {
|
||||
// Before displaying it, make sure this section of the POST data
|
||||
// isn't a line containing upload stream headers.
|
||||
if (payloadHeaders.every(header => !section.startsWith(header.name))) {
|
||||
|
@ -279,14 +283,14 @@ TabWatcher.prototype = {
|
|||
* @param object aPacket
|
||||
* Packet received from the server.
|
||||
*/
|
||||
onTabNavigated: function(aType, aPacket) {
|
||||
switch (aType) {
|
||||
onTabNavigated: function(type, packet) {
|
||||
switch (type) {
|
||||
case "will-navigate": {
|
||||
this.listener.pageLoadBegin(aPacket);
|
||||
this.listener.pageLoadBegin(packet);
|
||||
break;
|
||||
}
|
||||
case "navigate": {
|
||||
this.listener.pageLoadDone(aPacket);
|
||||
this.listener.pageLoadDone(packet);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const { Cu, Ci, Cc } = require("chrome");
|
||||
const { defer, all, resolve } = require("promise");
|
||||
const Services = require("Services");
|
||||
const { Ci, Cc } = require("chrome");
|
||||
const { defer, all } = require("promise");
|
||||
|
||||
loader.lazyImporter(this, "ViewHelpers", "resource://devtools/client/shared/widgets/ViewHelpers.jsm");
|
||||
loader.lazyRequireGetter(this, "NetworkHelper", "devtools/shared/webconsole/network-helper");
|
||||
|
@ -42,7 +41,7 @@ const HAR_VERSION = "1.1";
|
|||
var HarBuilder = function(options) {
|
||||
this._options = options;
|
||||
this._pageMap = [];
|
||||
}
|
||||
};
|
||||
|
||||
HarBuilder.prototype = {
|
||||
// Public API
|
||||
|
@ -63,7 +62,7 @@ HarBuilder.prototype = {
|
|||
|
||||
// Build entries.
|
||||
let items = this._options.items;
|
||||
for (let i=0; i<items.length; i++) {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let file = items[i].attachment;
|
||||
log.entries.push(this.buildEntry(log, file));
|
||||
}
|
||||
|
@ -91,7 +90,7 @@ HarBuilder.prototype = {
|
|||
},
|
||||
pages: [],
|
||||
entries: [],
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
buildPage: function(file) {
|
||||
|
@ -228,7 +227,7 @@ HarBuilder.prototype = {
|
|||
value: value
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
return result;
|
||||
},
|
||||
|
@ -281,7 +280,7 @@ HarBuilder.prototype = {
|
|||
|
||||
// Arbitrary value if it's aborted to make sure status has a number
|
||||
if (file.status) {
|
||||
response.status = parseInt(file.status);
|
||||
response.status = parseInt(file.status, 10);
|
||||
}
|
||||
|
||||
let responseHeaders = file.responseHeaders;
|
||||
|
@ -336,7 +335,7 @@ HarBuilder.prototype = {
|
|||
|
||||
if (responseContent) {
|
||||
let text = responseContent.content.text;
|
||||
let promise = this.fetchData(text).then(value => {
|
||||
this.fetchData(text).then(value => {
|
||||
content.text = value;
|
||||
});
|
||||
}
|
||||
|
@ -404,7 +403,7 @@ HarBuilder.prototype = {
|
|||
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Helpers
|
||||
|
||||
|
@ -412,7 +411,7 @@ HarBuilder.prototype = {
|
|||
* Returns true if specified request body is URL encoded.
|
||||
*/
|
||||
function isURLEncodedFile(file, text) {
|
||||
let contentType = "content-type: application/x-www-form-urlencoded"
|
||||
let contentType = "content-type: application/x-www-form-urlencoded";
|
||||
if (text && text.toLowerCase().indexOf(contentType) != -1) {
|
||||
return true;
|
||||
}
|
||||
|
@ -469,12 +468,12 @@ function dateToJSON(date) {
|
|||
return s;
|
||||
}
|
||||
|
||||
let result = date.getFullYear() + '-' +
|
||||
f(date.getMonth() + 1) + '-' +
|
||||
f(date.getDate()) + 'T' +
|
||||
f(date.getHours()) + ':' +
|
||||
f(date.getMinutes()) + ':' +
|
||||
f(date.getSeconds()) + '.' +
|
||||
let result = date.getFullYear() + "-" +
|
||||
f(date.getMonth() + 1) + "-" +
|
||||
f(date.getDate()) + "T" +
|
||||
f(date.getHours()) + ":" +
|
||||
f(date.getMinutes()) + ":" +
|
||||
f(date.getSeconds()) + "." +
|
||||
f(date.getMilliseconds(), 3);
|
||||
|
||||
let offset = date.getTimezoneOffset();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const { Cu, Ci, Cc } = require("chrome");
|
||||
const { Cu } = require("chrome");
|
||||
const { defer, all } = require("promise");
|
||||
const { setTimeout, clearTimeout } = require("sdk/timers");
|
||||
const { makeInfallible } = require("devtools/shared/DevToolsUtils");
|
||||
|
@ -13,7 +13,7 @@ const Services = require("Services");
|
|||
const trace = {
|
||||
log: function(...args) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This object is responsible for collecting data related to all
|
||||
|
@ -43,12 +43,14 @@ HarCollector.prototype = {
|
|||
|
||||
start: function() {
|
||||
this.debuggerClient.addListener("networkEvent", this.onNetworkEvent);
|
||||
this.debuggerClient.addListener("networkEventUpdate", this.onNetworkEventUpdate);
|
||||
this.debuggerClient.addListener("networkEventUpdate",
|
||||
this.onNetworkEventUpdate);
|
||||
},
|
||||
|
||||
stop: function() {
|
||||
this.debuggerClient.removeListener("networkEvent", this.onNetworkEvent);
|
||||
this.debuggerClient.removeListener("networkEventUpdate", this.onNetworkEventUpdate);
|
||||
this.debuggerClient.removeListener("networkEventUpdate",
|
||||
this.onNetworkEventUpdate);
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
|
@ -62,7 +64,8 @@ HarCollector.prototype = {
|
|||
},
|
||||
|
||||
waitForHarLoad: function() {
|
||||
// There should be yet another timeout 'devtools.netmonitor.har.pageLoadTimeout'
|
||||
// There should be yet another timeout e.g.:
|
||||
// 'devtools.netmonitor.har.pageLoadTimeout'
|
||||
// that should force export even if page isn't fully loaded.
|
||||
let deferred = defer();
|
||||
this.waitForResponses().then(() => {
|
||||
|
@ -95,7 +98,7 @@ HarCollector.prototype = {
|
|||
|
||||
// New requests executed, let's wait again.
|
||||
return this.waitForResponses();
|
||||
})
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -225,19 +228,24 @@ HarCollector.prototype = {
|
|||
let request;
|
||||
switch (packet.updateType) {
|
||||
case "requestHeaders":
|
||||
request = this.getData(actor, "getRequestHeaders", this.onRequestHeaders);
|
||||
request = this.getData(actor, "getRequestHeaders",
|
||||
this.onRequestHeaders);
|
||||
break;
|
||||
case "requestCookies":
|
||||
request = this.getData(actor, "getRequestCookies", this.onRequestCookies);
|
||||
request = this.getData(actor, "getRequestCookies",
|
||||
this.onRequestCookies);
|
||||
break;
|
||||
case "requestPostData":
|
||||
request = this.getData(actor, "getRequestPostData", this.onRequestPostData);
|
||||
request = this.getData(actor, "getRequestPostData",
|
||||
this.onRequestPostData);
|
||||
break;
|
||||
case "responseHeaders":
|
||||
request = this.getData(actor, "getResponseHeaders", this.onResponseHeaders);
|
||||
request = this.getData(actor, "getResponseHeaders",
|
||||
this.onResponseHeaders);
|
||||
break;
|
||||
case "responseCookies":
|
||||
request = this.getData(actor, "getResponseCookies", this.onResponseCookies);
|
||||
request = this.getData(actor, "getResponseCookies",
|
||||
this.onResponseCookies);
|
||||
break;
|
||||
case "responseStart":
|
||||
file.httpVersion = packet.response.httpVersion;
|
||||
|
@ -250,11 +258,13 @@ HarCollector.prototype = {
|
|||
file.transferredSize = packet.transferredSize;
|
||||
|
||||
if (includeResponseBodies) {
|
||||
request = this.getData(actor, "getResponseContent", this.onResponseContent);
|
||||
request = this.getData(actor, "getResponseContent",
|
||||
this.onResponseContent);
|
||||
}
|
||||
break;
|
||||
case "eventTimings":
|
||||
request = this.getData(actor, "getEventTimings", this.onEventTimings);
|
||||
request = this.getData(actor, "getEventTimings",
|
||||
this.onEventTimings);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -271,7 +281,7 @@ HarCollector.prototype = {
|
|||
if (!this.webConsoleClient[method]) {
|
||||
Cu.reportError("HarCollector.getData; ERROR " +
|
||||
"Unknown method!");
|
||||
return;
|
||||
return deferred.resolve();
|
||||
}
|
||||
|
||||
let file = this.getFile(actor);
|
||||
|
@ -332,8 +342,8 @@ HarCollector.prototype = {
|
|||
let text = response.postData.text;
|
||||
if (typeof text == "object") {
|
||||
this.getString(text).then(value => {
|
||||
response.postData.text = value;
|
||||
})
|
||||
response.postData.text = value;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -378,7 +388,7 @@ HarCollector.prototype = {
|
|||
if (typeof text == "object") {
|
||||
this.getString(text).then(value => {
|
||||
response.content.text = value;
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
const { Cu, Cc, Ci } = require("chrome");
|
||||
const Services = require("Services");
|
||||
const { defer, resolve } = require("promise");
|
||||
const { resolve } = require("promise");
|
||||
const { HarUtils } = require("./har-utils.js");
|
||||
const { HarBuilder } = require("./har-builder.js");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "clipboardHelper", function() {
|
||||
return Cc["@mozilla.org/widget/clipboardhelper;1"].
|
||||
getService(Ci.nsIClipboardHelper);
|
||||
return Cc["@mozilla.org/widget/clipboardhelper;1"]
|
||||
.getService(Ci.nsIClipboardHelper);
|
||||
});
|
||||
|
||||
var uid = 1;
|
||||
|
@ -20,7 +20,7 @@ var uid = 1;
|
|||
const trace = {
|
||||
log: function(...args) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This object represents the main public API designed to access
|
||||
|
@ -117,9 +117,10 @@ const HarExporter = {
|
|||
options.jsonp = options.jsonp ||
|
||||
Services.prefs.getBoolPref("devtools.netmonitor.har.jsonp");
|
||||
options.includeResponseBodies = options.includeResponseBodies ||
|
||||
Services.prefs.getBoolPref("devtools.netmonitor.har.includeResponseBodies");
|
||||
Services.prefs.getBoolPref(
|
||||
"devtools.netmonitor.har.includeResponseBodies");
|
||||
options.jsonpCallback = options.jsonpCallback ||
|
||||
Services.prefs.getCharPref( "devtools.netmonitor.har.jsonpCallback");
|
||||
Services.prefs.getCharPref("devtools.netmonitor.har.jsonpCallback");
|
||||
options.forceExport = options.forceExport ||
|
||||
Services.prefs.getBoolPref("devtools.netmonitor.har.forceExport");
|
||||
|
||||
|
@ -172,8 +173,7 @@ const HarExporter = {
|
|||
|
||||
try {
|
||||
return JSON.stringify(har, null, " ");
|
||||
}
|
||||
catch (err) {
|
||||
} catch (err) {
|
||||
Cu.reportError(err);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
"use strict";
|
||||
|
||||
const { Cu, Ci, Cc, CC } = require("chrome");
|
||||
const Services = require("Services");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "dirService", function() {
|
||||
return Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
|
||||
return Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIProperties);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ZipWriter", function() {
|
||||
|
@ -25,12 +25,12 @@ XPCOMUtils.defineLazyGetter(this, "getMostRecentBrowserWindow", function() {
|
|||
const nsIFilePicker = Ci.nsIFilePicker;
|
||||
|
||||
const OPEN_FLAGS = {
|
||||
RDONLY: parseInt("0x01"),
|
||||
WRONLY: parseInt("0x02"),
|
||||
CREATE_FILE: parseInt("0x08"),
|
||||
APPEND: parseInt("0x10"),
|
||||
TRUNCATE: parseInt("0x20"),
|
||||
EXCL: parseInt("0x80")
|
||||
RDONLY: parseInt("0x01", 16),
|
||||
WRONLY: parseInt("0x02", 16),
|
||||
CREATE_FILE: parseInt("0x08", 16),
|
||||
APPEND: parseInt("0x10", 16),
|
||||
TRUNCATE: parseInt("0x20", 16),
|
||||
EXCL: parseInt("0x80", 16)
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -46,7 +46,8 @@ var HarUtils = {
|
|||
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
fp.init(browser, null, nsIFilePicker.modeSave);
|
||||
fp.appendFilter("HTTP Archive Files", "*.har; *.harp; *.json; *.jsonp; *.zip");
|
||||
fp.appendFilter(
|
||||
"HTTP Archive Files", "*.har; *.harp; *.json; *.jsonp; *.zip");
|
||||
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText);
|
||||
fp.filterIndex = 1;
|
||||
|
||||
|
@ -65,8 +66,8 @@ var HarUtils = {
|
|||
|
||||
// Read more about toLocaleFormat & format string.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleFormat
|
||||
var now = new Date();
|
||||
var name = now.toLocaleFormat(defaultFileName);
|
||||
let now = new Date();
|
||||
let name = now.toLocaleFormat(defaultFileName);
|
||||
name = name.replace(/\:/gm, "-", "");
|
||||
name = name.replace(/\//gm, "_", "");
|
||||
|
||||
|
@ -106,8 +107,8 @@ var HarUtils = {
|
|||
|
||||
// The entire jsonString can be huge so, write the data in chunks.
|
||||
let chunkLength = 1024 * 1024;
|
||||
for (let i=0; i<=jsonString.length; i++) {
|
||||
let data = jsonString.substr(i, chunkLength+1);
|
||||
for (let i = 0; i <= jsonString.length; i++) {
|
||||
let data = jsonString.substr(i, chunkLength + 1);
|
||||
if (data) {
|
||||
convertor.writeString(data);
|
||||
}
|
||||
|
@ -136,8 +137,8 @@ var HarUtils = {
|
|||
file.moveTo(null, "temp" + (new Date()).getTime() + "temphar");
|
||||
|
||||
// Create compressed file with the original file path name.
|
||||
let zipFile = Cc["@mozilla.org/file/local;1"].
|
||||
createInstance(Ci.nsILocalFile);
|
||||
let zipFile = Cc["@mozilla.org/file/local;1"]
|
||||
.createInstance(Ci.nsILocalFile);
|
||||
zipFile.initWithPath(originalFilePath);
|
||||
|
||||
// The file within the zipped file doesn't use .zip extension.
|
||||
|
@ -179,7 +180,7 @@ var HarUtils = {
|
|||
|
||||
return dir;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// Exports from this module
|
||||
exports.HarUtils = HarUtils;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
// Extend from the shared list of defined globals for mochitests.
|
||||
"extends": "../../../../.eslintrc.mochitests"
|
||||
}
|
|
@ -1,22 +1,26 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Basic tests for exporting Network panel content into HAR format.
|
||||
*/
|
||||
add_task(function*() {
|
||||
let [ aTab, aDebuggee, aMonitor ] = yield initNetMonitor(SIMPLE_URL);
|
||||
// The first 'tab' isn't necessary so, don't create a var for it
|
||||
// to avoid eslint warning.
|
||||
let [ , debuggee, monitor ] = yield initNetMonitor(SIMPLE_URL);
|
||||
|
||||
info("Starting test... ");
|
||||
|
||||
let { NetMonitorView } = aMonitor.panelWin;
|
||||
let { NetMonitorView } = monitor.panelWin;
|
||||
let { RequestsMenu } = NetMonitorView;
|
||||
|
||||
RequestsMenu.lazyUpdate = false;
|
||||
|
||||
aDebuggee.location.reload();
|
||||
debuggee.location.reload();
|
||||
|
||||
yield waitForNetworkEvents(aMonitor, 1);
|
||||
yield waitForNetworkEvents(monitor, 1);
|
||||
yield RequestsMenu.copyAllAsHar();
|
||||
|
||||
let jsonString = SpecialPowers.getClipboardData("text/unicode");
|
||||
|
@ -36,9 +40,11 @@ add_task(function*() {
|
|||
is(entry.response.status, 200, "Check response status");
|
||||
is(entry.response.statusText, "OK", "Check response status text");
|
||||
is(entry.response.headers.length, 6, "Check number of response headers");
|
||||
is(entry.response.content.mimeType, "text/html", "Check response content type");
|
||||
isnot(entry.response.content.text, undefined, "Check response body");
|
||||
is(entry.response.content.mimeType, // eslint-disable-line
|
||||
"text/html", "Check response content type"); // eslint-disable-line
|
||||
isnot(entry.response.content.text, undefined, // eslint-disable-line
|
||||
"Check response body");
|
||||
isnot(entry.timings, undefined, "Check timings");
|
||||
|
||||
teardown(aMonitor).then(finish);
|
||||
teardown(monitor).then(finish);
|
||||
});
|
||||
|
|
|
@ -1,23 +1,27 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Tests for exporting POST data into HAR format.
|
||||
*/
|
||||
add_task(function*() {
|
||||
let [ aTab, aDebuggee, aMonitor ] = yield initNetMonitor(
|
||||
// The first 'tab' isn't necessary so, don't create a var for it
|
||||
// to avoid eslint warning.
|
||||
let [ , debuggee, monitor ] = yield initNetMonitor(
|
||||
HAR_EXAMPLE_URL + "html_har_post-data-test-page.html");
|
||||
|
||||
info("Starting test... ");
|
||||
|
||||
let { NetMonitorView } = aMonitor.panelWin;
|
||||
let { NetMonitorView } = monitor.panelWin;
|
||||
let { RequestsMenu } = NetMonitorView;
|
||||
|
||||
RequestsMenu.lazyUpdate = false;
|
||||
|
||||
// Execute one POST request on the page and wait till its done.
|
||||
aDebuggee.executeTest();
|
||||
yield waitForNetworkEvents(aMonitor, 0, 1);
|
||||
debuggee.executeTest();
|
||||
yield waitForNetworkEvents(monitor, 0, 1);
|
||||
|
||||
// Copy HAR into the clipboard (asynchronous).
|
||||
let jsonString = yield RequestsMenu.copyAllAsHar();
|
||||
|
@ -35,5 +39,5 @@ add_task(function*() {
|
|||
"Check post data payload");
|
||||
|
||||
// Clean up
|
||||
teardown(aMonitor).then(finish);
|
||||
teardown(monitor).then(finish);
|
||||
});
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* eslint no-unused-vars: [2, {"vars": "local", "args": "none"}] */
|
||||
/* import-globals-from ../../test/head.js */
|
||||
|
||||
var { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
// Load the NetMonitor head.js file to share its API.
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const { Cu, Ci } = require("chrome");
|
||||
const Services = require("Services");
|
||||
|
||||
loader.lazyRequireGetter(this, "HarAutomation", "devtools/client/netmonitor/har/har-automation", true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче