mirror of https://github.com/gorhill/uBlock.git
this fixes many addon validation warnings
This commit is contained in:
parent
7eac4072de
commit
facef0dc05
|
@ -46,6 +46,10 @@ vAPI.chrome = true;
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
vAPI.setTimeout = vAPI.setTimeout || self.setTimeout.bind(self);
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
vAPI.shutdown = (function() {
|
vAPI.shutdown = (function() {
|
||||||
var jobs = [];
|
var jobs = [];
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,12 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
self.vAPI = self.vAPI || {};
|
var vAPI = self.vAPI = self.vAPI || {};
|
||||||
|
|
||||||
var chrome = self.chrome;
|
var chrome = self.chrome;
|
||||||
var vAPI = self.vAPI;
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
vAPI.setTimeout = vAPI.setTimeout || self.setTimeout.bind(self);
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -747,7 +747,7 @@ vAPI.tabs.injectScript = function(tabId, details, callback) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( typeof callback === 'function' ) {
|
if ( typeof callback === 'function' ) {
|
||||||
setTimeout(callback, 13);
|
vAPI.setTimeout(callback, 13);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1568,7 +1568,7 @@ vAPI.toolbarButton.init = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anonymous elements need some time to be reachable
|
// Anonymous elements need some time to be reachable
|
||||||
setTimeout(this.updateBadgeStyle, 250);
|
vAPI.setTimeout(this.updateBadgeStyle, 250);
|
||||||
}.bind(this.CUIEvents);
|
}.bind(this.CUIEvents);
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/CustomizableUI.jsm#Listeners
|
// https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/CustomizableUI.jsm#Listeners
|
||||||
|
@ -1602,7 +1602,7 @@ vAPI.toolbarButton.init = function() {
|
||||||
|
|
||||||
this.onCreated = function(button) {
|
this.onCreated = function(button) {
|
||||||
button.setAttribute('badge', '');
|
button.setAttribute('badge', '');
|
||||||
setTimeout(updateBadge, 250);
|
vAPI.setTimeout(updateBadge, 250);
|
||||||
};
|
};
|
||||||
|
|
||||||
CustomizableUI.addListener(this.CUIEvents);
|
CustomizableUI.addListener(this.CUIEvents);
|
||||||
|
@ -1668,7 +1668,7 @@ vAPI.toolbarButton.onBeforeCreated = function(doc) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTimer = setTimeout(resizePopup, 10);
|
updateTimer = vAPI.setTimeout(resizePopup, 10);
|
||||||
};
|
};
|
||||||
var resizePopup = function() {
|
var resizePopup = function() {
|
||||||
updateTimer = null;
|
updateTimer = null;
|
||||||
|
|
|
@ -38,6 +38,12 @@ vAPI.sessionId = String.fromCharCode(Date.now() % 25 + 97) +
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
vAPI.setTimeout = vAPI.setTimeout || function(callback, delay) {
|
||||||
|
setTimeout(function() { callback(); }, delay);
|
||||||
|
};
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
vAPI.shutdown = (function() {
|
vAPI.shutdown = (function() {
|
||||||
var jobs = [];
|
var jobs = [];
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,13 @@ const {Services} = Components.utils.import(
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
self.vAPI = self.vAPI || {};
|
var vAPI = self.vAPI = self.vAPI || {};
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
vAPI.setTimeout = vAPI.setTimeout || function(callback, delay) {
|
||||||
|
setTimeout(function() { callback(); }, delay);
|
||||||
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -1352,7 +1352,7 @@ var scheduleUpdateDaemon = function() {
|
||||||
if ( updateDaemonTimer !== null ) {
|
if ( updateDaemonTimer !== null ) {
|
||||||
clearTimeout(updateDaemonTimer);
|
clearTimeout(updateDaemonTimer);
|
||||||
}
|
}
|
||||||
updateDaemonTimer = setTimeout(
|
updateDaemonTimer = vAPI.setTimeout(
|
||||||
updateDaemon,
|
updateDaemon,
|
||||||
exports.manualUpdate ? manualUpdateDaemonTimerPeriod : autoUpdateDaemonTimerPeriod
|
exports.manualUpdate ? manualUpdateDaemonTimerPeriod : autoUpdateDaemonTimerPeriod
|
||||||
);
|
);
|
||||||
|
|
|
@ -88,7 +88,7 @@ AsyncJobManager.prototype.restartTimer = function() {
|
||||||
if ( when < this.timerWhen ) {
|
if ( when < this.timerWhen ) {
|
||||||
clearTimeout(this.timerId);
|
clearTimeout(this.timerId);
|
||||||
this.timerWhen = when;
|
this.timerWhen = when;
|
||||||
this.timerId = setTimeout(processJobs, Math.max(when - Date.now(), 10));
|
this.timerId = vAPI.setTimeout(processJobs, Math.max(when - Date.now(), 10));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -198,6 +198,6 @@ return asyncJobManager;
|
||||||
if ( vAPI.isBehindTheSceneTabId(tabId) ) {
|
if ( vAPI.isBehindTheSceneTabId(tabId) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tabIdToTimer[tabId] = setTimeout(updateBadge.bind(this, tabId), 500);
|
tabIdToTimer[tabId] = vAPI.setTimeout(updateBadge.bind(this, tabId), 500);
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -206,7 +206,7 @@ var uBlockCollapser = (function() {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
send();
|
send();
|
||||||
} else if ( timer === null ) {
|
} else if ( timer === null ) {
|
||||||
timer = setTimeout(send, delay || 20);
|
timer = vAPI.setTimeout(send, delay || 20);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -599,7 +599,7 @@ var uBlockCollapser = (function() {
|
||||||
if ( processHighHighGenericsTimer !== null ) {
|
if ( processHighHighGenericsTimer !== null ) {
|
||||||
clearTimeout(processHighHighGenericsTimer);
|
clearTimeout(processHighHighGenericsTimer);
|
||||||
}
|
}
|
||||||
processHighHighGenericsTimer = setTimeout(processHighHighGenerics, 300);
|
processHighHighGenericsTimer = vAPI.setTimeout(processHighHighGenerics, 300);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extract all ids: these will be passed to the cosmetic filtering
|
// Extract all ids: these will be passed to the cosmetic filtering
|
||||||
|
@ -739,7 +739,7 @@ var uBlockCollapser = (function() {
|
||||||
// I arbitrarily chose 100 ms for now:
|
// I arbitrarily chose 100 ms for now:
|
||||||
// I have to compromise between the overhead of processing too few
|
// I have to compromise between the overhead of processing too few
|
||||||
// nodes too often and the delay of many nodes less often.
|
// nodes too often and the delay of many nodes less often.
|
||||||
addedNodeListsTimer = setTimeout(treeMutationObservedHandler, 100);
|
addedNodeListsTimer = vAPI.setTimeout(treeMutationObservedHandler, 100);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1012,7 +1012,7 @@ FilterContainer.prototype.triggerSelectorCachePruner = function() {
|
||||||
}
|
}
|
||||||
// Of interest: http://fitzgeraldnick.com/weblog/40/
|
// Of interest: http://fitzgeraldnick.com/weblog/40/
|
||||||
// http://googlecode.blogspot.ca/2009/07/gmail-for-mobile-html5-series-using.html
|
// http://googlecode.blogspot.ca/2009/07/gmail-for-mobile-html5-series-using.html
|
||||||
this.selectorCacheTimer = setTimeout(
|
this.selectorCacheTimer = vAPI.setTimeout(
|
||||||
this.pruneSelectorCacheAsync.bind(this),
|
this.pruneSelectorCacheAsync.bind(this),
|
||||||
this.selectorCachePruneDelay
|
this.selectorCachePruneDelay
|
||||||
);
|
);
|
||||||
|
|
|
@ -460,7 +460,7 @@ var onLogBufferRead = function(response) {
|
||||||
tbody.querySelector('tr') === null
|
tbody.querySelector('tr') === null
|
||||||
);
|
);
|
||||||
|
|
||||||
setTimeout(readLogBuffer, 1200);
|
vAPI.setTimeout(readLogBuffer, 1200);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -640,7 +640,7 @@ var rowFilterer = (function() {
|
||||||
if ( timer !== null ) {
|
if ( timer !== null ) {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
}
|
}
|
||||||
timer = setTimeout(commit, 750);
|
timer = vAPI.setTimeout(commit, 750);
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ var janitor = function() {
|
||||||
logBuffer = logBuffer.dispose();
|
logBuffer = logBuffer.dispose();
|
||||||
}
|
}
|
||||||
if ( logBuffer !== null ) {
|
if ( logBuffer !== null ) {
|
||||||
setTimeout(janitor, logBufferObsoleteAfter);
|
vAPI.setTimeout(janitor, logBufferObsoleteAfter);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ var writeOne = function() {
|
||||||
var readAll = function() {
|
var readAll = function() {
|
||||||
if ( logBuffer === null ) {
|
if ( logBuffer === null ) {
|
||||||
logBuffer = new LogBuffer();
|
logBuffer = new LogBuffer();
|
||||||
setTimeout(janitor, logBufferObsoleteAfter);
|
vAPI.setTimeout(janitor, logBufferObsoleteAfter);
|
||||||
}
|
}
|
||||||
return logBuffer.readAll();
|
return logBuffer.readAll();
|
||||||
};
|
};
|
||||||
|
|
|
@ -332,7 +332,7 @@ var updateMetadataNow = function() {
|
||||||
|
|
||||||
var updateMetadataAsync = function() {
|
var updateMetadataAsync = function() {
|
||||||
if ( metadataPersistTimer === null ) {
|
if ( metadataPersistTimer === null ) {
|
||||||
metadataPersistTimer = setTimeout(updateMetadata, 60 * 1000);
|
metadataPersistTimer = vAPI.setTimeout(updateMetadata, 60 * 1000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,7 @@ NetFilteringResultCache.prototype.prune = function() {
|
||||||
|
|
||||||
NetFilteringResultCache.prototype.pruneAsync = function() {
|
NetFilteringResultCache.prototype.pruneAsync = function() {
|
||||||
if ( this.timer === null ) {
|
if ( this.timer === null ) {
|
||||||
this.timer = setTimeout(this.boundPruneAsyncCallback, this.shelfLife * 2);
|
this.timer = vAPI.setTimeout(this.boundPruneAsyncCallback, this.shelfLife * 2);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -744,7 +744,7 @@ var pollForContentChange = (function() {
|
||||||
if ( pollTimer !== null ) {
|
if ( pollTimer !== null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pollTimer = setTimeout(pollCallback, 1500);
|
pollTimer = vAPI.setTimeout(pollCallback, 1500);
|
||||||
};
|
};
|
||||||
|
|
||||||
return poll;
|
return poll;
|
||||||
|
|
|
@ -165,7 +165,7 @@ housekeep itself.
|
||||||
|
|
||||||
TabContext.prototype.onTab = function(tab) {
|
TabContext.prototype.onTab = function(tab) {
|
||||||
if ( tab ) {
|
if ( tab ) {
|
||||||
this.timer = setTimeout(this.onTimerCallback, gcPeriod);
|
this.timer = vAPI.setTimeout(this.onTimerCallback, gcPeriod);
|
||||||
} else {
|
} else {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ housekeep itself.
|
||||||
}
|
}
|
||||||
this.onTabCallback = this.onTab.bind(this);
|
this.onTabCallback = this.onTab.bind(this);
|
||||||
this.onTimerCallback = this.onTimer.bind(this);
|
this.onTimerCallback = this.onTimer.bind(this);
|
||||||
this.timer = setTimeout(this.onTimerCallback, gcPeriod);
|
this.timer = vAPI.setTimeout(this.onTimerCallback, gcPeriod);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update just force all properties to be updated to match the most current
|
// Update just force all properties to be updated to match the most current
|
||||||
|
@ -593,7 +593,7 @@ vAPI.tabs.registerListeners();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
tabIdToTryCount[tabId] = count - 1;
|
tabIdToTryCount[tabId] = count - 1;
|
||||||
tabIdToTimer[tabId] = setTimeout(updateTitle.bind(µb, tabId), delay);
|
tabIdToTimer[tabId] = vAPI.setTimeout(updateTitle.bind(µb, tabId), delay);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -624,7 +624,7 @@ vAPI.tabs.registerListeners();
|
||||||
if ( tabIdToTimer[tabId] ) {
|
if ( tabIdToTimer[tabId] ) {
|
||||||
clearTimeout(tabIdToTimer[tabId]);
|
clearTimeout(tabIdToTimer[tabId]);
|
||||||
}
|
}
|
||||||
tabIdToTimer[tabId] = setTimeout(updateTitle.bind(this, tabId), delay);
|
tabIdToTimer[tabId] = vAPI.setTimeout(updateTitle.bind(this, tabId), delay);
|
||||||
tabIdToTryCount[tabId] = 5;
|
tabIdToTryCount[tabId] = 5;
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
@ -664,10 +664,10 @@ var pageStoreJanitor = function() {
|
||||||
}
|
}
|
||||||
pageStoreJanitorSampleAt = n;
|
pageStoreJanitorSampleAt = n;
|
||||||
|
|
||||||
setTimeout(pageStoreJanitor, pageStoreJanitorPeriod);
|
vAPI.setTimeout(pageStoreJanitor, pageStoreJanitorPeriod);
|
||||||
};
|
};
|
||||||
|
|
||||||
setTimeout(pageStoreJanitor, pageStoreJanitorPeriod);
|
vAPI.setTimeout(pageStoreJanitor, pageStoreJanitorPeriod);
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -372,7 +372,7 @@ var matchWhitelistDirective = function(url, hostname, directive) {
|
||||||
if ( tabIdToTimerMap.hasOwnProperty(tabId) ) {
|
if ( tabIdToTimerMap.hasOwnProperty(tabId) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tabIdToTimerMap[tabId] = setTimeout(
|
tabIdToTimerMap[tabId] = vAPI.setTimeout(
|
||||||
injectNow.bind(null, tabId),
|
injectNow.bind(null, tabId),
|
||||||
100
|
100
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue