Remove scheduleGc to avoid webNavigation

This commit is contained in:
Tamius Han 2020-02-14 21:45:31 +01:00
parent 72b28918e9
commit 66169ddeb1
2 changed files with 1 additions and 43 deletions

View File

@ -56,8 +56,6 @@ class UWServer {
} else if (BrowserDetect.chrome) { } else if (BrowserDetect.chrome) {
chrome.tabs.onActivated.addListener(function(m) {ths.onTabSwitched(m)}); chrome.tabs.onActivated.addListener(function(m) {ths.onTabSwitched(m)});
} }
this.scheduleGc();
} }
async _promisifyTabsGet(browserObj, tabId){ async _promisifyTabsGet(browserObj, tabId){
@ -97,23 +95,6 @@ class UWServer {
} }
} }
scheduleGc(timeout) {
if (this._gctimeout) {
return;
}
if (!timeout) {
timeout = 0;
}
const ths = this;
setTimeout( () => {
clearTimeout(ths._gctimeout);
ths.gcFrames();
ths._gctimeoutgcTimeout = ths.scheduleGc(5000);
}, timeout);
}
extractHostname(url){ extractHostname(url){
var hostname; var hostname;
@ -157,28 +138,6 @@ class UWServer {
//TODO: change extension icon based on whether there's any videos on current page //TODO: change extension icon based on whether there's any videos on current page
} }
async gcFrames() {
// does "garbage collection" on frames
let frames;
if (BrowserDetect.firefox) {
frames = await browser.webNavigation.getAllFrames({tabId: this.currentTabId});
} else if (BrowserDetect.chrome) {
frames = await new Promise( (resolve, reject) => {
chrome.webNavigation.getAllFrames({tabId: this.currentTabId}, (data) => {resolve(data); return true});
});
}
if (this.videoTabs[this.currentTabId]) {
for (let key in this.videoTabs[this.currentTabId].frames) {
if (! frames.find(x => x.frameId == key)) {
delete this.videoTabs[this.currentTabId].frames[key];
}
}
}
}
registerVideo(sender) { registerVideo(sender) {
this.logger.log('info', 'comms', '[UWServer::registerVideo] Registering video.\nsender:', sender); this.logger.log('info', 'comms', '[UWServer::registerVideo] Registering video.\nsender:', sender);

View File

@ -59,8 +59,7 @@
"permissions": [ "permissions": [
"storage", "storage",
"activeTab", "activeTab",
"<all_urls>", "<all_urls>"
"webNavigation"
], ],
"optional_permissions": [ "optional_permissions": [
"downloads" "downloads"