|
|
@ -25,27 +25,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
// rhill 2013-11-24: bind behind-the-scene virtual tab/url manually, since the
|
|
|
|
// Load everything
|
|
|
|
// normal way forbid binding behind the scene tab.
|
|
|
|
|
|
|
|
// https://github.com/gorhill/httpswitchboard/issues/67
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
(function() {
|
|
|
|
var µm = µMatrix;
|
|
|
|
|
|
|
|
var tabContext = µm.tabContextManager.mustLookup(vAPI.noTabId);
|
|
|
|
'use strict';
|
|
|
|
µm.pageStores[vAPI.noTabId] = µm.PageStore.factory(tabContext);
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
µMatrix.turnOn();
|
|
|
|
var µm = µMatrix;
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
// Browser data jobs
|
|
|
|
// Important: raise barrier to remote fetching: we do not want resources to
|
|
|
|
|
|
|
|
// be pulled from remote server at start up time.
|
|
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
µm.assets.remoteFetchBarrier += 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var onAllDone = function() {
|
|
|
|
|
|
|
|
µm.webRequest.start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/chrisaljoudi/uBlock/issues/184
|
|
|
|
|
|
|
|
// Check for updates not too far in the future.
|
|
|
|
|
|
|
|
µm.assetUpdater.onStart.addListener(µm.updateStartHandler.bind(µm));
|
|
|
|
|
|
|
|
µm.assetUpdater.onCompleted.addListener(µm.updateCompleteHandler.bind(µm));
|
|
|
|
|
|
|
|
µm.assetUpdater.onAssetUpdated.addListener(µm.assetUpdatedHandler.bind(µm));
|
|
|
|
|
|
|
|
µm.assets.onAssetCacheRemoved.addListener(µm.assetCacheRemovedHandler.bind(µm));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Browser data jobs
|
|
|
|
var jobCallback = function() {
|
|
|
|
var jobCallback = function() {
|
|
|
|
var µm = µMatrix;
|
|
|
|
|
|
|
|
if ( !µm.userSettings.clearBrowserCache ) {
|
|
|
|
if ( !µm.userSettings.clearBrowserCache ) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -60,65 +70,54 @@
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
µMatrix.asyncJobs.add('clearBrowserCache', null, jobCallback, 15 * 60 * 1000, true);
|
|
|
|
µMatrix.asyncJobs.add('clearBrowserCache', null, jobCallback, 15 * 60 * 1000, true);
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
// Important: remove barrier to remote fetching, this was useful only
|
|
|
|
|
|
|
|
// for launch time.
|
|
|
|
// Automatic update of non-user assets
|
|
|
|
µm.assets.remoteFetchBarrier -= 1;
|
|
|
|
// https://github.com/gorhill/httpswitchboard/issues/334
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
|
|
|
|
var µm = µMatrix;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/chrisaljoudi/uBlock/issues/184
|
|
|
|
|
|
|
|
// Check for updates not too far in the future.
|
|
|
|
|
|
|
|
µm.assetUpdater.onStart.addListener(µm.updateStartHandler.bind(µm));
|
|
|
|
|
|
|
|
µm.assetUpdater.onCompleted.addListener(µm.updateCompleteHandler.bind(µm));
|
|
|
|
|
|
|
|
µm.assetUpdater.onAssetUpdated.addListener(µm.assetUpdatedHandler.bind(µm));
|
|
|
|
|
|
|
|
µm.assets.onAssetCacheRemoved.addListener(µm.assetCacheRemovedHandler.bind(µm));
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Load everything
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
|
|
|
|
var µm = µMatrix;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
µm.assets.remoteFetchBarrier += 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This needs to be done when the PSL is loaded
|
|
|
|
var onTabsReady = function(tabs) {
|
|
|
|
var bindTabs = function(tabs) {
|
|
|
|
|
|
|
|
var tab;
|
|
|
|
var tab;
|
|
|
|
var i = tabs.length;
|
|
|
|
var i = tabs.length;
|
|
|
|
// console.debug('start.js > binding %d tabs', i);
|
|
|
|
// console.debug('start.js > binding %d tabs', i);
|
|
|
|
while ( i-- ) {
|
|
|
|
while ( i-- ) {
|
|
|
|
tab = tabs[i];
|
|
|
|
tab = tabs[i];
|
|
|
|
µm.tabContextManager.commit(tab.id, tab.url);
|
|
|
|
µm.tabContextManager.commit(tab.id, tab.url);
|
|
|
|
|
|
|
|
// https://github.com/gorhill/uMatrix/issues/56
|
|
|
|
|
|
|
|
// We must unbind first to flush out potentially bad domain names.
|
|
|
|
|
|
|
|
µm.unbindTabFromPageStats(tab.id);
|
|
|
|
µm.bindTabToPageStats(tab.id);
|
|
|
|
µm.bindTabToPageStats(tab.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
µm.webRequest.start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Important: remove barrier to remote fetching, this was useful only
|
|
|
|
onAllDone();
|
|
|
|
// for launch time.
|
|
|
|
};
|
|
|
|
µm.assets.remoteFetchBarrier -= 1;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var queryTabs = function() {
|
|
|
|
var onSettingsReady = function(settings) {
|
|
|
|
vAPI.tabs.getAll(bindTabs);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var onSettingsReady = function(settings) {
|
|
|
|
|
|
|
|
µm.loadPublicSuffixList(queryTabs);
|
|
|
|
|
|
|
|
µm.loadHostsFiles();
|
|
|
|
µm.loadHostsFiles();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var onMatrixReady = function() {
|
|
|
|
var onMatrixReady = function() {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var onPSLReady = function() {
|
|
|
|
µm.loadUserSettings(onSettingsReady);
|
|
|
|
µm.loadUserSettings(onSettingsReady);
|
|
|
|
µm.loadMatrix(onMatrixReady);
|
|
|
|
µm.loadMatrix(onMatrixReady);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// rhill 2013-11-24: bind behind-the-scene virtual tab/url manually, since the
|
|
|
|
|
|
|
|
// normal way forbid binding behind the scene tab.
|
|
|
|
|
|
|
|
// https://github.com/gorhill/httpswitchboard/issues/67
|
|
|
|
|
|
|
|
µm.pageStores[vAPI.noTabId] = µm.PageStore.factory(
|
|
|
|
|
|
|
|
µm.tabContextManager.mustLookup(vAPI.noTabId)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vAPI.tabs.getAll(onTabsReady);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Must be done ASAP
|
|
|
|
|
|
|
|
µm.loadPublicSuffixList(onPSLReady);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
})();
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
|