зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 47dea14575f1 (bug 1764349) for failing devtools at browser_net_stacktraces-visibility.js on a CLOSED TREE
This commit is contained in:
Родитель
7738a75fdd
Коммит
b328806a08
|
@ -143,13 +143,10 @@ function removeSelectedCustomRequest() {
|
||||||
type: REMOVE_SELECTED_CUSTOM_REQUEST,
|
type: REMOVE_SELECTED_CUSTOM_REQUEST,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Clear all requests
|
|
||||||
*/
|
|
||||||
function clearRequests() {
|
function clearRequests() {
|
||||||
return ({ dispatch, connector }) => {
|
return {
|
||||||
dispatch({ type: CLEAR_REQUESTS });
|
type: CLEAR_REQUESTS,
|
||||||
connector.clear();
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,6 @@ const {
|
||||||
getDisplayedTimingMarker,
|
getDisplayedTimingMarker,
|
||||||
} = require("devtools/client/netmonitor/src/selectors/index");
|
} = require("devtools/client/netmonitor/src/selectors/index");
|
||||||
|
|
||||||
const { TYPES } = require("devtools/shared/commands/resource/resource-command");
|
|
||||||
|
|
||||||
// Network throttling
|
// Network throttling
|
||||||
loader.lazyRequireGetter(
|
loader.lazyRequireGetter(
|
||||||
this,
|
this,
|
||||||
|
@ -54,13 +52,6 @@ class Connector {
|
||||||
this.networkFront = null;
|
this.networkFront = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NETWORK_RESOURCES = [
|
|
||||||
TYPES.NETWORK_EVENT,
|
|
||||||
TYPES.NETWORK_EVENT_STACKTRACE,
|
|
||||||
TYPES.WEBSOCKET,
|
|
||||||
TYPES.SERVER_SENT_EVENT,
|
|
||||||
];
|
|
||||||
|
|
||||||
get currentTarget() {
|
get currentTarget() {
|
||||||
return this.commands.targetCommand.targetFront;
|
return this.commands.targetCommand.targetFront;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +97,8 @@ class Connector {
|
||||||
onAvailable: this.onTargetAvailable,
|
onAvailable: this.onTargetAvailable,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { TYPES } = this.toolbox.resourceCommand;
|
||||||
|
|
||||||
await this.toolbox.resourceCommand.watchResources([TYPES.DOCUMENT_EVENT], {
|
await this.toolbox.resourceCommand.watchResources([TYPES.DOCUMENT_EVENT], {
|
||||||
onAvailable: this.onResourceAvailable,
|
onAvailable: this.onResourceAvailable,
|
||||||
});
|
});
|
||||||
|
@ -136,6 +129,7 @@ class Connector {
|
||||||
onAvailable: this.onTargetAvailable,
|
onAvailable: this.onTargetAvailable,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { TYPES } = this.toolbox.resourceCommand;
|
||||||
this.toolbox.resourceCommand.unwatchResources([TYPES.DOCUMENT_EVENT], {
|
this.toolbox.resourceCommand.unwatchResources([TYPES.DOCUMENT_EVENT], {
|
||||||
onAvailable: this.onResourceAvailable,
|
onAvailable: this.onResourceAvailable,
|
||||||
});
|
});
|
||||||
|
@ -157,19 +151,15 @@ class Connector {
|
||||||
this.dataProvider = null;
|
this.dataProvider = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
|
||||||
// Clear all the caches in the data provider
|
|
||||||
this.dataProvider.destroy();
|
|
||||||
|
|
||||||
this.toolbox.resourceCommand.clearResources(Connector.NETWORK_RESOURCES);
|
|
||||||
|
|
||||||
// Disable the realted network logs in the webconsole
|
|
||||||
this.toolbox.disableAllConsoleNetworkLogs();
|
|
||||||
}
|
|
||||||
|
|
||||||
pause() {
|
pause() {
|
||||||
return this.toolbox.resourceCommand.unwatchResources(
|
const { resourceCommand } = this.toolbox;
|
||||||
Connector.NETWORK_RESOURCES,
|
return resourceCommand.unwatchResources(
|
||||||
|
[
|
||||||
|
resourceCommand.TYPES.NETWORK_EVENT,
|
||||||
|
resourceCommand.TYPES.NETWORK_EVENT_STACKTRACE,
|
||||||
|
resourceCommand.TYPES.WEBSOCKET,
|
||||||
|
resourceCommand.TYPES.SERVER_SENT_EVENT,
|
||||||
|
],
|
||||||
{
|
{
|
||||||
onAvailable: this.onResourceAvailable,
|
onAvailable: this.onResourceAvailable,
|
||||||
onUpdated: this.onResourceUpdated,
|
onUpdated: this.onResourceUpdated,
|
||||||
|
@ -178,8 +168,15 @@ class Connector {
|
||||||
}
|
}
|
||||||
|
|
||||||
resume(ignoreExistingResources = true) {
|
resume(ignoreExistingResources = true) {
|
||||||
return this.toolbox.resourceCommand.watchResources(
|
const { resourceCommand } = this.toolbox;
|
||||||
Connector.NETWORK_RESOURCES,
|
|
||||||
|
return resourceCommand.watchResources(
|
||||||
|
[
|
||||||
|
resourceCommand.TYPES.NETWORK_EVENT,
|
||||||
|
resourceCommand.TYPES.NETWORK_EVENT_STACKTRACE,
|
||||||
|
resourceCommand.TYPES.WEBSOCKET,
|
||||||
|
resourceCommand.TYPES.SERVER_SENT_EVENT,
|
||||||
|
],
|
||||||
{
|
{
|
||||||
onAvailable: this.onResourceAvailable,
|
onAvailable: this.onResourceAvailable,
|
||||||
onUpdated: this.onResourceUpdated,
|
onUpdated: this.onResourceUpdated,
|
||||||
|
@ -204,6 +201,8 @@ class Connector {
|
||||||
|
|
||||||
async onResourceAvailable(resources, { areExistingResources }) {
|
async onResourceAvailable(resources, { areExistingResources }) {
|
||||||
for (const resource of resources) {
|
for (const resource of resources) {
|
||||||
|
const { TYPES } = this.toolbox.resourceCommand;
|
||||||
|
|
||||||
if (resource.resourceType === TYPES.DOCUMENT_EVENT) {
|
if (resource.resourceType === TYPES.DOCUMENT_EVENT) {
|
||||||
this.onDocEvent(resource, { areExistingResources });
|
this.onDocEvent(resource, { areExistingResources });
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -88,7 +88,6 @@ support-files =
|
||||||
xhr_original.js
|
xhr_original.js
|
||||||
!/devtools/client/shared/test/shared-head.js
|
!/devtools/client/shared/test/shared-head.js
|
||||||
!/devtools/client/shared/test/telemetry-test-helpers.js
|
!/devtools/client/shared/test/telemetry-test-helpers.js
|
||||||
!/devtools/client/webconsole/test/browser/shared-head.js
|
|
||||||
|
|
||||||
[browser_net_accessibility-01.js]
|
[browser_net_accessibility-01.js]
|
||||||
[browser_net_accessibility-02.js]
|
[browser_net_accessibility-02.js]
|
||||||
|
|
|
@ -3,20 +3,12 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/* import-globals-from ../../webconsole/test/browser/shared-head.js */
|
|
||||||
Services.scriptloader.loadSubScript(
|
|
||||||
"chrome://mochitests/content/browser/devtools/client/webconsole/test/browser/shared-head.js",
|
|
||||||
this
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests if the clear button empties the request menu.
|
* Tests if the clear button empties the request menu.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
Services.prefs.setBoolPref("devtools.webconsole.filter.net", true);
|
const { monitor } = await initNetMonitor(SIMPLE_URL, {
|
||||||
|
|
||||||
const { monitor, toolbox } = await initNetMonitor(SIMPLE_URL, {
|
|
||||||
requestCount: 1,
|
requestCount: 1,
|
||||||
});
|
});
|
||||||
info("Starting test... ");
|
info("Starting test... ");
|
||||||
|
@ -36,38 +28,10 @@ add_task(async function() {
|
||||||
await wait;
|
await wait;
|
||||||
|
|
||||||
assertSingleRequestState();
|
assertSingleRequestState();
|
||||||
assertNetworkEventResourceState(1);
|
|
||||||
|
|
||||||
info("Swith to the webconsole and wait for network logs");
|
|
||||||
const onWebConsole = monitor.toolbox.once("webconsole-selected");
|
|
||||||
const { hud } = await monitor.toolbox.selectTool("webconsole");
|
|
||||||
await onWebConsole;
|
|
||||||
|
|
||||||
info("Wait for request");
|
|
||||||
await waitFor(() => findMessageByType(hud, SIMPLE_URL, ".network"));
|
|
||||||
|
|
||||||
info("Switch back the the netmonitor");
|
|
||||||
await monitor.toolbox.selectTool("netmonitor");
|
|
||||||
|
|
||||||
// Click clear and make sure the requests are gone
|
// Click clear and make sure the requests are gone
|
||||||
let waitRequestListCleared = waitForEmptyRequestList(document);
|
|
||||||
EventUtils.sendMouseEvent({ type: "click" }, clearButton);
|
EventUtils.sendMouseEvent({ type: "click" }, clearButton);
|
||||||
await waitRequestListCleared;
|
|
||||||
|
|
||||||
assertNoRequestState();
|
assertNoRequestState();
|
||||||
assertNetworkEventResourceState(0);
|
|
||||||
|
|
||||||
info(
|
|
||||||
"Swith back to the webconsole to assert that the cleared request gets disabled"
|
|
||||||
);
|
|
||||||
await monitor.toolbox.selectTool("webconsole");
|
|
||||||
|
|
||||||
info("Wait for network request to show and that its disabled");
|
|
||||||
|
|
||||||
await waitFor(() => findMessageByType(hud, SIMPLE_URL, ".network.disabled"));
|
|
||||||
|
|
||||||
// Switch back to the netmonitor.
|
|
||||||
await monitor.toolbox.selectTool("netmonitor");
|
|
||||||
|
|
||||||
// Load a second request and make sure they still show up
|
// Load a second request and make sure they still show up
|
||||||
wait = waitForNetworkEvents(monitor, 1);
|
wait = waitForNetworkEvents(monitor, 1);
|
||||||
|
@ -75,14 +39,10 @@ add_task(async function() {
|
||||||
await wait;
|
await wait;
|
||||||
|
|
||||||
assertSingleRequestState();
|
assertSingleRequestState();
|
||||||
assertNetworkEventResourceState(1);
|
|
||||||
|
|
||||||
// Make sure we can now open the network details panel
|
// Make sure we can now open the network details panel
|
||||||
store.dispatch(Actions.toggleNetworkDetails());
|
store.dispatch(Actions.toggleNetworkDetails());
|
||||||
const detailsPanelToggleButton = document.querySelector(".sidebar-toggle");
|
const detailsPanelToggleButton = document.querySelector(".sidebar-toggle");
|
||||||
// Wait for the details panel to finish fetching the headers information
|
|
||||||
await waitForRequestData(store, ["requestHeaders", "responseHeaders"]);
|
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
detailsPanelToggleButton &&
|
detailsPanelToggleButton &&
|
||||||
!detailsPanelToggleButton.classList.contains("pane-collapsed"),
|
!detailsPanelToggleButton.classList.contains("pane-collapsed"),
|
||||||
|
@ -90,13 +50,9 @@ add_task(async function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Click clear and make sure the details pane closes
|
// Click clear and make sure the details pane closes
|
||||||
waitRequestListCleared = waitForEmptyRequestList(document);
|
|
||||||
EventUtils.sendMouseEvent({ type: "click" }, clearButton);
|
EventUtils.sendMouseEvent({ type: "click" }, clearButton);
|
||||||
await waitRequestListCleared;
|
|
||||||
|
|
||||||
assertNoRequestState();
|
assertNoRequestState();
|
||||||
assertNetworkEventResourceState(0);
|
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
!document.querySelector(".network-details-bar"),
|
!document.querySelector(".network-details-bar"),
|
||||||
"The details pane should not be visible clicking 'clear'."
|
"The details pane should not be visible clicking 'clear'."
|
||||||
|
@ -125,21 +81,4 @@ add_task(async function() {
|
||||||
"The request menu should be empty at this point."
|
"The request menu should be empty at this point."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertNetworkEventResourceState(expectedNoOfNetworkEventResources) {
|
|
||||||
const actualNoOfNetworkEventResources = toolbox.resourceCommand.getAllResources(
|
|
||||||
toolbox.resourceCommand.TYPES.NETWORK_EVENT
|
|
||||||
).length;
|
|
||||||
|
|
||||||
is(
|
|
||||||
actualNoOfNetworkEventResources,
|
|
||||||
expectedNoOfNetworkEventResources,
|
|
||||||
`The expected number of network resources is correctly ${actualNoOfNetworkEventResources}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function waitForEmptyRequestList(doc) {
|
|
||||||
info("Wait for request list to clear");
|
|
||||||
return waitFor(() => !!doc.querySelector(".request-list-empty-notice"));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,25 +18,20 @@ add_task(async function() {
|
||||||
await assertRequest(monitor, REQUEST_URL);
|
await assertRequest(monitor, REQUEST_URL);
|
||||||
|
|
||||||
info("Navigate to a page that runs in another content process (if fission)");
|
info("Navigate to a page that runs in another content process (if fission)");
|
||||||
await waitForUpdatesAndNavigateTo(EXAMPLE_NET_URL);
|
await navigateTo(EXAMPLE_NET_URL);
|
||||||
await assertRequest(monitor, REQUEST_URL);
|
await assertRequest(monitor, REQUEST_URL);
|
||||||
|
|
||||||
info("Navigate to a parent process page");
|
info("Navigate to a parent process page");
|
||||||
await waitForUpdatesAndNavigateTo(PARENT_PROCESS_URL);
|
await navigateTo(PARENT_PROCESS_URL);
|
||||||
await assertRequest(monitor, REQUEST_URL);
|
await assertRequest(monitor, REQUEST_URL);
|
||||||
|
|
||||||
info("Navigate back to the example.com content page");
|
info("Navigate back to the example.com content page");
|
||||||
await waitForUpdatesAndNavigateTo(EXAMPLE_COM_URL);
|
await navigateTo(EXAMPLE_COM_URL);
|
||||||
await assertRequest(monitor, REQUEST_URL);
|
await assertRequest(monitor, REQUEST_URL);
|
||||||
|
|
||||||
await teardown(monitor);
|
await teardown(monitor);
|
||||||
});
|
});
|
||||||
|
|
||||||
async function waitForUpdatesAndNavigateTo(url) {
|
|
||||||
await waitForAllNetworkUpdateEvents();
|
|
||||||
await navigateTo(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function assertRequest(monitor, url) {
|
async function assertRequest(monitor, url) {
|
||||||
const waitForRequests = waitForNetworkEvents(monitor, 1);
|
const waitForRequests = waitForNetworkEvents(monitor, 1);
|
||||||
info("Create a request in the target page for the URL: " + url);
|
info("Create a request in the target page for the URL: " + url);
|
||||||
|
|
|
@ -58,7 +58,6 @@ add_task(async function() {
|
||||||
EventUtils.sendMouseEvent({ type: "click" }, pauseButton);
|
EventUtils.sendMouseEvent({ type: "click" }, pauseButton);
|
||||||
await waitForPauseButtonToChange(document, true);
|
await waitForPauseButtonToChange(document, true);
|
||||||
|
|
||||||
await waitForAllNetworkUpdateEvents();
|
|
||||||
// Page reload should auto-resume
|
// Page reload should auto-resume
|
||||||
await reloadBrowser();
|
await reloadBrowser();
|
||||||
await waitForPauseButtonToChange(document, false);
|
await waitForPauseButtonToChange(document, false);
|
||||||
|
|
|
@ -119,7 +119,8 @@ add_task(async function() {
|
||||||
" after request has been completed."
|
" after request has been completed."
|
||||||
);
|
);
|
||||||
|
|
||||||
await clearNetworkEvents(monitor);
|
info("Clearing requests.");
|
||||||
|
store.dispatch(Actions.clearRequests());
|
||||||
}
|
}
|
||||||
|
|
||||||
return teardown(monitor);
|
return teardown(monitor);
|
||||||
|
|
|
@ -57,7 +57,7 @@ add_task(async function() {
|
||||||
"Cipher suite warning is hidden."
|
"Cipher suite warning is hidden."
|
||||||
);
|
);
|
||||||
|
|
||||||
await clearNetworkEvents(monitor);
|
store.dispatch(Actions.clearRequests());
|
||||||
}
|
}
|
||||||
|
|
||||||
return teardown(monitor);
|
return teardown(monitor);
|
||||||
|
|
|
@ -72,7 +72,7 @@ add_task(async function() {
|
||||||
"The network details panel should still be hidden after a reload."
|
"The network details panel should still be hidden after a reload."
|
||||||
);
|
);
|
||||||
|
|
||||||
await clearNetworkEvents(monitor);
|
store.dispatch(Actions.clearRequests());
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
document.querySelector(".request-list-empty-notice"),
|
document.querySelector(".request-list-empty-notice"),
|
||||||
|
|
|
@ -27,8 +27,6 @@ add_task(async function() {
|
||||||
const allRequestsVisible = waitUntil(
|
const allRequestsVisible = waitUntil(
|
||||||
() => document.querySelectorAll(".request-list-item").length == 2
|
() => document.querySelectorAll(".request-list-item").length == 2
|
||||||
);
|
);
|
||||||
|
|
||||||
await waitForAllNetworkUpdateEvents();
|
|
||||||
await reloadBrowser();
|
await reloadBrowser();
|
||||||
await allRequestsVisible;
|
await allRequestsVisible;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ add_task(async function() {
|
||||||
|
|
||||||
store.dispatch(Actions.batchEnable(false));
|
store.dispatch(Actions.batchEnable(false));
|
||||||
|
|
||||||
await waitForAllNetworkUpdateEvents();
|
|
||||||
// Remove all telemetry events (you can check about:telemetry).
|
// Remove all telemetry events (you can check about:telemetry).
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
|
||||||
|
@ -32,7 +31,6 @@ add_task(async function() {
|
||||||
|
|
||||||
// Reload to have one request in the list.
|
// Reload to have one request in the list.
|
||||||
const wait = waitForNetworkEvents(monitor, 1);
|
const wait = waitForNetworkEvents(monitor, 1);
|
||||||
await waitForAllNetworkUpdateEvents();
|
|
||||||
await navigateTo(HTTPS_SIMPLE_URL);
|
await navigateTo(HTTPS_SIMPLE_URL);
|
||||||
await wait;
|
await wait;
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,6 @@ add_task(async function() {
|
||||||
|
|
||||||
store.dispatch(Actions.batchEnable(false));
|
store.dispatch(Actions.batchEnable(false));
|
||||||
|
|
||||||
await waitForAllNetworkUpdateEvents();
|
|
||||||
|
|
||||||
// Clear all events
|
// Clear all events
|
||||||
Services.telemetry.clearEvents();
|
Services.telemetry.clearEvents();
|
||||||
|
|
||||||
|
@ -70,7 +68,6 @@ add_task(async function() {
|
||||||
object: "netmonitor",
|
object: "netmonitor",
|
||||||
};
|
};
|
||||||
|
|
||||||
await waitForAllNetworkUpdateEvents();
|
|
||||||
// Will compare filtered events to event list above
|
// Will compare filtered events to event list above
|
||||||
await TelemetryTestUtils.assertEvents(expectedEvents, filter);
|
await TelemetryTestUtils.assertEvents(expectedEvents, filter);
|
||||||
|
|
||||||
|
|
|
@ -338,6 +338,12 @@ function initNetMonitor(
|
||||||
startNetworkEventUpdateObserver(monitor.panelWin);
|
startNetworkEventUpdateObserver(monitor.panelWin);
|
||||||
|
|
||||||
if (!enableCache) {
|
if (!enableCache) {
|
||||||
|
const panel = monitor.panelWin;
|
||||||
|
const { store, windowRequire } = panel;
|
||||||
|
const Actions = windowRequire(
|
||||||
|
"devtools/client/netmonitor/src/actions/index"
|
||||||
|
);
|
||||||
|
|
||||||
info("Disabling cache and reloading page.");
|
info("Disabling cache and reloading page.");
|
||||||
|
|
||||||
const requestsDone = waitForNetworkEvents(monitor, requestCount, {
|
const requestsDone = waitForNetworkEvents(monitor, requestCount, {
|
||||||
|
@ -346,7 +352,8 @@ function initNetMonitor(
|
||||||
const markersDone = waitForTimelineMarkers(monitor);
|
const markersDone = waitForTimelineMarkers(monitor);
|
||||||
await toggleCache(toolbox, true);
|
await toggleCache(toolbox, true);
|
||||||
await Promise.all([requestsDone, markersDone]);
|
await Promise.all([requestsDone, markersDone]);
|
||||||
await clearNetworkEvents(monitor);
|
info("Clearing requests in the UI.");
|
||||||
|
store.dispatch(Actions.clearRequests());
|
||||||
}
|
}
|
||||||
|
|
||||||
return { tab, monitor, toolbox };
|
return { tab, monitor, toolbox };
|
||||||
|
@ -371,23 +378,6 @@ function restartNetMonitor(monitor, { requestCount }) {
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the network requests in the UI
|
|
||||||
* @param {Object} monitor
|
|
||||||
* The netmonitor instance used for retrieving a context menu element.
|
|
||||||
*/
|
|
||||||
async function clearNetworkEvents(monitor) {
|
|
||||||
const { store, windowRequire, document } = monitor.panelWin;
|
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
|
||||||
|
|
||||||
info("Clearing the network requests in the UI");
|
|
||||||
await waitForAllNetworkUpdateEvents();
|
|
||||||
store.dispatch(Actions.clearRequests());
|
|
||||||
|
|
||||||
info("Waiting for the request list to clear");
|
|
||||||
await waitFor(() => !!document.querySelector(".request-list-empty-notice"));
|
|
||||||
}
|
|
||||||
|
|
||||||
function teardown(monitor) {
|
function teardown(monitor) {
|
||||||
info("Destroying the specified network monitor.");
|
info("Destroying the specified network monitor.");
|
||||||
|
|
||||||
|
|
|
@ -1426,14 +1426,6 @@ NetworkObserver.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
|
||||||
* Clears all open requests and responses
|
|
||||||
*/
|
|
||||||
clear: function() {
|
|
||||||
this.openRequests.clear();
|
|
||||||
this.openResponses.clear();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suspend observer activity. This is called when the Network monitor actor stops
|
* Suspend observer activity. This is called when the Network monitor actor stops
|
||||||
* listening.
|
* listening.
|
||||||
|
@ -1473,7 +1465,6 @@ NetworkObserver.prototype = {
|
||||||
this.filters = null;
|
this.filters = null;
|
||||||
this._throttler = null;
|
this._throttler = null;
|
||||||
this._decodedCertificateCache.clear();
|
this._decodedCertificateCache.clear();
|
||||||
this.clear();
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -69,10 +69,6 @@ class ChannelMap {
|
||||||
this.finalizationGroup.unregister(entry.ref);
|
this.finalizationGroup.unregister(entry.ref);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
|
||||||
this.refMap.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.ChannelMap = ChannelMap;
|
exports.ChannelMap = ChannelMap;
|
||||||
|
|
|
@ -57,12 +57,6 @@ class NetworkEventContentWatcher {
|
||||||
"http-on-image-cache-response"
|
"http-on-image-cache-response"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Allows clearing of network events
|
|
||||||
*/
|
|
||||||
clear() {
|
|
||||||
this._networkEvents.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
get conn() {
|
get conn() {
|
||||||
return this.targetActor.conn;
|
return this.targetActor.conn;
|
||||||
|
@ -235,7 +229,6 @@ class NetworkEventContentWatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
this.clear();
|
|
||||||
Services.obs.removeObserver(
|
Services.obs.removeObserver(
|
||||||
this.httpFailedOpeningRequest,
|
this.httpFailedOpeningRequest,
|
||||||
"http-on-failed-opening-request"
|
"http-on-failed-opening-request"
|
||||||
|
|
|
@ -46,13 +46,6 @@ class NetworkEventStackTracesWatcher {
|
||||||
ChannelEventSinkFactory.getService().registerCollector(this);
|
ChannelEventSinkFactory.getService().registerCollector(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Allows clearing of network stacktrace resources
|
|
||||||
*/
|
|
||||||
clear() {
|
|
||||||
this.stacktraces.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop watching for network event's strack traces related to a given Target Actor.
|
* Stop watching for network event's strack traces related to a given Target Actor.
|
||||||
*
|
*
|
||||||
|
@ -60,7 +53,7 @@ class NetworkEventStackTracesWatcher {
|
||||||
* The target actor from which we should stop observing the strack traces
|
* The target actor from which we should stop observing the strack traces
|
||||||
*/
|
*/
|
||||||
destroy(targetActor) {
|
destroy(targetActor) {
|
||||||
this.clear();
|
this.stacktraces.clear();
|
||||||
Services.obs.removeObserver(this, "http-on-opening-request");
|
Services.obs.removeObserver(this, "http-on-opening-request");
|
||||||
Services.obs.removeObserver(this, "document-on-opening-request");
|
Services.obs.removeObserver(this, "document-on-opening-request");
|
||||||
Services.obs.removeObserver(this, "network-monitor-alternate-stack");
|
Services.obs.removeObserver(this, "network-monitor-alternate-stack");
|
||||||
|
|
|
@ -60,15 +60,6 @@ class NetworkEventWatcher {
|
||||||
Services.obs.addObserver(this, "window-global-destroyed");
|
Services.obs.addObserver(this, "window-global-destroyed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear all the network events and the related actors.
|
|
||||||
*/
|
|
||||||
clear() {
|
|
||||||
this.networkEvents.clear();
|
|
||||||
this.listener.clear();
|
|
||||||
this.pool.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
get conn() {
|
get conn() {
|
||||||
return this.watcherActor.conn;
|
return this.watcherActor.conn;
|
||||||
}
|
}
|
||||||
|
@ -331,9 +322,9 @@ class NetworkEventWatcher {
|
||||||
*/
|
*/
|
||||||
destroy() {
|
destroy() {
|
||||||
if (this.listener) {
|
if (this.listener) {
|
||||||
this.clear();
|
|
||||||
this.listener.destroy();
|
this.listener.destroy();
|
||||||
Services.obs.removeObserver(this, "window-global-destroyed");
|
Services.obs.removeObserver(this, "window-global-destroyed");
|
||||||
|
this.pool.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ support-files =
|
||||||
breakpoint_document.html
|
breakpoint_document.html
|
||||||
doc_console.html
|
doc_console.html
|
||||||
doc_console_iframe.html
|
doc_console_iframe.html
|
||||||
empty.html
|
|
||||||
network_document.html
|
network_document.html
|
||||||
network_document_navigation.html
|
network_document_navigation.html
|
||||||
network_navigation.js
|
network_navigation.js
|
||||||
|
@ -38,7 +37,6 @@ support-files =
|
||||||
worker-sources.js
|
worker-sources.js
|
||||||
|
|
||||||
[browser_browser_resources_console_messages.js]
|
[browser_browser_resources_console_messages.js]
|
||||||
[browser_resources_clear_resources.js]
|
|
||||||
[browser_resources_client_caching.js]
|
[browser_resources_client_caching.js]
|
||||||
[browser_resources_console_messages.js]
|
[browser_resources_console_messages.js]
|
||||||
[browser_resources_console_messages_navigation.js]
|
[browser_resources_console_messages_navigation.js]
|
||||||
|
|
|
@ -1,90 +0,0 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Test the clearResources function of the ResourceCommand
|
|
||||||
|
|
||||||
add_task(async () => {
|
|
||||||
const tab = await addTab(`${URL_ROOT_SSL}empty.html`);
|
|
||||||
const { client, resourceCommand, targetCommand } = await initResourceCommand(
|
|
||||||
tab
|
|
||||||
);
|
|
||||||
|
|
||||||
info("Assert the initial no of resources");
|
|
||||||
assertNoOfResources(resourceCommand, 0, 0);
|
|
||||||
|
|
||||||
const onAvailable = () => {};
|
|
||||||
const onUpdated = () => {};
|
|
||||||
|
|
||||||
await resourceCommand.watchResources(
|
|
||||||
[
|
|
||||||
resourceCommand.TYPES.CONSOLE_MESSAGE,
|
|
||||||
resourceCommand.TYPES.NETWORK_EVENT,
|
|
||||||
],
|
|
||||||
{ onAvailable, onUpdated }
|
|
||||||
);
|
|
||||||
|
|
||||||
info("Log some messages");
|
|
||||||
await logConsoleMessages(tab.linkedBrowser, ["log1", "log2", "log3"]);
|
|
||||||
|
|
||||||
info("Trigger some network requests");
|
|
||||||
const EXAMPLE_DOMAIN = "https://example.com/";
|
|
||||||
await triggerNetworkRequests(tab.linkedBrowser, [
|
|
||||||
`await fetch("${EXAMPLE_DOMAIN}/request1.html", { method: "GET" });`,
|
|
||||||
`await fetch("${EXAMPLE_DOMAIN}/request2.html", { method: "GET" });`,
|
|
||||||
]);
|
|
||||||
|
|
||||||
assertNoOfResources(resourceCommand, 3, 2);
|
|
||||||
|
|
||||||
info("Clear the network event resources");
|
|
||||||
await resourceCommand.clearResources([resourceCommand.TYPES.NETWORK_EVENT]);
|
|
||||||
assertNoOfResources(resourceCommand, 3, 0);
|
|
||||||
|
|
||||||
info("Clear the console message resources");
|
|
||||||
await resourceCommand.clearResources([resourceCommand.TYPES.CONSOLE_MESSAGE]);
|
|
||||||
assertNoOfResources(resourceCommand, 0, 0);
|
|
||||||
|
|
||||||
resourceCommand.unwatchResources(
|
|
||||||
[
|
|
||||||
resourceCommand.TYPES.CONSOLE_MESSAGE,
|
|
||||||
resourceCommand.TYPES.NETWORK_EVENT,
|
|
||||||
],
|
|
||||||
{ onAvailable, onUpdated, ignoreExistingResources: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
targetCommand.destroy();
|
|
||||||
await client.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
function assertNoOfResources(
|
|
||||||
resourceCommand,
|
|
||||||
expectedNoOfConsoleMessageResources,
|
|
||||||
expectedNoOfNetworkEventResources
|
|
||||||
) {
|
|
||||||
const actualNoOfConsoleMessageResources = resourceCommand.getAllResources(
|
|
||||||
resourceCommand.TYPES.CONSOLE_MESSAGE
|
|
||||||
).length;
|
|
||||||
is(
|
|
||||||
actualNoOfConsoleMessageResources,
|
|
||||||
expectedNoOfConsoleMessageResources,
|
|
||||||
`There are ${actualNoOfConsoleMessageResources} console messages resources`
|
|
||||||
);
|
|
||||||
|
|
||||||
const actualNoOfNetworkEventResources = resourceCommand.getAllResources(
|
|
||||||
resourceCommand.TYPES.NETWORK_EVENT
|
|
||||||
).length;
|
|
||||||
is(
|
|
||||||
actualNoOfNetworkEventResources,
|
|
||||||
expectedNoOfNetworkEventResources,
|
|
||||||
`There are ${actualNoOfNetworkEventResources} network event resources`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function logConsoleMessages(browser, messages) {
|
|
||||||
return SpecialPowers.spawn(browser, [messages], innerMessages => {
|
|
||||||
for (const message of innerMessages) {
|
|
||||||
content.console.log(message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!-- Any copyright is dedicated to the Public Domain.
|
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
|
||||||
|
|
||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Empty page (No network requests)</title>
|
|
||||||
</head>
|
|
||||||
<body></body>
|
|
||||||
</html>
|
|
Загрузка…
Ссылка в новой задаче