mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Backed out 3 changesets (bug 1223726) for mochitest devtools failures on devtools/client/styleeditor/test/browser_styleeditor_fetch-from-netmonitor.js
Backed out changeset 1a09e6c3c0a3 (bug 1223726) Backed out changeset 41da2897f549 (bug 1223726) Backed out changeset fa0a1e88a238 (bug 1223726)
This commit is contained in:
parent
630a574ba4
commit
4a083dee60
@ -10,12 +10,30 @@ add_task(async function () {
|
||||
// Disable tcp fast open, because it is setting a response header indicator
|
||||
// (bug 1352274). TCP Fast Open is not present on all platforms therefore the
|
||||
// number of response headers will vary depending on the platform.
|
||||
await pushPref("network.tcp.tcp_fastopen_enable", false);
|
||||
Services.prefs.setBoolPref("network.tcp.tcp_fastopen_enable", false);
|
||||
let { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||
|
||||
info("Starting test...");
|
||||
info("Starting test... ");
|
||||
|
||||
let har = await reloadAndCopyAllAsHar(tab, monitor);
|
||||
let { connector, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
let RequestListContextMenu = windowRequire(
|
||||
"devtools/client/netmonitor/src/widgets/RequestListContextMenu");
|
||||
let { getSortedRequests } = windowRequire(
|
||||
"devtools/client/netmonitor/src/selectors/index");
|
||||
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
await wait;
|
||||
|
||||
let contextMenu = new RequestListContextMenu({ connector });
|
||||
|
||||
await contextMenu.copyAllAsHar(getSortedRequests(store.getState()));
|
||||
|
||||
let jsonString = SpecialPowers.getClipboardData("text/unicode");
|
||||
let har = JSON.parse(jsonString);
|
||||
|
||||
// Check out HAR log
|
||||
isnot(har.log, null, "The HAR log must exist");
|
||||
@ -42,44 +60,5 @@ add_task(async function () {
|
||||
"Check response body");
|
||||
isnot(entry.timings, undefined, "Check timings");
|
||||
|
||||
// Test response body limit (non zero).
|
||||
await pushPref("devtools.netmonitor.responseBodyLimit", 10);
|
||||
har = await reloadAndCopyAllAsHar(tab, monitor);
|
||||
entry = har.log.entries[0];
|
||||
is(entry.response.content.text.length, 10, // eslint-disable-line
|
||||
"Response body must be truncated");
|
||||
|
||||
// Test response body limit (zero).
|
||||
await pushPref("devtools.netmonitor.responseBodyLimit", 0);
|
||||
har = await reloadAndCopyAllAsHar(tab, monitor);
|
||||
entry = har.log.entries[0];
|
||||
is(entry.response.content.text.length, 465, // eslint-disable-line
|
||||
"Response body must not be truncated");
|
||||
|
||||
return teardown(monitor);
|
||||
});
|
||||
|
||||
/**
|
||||
* Reload the page and copy all as HAR.
|
||||
*/
|
||||
async function reloadAndCopyAllAsHar(tab, monitor) {
|
||||
let { connector, store, windowRequire } = monitor.panelWin;
|
||||
let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||
let RequestListContextMenu = windowRequire(
|
||||
"devtools/client/netmonitor/src/widgets/RequestListContextMenu");
|
||||
let { getSortedRequests } = windowRequire(
|
||||
"devtools/client/netmonitor/src/selectors/index");
|
||||
|
||||
store.dispatch(Actions.batchEnable(false));
|
||||
|
||||
let wait = waitForNetworkEvents(monitor, 1);
|
||||
tab.linkedBrowser.reload();
|
||||
await wait;
|
||||
|
||||
let contextMenu = new RequestListContextMenu({ connector });
|
||||
|
||||
await contextMenu.copyAllAsHar(getSortedRequests(store.getState()));
|
||||
|
||||
let jsonString = SpecialPowers.getClipboardData("text/unicode");
|
||||
return JSON.parse(jsonString);
|
||||
}
|
||||
|
@ -8,8 +8,8 @@
|
||||
*/
|
||||
|
||||
add_task(async function () {
|
||||
let limit = Services.prefs.getIntPref("devtools.netmonitor.responseBodyLimit");
|
||||
let URL = EXAMPLE_URL + "sjs_truncate-test-server.sjs?limit=" + limit;
|
||||
let { RESPONSE_BODY_LIMIT } = require("devtools/shared/webconsole/network-monitor");
|
||||
let URL = EXAMPLE_URL + "sjs_truncate-test-server.sjs?limit=" + RESPONSE_BODY_LIMIT;
|
||||
let { monitor, tab } = await initNetMonitor(URL);
|
||||
|
||||
info("Starting test... ");
|
||||
|
@ -165,9 +165,6 @@ pref("devtools.netmonitor.visibleColumns",
|
||||
"[\"status\",\"method\",\"file\",\"domain\",\"cause\",\"type\",\"transferred\",\"contentSize\",\"waterfall\"]"
|
||||
);
|
||||
|
||||
// Save request/response bodies yes/no.
|
||||
pref("devtools.netmonitor.saveRequestAndResponseBodies", true);
|
||||
|
||||
// The default Network monitor HAR export setting
|
||||
pref("devtools.netmonitor.har.defaultLogDir", "");
|
||||
pref("devtools.netmonitor.har.defaultFileName", "Archive %date");
|
||||
|
@ -34,10 +34,6 @@ add_task(function* () {
|
||||
yield ui.selectStyleSheet(ui.editors[1].styleSheet);
|
||||
yield ui.editors[1].getSourceEditor();
|
||||
|
||||
// Wait till there is 5 requests in Netmonitor store.
|
||||
// (i.e. the Styleeditor panel performed one request).
|
||||
yield waitUntil(() => getSortedRequests(store.getState()).length == 5);
|
||||
|
||||
info("Checking Netmonitor contents.");
|
||||
let shortRequests = [];
|
||||
let longRequests = [];
|
||||
|
@ -208,15 +208,9 @@ WebConsoleConnectionProxy.prototype = {
|
||||
this.webConsoleClient = webConsoleClient;
|
||||
this._hasNativeConsoleAPI = response.nativeConsoleAPI;
|
||||
|
||||
let saveBodies = Services.prefs.getBoolPref(
|
||||
"devtools.netmonitor.saveRequestAndResponseBodies");
|
||||
|
||||
// There is no way to view response bodies from the Browser Console, so do
|
||||
// not waste the memory.
|
||||
if (this.webConsoleFrame.isBrowserConsole) {
|
||||
saveBodies = false;
|
||||
}
|
||||
|
||||
let saveBodies = !this.webConsoleFrame.isBrowserConsole;
|
||||
this.webConsoleFrame.setSaveRequestAndResponseBodies(saveBodies);
|
||||
|
||||
this.webConsoleClient.on("networkEvent", this._onNetworkEvent);
|
||||
|
@ -35,6 +35,11 @@ const HTTP_FOUND = 302;
|
||||
const HTTP_SEE_OTHER = 303;
|
||||
const HTTP_TEMPORARY_REDIRECT = 307;
|
||||
|
||||
// The maximum number of bytes a NetworkResponseListener can hold: 1 MB
|
||||
const RESPONSE_BODY_LIMIT = 1048576;
|
||||
// Exported for testing.
|
||||
exports.RESPONSE_BODY_LIMIT = RESPONSE_BODY_LIMIT;
|
||||
|
||||
/**
|
||||
* Check if a given network request should be logged by a network monitor
|
||||
* based on the specified filters.
|
||||
@ -274,16 +279,13 @@ function NetworkResponseListener(owner, httpActivity) {
|
||||
this.receivedData = "";
|
||||
this.httpActivity = httpActivity;
|
||||
this.bodySize = 0;
|
||||
// Indicates if the response had a size greater than response body limit.
|
||||
// Indicates if the response had a size greater than RESPONSE_BODY_LIMIT.
|
||||
this.truncated = false;
|
||||
// Note that this is really only needed for the non-e10s case.
|
||||
// See bug 1309523.
|
||||
let channel = this.httpActivity.channel;
|
||||
this._wrappedNotificationCallbacks = channel.notificationCallbacks;
|
||||
channel.notificationCallbacks = this;
|
||||
|
||||
this.responseBodyLimit = Services.prefs.getIntPref(
|
||||
"devtools.netmonitor.responseBodyLimit");
|
||||
}
|
||||
|
||||
NetworkResponseListener.prototype = {
|
||||
@ -395,7 +397,7 @@ NetworkResponseListener.prototype = {
|
||||
/**
|
||||
* Stores the received data, if request/response body logging is enabled. It
|
||||
* also does limit the number of stored bytes, based on the
|
||||
* `devtools.netmonitor.responseBodyLimit` pref.
|
||||
* RESPONSE_BODY_LIMIT constant.
|
||||
*
|
||||
* Learn more about nsIStreamListener at:
|
||||
* https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIStreamListener
|
||||
@ -413,13 +415,10 @@ NetworkResponseListener.prototype = {
|
||||
this.bodySize += count;
|
||||
|
||||
if (!this.httpActivity.discardResponseBody) {
|
||||
let limit = Services.prefs.getIntPref("devtools.netmonitor.responseBodyLimit");
|
||||
if (this.receivedData.length < limit || limit == 0) {
|
||||
if (this.receivedData.length < RESPONSE_BODY_LIMIT) {
|
||||
this.receivedData +=
|
||||
NetworkHelper.convertToUnicode(data, request.contentCharset);
|
||||
}
|
||||
if (this.receivedData.length > limit && limit > 0) {
|
||||
this.receivedData = this.receivedData.substr(0, limit);
|
||||
} else {
|
||||
this.truncated = true;
|
||||
}
|
||||
}
|
||||
|
@ -1113,12 +1113,6 @@ pref("devtools.debugger.force-local", true);
|
||||
// Block tools from seeing / interacting with certified apps
|
||||
pref("devtools.debugger.forbid-certified-apps", true);
|
||||
|
||||
// Limit for intercepted response bodies (1 MB)
|
||||
// Possible values:
|
||||
// 0 => the response body has no limit
|
||||
// n => represents max number of bytes stored
|
||||
pref("devtools.netmonitor.responseBodyLimit", 1048576);
|
||||
|
||||
// DevTools default color unit
|
||||
pref("devtools.defaultColorUnit", "authored");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user