refactoring: many changes throughout -- not close to be done

pull/2/head
gorhill 10 years ago
parent 31b785bcf7
commit b4254db51c

@ -176,6 +176,7 @@ vAPI.tabs.registerListeners = function() {
var reGoodForWebRequestAPI = /^https?:\/\//; var reGoodForWebRequestAPI = /^https?:\/\//;
var onCreatedNavigationTarget = function(details) { var onCreatedNavigationTarget = function(details) {
details.tabId = details.tabId.toString();
//console.debug('onCreatedNavigationTarget: popup candidate tab id %d = "%s"', details.tabId, details.url); //console.debug('onCreatedNavigationTarget: popup candidate tab id %d = "%s"', details.tabId, details.url);
if ( reGoodForWebRequestAPI.test(details.url) === false ) { if ( reGoodForWebRequestAPI.test(details.url) === false ) {
details.frameId = 0; details.frameId = 0;
@ -190,10 +191,12 @@ vAPI.tabs.registerListeners = function() {
return; return;
} }
//console.debug('onBeforeNavigate: popup candidate tab id %d = "%s"', details.tabId, details.url); //console.debug('onBeforeNavigate: popup candidate tab id %d = "%s"', details.tabId, details.url);
details.tabId = details.tabId.toString();
popupCandidateTest(details); popupCandidateTest(details);
}; };
var onUpdated = function(tabId, changeInfo, tab) { var onUpdated = function(tabId, changeInfo, tab) {
tabId = tabId.toString();
if ( changeInfo.url && popupCandidateTest({ tabId: tabId, url: changeInfo.url }) ) { if ( changeInfo.url && popupCandidateTest({ tabId: tabId, url: changeInfo.url }) ) {
return; return;
} }
@ -204,6 +207,7 @@ vAPI.tabs.registerListeners = function() {
if ( details.frameId !== 0 ) { if ( details.frameId !== 0 ) {
return; return;
} }
details.tabId = details.tabId.toString();
onNavigationClient(details); onNavigationClient(details);
//console.debug('onCommitted: popup candidate tab id %d = "%s"', details.tabId, details.url); //console.debug('onCommitted: popup candidate tab id %d = "%s"', details.tabId, details.url);
if ( popupCandidateTest(details) === true ) { if ( popupCandidateTest(details) === true ) {
@ -231,9 +235,10 @@ vAPI.tabs.get = function(tabId, callback) {
var onTabReady = function(tab) { var onTabReady = function(tab) {
// https://code.google.com/p/chromium/issues/detail?id=410868#c8 // https://code.google.com/p/chromium/issues/detail?id=410868#c8
if ( chrome.runtime.lastError ) { if ( chrome.runtime.lastError ) {
/* noop */
} }
// Caller must be prepared to deal with nil tab value if ( tab instanceof Object ) {
tab.id = tab.id.toString();
}
callback(tab); callback(tab);
}; };
if ( tabId !== null ) { if ( tabId !== null ) {
@ -246,9 +251,13 @@ vAPI.tabs.get = function(tabId, callback) {
var onTabReceived = function(tabs) { var onTabReceived = function(tabs) {
// https://code.google.com/p/chromium/issues/detail?id=410868#c8 // https://code.google.com/p/chromium/issues/detail?id=410868#c8
if ( chrome.runtime.lastError ) { if ( chrome.runtime.lastError ) {
/* noop */
} }
callback(tabs[0]); var tab = null;
if ( Array.isArray(tabs) && tabs.length !== 0 ) {
tab = tabs[0];
tab.id = tab.id.toString();
}
callback(tab);
}; };
chrome.tabs.query({ active: true, currentWindow: true }, onTabReceived); chrome.tabs.query({ active: true, currentWindow: true }, onTabReceived);
}; };
@ -256,7 +265,16 @@ vAPI.tabs.get = function(tabId, callback) {
/******************************************************************************/ /******************************************************************************/
vAPI.tabs.getAll = function(callback) { vAPI.tabs.getAll = function(callback) {
chrome.tabs.query({ url: '<all_urls>' }, callback); var onTabsReady = function(tabs) {
if ( Array.isArray(tabs) ) {
var i = tabs.length;
while ( i-- ) {
tabs[i].id = tabs[i].id.toString();
}
}
callback(tabs);
};
chrome.tabs.query({ url: '<all_urls>' }, onTabsReady);
}; };
/******************************************************************************/ /******************************************************************************/
@ -714,7 +732,6 @@ vAPI.net.registerListeners = function() {
// If no transposition possible, transpose to `object` as per // If no transposition possible, transpose to `object` as per
// Chromium bug 410382 (see below) // Chromium bug 410382 (see below)
if ( pos === -1 ) { if ( pos === -1 ) {
details.type = 'object';
return; return;
} }
@ -729,8 +746,6 @@ vAPI.net.registerListeners = function() {
details.type = 'image'; details.type = 'image';
return; return;
} }
// https://code.google.com/p/chromium/issues/detail?id=410382
details.type = 'object';
}; };
// <<<<<<<< // <<<<<<<<
// End of: Normalizing request types // End of: Normalizing request types

@ -109,15 +109,23 @@
}, },
"matrixSwitchNoMixedContent" : { "matrixSwitchNoMixedContent" : {
"message": "Strict HTTPS", "message": "Strict HTTPS",
"description": "" "description": "A menu entry in the matrix popup"
}, },
"matrixSwitchUASpoof" : { "matrixSwitchUASpoof" : {
"message": "User agent spoofing", "message": "User agent spoofing",
"description": "" "description": "A menu entry in the matrix popup"
}, },
"matrixSwitchReferrerSpoof" : { "matrixSwitchReferrerSpoof" : {
"message": "Referrer spoofing", "message": "Referrer spoofing",
"description": "" "description": "A menu entry in the matrix popup"
},
"matrixLoggerMenuEntry" : {
"message": "Request log",
"description": "A menu entry in the matrix popup"
},
"matrixDashboardMenuEntry" : {
"message": "Dashboard",
"description": "A menu entry in the matrix popup"
}, },

@ -22,6 +22,7 @@
<script src="js/httpsb.js"></script> <script src="js/httpsb.js"></script>
<script src="js/reqstats.js"></script> <script src="js/reqstats.js"></script>
<script src="js/cookies.js"></script> <script src="js/cookies.js"></script>
<script src="js/logger.js"></script>
<script src="js/messaging.js"></script> <script src="js/messaging.js"></script>
<script src="js/profiler.js"></script> <script src="js/profiler.js"></script>
<script src="js/storage.js"></script> <script src="js/storage.js"></script>
@ -30,6 +31,7 @@
<script src="js/tab.js"></script> <script src="js/tab.js"></script>
<script src="js/traffic.js"></script> <script src="js/traffic.js"></script>
<script src="js/useragent.js"></script> <script src="js/useragent.js"></script>
<script src="js/browsercache.js"></script>
<script src="js/start.js"></script> <script src="js/start.js"></script>
<script src="js/commands.js"></script> <script src="js/commands.js"></script>
</body> </body>

@ -120,7 +120,7 @@ body[dir="rtl"] #mtxSwitches > li > span:before {
display: none; display: none;
font-size: 110%; font-size: 110%;
padding: 3px 0 0 0; padding: 3px 0 0 0;
position: absolute; position: fixed;
white-space: normal; white-space: normal;
z-index: 50; z-index: 50;
} }
@ -203,9 +203,6 @@ body #buttonRevertAll > span:nth-of-type(4) {
bottom: 3px; bottom: 3px;
} }
button {
position: relative;
}
button > span.badge { button > span.badge {
padding: 1px 1px; padding: 1px 1px;
display: inline-block; display: inline-block;
@ -302,10 +299,9 @@ body .toolbar button#scopeCell {
} }
body #scopeCell + .dropdown-menu { body #scopeCell + .dropdown-menu {
padding: 6px 1px 3px 1px; padding: 6px 1px 3px 1px;
left: 0;
right: 0;
text-align: right; text-align: right;
width: 16em; min-width: 50%;
max-width: 80%;
} }
body.tScopeGlobal #scopeCell { body.tScopeGlobal #scopeCell {
background-color: #000; background-color: #000;

