Fixed cleaning up reloadingTabs in StreamFilter.onstart() was still breaking some feeds sometimes.
This commit is contained in:
parent
7e3decc8f4
commit
25719ddc5e
|
@ -8,11 +8,15 @@
|
||||||
|
|
||||||
let pendingRequests = new Map();
|
let pendingRequests = new Map();
|
||||||
|
|
||||||
let reloadingTabs = new Set();
|
let reloadingTabs = new Map();
|
||||||
let tabKey = (tabId, url) => `${tabId}:${url}`;
|
let tabKey = (tabId, url) => `${tabId}:${url}`;
|
||||||
|
|
||||||
let cleanup = r => {
|
let cleanup = r => {
|
||||||
pendingRequests.delete(r.requestId);
|
pendingRequests.delete(r.requestId);
|
||||||
|
let key = tabKey(r.tabId, r.url);
|
||||||
|
if (reloadingTabs.get(key) === false) {
|
||||||
|
reloadingTabs.delete(key);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let filter = {
|
let filter = {
|
||||||
urls: ["<all_urls>"],
|
urls: ["<all_urls>"],
|
||||||
|
@ -66,14 +70,8 @@
|
||||||
if (frameId === 0) {
|
if (frameId === 0) {
|
||||||
let key = tabKey(tabId, url);
|
let key = tabKey(tabId, url);
|
||||||
debug("Checking whether %s is a reloading tab...", key);
|
debug("Checking whether %s is a reloading tab...", key);
|
||||||
if (reloadingTabs.has(key)) {
|
if (reloadingTabs.get(key)) {
|
||||||
debug("Skipping dynamic script injection for reloading feed tab", key);
|
reloadingTabs.set(key, false); // doom it for removal in cleanup
|
||||||
let filter = browser.webRequest.filterResponseData(requestId);
|
|
||||||
filter.onstart = e => {
|
|
||||||
reloadingTabs.delete(key);
|
|
||||||
filter.write(NULL);
|
|
||||||
filter.disconnect();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +95,7 @@
|
||||||
if (mustCheckFeed && !scriptsRan) {
|
if (mustCheckFeed && !scriptsRan) {
|
||||||
mustReload = true;
|
mustReload = true;
|
||||||
debug(`Marking as "must reload"`, tabId, url);
|
debug(`Marking as "must reload"`, tabId, url);
|
||||||
reloadingTabs.add(tabKey(tabId, url));
|
reloadingTabs.set(tabKey(tabId, url), true);
|
||||||
}
|
}
|
||||||
if (buffer && buffer.length) {
|
if (buffer && buffer.length) {
|
||||||
debug("Flushing %s buffer chunks", buffer.length);
|
debug("Flushing %s buffer chunks", buffer.length);
|
||||||
|
|
Loading…
Reference in New Issue