|
|
@ -96,18 +96,21 @@
|
|
|
|
// Normalize to a page-URL.
|
|
|
|
// Normalize to a page-URL.
|
|
|
|
pageURL = this.normalizePageURL(pageURL);
|
|
|
|
pageURL = this.normalizePageURL(pageURL);
|
|
|
|
|
|
|
|
|
|
|
|
// The page URL, if any, currently associated with the tab
|
|
|
|
// The previous page URL, if any, associated with the tab
|
|
|
|
|
|
|
|
if ( this.tabIdToPageUrl.hasOwnProperty(tabId) ) {
|
|
|
|
var previousPageURL = this.tabIdToPageUrl[tabId];
|
|
|
|
var previousPageURL = this.tabIdToPageUrl[tabId];
|
|
|
|
if ( previousPageURL === pageURL ) {
|
|
|
|
if ( previousPageURL === pageURL ) {
|
|
|
|
return this.pageStats[pageURL];
|
|
|
|
return this.pageStats[pageURL];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/gorhill/uMatrix/issues/37
|
|
|
|
// https://github.com/gorhill/uMatrix/issues/37
|
|
|
|
// Just rebind: the URL changed, but the document itself is the same.
|
|
|
|
// Just rebind whenever possible: the URL changed, but the document maybe is the same.
|
|
|
|
// Example: Google Maps, Github
|
|
|
|
// Example: Google Maps, Github
|
|
|
|
var pageStore;
|
|
|
|
|
|
|
|
if ( context === 'pageUpdated' && this.pageStats.hasOwnProperty(previousPageURL) ) {
|
|
|
|
// https://github.com/gorhill/uMatrix/issues/72
|
|
|
|
pageStore = this.pageStats[previousPageURL];
|
|
|
|
// Need to double-check that the new scope is same as old scope
|
|
|
|
|
|
|
|
var pageStore = this.pageStats[previousPageURL];
|
|
|
|
|
|
|
|
if ( context === 'pageUpdated' && pageStore.pageHostname === this.hostnameFromURL(pageURL) ) {
|
|
|
|
pageStore.pageUrl = pageURL;
|
|
|
|
pageStore.pageUrl = pageURL;
|
|
|
|
delete this.pageStats[previousPageURL];
|
|
|
|
delete this.pageStats[previousPageURL];
|
|
|
|
this.pageStats[pageURL] = pageStore;
|
|
|
|
this.pageStats[pageURL] = pageStore;
|
|
|
@ -116,6 +119,7 @@
|
|
|
|
this.tabIdToPageUrl[tabId] = pageURL;
|
|
|
|
this.tabIdToPageUrl[tabId] = pageURL;
|
|
|
|
return pageStore;
|
|
|
|
return pageStore;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pageStore = this.createPageStore(pageURL, context);
|
|
|
|
pageStore = this.createPageStore(pageURL, context);
|
|
|
|
|
|
|
|
|
|
|
|