1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-01 16:49:39 +02:00
This commit is contained in:
gorhill 2016-02-09 18:53:36 -05:00
parent e209a632a6
commit f044854068
2 changed files with 8 additions and 15 deletions

View File

@ -309,7 +309,7 @@ PageStore.prototype.init = function(tabId) {
this.rawURL = tabContext.rawURL; this.rawURL = tabContext.rawURL;
this.hostnameToCountMap = {}; this.hostnameToCountMap = {};
this.contentLastModified = 0; this.contentLastModified = 0;
this.frames = {}; this.frames = Object.create(null);
this.perLoadBlockedRequestCount = 0; this.perLoadBlockedRequestCount = 0;
this.perLoadAllowedRequestCount = 0; this.perLoadAllowedRequestCount = 0;
this.hiddenElementCount = ''; // Empty string means "unknown" this.hiddenElementCount = ''; // Empty string means "unknown"
@ -407,11 +407,9 @@ PageStore.prototype.dispose = function() {
PageStore.prototype.disposeFrameStores = function() { PageStore.prototype.disposeFrameStores = function() {
var frames = this.frames; var frames = this.frames;
for ( var k in frames ) { for ( var k in frames ) {
if ( frames.hasOwnProperty(k) ) { frames[k].dispose();
frames[k].dispose();
}
} }
this.frames = {}; this.frames = Object.create(null);
}; };
/******************************************************************************/ /******************************************************************************/
@ -424,7 +422,7 @@ PageStore.prototype.getFrame = function(frameId) {
PageStore.prototype.setFrame = function(frameId, frameURL) { PageStore.prototype.setFrame = function(frameId, frameURL) {
var frameStore = this.frames[frameId]; var frameStore = this.frames[frameId];
if ( frameStore instanceof FrameStore ) { if ( frameStore ) {
frameStore.init(this.rootHostname, frameURL); frameStore.init(this.rootHostname, frameURL);
} else { } else {
this.frames[frameId] = FrameStore.factory(this.rootHostname, frameURL); this.frames[frameId] = FrameStore.factory(this.rootHostname, frameURL);
@ -442,8 +440,8 @@ PageStore.prototype.createContextFromPage = function() {
PageStore.prototype.createContextFromFrameId = function(frameId) { PageStore.prototype.createContextFromFrameId = function(frameId) {
var context = new µb.tabContextManager.createContext(this.tabId); var context = new µb.tabContextManager.createContext(this.tabId);
if ( this.frames.hasOwnProperty(frameId) ) { var frameStore = this.frames[frameId];
var frameStore = this.frames[frameId]; if ( frameStore ) {
context.pageHostname = frameStore.pageHostname; context.pageHostname = frameStore.pageHostname;
context.pageDomain = frameStore.pageDomain; context.pageDomain = frameStore.pageDomain;
} else { } else {

View File

@ -106,14 +106,9 @@ var onBeforeRequest = function(details) {
if ( µb.isAllowResult(result) ) { if ( µb.isAllowResult(result) ) {
// https://github.com/chrisaljoudi/uBlock/issues/114 // https://github.com/chrisaljoudi/uBlock/issues/114
frameId = details.frameId; frameId = details.frameId;
if ( frameId > 0 ) { if ( frameId > 0 && isFrame ) {
if ( isFrame ) { pageStore.setFrame(frameId, requestURL);
pageStore.setFrame(frameId, requestURL);
} else if ( pageStore.getFrame(frameId) === null ) {
pageStore.setFrame(frameId, requestURL);
}
} }
return; return;
} }