From b3863f5c4984ae814eeb32407ae5899693b735ab Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Wed, 20 Feb 2019 00:02:26 +0100 Subject: =?UTF-8?q?Change=20all=20names=20from=20=CE=BCMatrix=20to=20?= =?UTF-8?q?=CE=B7Matrix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hopefully I caught all of them! --- js/traffic.js | 108 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 54 insertions(+), 54 deletions(-) (limited to 'js/traffic.js') diff --git a/js/traffic.js b/js/traffic.js index 3e6a6ac..1ca12cd 100644 --- a/js/traffic.js +++ b/js/traffic.js @@ -26,34 +26,34 @@ // Start isolation from global scope -µMatrix.webRequest = (function() { +ηMatrix.webRequest = (function() { /******************************************************************************/ // Intercept and filter web requests according to white and black lists. var onBeforeRootFrameRequestHandler = function(details) { - var µm = µMatrix; + var ηm = ηMatrix; var requestURL = details.url; - var requestHostname = µm.URI.hostnameFromURI(requestURL); + var requestHostname = ηm.URI.hostnameFromURI(requestURL); var tabId = details.tabId; - µm.tabContextManager.push(tabId, requestURL); + ηm.tabContextManager.push(tabId, requestURL); - var tabContext = µm.tabContextManager.mustLookup(tabId); + var tabContext = ηm.tabContextManager.mustLookup(tabId); var rootHostname = tabContext.rootHostname; // Disallow request as per matrix? - var block = µm.mustBlock(rootHostname, requestHostname, 'doc'); + var block = ηm.mustBlock(rootHostname, requestHostname, 'doc'); - var pageStore = µm.pageStoreFromTabId(tabId); + var pageStore = ηm.pageStoreFromTabId(tabId); pageStore.recordRequest('doc', requestURL, block); - µm.logger.writeOne(tabId, 'net', rootHostname, requestURL, 'doc', block); + ηm.logger.writeOne(tabId, 'net', rootHostname, requestURL, 'doc', block); // Not blocked if ( !block ) { // rhill 2013-11-07: Senseless to do this for behind-the-scene requests. - µm.cookieHunter.recordPageCookies(pageStore); + ηm.cookieHunter.recordPageCookies(pageStore); return; } @@ -74,12 +74,12 @@ var onBeforeRootFrameRequestHandler = function(details) { // Intercept and filter web requests according to white and black lists. var onBeforeRequestHandler = function(details) { - var µm = µMatrix, - µmuri = µm.URI, + var ηm = ηMatrix, + ηmuri = ηm.URI, requestURL = details.url, - requestScheme = µmuri.schemeFromURI(requestURL); + requestScheme = ηmuri.schemeFromURI(requestURL); - if ( µmuri.isNetworkScheme(requestScheme) === false ) { return; } + if ( ηmuri.isNetworkScheme(requestScheme) === false ) { return; } var requestType = requestTypeNormalizer[details.type] || 'other'; @@ -92,24 +92,24 @@ var onBeforeRequestHandler = function(details) { // Re-classify orphan HTTP requests as behind-the-scene requests. There is // not much else which can be done, because there are URLs - // which cannot be handled by µMatrix, i.e. `opera://startpage`, + // which cannot be handled by ηMatrix, i.e. `opera://startpage`, // as this would lead to complications with no obvious solution, like how // to scope on unknown scheme? Etc. // https://github.com/gorhill/httpswitchboard/issues/191 // https://github.com/gorhill/httpswitchboard/issues/91#issuecomment-37180275 - var tabContext = µm.tabContextManager.mustLookup(details.tabId), + var tabContext = ηm.tabContextManager.mustLookup(details.tabId), tabId = tabContext.tabId, rootHostname = tabContext.rootHostname, specificity = 0; // Filter through matrix - var block = µm.tMatrix.mustBlock( + var block = ηm.tMatrix.mustBlock( rootHostname, - µmuri.hostnameFromURI(requestURL), + ηmuri.hostnameFromURI(requestURL), requestType ); if ( block ) { - specificity = µm.tMatrix.specificityRegister; + specificity = ηm.tMatrix.specificityRegister; } // Record request. @@ -118,18 +118,18 @@ var onBeforeRequestHandler = function(details) { // processing has already been performed, and that a synthetic URL has // been constructed for logging purpose. Use this synthetic URL if // it is available. - var pageStore = µm.mustPageStoreFromTabId(tabId); + var pageStore = ηm.mustPageStoreFromTabId(tabId); // Enforce strict secure connection? - if ( tabContext.secure && µmuri.isSecureScheme(requestScheme) === false ) { + if ( tabContext.secure && ηmuri.isSecureScheme(requestScheme) === false ) { pageStore.hasMixedContent = true; if ( block === false ) { - block = µm.tMatrix.evaluateSwitchZ('https-strict', rootHostname); + block = ηm.tMatrix.evaluateSwitchZ('https-strict', rootHostname); } } pageStore.recordRequest(requestType, requestURL, block); - µm.logger.writeOne(tabId, 'net', rootHostname, requestURL, details.type, block); + ηm.logger.writeOne(tabId, 'net', rootHostname, requestURL, details.type, block); if ( block ) { pageStore.cacheBlockedCollapsible(requestType, requestURL, specificity); @@ -142,13 +142,13 @@ var onBeforeRequestHandler = function(details) { // Sanitize outgoing headers as per user settings. var onBeforeSendHeadersHandler = function(details) { - var µm = µMatrix, - µmuri = µm.URI, + var ηm = ηMatrix, + ηmuri = ηm.URI, requestURL = details.url, - requestScheme = µmuri.schemeFromURI(requestURL); + requestScheme = ηmuri.schemeFromURI(requestURL); // Ignore non-network schemes - if ( µmuri.isNetworkScheme(requestScheme) === false ) { return; } + if ( ηmuri.isNetworkScheme(requestScheme) === false ) { return; } // Re-classify orphan HTTP requests as behind-the-scene requests. There is // not much else which can be done, because there are URLs @@ -158,7 +158,7 @@ var onBeforeSendHeadersHandler = function(details) { // https://github.com/gorhill/httpswitchboard/issues/191 // https://github.com/gorhill/httpswitchboard/issues/91#issuecomment-37180275 var tabId = details.tabId, - pageStore = µm.mustPageStoreFromTabId(tabId), + pageStore = ηm.mustPageStoreFromTabId(tabId), requestType = requestTypeNormalizer[details.type] || 'other', requestHeaders = details.requestHeaders, headerIndex, headerValue; @@ -188,11 +188,11 @@ var onBeforeSendHeadersHandler = function(details) { if ( headerIndex !== -1 ) { headerValue = requestHeaders[headerIndex].value; if ( headerValue !== '' ) { - var block = µm.userSettings.processHyperlinkAuditing; + var block = ηm.userSettings.processHyperlinkAuditing; pageStore.recordRequest('other', requestURL + '{Ping-To:' + headerValue + '}', block); - µm.logger.writeOne(tabId, 'net', '', requestURL, 'ping', block); + ηm.logger.writeOne(tabId, 'net', '', requestURL, 'ping', block); if ( block ) { - µm.hyperlinkAuditingFoiledCounter += 1; + ηm.hyperlinkAuditingFoiledCounter += 1; return { 'cancel': true }; } } @@ -202,7 +202,7 @@ var onBeforeSendHeadersHandler = function(details) { // is to sanitize headers. var rootHostname = pageStore.pageHostname, - requestHostname = µmuri.hostnameFromURI(requestURL), + requestHostname = ηmuri.hostnameFromURI(requestURL), modified = false; // Process `Cookie` header. @@ -210,14 +210,14 @@ var onBeforeSendHeadersHandler = function(details) { headerIndex = headerIndexFromName('cookie', requestHeaders); if ( headerIndex !== -1 && - µm.mustBlock(rootHostname, requestHostname, 'cookie') + ηm.mustBlock(rootHostname, requestHostname, 'cookie') ) { modified = true; headerValue = requestHeaders[headerIndex].value; requestHeaders.splice(headerIndex, 1); - µm.cookieHeaderFoiledCounter++; + ηm.cookieHeaderFoiledCounter++; if ( requestType === 'doc' ) { - µm.logger.writeOne(tabId, 'net', '', headerValue, 'COOKIE', true); + ηm.logger.writeOne(tabId, 'net', '', headerValue, 'COOKIE', true); } } @@ -245,10 +245,10 @@ var onBeforeSendHeadersHandler = function(details) { if ( headerIndex !== -1 ) { headerValue = requestHeaders[headerIndex].value; if ( headerValue !== '' ) { - var toDomain = µmuri.domainFromHostname(requestHostname); - if ( toDomain !== '' && toDomain !== µmuri.domainFromURI(headerValue) ) { + var toDomain = ηmuri.domainFromHostname(requestHostname); + if ( toDomain !== '' && toDomain !== ηmuri.domainFromURI(headerValue) ) { pageStore.has3pReferrer = true; - if ( µm.tMatrix.evaluateSwitchZ('referrer-spoof', rootHostname) ) { + if ( ηm.tMatrix.evaluateSwitchZ('referrer-spoof', rootHostname) ) { modified = true; var newValue; if ( details.method === 'GET' ) { @@ -257,11 +257,11 @@ var onBeforeSendHeadersHandler = function(details) { } else { requestHeaders.splice(headerIndex, 1); } - µm.refererHeaderFoiledCounter++; + ηm.refererHeaderFoiledCounter++; if ( requestType === 'doc' ) { - µm.logger.writeOne(tabId, 'net', '', headerValue, 'REFERER', true); + ηm.logger.writeOne(tabId, 'net', '', headerValue, 'REFERER', true); if ( newValue !== undefined ) { - µm.logger.writeOne(tabId, 'net', '', newValue, 'REFERER', false); + ηm.logger.writeOne(tabId, 'net', '', newValue, 'REFERER', false); } } } @@ -286,7 +286,7 @@ var onBeforeSendHeadersHandler = function(details) { var onHeadersReceived = function(details) { // Ignore schemes other than 'http...' - var µm = µMatrix, + var ηm = ηMatrix, tabId = details.tabId, requestURL = details.url, requestType = requestTypeNormalizer[details.type] || 'other'; @@ -294,36 +294,36 @@ var onHeadersReceived = function(details) { // https://github.com/gorhill/uMatrix/issues/145 // Check if the main_frame is a download if ( requestType === 'doc' ) { - µm.tabContextManager.push(tabId, requestURL); + ηm.tabContextManager.push(tabId, requestURL); } - var tabContext = µm.tabContextManager.lookup(tabId); + var tabContext = ηm.tabContextManager.lookup(tabId); if ( tabContext === null ) { return; } var csp = [], cspReport = [], rootHostname = tabContext.rootHostname, - requestHostname = µm.URI.hostnameFromURI(requestURL); + requestHostname = ηm.URI.hostnameFromURI(requestURL); // Inline script tags. - if ( µm.mustAllow(rootHostname, requestHostname, 'script' ) !== true ) { - csp.push(µm.cspNoInlineScript); + if ( ηm.mustAllow(rootHostname, requestHostname, 'script' ) !== true ) { + csp.push(ηm.cspNoInlineScript); } // Inline style tags. - if ( µm.mustAllow(rootHostname, requestHostname, 'css' ) !== true ) { - csp.push(µm.cspNoInlineStyle); + if ( ηm.mustAllow(rootHostname, requestHostname, 'css' ) !== true ) { + csp.push(ηm.cspNoInlineStyle); } // https://bugzilla.mozilla.org/show_bug.cgi?id=1302667 - var cspNoWorker = µm.cspNoWorker; + var cspNoWorker = ηm.cspNoWorker; if ( cspNoWorker === undefined ) { cspNoWorker = cspNoWorkerInit(); } - if ( µm.tMatrix.evaluateSwitchZ('no-workers', rootHostname) ) { + if ( ηm.tMatrix.evaluateSwitchZ('no-workers', rootHostname) ) { csp.push(cspNoWorker); - } else if ( µm.rawSettings.disableCSPReportInjection === false ) { + } else if ( ηm.rawSettings.disableCSPReportInjection === false ) { cspReport.push(cspNoWorker); } @@ -342,7 +342,7 @@ var onHeadersReceived = function(details) { }); } if ( requestType === 'doc' ) { - µm.logger.writeOne(tabId, 'net', '', cspDirectives, 'CSP', false); + ηm.logger.writeOne(tabId, 'net', '', cspDirectives, 'CSP', false); } } @@ -368,10 +368,10 @@ var cspNoWorkerInit = function() { if ( vAPI.webextFlavor === undefined ) { return "child-src 'none'; frame-src data: blob: *; report-uri about:blank"; } - µMatrix.cspNoWorker = /^Mozilla-Firefox-5[67]/.test(vAPI.webextFlavor) ? + ηMatrix.cspNoWorker = /^Mozilla-Firefox-5[67]/.test(vAPI.webextFlavor) ? "child-src 'none'; frame-src data: blob: *; report-uri about:blank" : "worker-src 'none'; report-uri about:blank" ; - return µMatrix.cspNoWorker; + return ηMatrix.cspNoWorker; }; /******************************************************************************/ -- cgit v1.2.3