From 08dd67b854002ef04f3192efc53228db5d739aa9 Mon Sep 17 00:00:00 2001 From: gorhill Date: Tue, 13 Sep 2016 11:25:24 -0400 Subject: [PATCH] fix #1735 --- src/js/tab.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/js/tab.js b/src/js/tab.js index 597896e45..550f0cf10 100644 --- a/src/js/tab.js +++ b/src/js/tab.js @@ -391,11 +391,15 @@ housekeep itself. return tabContexts[vAPI.noTabId]; }; + // https://github.com/gorhill/uBlock/issues/1735 + // Always push before committing, to allow popup detector code to do its + // job. var commit = function(tabId, url) { var entry = tabContexts[tabId]; if ( entry === undefined ) { entry = push(tabId, url); } else { + entry.push(url); entry.commit(url); } return entry; @@ -534,8 +538,6 @@ vAPI.tabs.onClosed = function(tabId) { // d: close target vAPI.tabs.onPopupUpdated = (function() { - //console.debug('vAPI.tabs.onPopup: details = %o', details); - // The same context object will be reused everytime. This also allows to // remember whether a popup or popunder was matched. var context = {}; @@ -575,9 +577,15 @@ vAPI.tabs.onPopupUpdated = (function() { context.requestType = 'popup'; // https://github.com/gorhill/uBlock/commit/1d448b85b2931412508aa01bf899e0b6f0033626#commitcomment-14944764 - // Ignore bad target URL. On Firefox, an `about:blank` tab may be - // opened for a new tab before it is filled in with the real target URL. - if ( context.requestHostname === '' ) { + // Ignore bad target URL. On Firefox, an `about:blank` tab may be + // opened for a new tab before it is filled in with the real target + // URL. + // https://github.com/gorhill/uBlock/issues/1735 + // Do not bail out on `data:` URI, they are commonly used for popups. + if ( + context.requestHostname === '' && + targetURL.startsWith('data:') === false + ) { return ''; }