# HG changeset patch # User Guido Berhoerster # Date 1562161896 -7200 # Node ID 586eebf8efb7ca44be3cca877616ee773dce2ec1 # Parent cc328d4662dd7b0b835dc2972c34ed765596a52e Work around race condition in feed reader subscription script execution browser.tabs.executeScript() should only run the script once the feed preview page is completely loaded but there seems to be a race condition where it is run too early resulting in disabled feed reader subscription. diff -r cc328d4662dd -r 586eebf8efb7 js/background.js --- a/js/background.js Fri Apr 12 12:17:47 2019 +0200 +++ b/js/background.js Wed Jul 03 15:51:36 2019 +0200 @@ -192,8 +192,7 @@ }); browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { - if (typeof changeInfo.url === 'undefined') { - // filter out updates which do not change the URL + if (changeInfo.status !== 'complete') { return; } @@ -202,13 +201,13 @@ browser.pageAction.hide(tabId); // inject content script once if the requested URL is a feed preview - if (tabsFeedPreviews.get(tabId) === changeInfo.url) { + if (tabsFeedPreviews.get(tabId) === tab.url) { browser.tabs.executeScript(tabId, { file: 'content_scripts/feed-readers.js' }); tabsFeedPreviews.delete(tabId); } -}); +}, {properties: ["status"]}); browser.tabs.onRemoved.addListener((tabId, removeInfo) => { tabsFeeds.delete(tabId);