Cancel redirects for the same requestIds and urls if originating from the same tabId

Fixes #940
This commit is contained in:
stoically
2018-02-12 23:12:32 +01:00
parent 601056406a
commit dab3005c6f
6 changed files with 201 additions and 24 deletions
+9 -7
View File
@@ -18,19 +18,21 @@ module.exports = {
});
},
async openNewTab(tab, options = {isAsync: true}) {
async openNewTab(tab, options = {}) {
if (options.resetHistory) {
background.browser.tabs.create.resetHistory();
background.browser.tabs.remove.resetHistory();
}
background.browser.tabs.get.resolves(tab);
background.browser.webRequest.onBeforeRequest.addListener.yield({
background.browser.tabs.onCreated.addListener.yield(tab);
const [promise] = background.browser.webRequest.onBeforeRequest.addListener.yield({
frameId: 0,
tabId: tab.id,
url: tab.url,
requestId: options.requestId
});
background.browser.tabs.onCreated.addListener.yield(tab);
if (!options.isAsync) {
return;
}
await nextTick();
return promise;
}
},