|
57 | 57 | let {requestId, url, tabId, frameId, statusCode} = request; |
58 | 58 |
|
59 | 59 | if (statusCode >= 300 && statusCode < 400) return; |
| 60 | + if (frameId === 0) { |
| 61 | + let key = tabKey(tabId, url); |
| 62 | + debug("Checking whether %s is a reloading tab...", key); |
| 63 | + if (reloadingTabs.get(key)) { |
| 64 | + reloadingTabs.set(key, false); // doom it for removal in cleanup |
| 65 | + return; |
| 66 | + } |
| 67 | + } |
| 68 | + let content = this.getContentMetaData(request); |
| 69 | + if (content.disposition) { |
| 70 | + debug("Skipping execute on start of %s %o", url, content); |
| 71 | + return; |
| 72 | + } |
| 73 | + debug("Injecting script on start in %s (%o)", url, content); |
| 74 | + |
60 | 75 | let scripts = pendingRequests.get(requestId); |
61 | 76 | let scriptKey = JSON.stringify(details); |
62 | 77 | if (!scripts) { |
|
67 | 82 | return; |
68 | 83 | } |
69 | 84 |
|
70 | | - if (frameId === 0) { |
71 | | - let key = tabKey(tabId, url); |
72 | | - debug("Checking whether %s is a reloading tab...", key); |
73 | | - if (reloadingTabs.get(key)) { |
74 | | - reloadingTabs.set(key, false); // doom it for removal in cleanup |
75 | | - return; |
76 | | - } |
77 | | - } |
78 | | - |
79 | | - let content = this.getContentMetaData(request); |
80 | | - debug(url, content.type, content.charset); |
81 | 85 | if (xmlFeedOrImage.test(content.type) && !/\/svg\b/i.test(content.type)) return; |
82 | 86 | if (typeof brokenOnLoad === "undefined") { |
83 | 87 | brokenOnLoad = await (async () => parseInt((await browser.runtime.getBrowserInfo()).version) < 61)(); |
|
0 commit comments