Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.

Commit

Permalink
Merge tag '1.9.7b4'
Browse files Browse the repository at this point in the history
  • Loading branch information
nicole-ashley committed Sep 19, 2016
2 parents 5862eb1 + 40a85f8 commit bf90e28
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Also of interest: [Deploying uBlock Origin for Firefox with CCK2 and Group Polic

##### Debian/Ubuntu

Users of Debian 9 or later or Ubuntu 16.04 or later may simply
Thanks to Debian contributor [Sean Whitton](https://wiki.debian.org/SeanWhitton), users of Debian 9 or later or Ubuntu 16.04 or later may simply
`apt-get install xul-ext-ublock-origin`.

#### Microsoft Edge
Expand Down
2 changes: 1 addition & 1 deletion platform/chromium/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,

"name": "uBlock Origin",
"version": "1.9.7.1",
"version": "1.9.7.4",

"default_locale": "en",
"description": "__MSG_extShortDesc__",
Expand Down
19 changes: 19 additions & 0 deletions platform/chromium/vapi-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,25 @@ vAPI.tabs.registerListeners = function() {
// http://raymondhill.net/ublock/popup.html
var reGoodForWebRequestAPI = /^https?:\/\//;

// https://forums.lanik.us/viewtopic.php?f=62&t=32826
// Chromium-based browsers: sanitize target URL. I've seen data: URI with
// newline characters in standard fields, possibly as a way of evading
// filters. As per spec, there should be no whitespaces in a data: URI's
// standard fields.
var sanitizeURL = function(url) {
if ( url.startsWith('data:') === false ) { return url; }
var pos = url.indexOf(',');
if ( pos === -1 ) { return url; }
var s = url.slice(0, pos);
if ( s.search(/\s/) === -1 ) { return url; }
return s.replace(/\s+/, '') + url.slice(pos);
};

var onCreatedNavigationTarget = function(details) {
//console.debug('onCreatedNavigationTarget: popup candidate tab id %d = "%s"', details.tabId, details.url);
if ( reGoodForWebRequestAPI.test(details.url) === false ) {
details.frameId = 0;
details.url = sanitizeURL(details.url);
onNavigationClient(details);
}
if ( typeof vAPI.tabs.onPopupCreated === 'function' ) {
Expand All @@ -261,6 +276,7 @@ vAPI.tabs.registerListeners = function() {
if ( details.frameId !== 0 ) {
return;
}
details.url = sanitizeURL(details.url);
onNavigationClient(details);
};

Expand All @@ -269,6 +285,9 @@ vAPI.tabs.registerListeners = function() {
};

var onUpdated = function(tabId, changeInfo, tab) {
if ( changeInfo.url ) {
changeInfo.url = sanitizeURL(changeInfo.url);
}
onUpdatedClient(tabId, changeInfo, tab);
};

Expand Down
4 changes: 2 additions & 2 deletions platform/edge/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"manifest_version": 2,

"name": "uBlock Origin",
"version": "1.9.7.1",
"name": "μBlock Origin",
"version": "1.9.7.4",

"default_locale": "en",
"description": "__MSG_extShortDesc__",
Expand Down
19 changes: 19 additions & 0 deletions platform/edge/vapi-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,25 @@ vAPI.tabs.registerListeners = function() {
// http://raymondhill.net/ublock/popup.html
var reGoodForWebRequestAPI = /^https?:\/\//;

// https://forums.lanik.us/viewtopic.php?f=62&t=32826
// Chromium-based browsers: sanitize target URL. I've seen data: URI with
// newline characters in standard fields, possibly as a way of evading
// filters. As per spec, there should be no whitespaces in a data: URI's
// standard fields.
var sanitizeURL = function(url) {
if ( url.startsWith('data:') === false ) { return url; }
var pos = url.indexOf(',');
if ( pos === -1 ) { return url; }
var s = url.slice(0, pos);
if ( s.search(/\s/) === -1 ) { return url; }
return s.replace(/\s+/, '') + url.slice(pos);
};

var onCreatedNavigationTarget = function(details) {
//console.debug('onCreatedNavigationTarget: popup candidate tab id %d = "%s"', details.tabId, details.url);
if ( reGoodForWebRequestAPI.test(details.url) === false ) {
details.frameId = 0;
details.url = sanitizeURL(details.url);
onNavigationClient(details);
}
if ( typeof vAPI.tabs.onPopupCreated === 'function' ) {
Expand All @@ -382,6 +397,7 @@ vAPI.tabs.registerListeners = function() {
if ( details.frameId !== 0 ) {
return;
}
details.url = sanitizeURL(details.url);
onNavigationClient(details);
};

Expand All @@ -390,6 +406,9 @@ vAPI.tabs.registerListeners = function() {
};

var onUpdated = function(tabId, changeInfo, tab) {
if ( changeInfo.url ) {
changeInfo.url = sanitizeURL(changeInfo.url);
}
onUpdatedClient(tabId, changeInfo, tab);
};

Expand Down
2 changes: 1 addition & 1 deletion platform/opera/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,

"name": "uBlock Origin",
"version": "1.9.7.1",
"version": "1.9.7.4",

"default_locale": "en",
"description": "__MSG_extShortDesc__",
Expand Down
1 change: 1 addition & 0 deletions src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ return {

userSettings: {
advancedUserEnabled: false,
alwaysDetachLogger: false,
autoUpdate: true,
cloudStorageEnabled: false,
collapseBlocked: true,
Expand Down
2 changes: 1 addition & 1 deletion src/js/cosmetic-filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ FilterContainer.prototype.retrieveUserScripts = function(domain, hostname) {
bucket.retrieve(hostname, selectors);
}
if ( entity !== '' && (bucket = this.userScripts.get(entity)) ) {
bucket.retrieve(hostname, selectors);
bucket.retrieve(entity, selectors);
}
var i = selectors.length;
while ( i-- ) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ var onMessage = function(request, sender, callback) {
break;

case 'gotoURL':
vAPI.tabs.open(request.details);
µb.openNewTab(request.details);
break;

case 'reloadTab':
Expand Down
4 changes: 1 addition & 3 deletions src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,6 @@ var gotoURL = function(ev) {

ev.preventDefault();

var rel = this.getAttribute('rel') || '';

messaging.send(
'popupPanel',
{
Expand All @@ -581,7 +579,7 @@ var gotoURL = function(ev) {
url: this.getAttribute('href'),
select: true,
index: -1,
popup: rel === 'popup' && ev.shiftKey
shiftKey: ev.shiftKey
}
}
);
Expand Down
6 changes: 3 additions & 3 deletions src/js/reverselookup-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ var fromCosmeticFilter = function(details) {
var domain = details.domain;
pos = domain.indexOf('.');
if ( pos !== -1 ) {
var entity = domain.slice(0, pos);
candidates[entity + '.*##' + filter] = new RegExp(
['c', 'e', reEscape(entity), reEscape(filter)].join('\\v') +
var entity = domain.slice(0, pos) + '.*';
candidates[entity + '##' + filter] = new RegExp(
['c', 'h', '\\w+', reEscape(entity), reEscape(filter)].join('\\v') +
'(?:\\n|$)'
);
}
Expand Down
17 changes: 12 additions & 5 deletions src/js/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,15 @@ housekeep itself.
return tabContexts[vAPI.noTabId];
};

// https://github.com/gorhill/uBlock/issues/1735
// Filter for popups if actually committing.
var commit = function(tabId, url) {
var entry = tabContexts[tabId];
if ( entry === undefined ) {
entry = push(tabId, url);
} else {
entry.commit(url);
popupCandidateTest(tabId);
}
return entry;
};
Expand Down Expand Up @@ -534,8 +537,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 = {};
Expand Down Expand Up @@ -575,9 +576,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 '';
}

Expand Down
15 changes: 15 additions & 0 deletions src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,18 @@
};

/******************************************************************************/

µBlock.openNewTab = function(details) {
if ( details.url.startsWith('logger-ui.html') ) {
if ( details.shiftKey ) {
this.changeUserSettings(
'alwaysDetachLogger',
!this.userSettings.alwaysDetachLogger
);
}
details.popup = this.userSettings.alwaysDetachLogger;
}
vAPI.tabs.open(details);
};

/******************************************************************************/
2 changes: 1 addition & 1 deletion src/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h2 id="dfToggler" data-i18n="popupBlockedRequestPrompt">&nbsp;</h2>
<p class="statName">
<span data-i18n="popupBlockedOnThisPagePrompt">&nbsp;</span>&ensp;
<span id="gotoPick" class="fa tool" data-i18n-tip="popupTipPicker">&#xf1fb;</span>&ensp;
<a href="logger-ui.html" rel="popup" class="fa tool enabled" data-i18n-tip="popupTipLog">&#xf022;</a>
<a href="logger-ui.html" class="fa tool enabled" data-i18n-tip="popupTipLog">&#xf022;</a>
</p>
<p class="statValue" id="page-blocked">?</p>
<div id="refresh" class="fa">&#xf021;</div>
Expand Down

0 comments on commit bf90e28

Please sign in to comment.