@ -83,7 +83,6 @@ iframe {
<a class="tabButton" id="privacy" href="#privacy" data-dashboard-panel-url="privacy.html" data-i18n="privacyPageName"></a> <a class="tabButton" id="privacy" href="#privacy" data-dashboard-panel-url="privacy.html" data-i18n="privacyPageName"></a>
<a class="tabButton" id="user-rules" href="#user-rules" data-dashboard-panel-url="user-rules.html" data-i18n="userRulesPageName"></a> <a class="tabButton" id="user-rules" href="#user-rules" data-dashboard-panel-url="user-rules.html" data-i18n="userRulesPageName"></a>
<a class="tabButton" id="hosts-files" href="#hosts-files" data-dashboard-panel-url="hosts-files.html" data-i18n="ubiquitousRulesPageName"></a> <a class="tabButton" id="hosts-files" href="#hosts-files" data-dashboard-panel-url="hosts-files.html" data-i18n="ubiquitousRulesPageName"></a>
<a class="tabButton" id="statistics" href="#statistics" data-dashboard-panel-url="info.html" data-i18n="statsPageName"></a>
<a class="tabButton" id="about" href="#about" data-dashboard-panel-url="about.html" data-i18n="aboutPageName"></a> <a class="tabButton" id="about" href="#about" data-dashboard-panel-url="about.html" data-i18n="aboutPageName"></a>
</div> </div>
</div> </div>

@ -116,7 +116,6 @@ return {
// record what chromium is doing behind the scene // record what chromium is doing behind the scene
behindTheSceneURL: 'http://behind-the-scene/', behindTheSceneURL: 'http://behind-the-scene/',
behindTheSceneTabId: vAPI.noTabId,
behindTheSceneMaxReq: 250, behindTheSceneMaxReq: 250,
behindTheSceneScope: 'behind-the-scene', behindTheSceneScope: 'behind-the-scene',

@ -294,11 +294,12 @@ var chromeCookieRemove = function(url, name) {
} }
var cookieKey = cookieKeyFromCookieURL(details.url, 'session', details.name); var cookieKey = cookieKeyFromCookieURL(details.url, 'session', details.name);
if ( removeCookieFromDict(cookieKey) ) { if ( removeCookieFromDict(cookieKey) ) {
µm.logger.writeOne('', 'info', 'cookie deleted: ' + cookieKey);
µm.cookieRemovedCounter += 1; µm.cookieRemovedCounter += 1;
return;
} }
cookieKey = cookieKeyFromCookieURL(details.url, 'persistent', details.name); cookieKey = cookieKeyFromCookieURL(details.url, 'persistent', details.name);
if ( removeCookieFromDict(cookieKey) ) { if ( removeCookieFromDict(cookieKey) ) {
µm.logger.writeOne('', 'info', 'cookie deleted: ' + cookieKey);
µm.cookieRemovedCounter += 1; µm.cookieRemovedCounter += 1;
} }
}; };

