mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 1434855 - Improve performance of HAR export; r=ochameau
MozReview-Commit-ID: 6H6P6wYmdQL --HG-- extra : rebase_source : ab9e8e9ea68ae91e8fe4f28c344c41e2324e223f
This commit is contained in:
parent
da22fde827
commit
fae7d4473f
@ -180,6 +180,8 @@ add_task(async function test_devtools_network_get_har() {
|
||||
extension.awaitMessage("tabUpdated"),
|
||||
extension.awaitMessage("onNavigatedFired"),
|
||||
extension.awaitMessage("onRequestFinished"),
|
||||
extension.awaitMessage("onRequestFinished-callbackExecuted"),
|
||||
extension.awaitMessage("onRequestFinished-promiseResolved"),
|
||||
waitForRequestAdded(toolbox),
|
||||
]);
|
||||
|
||||
|
@ -43,6 +43,10 @@ class ChromeConnector {
|
||||
this.setup();
|
||||
}
|
||||
|
||||
enableActions(enable) {
|
||||
// TODO : implement.
|
||||
}
|
||||
|
||||
/**
|
||||
* currently all events are about "navigation" is not support on CDP
|
||||
*/
|
||||
|
@ -127,6 +127,10 @@ class FirefoxConnector {
|
||||
}
|
||||
}
|
||||
|
||||
enableActions(enable) {
|
||||
this.dataProvider.enableActions(enable);
|
||||
}
|
||||
|
||||
willNavigate() {
|
||||
if (!Services.prefs.getBoolPref("devtools.netmonitor.persistlog")) {
|
||||
this.actions.batchReset();
|
||||
|
@ -22,6 +22,7 @@ class FirefoxDataProvider {
|
||||
// Options
|
||||
this.webConsoleClient = webConsoleClient;
|
||||
this.actions = actions;
|
||||
this.actionsEnabled = true;
|
||||
|
||||
// Internal properties
|
||||
this.payloadQueue = new Map();
|
||||
@ -38,6 +39,15 @@ class FirefoxDataProvider {
|
||||
this.onNetworkEventUpdate = this.onNetworkEventUpdate.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable firing redux actions (enabled by default).
|
||||
*
|
||||
* @param {boolean} enable Set to true to fire actions.
|
||||
*/
|
||||
enableActions(enable) {
|
||||
this.actionsEnabled = enable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new network request to application state.
|
||||
*
|
||||
@ -55,7 +65,7 @@ class FirefoxDataProvider {
|
||||
fromServiceWorker,
|
||||
} = data;
|
||||
|
||||
if (this.actions.addRequest) {
|
||||
if (this.actionsEnabled && this.actions.addRequest) {
|
||||
await this.actions.addRequest(id, {
|
||||
// Convert the received date/time string to a unix timestamp.
|
||||
startedMillis: Date.parse(startedDateTime),
|
||||
@ -120,7 +130,7 @@ class FirefoxDataProvider {
|
||||
responseCookiesObj
|
||||
);
|
||||
|
||||
if (this.actions.updateRequest) {
|
||||
if (this.actionsEnabled && this.actions.updateRequest) {
|
||||
await this.actions.updateRequest(id, payload, true);
|
||||
}
|
||||
|
||||
@ -377,7 +387,7 @@ class FirefoxDataProvider {
|
||||
|
||||
this.payloadQueue.delete(actor);
|
||||
|
||||
if (this.actions.updateRequest) {
|
||||
if (this.actionsEnabled && this.actions.updateRequest) {
|
||||
await this.actions.updateRequest(actor, payload, true);
|
||||
}
|
||||
|
||||
@ -414,7 +424,7 @@ class FirefoxDataProvider {
|
||||
// data again.
|
||||
this.lazyRequestData.delete(key);
|
||||
|
||||
if (this.actions.updateRequest) {
|
||||
if (this.actionsEnabled && this.actions.updateRequest) {
|
||||
await this.actions.updateRequest(actor, {
|
||||
...payload,
|
||||
// Lockdown *Available property once we fetch data from back-end.
|
||||
|
@ -71,6 +71,10 @@ class Connector {
|
||||
return this.connector.resume();
|
||||
}
|
||||
|
||||
enableActions() {
|
||||
this.connector.enableActions(...arguments);
|
||||
}
|
||||
|
||||
// Public API
|
||||
|
||||
getLongString() {
|
||||
|
@ -195,6 +195,9 @@ const HarExporter = {
|
||||
form: { title, url }
|
||||
} = getTabTarget();
|
||||
|
||||
// Disconnect from redux actions/store.
|
||||
connector.enableActions(false);
|
||||
|
||||
options = {
|
||||
...options,
|
||||
title: title || url,
|
||||
@ -207,6 +210,9 @@ const HarExporter = {
|
||||
let builder = new HarBuilder(options);
|
||||
let result = await builder.build();
|
||||
|
||||
// Connect to redux actions again.
|
||||
connector.enableActions(true);
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user