зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1702511 - [devtools] Avoid removing the navigation request on navigation in console batch registry. r=jdescottes,nchevobbe
Surprisingly, there is no issue with ResourceWatcher cache, but only with the WebConsoleWrapper which gets its inner cache purged. Differential Revision: https://phabricator.services.mozilla.com/D112232
This commit is contained in:
Родитель
571f6e5f8e
Коммит
267732d976
|
@ -34,9 +34,9 @@ async function getWebConsoleWrapper() {
|
|||
describe("WebConsoleWrapper", () => {
|
||||
it("clears queues when dispatchMessagesClear is called", async () => {
|
||||
const ncow = await getWebConsoleWrapper();
|
||||
ncow.queuedMessageAdds.push({ fakePacket: "message" });
|
||||
ncow.queuedMessageUpdates.push({ fakePacket: "message-update" });
|
||||
ncow.queuedRequestUpdates.push({ fakePacket: "request-update" });
|
||||
ncow.queuedMessageAdds.push({ fakePacket: "message", data: {} });
|
||||
ncow.queuedMessageUpdates.push({ fakePacket: "message-update", data: {} });
|
||||
ncow.queuedRequestUpdates.push({ fakePacket: "request-update", data: {} });
|
||||
|
||||
ncow.dispatchMessagesClear();
|
||||
|
||||
|
|
|
@ -142,10 +142,17 @@ class WebConsoleWrapper {
|
|||
dispatchMessagesClear() {
|
||||
// We might still have pending message additions and updates when the clear action is
|
||||
// triggered, so we need to flush them to make sure we don't have unexpected behavior
|
||||
// in the ConsoleOutput.
|
||||
this.queuedMessageAdds = [];
|
||||
this.queuedMessageUpdates = [];
|
||||
this.queuedRequestUpdates = [];
|
||||
// in the ConsoleOutput. *But* we want to keep any pending navigation request,
|
||||
// as we want to keep displaying them even if we received a clear request.
|
||||
function filter(l) {
|
||||
return l.filter(update => update.isNavigationRequest);
|
||||
}
|
||||
this.queuedMessageAdds = filter(this.queuedMessageAdds);
|
||||
this.queuedMessageUpdates = filter(this.queuedMessageUpdates);
|
||||
this.queuedRequestUpdates = this.queuedRequestUpdates.filter(
|
||||
update => update.data.isNavigationRequest
|
||||
);
|
||||
|
||||
store?.dispatch(actions.messagesClear());
|
||||
this.webConsoleUI.emitForTests("messages-cleared");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче