|
|
@ -96,25 +96,29 @@
|
|
|
|
// 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
|
|
|
|
var previousPageURL = this.tabIdToPageUrl[tabId];
|
|
|
|
if ( this.tabIdToPageUrl.hasOwnProperty(tabId) ) {
|
|
|
|
if ( previousPageURL === pageURL ) {
|
|
|
|
var previousPageURL = this.tabIdToPageUrl[tabId];
|
|
|
|
return this.pageStats[pageURL];
|
|
|
|
if ( previousPageURL === 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
|
|
|
|
pageStore.pageUrl = pageURL;
|
|
|
|
var pageStore = this.pageStats[previousPageURL];
|
|
|
|
delete this.pageStats[previousPageURL];
|
|
|
|
if ( context === 'pageUpdated' && pageStore.pageHostname === this.hostnameFromURL(pageURL) ) {
|
|
|
|
this.pageStats[pageURL] = pageStore;
|
|
|
|
pageStore.pageUrl = pageURL;
|
|
|
|
delete this.pageUrlToTabId[previousPageURL];
|
|
|
|
delete this.pageStats[previousPageURL];
|
|
|
|
this.pageUrlToTabId[pageURL] = tabId;
|
|
|
|
this.pageStats[pageURL] = pageStore;
|
|
|
|
this.tabIdToPageUrl[tabId] = pageURL;
|
|
|
|
delete this.pageUrlToTabId[previousPageURL];
|
|
|
|
return pageStore;
|
|
|
|
this.pageUrlToTabId[pageURL] = tabId;
|
|
|
|
|
|
|
|
this.tabIdToPageUrl[tabId] = pageURL;
|
|
|
|
|
|
|
|
return pageStore;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pageStore = this.createPageStore(pageURL, context);
|
|
|
|
pageStore = this.createPageStore(pageURL, context);
|
|
|
|