1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 01:27:12 +02:00

#608: this fixes a bunch of strictness-related warnings

This commit is contained in:
gorhill 2015-08-18 11:44:24 -04:00
parent 5366697a0c
commit 9b4b998364
22 changed files with 91 additions and 77 deletions

View File

@ -7,7 +7,6 @@
"unused": true, "unused": true,
"nonew": false, "nonew": false,
"sub": true, "sub": true,
"boss": true,
"laxbreak": true, "laxbreak": true,
"validthis": true, "validthis": true,
"newcap": false, "newcap": false,
@ -19,4 +18,4 @@
"safari": false, "safari": false,
"Components": false // global variable in Firefox "Components": false // global variable in Firefox
} }
} }

View File

@ -159,7 +159,8 @@ const contentObserver = {
if ( type === this.MAIN_FRAME ) { if ( type === this.MAIN_FRAME ) {
context = context.contentWindow || context; context = context.contentWindow || context;
if ( if (
context.opener && typeof context.opener === 'object' &&
context.opener !== null &&
context.opener !== context && context.opener !== context &&
this.ignoredPopups.has(context) === false this.ignoredPopups.has(context) === false
) { ) {
@ -334,9 +335,8 @@ const contentObserver = {
return; return;
} }
let win = doc.defaultView; let win = doc.defaultView || null;
if ( win === null ) {
if ( !win ) {
return; return;
} }

View File

@ -19,6 +19,8 @@
Home: https://github.com/gorhill/uBlock Home: https://github.com/gorhill/uBlock
*/ */
/* global addMessageListener, removeMessageListener, docShell */
/******************************************************************************/ /******************************************************************************/
var locationChangeListener; // Keep alive while frameScript is alive var locationChangeListener; // Keep alive while frameScript is alive

View File

@ -2707,14 +2707,22 @@ vAPI.contextMenu.displayMenuItem = function({target}) {
var ctxMap = vAPI.contextMenu.contextMap; var ctxMap = vAPI.contextMenu.contextMap;
for ( var context of ctx ) { for ( var context of ctx ) {
if ( context === 'page' && !gContextMenu.onLink && !gContextMenu.onImage if (
&& !gContextMenu.onEditableArea && !gContextMenu.inFrame context === 'page' &&
&& !gContextMenu.onVideo && !gContextMenu.onAudio ) { !gContextMenu.onLink &&
!gContextMenu.onImage &&
!gContextMenu.onEditableArea &&
!gContextMenu.inFrame &&
!gContextMenu.onVideo &&
!gContextMenu.onAudio
) {
menuitem.hidden = false; menuitem.hidden = false;
return; return;
} }
if (
if ( gContextMenu[ctxMap[context]] ) { ctxMap.hasOwnProperty(context) &&
gContextMenu[ctxMap[context]]
) {
menuitem.hidden = false; menuitem.hidden = false;
return; return;
} }

View File

@ -54,7 +54,7 @@ vAPI.shutdown = (function() {
var exec = function() { var exec = function() {
//console.debug('Shutting down...'); //console.debug('Shutting down...');
var job; var job;
while ( job = jobs.pop() ) { while ( (job = jobs.pop()) ) {
job(); job();
} }
}; };
@ -199,7 +199,7 @@ var messagingConnector = function(details) {
var channel; var channel;
// Sent to all channels // Sent to all channels
if ( details.broadcast === true && !details.channelName ) { if ( details.broadcast && !details.channelName ) {
for ( channel in channels ) { for ( channel in channels ) {
if ( channels[channel] instanceof MessagingChannel === false ) { if ( channels[channel] instanceof MessagingChannel === false ) {
continue; continue;

View File

@ -448,14 +448,14 @@ var getRepoMetadata = function(callback) {
}; };
var onLocalChecksumsLoaded = function(details) { var onLocalChecksumsLoaded = function(details) {
if ( localChecksums = validateChecksums(details) ) { if ( (localChecksums = validateChecksums(details)) ) {
parseChecksums(localChecksums, 'local'); parseChecksums(localChecksums, 'local');
} }
checksumsReceived(); checksumsReceived();
}; };
var onRepoChecksumsLoaded = function(details) { var onRepoChecksumsLoaded = function(details) {
if ( repoChecksums = validateChecksums(details) ) { if ( (repoChecksums = validateChecksums(details)) ) {
parseChecksums(repoChecksums, 'repo'); parseChecksums(repoChecksums, 'repo');
} }
checksumsReceived(); checksumsReceived();

View File

@ -81,7 +81,7 @@ vAPI.shutdown.add(function() {
(function() { (function() {
// Were there specific cosmetic filters? // Were there specific cosmetic filters?
if ( vAPI.specificHideStyle instanceof HTMLStyleElement === false ) { if ( typeof vAPI.specificHideStyle !== 'object' ) {
return; return;
} }
// Is our style tag still in the DOM? (the guess is whatever parent there // Is our style tag still in the DOM? (the guess is whatever parent there
@ -171,7 +171,7 @@ var uBlockCollapser = (function() {
// https://github.com/chrisaljoudi/uBlock/issues/1048 // https://github.com/chrisaljoudi/uBlock/issues/1048
// Use attribute to construct CSS rule // Use attribute to construct CSS rule
if ( value = target.getAttribute(entry.attr) ) { if ( (value = target.getAttribute(entry.attr)) ) {
selectors.push(entry.tagName + '[' + entry.attr + '="' + value + '"]'); selectors.push(entry.tagName + '[' + entry.attr + '="' + value + '"]');
} }
} }
@ -534,7 +534,7 @@ var uBlockCollapser = (function() {
var attrs = ['title', 'alt']; var attrs = ['title', 'alt'];
var attr, attrValue, nodeList, iNode, node; var attr, attrValue, nodeList, iNode, node;
var selector; var selector;
while ( attr = attrs.pop() ) { while ( (attr = attrs.pop()) ) {
nodeList = selectNodes('[' + attr + ']'); nodeList = selectNodes('[' + attr + ']');
iNode = nodeList.length; iNode = nodeList.length;
while ( iNode-- ) { while ( iNode-- ) {
@ -738,7 +738,7 @@ var uBlockCollapser = (function() {
var treeMutationObservedHandler = function() { var treeMutationObservedHandler = function() {
var nodeList, iNode, node; var nodeList, iNode, node;
while ( nodeList = addedNodeLists.pop() ) { while ( (nodeList = addedNodeLists.pop()) ) {
iNode = nodeList.length; iNode = nodeList.length;
while ( iNode-- ) { while ( iNode-- ) {
node = nodeList[iNode]; node = nodeList[iNode];

View File

@ -1141,7 +1141,7 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {
continue; continue;
} }
hash = makeHash(0, selector, hashMask); hash = makeHash(0, selector, hashMask);
if ( bucket = this.lowGenericHide[hash] ) { if ( (bucket = this.lowGenericHide[hash]) ) {
bucket.retrieve(selector, hideSelectors); bucket.retrieve(selector, hideSelectors);
} }
} }
@ -1187,29 +1187,29 @@ FilterContainer.prototype.retrieveDomainSelectors = function(request) {
var hash, bucket; var hash, bucket;
hash = makeHash(0, domain, this.domainHashMask); hash = makeHash(0, domain, this.domainHashMask);
if ( bucket = this.hostnameFilters[hash] ) { if ( (bucket = this.hostnameFilters[hash]) ) {
bucket.retrieve(hostname, r.cosmeticHide); bucket.retrieve(hostname, r.cosmeticHide);
} }
// https://github.com/chrisaljoudi/uBlock/issues/188 // https://github.com/chrisaljoudi/uBlock/issues/188
// Special bucket for those filters without a valid domain name as per PSL // Special bucket for those filters without a valid domain name as per PSL
if ( bucket = this.hostnameFilters[this.type0NoDomainHash] ) { if ( (bucket = this.hostnameFilters[this.type0NoDomainHash]) ) {
bucket.retrieve(hostname, r.cosmeticHide); bucket.retrieve(hostname, r.cosmeticHide);
} }
// entity filter buckets are always plain js array // entity filter buckets are always plain js array
if ( bucket = this.entityFilters[r.entity] ) { if ( (bucket = this.entityFilters[r.entity]) ) {
r.cosmeticHide = r.cosmeticHide.concat(bucket); r.cosmeticHide = r.cosmeticHide.concat(bucket);
} }
// No entity exceptions as of now // No entity exceptions as of now
hash = makeHash(1, domain, this.domainHashMask); hash = makeHash(1, domain, this.domainHashMask);
if ( bucket = this.hostnameFilters[hash] ) { if ( (bucket = this.hostnameFilters[hash]) ) {
bucket.retrieve(hostname, r.cosmeticDonthide); bucket.retrieve(hostname, r.cosmeticDonthide);
} }
// https://github.com/chrisaljoudi/uBlock/issues/188 // https://github.com/chrisaljoudi/uBlock/issues/188
// Special bucket for those filters without a valid domain name as per PSL // Special bucket for those filters without a valid domain name as per PSL
if ( bucket = this.hostnameFilters[this.type1NoDomainHash] ) { if ( (bucket = this.hostnameFilters[this.type1NoDomainHash]) ) {
bucket.retrieve(hostname, r.cosmeticDonthide); bucket.retrieve(hostname, r.cosmeticDonthide);
} }

View File

@ -206,11 +206,11 @@ Matrix.prototype.hasSameRules = function(other, srcHostname, desHostnames) {
// Specific types // Specific types
ruleKey = '* *'; ruleKey = '* *';
if ( thisRules[ruleKey] !== otherRules[ruleKey] ) { if ( (thisRules[ruleKey] || 0) !== (otherRules[ruleKey] || 0) ) {
return false; return false;
} }
ruleKey = srcHostname + ' *'; ruleKey = srcHostname + ' *';
if ( thisRules[ruleKey] !== otherRules[ruleKey] ) { if ( (thisRules[ruleKey] || 0) !== (otherRules[ruleKey] || 0) ) {
return false; return false;
} }
@ -220,11 +220,11 @@ Matrix.prototype.hasSameRules = function(other, srcHostname, desHostnames) {
continue; continue;
} }
ruleKey = '* ' + desHostname; ruleKey = '* ' + desHostname;
if ( thisRules[ruleKey] !== otherRules[ruleKey] ) { if ( (thisRules[ruleKey] || 0) !== (otherRules[ruleKey] || 0) ) {
return false; return false;
} }
ruleKey = srcHostname + ' ' + desHostname ; ruleKey = srcHostname + ' ' + desHostname ;
if ( thisRules[ruleKey] !== otherRules[ruleKey] ) { if ( (thisRules[ruleKey] || 0) !== (otherRules[ruleKey] || 0) ) {
return false; return false;
} }
} }

View File

@ -19,7 +19,6 @@
Home: https://github.com/gorhill/uBlock Home: https://github.com/gorhill/uBlock
*/ */
/* jshint boss: true */
/* global vAPI, uDom */ /* global vAPI, uDom */
/******************************************************************************/ /******************************************************************************/
@ -400,7 +399,7 @@ var createRow = function(layout) {
td.setAttribute('colspan', span); td.setAttribute('colspan', span);
} }
index += 1; index += 1;
while ( td = tr.cells[index] ) { while ( (td = tr.cells[index]) ) {
tdJunkyard.push(tr.removeChild(td)); tdJunkyard.push(tr.removeChild(td));
} }
return tr; return tr;

View File

@ -231,7 +231,9 @@ var getHostnameDict = function(hostnameToCountMap) {
r[hostname] = { r[hostname] = {
domain: domain, domain: domain,
blockCount: blockCount, blockCount: blockCount,
allowCount: allowCount allowCount: allowCount,
totalBlockCount: 0,
totalAllowCount: 0
}; };
} }
return r; return r;

View File

@ -298,7 +298,7 @@ var pruneToSize = function(toSize) {
delete h2cMap[hash]; delete h2cMap[hash];
toRemove.push(storageKeyFromHash(hash)); toRemove.push(storageKeyFromHash(hash));
exports.bytesInUse -= ctEntry.dataURL.length; exports.bytesInUse -= ctEntry.dataURL.length;
while ( urlKey = prEntry.urlKeys.pop() ) { while ( (urlKey = prEntry.urlKeys.pop()) ) {
delete k2hMap[urlKey]; delete k2hMap[urlKey];
} }
if ( exports.bytesInUse < toSize ) { if ( exports.bytesInUse < toSize ) {

View File

@ -212,7 +212,7 @@ NetFilteringResultCache.prototype.pruneAsyncCallback = function() {
/******************************************************************************/ /******************************************************************************/
NetFilteringResultCache.prototype.lookup = function(context) { NetFilteringResultCache.prototype.lookup = function(context) {
return this.urls[context.requestType + ' ' + context.requestURL]; return this.urls[context.requestType + ' ' + context.requestURL] || undefined;
}; };
/******************************************************************************/ /******************************************************************************/
@ -445,10 +445,7 @@ PageStore.prototype.createContextFromFrameHostname = function(frameHostname) {
PageStore.prototype.getNetFilteringSwitch = function() { PageStore.prototype.getNetFilteringSwitch = function() {
var tabContext = µb.tabContextManager.lookup(this.tabId); var tabContext = µb.tabContextManager.lookup(this.tabId);
if ( if ( this.netFilteringReadTime > µb.netWhitelistModifyTime ) {
this.netFilteringReadTime > µb.netWhitelistModifyTime &&
this.netFilteringReadTime > tabContext.modifyTime
) {
return this.netFiltering; return this.netFiltering;
} }

View File

@ -40,10 +40,15 @@ var dfPaneVisibleStored = vAPI.localStorage.getItem('popupFirewallPane') === 'tr
// dictate the height of the popup. The right pane dictates the height // dictate the height of the popup. The right pane dictates the height
// of the popup, and the left pane will have a scrollbar if ever its // of the popup, and the left pane will have a scrollbar if ever its
// height is more than what is available. // height is more than what is available.
document.querySelector('#panes > div:nth-of-type(2)').style.setProperty( (function() {
'height', var rpane = document.querySelector('#panes > div:nth-of-type(1)');
document.querySelector('#panes > div:nth-of-type(1)').offsetHeight + 'px' if ( typeof rpane.offsetHeight === 'number' ) {
); document.querySelector('#panes > div:nth-of-type(2)').style.setProperty(
'height',
rpane.offsetHeight + 'px'
);
}
})();
// The padlock/eraser must be manually positioned: // The padlock/eraser must be manually positioned:
// - Its vertical position depends on the height of the popup title bar // - Its vertical position depends on the height of the popup title bar

View File

@ -78,7 +78,7 @@ try {
} catch (e) { } catch (e) {
} }
var elem, shadow, selector = '#' + sessionId; var elem, shadow;
i = elems.length; i = elems.length;
while ( i-- ) { while ( i-- ) {
elem = elems[i]; elem = elems[i];

View File

@ -618,7 +618,7 @@ var cosmeticFilterFromNode = function(elem) {
default: default:
break; break;
} }
while ( attr = attributes.pop() ) { while ( (attr = attributes.pop()) ) {
if ( attr.v.length === 0 ) { if ( attr.v.length === 0 ) {
continue; continue;
} }

View File

@ -419,7 +419,7 @@ var cosmeticFilterFromElement = function(elem, out) {
default: default:
break; break;
} }
while ( attr = attributes.pop() ) { while ( (attr = attributes.pop()) ) {
if ( attr.v.length === 0 ) { if ( attr.v.length === 0 ) {
continue; continue;
} }
@ -890,8 +890,8 @@ var startPicker = function(details) {
pickerRoot.contentWindow.focus(); pickerRoot.contentWindow.focus();
// Restore net filter union data if it originate from the same URL. // Restore net filter union data if it originate from the same URL.
var eprom = details.eprom || {}; var eprom = details.eprom || null;
if ( eprom.lastNetFilterSession === lastNetFilterSession ) { if ( eprom !== null && eprom.lastNetFilterSession === lastNetFilterSession ) {
lastNetFilterHostname = eprom.lastNetFilterHostname || ''; lastNetFilterHostname = eprom.lastNetFilterHostname || '';
lastNetFilterUnion = eprom.lastNetFilterUnion || ''; lastNetFilterUnion = eprom.lastNetFilterUnion || '';
} }

View File

@ -19,7 +19,7 @@
Home: https://github.com/gorhill/uBlock Home: https://github.com/gorhill/uBlock
*/ */
/* jshint bitwise: false, esnext: true, boss: true */ /* jshint bitwise: false, esnext: true */
/* global punycode, µBlock */ /* global punycode, µBlock */
/******************************************************************************/ /******************************************************************************/
@ -1198,7 +1198,7 @@ var trimChar = function(s, c) {
pos += 1; pos += 1;
} }
s = s.slice(pos); s = s.slice(pos);
if ( pos = s.length ) { if ( (pos = s.length) ) {
while ( s.charAt(pos-1) === c ) { while ( s.charAt(pos-1) === c ) {
pos -= 1; pos -= 1;
} }
@ -1497,7 +1497,7 @@ var badTokens = {
var findFirstGoodToken = function(s) { var findFirstGoodToken = function(s) {
reGoodToken.lastIndex = 0; reGoodToken.lastIndex = 0;
var matches; var matches;
while ( matches = reGoodToken.exec(s) ) { while ( (matches = reGoodToken.exec(s)) ) {
if ( s.charAt(reGoodToken.lastIndex) === '*' ) { if ( s.charAt(reGoodToken.lastIndex) === '*' ) {
continue; continue;
} }
@ -1508,7 +1508,7 @@ var findFirstGoodToken = function(s) {
} }
// No good token found, try again without minding "bad" tokens // No good token found, try again without minding "bad" tokens
reGoodToken.lastIndex = 0; reGoodToken.lastIndex = 0;
while ( matches = reGoodToken.exec(s) ) { while ( (matches = reGoodToken.exec(s)) ) {
if ( s.charAt(reGoodToken.lastIndex) === '*' ) { if ( s.charAt(reGoodToken.lastIndex) === '*' ) {
continue; continue;
} }
@ -2154,7 +2154,7 @@ FilterContainer.prototype.tokenize = function(url) {
var matches, tokenEntry; var matches, tokenEntry;
re.lastIndex = 0; re.lastIndex = 0;
var i = 0; var i = 0;
while ( matches = re.exec(url) ) { while ( (matches = re.exec(url)) ) {
tokenEntry = tokens[i]; tokenEntry = tokens[i];
if ( tokenEntry === undefined ) { if ( tokenEntry === undefined ) {
tokenEntry = tokens[i] = new TokenEntry(); tokenEntry = tokens[i] = new TokenEntry();
@ -2251,14 +2251,14 @@ FilterContainer.prototype.matchStringExactType = function(context, requestURL, r
// https://github.com/chrisaljoudi/uBlock/issues/139 // https://github.com/chrisaljoudi/uBlock/issues/139
// Test against important block filters // Test against important block filters
key = BlockAnyParty | Important | type; key = BlockAnyParty | Important | type;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return true; return true;
} }
} }
key = BlockAction | Important | type | party; key = BlockAction | Important | type | party;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return true; return true;
@ -2267,14 +2267,14 @@ FilterContainer.prototype.matchStringExactType = function(context, requestURL, r
// Test against block filters // Test against block filters
key = BlockAnyParty | type; key = BlockAnyParty | type;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
} }
} }
if ( this.fRegister === null ) { if ( this.fRegister === null ) {
key = BlockAction | type | party; key = BlockAction | type | party;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
} }
@ -2288,14 +2288,14 @@ FilterContainer.prototype.matchStringExactType = function(context, requestURL, r
// Test against allow filters // Test against allow filters
key = AllowAnyParty | type; key = AllowAnyParty | type;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return false; return false;
} }
} }
key = AllowAction | type | party; key = AllowAction | type | party;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return false; return false;
@ -2363,28 +2363,28 @@ FilterContainer.prototype.matchString = function(context) {
// evaluation. Normally, it is "evaluate block then evaluate allow", with // evaluation. Normally, it is "evaluate block then evaluate allow", with
// the `important` property it is "evaluate allow then evaluate block". // the `important` property it is "evaluate allow then evaluate block".
key = BlockAnyTypeAnyParty | Important; key = BlockAnyTypeAnyParty | Important;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return true; return true;
} }
} }
key = BlockAnyType | Important | party; key = BlockAnyType | Important | party;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return true; return true;
} }
} }
key = BlockAnyParty | Important | type; key = BlockAnyParty | Important | type;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return true; return true;
} }
} }
key = BlockAction | Important | type | party; key = BlockAction | Important | type | party;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return true; return true;
@ -2393,28 +2393,28 @@ FilterContainer.prototype.matchString = function(context) {
// Test against block filters // Test against block filters
key = BlockAnyTypeAnyParty; key = BlockAnyTypeAnyParty;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
} }
} }
if ( this.fRegister === null ) { if ( this.fRegister === null ) {
key = BlockAnyType | party; key = BlockAnyType | party;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
} }
} }
if ( this.fRegister === null ) { if ( this.fRegister === null ) {
key = BlockAnyParty | type; key = BlockAnyParty | type;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
} }
} }
if ( this.fRegister === null ) { if ( this.fRegister === null ) {
key = BlockAction | type | party; key = BlockAction | type | party;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
} }
@ -2430,28 +2430,28 @@ FilterContainer.prototype.matchString = function(context) {
// Test against allow filters // Test against allow filters
key = AllowAnyTypeAnyParty; key = AllowAnyTypeAnyParty;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return false; return false;
} }
} }
key = AllowAnyType | party; key = AllowAnyType | party;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return false; return false;
} }
} }
key = AllowAnyParty | type; key = AllowAnyParty | type;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return false; return false;
} }
} }
key = AllowAction | type | party; key = AllowAction | type | party;
if ( bucket = categories[toHex(key)] ) { if ( (bucket = categories[toHex(key)]) ) {
if ( this.matchTokens(bucket, url) ) { if ( this.matchTokens(bucket, url) ) {
this.keyRegister = key; this.keyRegister = key;
return false; return false;

View File

@ -225,7 +225,7 @@
var location, availableEntry, storedEntry; var location, availableEntry, storedEntry;
var off; var off;
while ( location = locations.pop() ) { while ( (location = locations.pop()) ) {
storedEntry = lists[location]; storedEntry = lists[location];
off = storedEntry.off === true; off = storedEntry.off === true;
// New location? // New location?
@ -242,7 +242,9 @@
continue; continue;
} }
availableEntry.off = off; availableEntry.off = off;
µb.assets.setHomeURL(location, availableEntry.homeURL); if ( typeof availableEntry.homeURL === 'string' ) {
µb.assets.setHomeURL(location, availableEntry.homeURL);
}
if ( storedEntry.entryCount !== undefined ) { if ( storedEntry.entryCount !== undefined ) {
availableEntry.entryCount = storedEntry.entryCount; availableEntry.entryCount = storedEntry.entryCount;
} }

View File

@ -597,7 +597,7 @@ vAPI.tabs.registerListeners();
if ( !pageStore ) { if ( !pageStore ) {
this.updateTitle(tabId); this.updateTitle(tabId);
this.pageStoresToken = Date.now(); this.pageStoresToken = Date.now();
return this.pageStores[tabId] = this.PageStore.factory(tabId); return (this.pageStores[tabId] = this.PageStore.factory(tabId));
} }
// https://github.com/chrisaljoudi/uBlock/issues/516 // https://github.com/chrisaljoudi/uBlock/issues/516

View File

@ -336,7 +336,7 @@ DOMList.prototype.remove = function() {
var i = this.nodes.length; var i = this.nodes.length;
while ( i-- ) { while ( i-- ) {
cn = this.nodes[i]; cn = this.nodes[i];
if ( p = cn.parentNode ) { if ( (p = cn.parentNode) ) {
p.removeChild(cn); p.removeChild(cn);
} }
} }
@ -713,7 +713,7 @@ DOMList.prototype.trigger = function(etype) {
var onBeforeUnload = function() { var onBeforeUnload = function() {
var entry; var entry;
while ( entry = listenerEntries.pop() ) { while ( (entry = listenerEntries.pop()) ) {
entry.dispose(); entry.dispose();
} }
window.removeEventListener('beforeunload', onBeforeUnload); window.removeEventListener('beforeunload', onBeforeUnload);

View File

@ -252,7 +252,7 @@ URLNetFiltering.prototype.evaluateZ = function(context, target, type) {
for (;;) { for (;;) {
this.context = context; this.context = context;
keyShard = context + ' ' + urlKey; keyShard = context + ' ' + urlKey;
if ( urls = this.rules[keyShard + ' ' + type] ) { if ( (urls = this.rules[keyShard + ' ' + type]) ) {
i = indexOfMatch(urls, target); i = indexOfMatch(urls, target);
if ( i !== -1 ) { if ( i !== -1 ) {
entry = urls[i]; entry = urls[i];
@ -262,7 +262,7 @@ URLNetFiltering.prototype.evaluateZ = function(context, target, type) {
return this; return this;
} }
} }
if ( urls = this.rules[keyShard + ' *'] ) { if ( (urls = this.rules[keyShard + ' *']) ) {
i = indexOfMatch(urls, target); i = indexOfMatch(urls, target);
if ( i !== -1 ) { if ( i !== -1 ) {
entry = urls[i]; entry = urls[i];