From b20d44e36c96d40bd05cf03b67872f41a889d1cd Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 27 May 2015 07:51:48 -0400 Subject: [PATCH] this should fix #225 --- src/js/messaging.js | 5 +++++ src/js/tab.js | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/js/messaging.js b/src/js/messaging.js index bf64f6a..83eb186 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -413,6 +413,11 @@ var contentScriptSummaryHandler = function(tabId, details) { var url = frameURL + '{inline_script}'; pageStore.recordRequest('script', url, inlineScriptBlocked); µm.logger.writeOne(tabId, 'net', pageHostname, url, 'script', inlineScriptBlocked); + + // https://github.com/gorhill/uMatrix/issues/225 + // A good place to force an update of the page title, as at this point + // the DOM has been loaded. + µm.updateTitle(tabId); }; /******************************************************************************/ diff --git a/src/js/tab.js b/src/js/tab.js index 91235a3..fa36ccc 100644 --- a/src/js/tab.js +++ b/src/js/tab.js @@ -657,9 +657,14 @@ vAPI.tabs.registerListeners(); if ( !tab.title && tryAgain(tabId) ) { return; } - tryNoMore(tabId); + // https://github.com/gorhill/uMatrix/issues/225 + // Sometimes title changes while page is loading. + var settled = tab.title && tab.title === pageStore.title; pageStore.title = tab.title || tab.url || ''; this.pageStoresToken = Date.now(); + if ( settled || !tryAgain(tabId) ) { + tryNoMore(tabId); + } }; var updateTitle = function(tabId) {