@ -31,18 +31,18 @@
/******************************************************************************/ /******************************************************************************/
/******************************************************************************/ /******************************************************************************/
var LogEntry = function(tabId, details, result) { var LogEntry = function(args) {
this.init(tabId, details, result); this.init(args);
}; };
/******************************************************************************/ /******************************************************************************/
var logEntryFactory = function(tabId, details, result) { var logEntryFactory = function(args) {
var entry = logEntryJunkyard.pop(); var entry = logEntryJunkyard.pop();
if ( entry ) { if ( entry ) {
return entry.init(tabId, details, result); return entry.init(args);
} }
return new LogEntry(tabId, details, result); return new LogEntry(args);
}; };
var logEntryJunkyard = []; var logEntryJunkyard = [];
@ -50,13 +50,14 @@ var logEntryJunkyardMax = 100;
/******************************************************************************/ /******************************************************************************/
LogEntry.prototype.init = function(tabId, details, result) { LogEntry.prototype.init = function(args) {
this.tstamp = Date.now(); this.tstamp = Date.now();
this.tabId = tabId; this.tab = args[0] || '';
this.url = details.requestURL; this.cat = args[1] || '';
this.hostname = details.requestHostname; this.d0 = args[2];
this.type = details.requestType; this.d1 = args[3];
this.result = result; this.d2 = args[4];
this.d3 = args[5];
return this; return this;
}; };
@ -97,13 +98,13 @@ LogBuffer.prototype.dispose = function() {
/******************************************************************************/ /******************************************************************************/
LogBuffer.prototype.writeOne = function(tabId, details, result) { LogBuffer.prototype.writeOne = function(args) {
// Reusing log entry = less memory churning // Reusing log entry = less memory churning
var entry = this.buffer[this.writePtr]; var entry = this.buffer[this.writePtr];
if ( entry instanceof LogEntry === false ) { if ( entry instanceof LogEntry === false ) {
this.buffer[this.writePtr] = logEntryFactory(tabId, details, result); this.buffer[this.writePtr] = logEntryFactory(args);
} else { } else {
entry.init(tabId, details, result); entry.init(args);
} }
this.writePtr += 1; this.writePtr += 1;
if ( this.writePtr === this.size ) { if ( this.writePtr === this.size ) {
@ -156,11 +157,11 @@ var loggerJanitorPeriod = 2 * 60 * 1000;
/******************************************************************************/ /******************************************************************************/
var writeOne = function(tabId, details, result) { var writeOne = function() {
if ( logBuffer === null ) { if ( logBuffer === null ) {
return; return;
} }
logBuffer.writeOne(tabId, details, result); logBuffer.writeOne(arguments);
}; };
/******************************************************************************/ /******************************************************************************/

@ -170,7 +170,7 @@ var matrixSnapshot = function(tabId, details) {
tabContext.rawURL.lastIndexOf(vAPI.getURL('dashboard.html'), 0) === 0 || tabContext.rawURL.lastIndexOf(vAPI.getURL('dashboard.html'), 0) === 0 ||
tabContext.rawURL === µm.behindTheSceneURL tabContext.rawURL === µm.behindTheSceneURL
) { ) {
tabId = µm.behindTheSceneTabId; tabId = vAPI.noTabId;
} }
var pageStore = µm.pageStoreFromTabId(tabId); var pageStore = µm.pageStoreFromTabId(tabId);
@ -491,7 +491,7 @@ var evaluateURLs = function(tabId, requests) {
/******************************************************************************/ /******************************************************************************/
var tagNameToRequestTypeMap = { var tagNameToRequestTypeMap = {
'iframe': 'sub_frame', 'iframe': 'frame',
'img': 'image' 'img': 'image'
}; };
@ -816,54 +816,6 @@ var getTabURLs = function() {
/******************************************************************************/ /******************************************************************************/
// map(pageURL) => array of request log entries
var getRequestLog = function(tabId) {
var requestLogs = {};
var pageStores = µm.pageStores;
var tabIds = tabId ? [tabId] : Object.keys(pageStores);
var pageStore, pageURL, pageRequestLog, logEntries, j, logEntry;
for ( var i = 0; i < tabIds.length; i++ ) {
pageStore = pageStores[tabIds[i]];
if ( !pageStore ) {
continue;
}
pageURL = pageStore.pageUrl;
pageRequestLog = [];
logEntries = pageStore.requests.getLoggedRequests();
j = logEntries.length;
while ( j-- ) {
// rhill 2013-12-04: `logEntry` can be null since a ring buffer is
// now used, and it might not have been filled yet.
if ( logEntry = logEntries[j] ) {
pageRequestLog.push(logEntry);
}
}
requestLogs[pageURL] = pageRequestLog;
}
return requestLogs;
};
/******************************************************************************/
var clearRequestLog = function(tabId) {
var pageStores = µm.pageStores;
var tabIds = tabId ? [tabId] : Object.keys(pageStores);
var pageStore;
for ( var i = 0; i < tabIds.length; i++ ) {
pageStore = pageStores[tabIds[i]];
if ( !pageStore ) {
continue;
}
pageStore.requests.clearLogBuffer();
}
};
/******************************************************************************/
var onMessage = function(request, sender, callback) { var onMessage = function(request, sender, callback) {
// Async // Async
switch ( request.what ) { switch ( request.what ) {
@ -893,14 +845,6 @@ var onMessage = function(request, sender, callback) {
}; };
break; break;
case 'getRequestLogs':
response = getRequestLog(request.tabId);
break;
case 'clearRequestLogs':
clearRequestLog(request.tabId);
break;
default: default:
return vAPI.messaging.UNHANDLED; return vAPI.messaging.UNHANDLED;
} }
@ -1004,6 +948,52 @@ vAPI.messaging.listen('about.js', onMessage);
/******************************************************************************/ /******************************************************************************/
/******************************************************************************/ /******************************************************************************/
// logger-ui.js
(function() {
'use strict';
/******************************************************************************/
var µm = µMatrix;
/******************************************************************************/
var onMessage = function(request, sender, callback) {
// Async
switch ( request.what ) {
default:
break;
}
// Sync
var response;
switch ( request.what ) {
case 'readMany':
response = {
colorBlind: false,
entries: µm.logger.readAll(request.tabId)
};
break;
default:
return vAPI.messaging.UNHANDLED;
}
callback(response);
};
vAPI.messaging.listen('logger-ui.js', onMessage);
/******************************************************************************/
})();
/******************************************************************************/
/******************************************************************************/
})(); })();
/******************************************************************************/ /******************************************************************************/

@ -27,7 +27,6 @@
A PageRequestStore object is used to store net requests in two ways: A PageRequestStore object is used to store net requests in two ways:
To record distinct net requests To record distinct net requests
To create a log of net requests
**/ **/
@ -152,37 +151,8 @@ var stringPacker = {
/******************************************************************************/ /******************************************************************************/
var LogEntry = function() {
this.url = '';
this.type = '';
this.when = 0;
this.block = false;
};
var logEntryJunkyard = [];
LogEntry.prototype.dispose = function() {
this.url = this.type = '';
// Let's not grab and hold onto too much memory..
if ( logEntryJunkyard.length < 200 ) {
logEntryJunkyard.push(this);
}
};
var logEntryFactory = function() {
var entry = logEntryJunkyard.pop();
if ( entry ) {
return entry;
}
return new LogEntry();
};
/******************************************************************************/
var PageRequestStats = function() { var PageRequestStats = function() {
this.requests = {}; this.requests = {};
this.ringBuffer = null;
this.ringBufferPointer = 0;
if ( !µmuri ) { if ( !µmuri ) {
µmuri = µm.URI; µmuri = µm.URI;
} }
@ -205,7 +175,6 @@ var pageRequestStoreFactory = function() {
} else { } else {
pageRequestStore = new PageRequestStats(); pageRequestStore = new PageRequestStats();
} }
pageRequestStore.resizeLogBuffer(µm.userSettings.maxLoggedRequests);
return pageRequestStore; return pageRequestStore;
}; };
@ -229,16 +198,6 @@ PageRequestStats.prototype.dispose = function() {
stringPacker.forget(reqKey.slice(3)); stringPacker.forget(reqKey.slice(3));
} }
this.requests = {}; this.requests = {};
var i = this.ringBuffer.length;
var logEntry;
while ( i-- ) {
logEntry = this.ringBuffer[i];
if ( logEntry ) {
logEntry.dispose();
}
}
this.ringBuffer = [];
this.ringBufferPointer = 0;
if ( pageRequestStoreJunkyard.length < 8 ) { if ( pageRequestStoreJunkyard.length < 8 ) {
pageRequestStoreJunkyard.push(this); pageRequestStoreJunkyard.push(this);
} }
@ -313,100 +272,6 @@ PageRequestStats.prototype.createEntryIfNotExists = function(url, type) {
/******************************************************************************/ /******************************************************************************/
PageRequestStats.prototype.resizeLogBuffer = function(size) {
if ( !this.ringBuffer ) {
this.ringBuffer = new Array(0);
this.ringBufferPointer = 0;
}
if ( size === this.ringBuffer.length ) {
return;
}
if ( !size ) {
this.ringBuffer = new Array(0);
this.ringBufferPointer = 0;
return;
}
var newBuffer = new Array(size);
var copySize = Math.min(size, this.ringBuffer.length);
var newBufferPointer = (copySize % size) | 0;
var isrc = this.ringBufferPointer;
var ides = newBufferPointer;
while ( copySize-- ) {
isrc--;
if ( isrc < 0 ) {
isrc = this.ringBuffer.length - 1;
}
ides--;
if ( ides < 0 ) {
ides = size - 1;
}
newBuffer[ides] = this.ringBuffer[isrc];
}
this.ringBuffer = newBuffer;
this.ringBufferPointer = newBufferPointer;
};
/******************************************************************************/
PageRequestStats.prototype.clearLogBuffer = function() {
var buffer = this.ringBuffer;
if ( buffer === null ) {
return;
}
var logEntry;
var i = buffer.length;
while ( i-- ) {
if ( logEntry = buffer[i] ) {
logEntry.dispose();
buffer[i] = null;
}
}
this.ringBufferPointer = 0;
};
/******************************************************************************/
PageRequestStats.prototype.logRequest = function(url, type, block) {
var buffer = this.ringBuffer;
var len = buffer.length;
if ( !len ) {
return;
}
var pointer = this.ringBufferPointer;
if ( !buffer[pointer] ) {
buffer[pointer] = logEntryFactory();
}
var logEntry = buffer[pointer];
logEntry.url = url;
logEntry.type = type;
logEntry.when = Date.now();
logEntry.block = block;
this.ringBufferPointer = ((pointer + 1) % len) | 0;
};
/******************************************************************************/
PageRequestStats.prototype.getLoggedRequests = function() {
var buffer = this.ringBuffer;
if ( !buffer.length ) {
return [];
}
// [0 - pointer] = most recent
// [pointer - length] = least recent
// thus, ascending order:
// [pointer - length] + [0 - pointer]
var pointer = this.ringBufferPointer;
return buffer.slice(pointer).concat(buffer.slice(0, pointer)).reverse();
};
/******************************************************************************/
PageRequestStats.prototype.getLoggedRequestEntry = function(reqURL, reqType) {
return this.requests[makeRequestKey(reqURL, reqType)];
};
/******************************************************************************/
PageRequestStats.prototype.getRequestKeys = function() { PageRequestStats.prototype.getRequestKeys = function() {
return Object.keys(this.requests); return Object.keys(this.requests);
}; };
@ -520,7 +385,7 @@ PageStore.prototype.recordRequest = function(type, url, block) {
this.perLoadAllowedRequestCount++; this.perLoadAllowedRequestCount++;
} }
this.requests.logRequest(url, type, block); µm.logger.writeOne(this.tabId, 'net', block ? '---' : '', type, url);
if ( !this.requests.createEntryIfNotExists(url, type, block) ) { if ( !this.requests.createEntryIfNotExists(url, type, block) ) {
return; return;

@ -1031,12 +1031,13 @@ function updateMatrixSwitches() {
uDom('body').toggleClass('powerOff', switches['matrix-off']); uDom('body').toggleClass('powerOff', switches['matrix-off']);
} }
function toggleMatrixSwitch() { function toggleMatrixSwitch(ev) {
var pos = this.id.indexOf('_'); var elem = ev.currentTarget;
var pos = elem.id.indexOf('_');
if ( pos === -1 ) { if ( pos === -1 ) {
return; return;
} }
var switchName = this.id.slice(pos + 1); var switchName = elem.id.slice(pos + 1);
var request = { var request = {
what: 'toggleMatrixSwitch', what: 'toggleMatrixSwitch',
switchName: switchName, switchName: switchName,
@ -1113,8 +1114,8 @@ function buttonReloadHandler() {
/******************************************************************************/ /******************************************************************************/
function mouseenterMatrixCellHandler() { function mouseenterMatrixCellHandler(ev) {
matrixCellHotspots.appendTo(this); matrixCellHotspots.appendTo(ev.target);
} }
function mouseleaveMatrixCellHandler() { function mouseleaveMatrixCellHandler() {
@ -1123,8 +1124,8 @@ function mouseleaveMatrixCellHandler() {
/******************************************************************************/ /******************************************************************************/
function gotoExtensionURL() { function gotoExtensionURL(ev) {
var url = uDom(this).attr('data-extension-url'); var url = uDom(ev.currentTarget).attr('data-extension-url');
if ( url ) { if ( url ) {
messager.send({ what: 'gotoExtensionURL', url: url }); messager.send({ what: 'gotoExtensionURL', url: url });
} }
@ -1133,8 +1134,16 @@ function gotoExtensionURL() {
/******************************************************************************/ /******************************************************************************/
function dropDownMenuShow() { function dropDownMenuShow(ev) {
uDom(this).next('.dropdown-menu').addClass('show'); var button = ev.target;
var menu = button.nextElementSibling;
var butnRect = button.getBoundingClientRect();
var viewRect = document.body.getBoundingClientRect();
var butnNormalLeft = butnRect.left / (viewRect.width - butnRect.width);
menu.classList.add('show');
var menuRect = menu.getBoundingClientRect();
var menuLeft = butnNormalLeft * (viewRect.width - menuRect.width);
menu.style.left = menuLeft.toFixed(0) + 'px';
} }
function dropDownMenuHide() { function dropDownMenuHide() {

@ -44,24 +44,6 @@ var µm = µMatrix;
/******************************************************************************/ /******************************************************************************/
// Browser data jobs
var jobCallback = function() {
if ( !µm.userSettings.clearBrowserCache ) {
return;
}
µm.clearBrowserCacheCycle -= 15;
if ( µm.clearBrowserCacheCycle > 0 ) {
return;
}
µm.clearBrowserCacheCycle = µm.userSettings.clearBrowserCacheAfter;
µm.browserCacheClearedCounter++;
vAPI.browserCache.clearByTime(0);
// console.debug('clearBrowserCacheCallback()> vAPI.browserCache.clearByTime() called');
};
/******************************************************************************/
var defaultLocalUserSettings = { var defaultLocalUserSettings = {
placeholderBackground: [ placeholderBackground: [
'linear-gradient(0deg,', 'linear-gradient(0deg,',
@ -78,7 +60,7 @@ var defaultLocalUserSettings = {
'rgba(0,0,0,0.05) 75%,', 'rgba(0,0,0,0.05) 75%,',
'rgba(0,0,0,0.02) 75%,', 'rgba(0,0,0,0.02) 75%,',
'rgba(0,0,0,0.02)', 'rgba(0,0,0,0.02)',
') center center / 10px 10px repeat scroll' ') #fff center center / 10px 10px repeat scroll'
].join(''), ].join(''),
placeholderBorder: '1px solid rgba(0, 0, 0, 0.05)', placeholderBorder: '1px solid rgba(0, 0, 0, 0.05)',
placeholderDocument: [ placeholderDocument: [
@ -110,8 +92,6 @@ var onAllDone = function() {
µm.assetUpdater.onAssetUpdated.addListener(µm.assetUpdatedHandler.bind(µm)); µm.assetUpdater.onAssetUpdated.addListener(µm.assetUpdatedHandler.bind(µm));
µm.assets.onAssetCacheRemoved.addListener(µm.assetCacheRemovedHandler.bind(µm)); µm.assets.onAssetCacheRemoved.addListener(µm.assetCacheRemovedHandler.bind(µm));
µMatrix.asyncJobs.add('clearBrowserCache', null, jobCallback, 15 * 60 * 1000, true);
// Important: remove barrier to remote fetching, this was useful only // Important: remove barrier to remote fetching, this was useful only
// for launch time. // for launch time.
µm.assets.remoteFetchBarrier -= 1; µm.assets.remoteFetchBarrier -= 1;

@ -55,9 +55,6 @@
µm.userSettings = store; µm.userSettings = store;
// https://github.com/gorhill/uMatrix/issues/47
µm.resizeLogBuffers(store.maxLoggedRequests);
// https://github.com/gorhill/httpswitchboard/issues/344 // https://github.com/gorhill/httpswitchboard/issues/344
µm.userAgentSpoofer.shuffle(); µm.userAgentSpoofer.shuffle();

@ -620,17 +620,6 @@ vAPI.tabs.registerListeners();
/******************************************************************************/ /******************************************************************************/
µm.resizeLogBuffers = function(size) {
var pageStores = this.pageStores;
for ( var pageURL in pageStores ) {
if ( pageStores.hasOwnProperty(pageURL) ) {
pageStores[pageURL].requests.resizeLogBuffer(size);
}
}
};
/******************************************************************************/
µm.forceReload = function(tabId) { µm.forceReload = function(tabId) {
vAPI.tabs.reload(tabId, { bypassCache: true }); vAPI.tabs.reload(tabId, { bypassCache: true });
}; };

@ -38,10 +38,6 @@
// Pre-change // Pre-change
switch ( name ) { switch ( name ) {
case 'maxLoggedRequests':
value = Math.max(Math.min(value, 500), 0);
break;
default: default:
break; break;
} }
@ -52,10 +48,6 @@
// Post-change // Post-change
switch ( name ) { switch ( name ) {
case 'maxLoggedRequests':
this.resizeLogBuffers(value);
break;
// https://github.com/gorhill/httpswitchboard/issues/344 // https://github.com/gorhill/httpswitchboard/issues/344
case 'spoofUserAgentWith': case 'spoofUserAgentWith':
this.userAgentSpoofer.shuffle(); this.userAgentSpoofer.shuffle();

@ -20,7 +20,7 @@
<div class="paneHead"> <div class="paneHead">
<div id="toolbarLeft" class="toolbar alignLeft"> <div id="toolbarLeft" class="toolbar alignLeft">
<button id="scopeCell" class="dropdown-menu-button" tabindex="-1"></button> <button id="scopeCell" class="dropdown-menu-button" tabindex="-1"></button>
<div id="scopeKeys" class="dropdown-menu"> <div class="dropdown-menu">
<ul> <ul>
<li id="scopeKeyGlobal" class="dropdown-menu-entry">&#x2217; <li id="scopeKeyGlobal" class="dropdown-menu-entry">&#x2217;
<li id="scopeKeyDomain" class="dropdown-menu-entry"> <li id="scopeKeyDomain" class="dropdown-menu-entry">
@ -49,7 +49,14 @@
<div class="toolbar alignRight"> <div class="toolbar alignRight">
<button id="buttonReload" type="button" class="fa tip-anchor-right" data-i18n-tip="matrixReloadButton">&#xf021;</button> <button id="buttonReload" type="button" class="fa tip-anchor-right" data-i18n-tip="matrixReloadButton">&#xf021;</button>
<button id="buttonRevertAll" type="button" class="fa tip-anchor-right" tabindex="-1" data-i18n-tip="matrixRevertButtonAllTip">&#xf12d;<span class="fa">&#xf12d;</span><span class="fa">&#xf12d;</span><span class="fa">&#xf12d;</span><span class="fa">&#xf12d;</span></button> <button id="buttonRevertAll" type="button" class="fa tip-anchor-right" tabindex="-1" data-i18n-tip="matrixRevertButtonAllTip">&#xf12d;<span class="fa">&#xf12d;</span><span class="fa">&#xf12d;</span><span class="fa">&#xf12d;</span><span class="fa">&#xf12d;</span></button>
<button id="buttonDashboard" type="button" class="extensionURL fa tip-anchor-right" data-extension-url="dashboard.html">&#xf085;</button> <button type="button" class="dropdown-menu-button fa tip-anchor-right">&#xf085;</button>
<div class="dropdown-menu">
<ul>
<li class="dropdown-menu-entry extensionURL" data-extension-url="logger-ui.html" data-i18n="matrixLoggerMenuEntry">
<li class="dropdown-menu-entry extensionURL" data-extension-url="dashboard.html" data-i18n="matrixDashboardMenuEntry">
</ul>
</div>
<div class="dropdown-menu-capture"></div>
</div> </div>
<div id="matHead" class="matrix collapsible"> <div id="matHead" class="matrix collapsible">

Loading…
Cancel
Save