diff options
author | gorhill <rhill@raymondhill.net> | 2014-10-06 22:40:25 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2014-10-06 22:40:25 -0400 |
commit | 6bd6101e6afed46dc3f3fb84905bac8af845c5bc (patch) | |
tree | 8bc3c2a9314bf6a5e466da2dbe6add7f7c53ae7a /js/pagestore.js | |
parent | 2a78d7fb99f6943df8578659ca7765f15ad41cca (diff) | |
download | uBlock-6bd6101e6afed46dc3f3fb84905bac8af845c5bc.zip uBlock-6bd6101e6afed46dc3f3fb84905bac8af845c5bc.tar.gz uBlock-6bd6101e6afed46dc3f3fb84905bac8af845c5bc.tar.bz2 |
code review/testing: for dynamic filtering, it makes more sense to consider the top URL for 1st/3rd party status
Diffstat (limited to 'js/pagestore.js')
-rw-r--r-- | js/pagestore.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/js/pagestore.js b/js/pagestore.js index fc8c36b..ddd2940 100644 --- a/js/pagestore.js +++ b/js/pagestore.js @@ -219,35 +219,36 @@ var frameStoreJunkyardMax = 50; /******************************************************************************/ -var FrameStore = function(frameURL) { - this.init(frameURL); +var FrameStore = function(rootHostname, frameURL) { + this.init(rootHostname, frameURL); }; /******************************************************************************/ -FrameStore.factory = function(frameURL) { +FrameStore.factory = function(rootHostname, frameURL) { var entry = frameStoreJunkyard.pop(); if ( entry === undefined ) { - entry = new FrameStore(frameURL); + entry = new FrameStore(rootHostname, frameURL); } else { - entry.init(frameURL); + entry.init(rootHostname, frameURL); } return entry; }; /******************************************************************************/ -FrameStore.prototype.init = function(frameURL) { +FrameStore.prototype.init = function(rootHostname, frameURL) { var µburi = µb.URI; this.pageHostname = µburi.hostnameFromURI(frameURL); this.pageDomain = µburi.domainFromHostname(this.pageHostname); + this.rootHostname = rootHostname; return this; }; /******************************************************************************/ FrameStore.prototype.dispose = function() { - this.pageHostname = this.pageDomain = ''; + this.pageHostname = this.pageDomain = this.rootHostname = ''; if ( frameStoreJunkyard.length < frameStoreJunkyardMax ) { frameStoreJunkyard.push(this); } @@ -296,6 +297,7 @@ PageStore.prototype.init = function(tabId, pageURL) { // https://github.com/gorhill/uBlock/issues/185 // Use hostname if no domain can be extracted this.pageDomain = µb.URI.domainFromHostname(this.pageHostname) || this.pageHostname; + this.rootHostname = this.pageHostname; this.frames = {}; this.netFiltering = true; @@ -324,6 +326,7 @@ PageStore.prototype.reuse = function(pageURL, context) { this.pageURL = pageURL; this.pageHostname = µb.URI.hostnameFromURI(pageURL); this.pageDomain = µb.URI.domainFromHostname(this.pageHostname) || this.pageHostname; + this.rootHostname = this.pageHostname; return this; } // A new page is completely reloaded from scratch, reset all. @@ -348,6 +351,7 @@ PageStore.prototype.dispose = function() { this.previousPageURL = ''; this.pageHostname = ''; this.pageDomain = ''; + this.rootHostname = ''; this.disposeFrameStores(); this.netFilteringCache = this.netFilteringCache.dispose(); if ( pageStoreJunkyard.length < pageStoreJunkyardMax ) { @@ -376,7 +380,7 @@ PageStore.prototype.disposeFrameStores = function() { PageStore.prototype.addFrame = function(frameId, frameURL) { var frameStore = this.frames[frameId]; if ( frameStore === undefined ) { - this.frames[frameId] = frameStore = FrameStore.factory(frameURL); + this.frames[frameId] = frameStore = FrameStore.factory(this.rootHostname, frameURL); //console.debug('µBlock> PageStore.addFrame(%d, "%s")', frameId, frameURL); } return frameStore; |