Browse Source

this fixes many strictness warning in browser console

pull/2/head
gorhill 9 years ago
parent
commit
9e4e4943f3
  1. 6
      platform/firefox/vapi-background.js
  2. 8
      platform/firefox/vapi-client.js
  3. 16
      src/js/assets.js
  4. 4
      src/js/contentscript-end.js
  5. 3
      src/js/logger-ui.js
  6. 4
      src/js/messaging.js
  7. 7
      src/js/storage.js
  8. 4
      src/js/udom.js

6
platform/firefox/vapi-background.js

@ -19,7 +19,7 @@
Home: https://github.com/gorhill/uMatrix Home: https://github.com/gorhill/uMatrix
*/ */
/* jshint bitwise: false, boss: true, esnext: true */
/* jshint bitwise: false, esnext: true */
/* global self, Components, punycode, µBlock */ /* global self, Components, punycode, µBlock */
// For background page // For background page
@ -355,7 +355,7 @@ vAPI.storage = (function() {
var row; var row;
while ( row = rows.getNextRow() ) {
while ( (row = rows.getNextRow()) ) {
// we assume that there will be two columns, since we're // we assume that there will be two columns, since we're
// using it only for preferences // using it only for preferences
result[row.getResultByIndex(0)] = row.getResultByIndex(1); result[row.getResultByIndex(0)] = row.getResultByIndex(1);
@ -713,7 +713,7 @@ vAPI.tabs.open = function(details) {
var tabBrowser = getTabBrowser(win); var tabBrowser = getTabBrowser(win);
// Open in a standalone window // Open in a standalone window
if ( details.popup === true ) {
if ( details.popup ) {
Services.ww.openWindow( Services.ww.openWindow(
self, self,
details.url, details.url,

8
platform/firefox/vapi-client.js

@ -19,7 +19,7 @@
Home: https://github.com/gorhill/uMatrix Home: https://github.com/gorhill/uMatrix
*/ */
/* jshint boss: true, esnext: true */
/* jshint esnext: true */
/* global addMessageListener, removeMessageListener, sendAsyncMessage */ /* global addMessageListener, removeMessageListener, sendAsyncMessage */
// For non background pages // For non background pages
@ -55,7 +55,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();
} }
}; };
@ -76,7 +76,7 @@ var messagingConnector = function(response) {
var channels = vAPI.messaging.channels; var channels = vAPI.messaging.channels;
var channel, listener; var channel, listener;
if ( response.broadcast === true && !response.channelName ) {
if ( response.broadcast && !response.channelName ) {
for ( channel in channels ) { for ( channel in channels ) {
if ( channels.hasOwnProperty(channel) === false ) { if ( channels.hasOwnProperty(channel) === false ) {
continue; continue;
@ -121,7 +121,7 @@ vAPI.messaging = {
this.channels.vAPI = { this.channels.vAPI = {
listener: function(msg) { listener: function(msg) {
if ( msg.cmd === 'injectScript' ) {
if ( typeof msg.cmd === 'string' && msg.cmd === 'injectScript' ) {
var details = msg.details; var details = msg.details;
if ( !details.allFrames && window !== window.top ) { if ( !details.allFrames && window !== window.top ) {
return; return;

16
src/js/assets.js

@ -20,7 +20,6 @@
*/ */
/* global vAPI, µMatrix, YaMD5 */ /* global vAPI, µMatrix, YaMD5 */
/* jshint boss: true */
/******************************************************************************* /*******************************************************************************
@ -449,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();
@ -1011,7 +1010,10 @@ exports.get = function(path, callback) {
} }
// Asset is repo copy of external content // Asset is repo copy of external content
if ( stringIsNotEmpty(homeURLs[path]) ) {
if (
homeURLs.hasOwnProperty(path) &&
stringIsNotEmpty(homeURLs[path])
) {
readRepoCopyAsset(path, callback); readRepoCopyAsset(path, callback);
return; return;
} }
@ -1056,8 +1058,10 @@ exports.metadata = function(callback) {
continue; continue;
} }
entry = out[path]; entry = out[path];
entry.cacheObsolete = stringIsNotEmpty(homeURLs[path]) &&
cacheIsObsolete(entry.lastModified);
entry.cacheObsolete =
homeURLs.hasOwnProperty(path) &&
stringIsNotEmpty(homeURLs[path]) &&
cacheIsObsolete(entry.lastModified || 0);
} }
callback(out); callback(out);
}; };

4
src/js/contentscript-end.js

@ -20,7 +20,7 @@
*/ */
/* global vAPI */ /* global vAPI */
/* jshint multistr: true, boss: true */
/* jshint multistr: true */
/******************************************************************************/ /******************************************************************************/
/******************************************************************************/ /******************************************************************************/
@ -344,7 +344,7 @@ var collapser = (function() {
var hasInlineScript = function(nodeList, summary) { var hasInlineScript = function(nodeList, summary) {
var i = 0; var i = 0;
var node, text; var node, text;
while ( node = nodeList.item(i++) ) {
while ( (node = nodeList.item(i++)) ) {
if ( node.nodeType !== 1 ) { if ( node.nodeType !== 1 ) {
continue; continue;
} }

3
src/js/logger-ui.js

@ -19,7 +19,6 @@
Home: https://github.com/gorhill/sessbench Home: https://github.com/gorhill/sessbench
*/ */
/* jshint boss: true */
/* global vAPI, uDom */ /* global vAPI, uDom */
/******************************************************************************/ /******************************************************************************/
@ -205,7 +204,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;

4
src/js/messaging.js

@ -20,7 +20,6 @@
*/ */
/* global µMatrix, vAPI */ /* global µMatrix, vAPI */
/* jshint boss: true */
/******************************************************************************/ /******************************************************************************/
/******************************************************************************/ /******************************************************************************/
@ -88,6 +87,9 @@ function onMessage(request, sender, callback) {
break; break;
case 'userSettings': case 'userSettings':
if ( request.hasOwnProperty('value') === false ) {
request.value = undefined;
}
response = µm.changeUserSettings(request.name, request.value); response = µm.changeUserSettings(request.name, request.value);
break; break;

7
src/js/storage.js

@ -19,7 +19,6 @@
Home: https://github.com/gorhill/uMatrix Home: https://github.com/gorhill/uMatrix
*/ */
/* jshint boss: true */
/* global chrome, µMatrix, punycode, publicSuffixList */ /* global chrome, µMatrix, punycode, publicSuffixList */
/******************************************************************************/ /******************************************************************************/
@ -111,7 +110,7 @@
var oldLocation, newLocation; var oldLocation, newLocation;
var availableEntry, storedEntry; var availableEntry, storedEntry;
while ( oldLocation = locations.pop() ) {
while ( (oldLocation = locations.pop()) ) {
newLocation = redirections[oldLocation] || oldLocation; newLocation = redirections[oldLocation] || oldLocation;
availableEntry = availableHostsFiles[newLocation]; availableEntry = availableHostsFiles[newLocation];
if ( availableEntry === undefined ) { if ( availableEntry === undefined ) {
@ -119,7 +118,7 @@
} }
storedEntry = lists[oldLocation] || {}; storedEntry = lists[oldLocation] || {};
availableEntry.off = storedEntry.off || false; availableEntry.off = storedEntry.off || false;
µm.assets.setHomeURL(newLocation, availableEntry.homeURL);
µm.assets.setHomeURL(newLocation, availableEntry.homeURL || '');
if ( storedEntry.entryCount !== undefined ) { if ( storedEntry.entryCount !== undefined ) {
availableEntry.entryCount = storedEntry.entryCount; availableEntry.entryCount = storedEntry.entryCount;
} }
@ -225,7 +224,7 @@
// Load all hosts file which are not disabled. // Load all hosts file which are not disabled.
var location; var location;
while ( location = locations.pop() ) {
while ( (location = locations.pop()) ) {
if ( hostsFiles[location].off ) { if ( hostsFiles[location].off ) {
hostsFileLoadCount -= 1; hostsFileLoadCount -= 1;
continue; continue;

4
src/js/udom.js

@ -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);

Loading…
Cancel
Save