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

8
platform/firefox/vapi-client.js

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

16
src/js/assets.js

@ -20,7 +20,6 @@
*/
/* global vAPI, µMatrix, YaMD5 */
/* jshint boss: true */
/*******************************************************************************
@ -449,14 +448,14 @@ var getRepoMetadata = function(callback) {
};
var onLocalChecksumsLoaded = function(details) {
if ( localChecksums = validateChecksums(details) ) {
if ( (localChecksums = validateChecksums(details)) ) {
parseChecksums(localChecksums, 'local');
}
checksumsReceived();
};
var onRepoChecksumsLoaded = function(details) {
if ( repoChecksums = validateChecksums(details) ) {
if ( (repoChecksums = validateChecksums(details)) ) {
parseChecksums(repoChecksums, 'repo');
}
checksumsReceived();
@ -1011,7 +1010,10 @@ exports.get = function(path, callback) {
}
// Asset is repo copy of external content
if ( stringIsNotEmpty(homeURLs[path]) ) {
if (
homeURLs.hasOwnProperty(path) &&
stringIsNotEmpty(homeURLs[path])
) {
readRepoCopyAsset(path, callback);
return;
}
@ -1056,8 +1058,10 @@ exports.metadata = function(callback) {
continue;
}
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);
};

4
src/js/contentscript-end.js

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

3
src/js/logger-ui.js

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

4
src/js/messaging.js

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

7
src/js/storage.js

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

4
src/js/udom.js

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

Loading…
Cancel
Save