@ -72,8 +72,8 @@ var matrixSnapshot = function(details) {
blockedCount : 0 ,
blockedCount : 0 ,
scope : '*' ,
scope : '*' ,
headers : µm . Matrix . getColumnHeaders ( ) ,
headers : µm . Matrix . getColumnHeaders ( ) ,
tSwitch : false ,
pSwitch : false ,
tSwitches : { } ,
pSwitches : { } ,
rows : { } ,
rows : { } ,
rowCount : 0 ,
rowCount : 0 ,
diff : [ ] ,
diff : [ ] ,
@ -115,8 +115,14 @@ var matrixSnapshot = function(details) {
r . scope = r . domain ;
r . scope = r . domain ;
}
}
r . tSwitch = µm . tMatrix . evaluateSwitchZ ( 'matrix-off' , r . scope ) ;
r . pSwitch = µm . pMatrix . evaluateSwitchZ ( 'matrix-off' , r . scope ) ;
var switchNames = µm . Matrix . getSwitchNames ( ) ;
for ( var switchName in switchNames ) {
if ( switchNames . hasOwnProperty ( switchName ) === false ) {
continue ;
}
r . tSwitches [ switchName ] = µm . tMatrix . evaluateSwitchZ ( switchName , r . scope ) ;
r . pSwitches [ switchName ] = µm . pMatrix . evaluateSwitchZ ( switchName , r . scope ) ;
}
// These rows always exist
// These rows always exist
r . rows [ '*' ] = new RowSnapshot ( r . scope , '*' , '*' ) ;
r . rows [ '*' ] = new RowSnapshot ( r . scope , '*' , '*' ) ;
@ -210,9 +216,9 @@ var onMessage = function(request, sender, callback) {
case 'toggleMatrixSwitch' :
case 'toggleMatrixSwitch' :
µm . tMatrix . setSwitchZ (
µm . tMatrix . setSwitchZ (
'matrix-off' ,
request . switchName ,
request . srcHostname ,
request . srcHostname ,
! µm . tMatrix . evaluateSwitchZ ( 'matrix-off' , request . srcHostname )
µm . tMatrix . evaluateSwitchZ ( request . switchName , request . srcHostname ) === false
) ;
) ;
break ;
break ;
@ -272,6 +278,10 @@ var onMessage = function(request, sender, callback) {
( function ( ) {
( function ( ) {
var µm = µMatrix ;
/******************************************************************************/
var contentScriptSummaryHandler = function ( details , sender ) {
var contentScriptSummaryHandler = function ( details , sender ) {
// TODO: Investigate "Error in response to tabs.executeScript: TypeError:
// TODO: Investigate "Error in response to tabs.executeScript: TypeError:
// Cannot read property 'locationURL' of null" (2013-11-12). When can this
// Cannot read property 'locationURL' of null" (2013-11-12). When can this
@ -279,7 +289,6 @@ var contentScriptSummaryHandler = function(details, sender) {
if ( ! details || ! details . locationURL ) {
if ( ! details || ! details . locationURL ) {
return ;
return ;
}
}
var µm = µMatrix ;
var pageURL = µm . pageUrlFromTabId ( sender . tab . id ) ;
var pageURL = µm . pageUrlFromTabId ( sender . tab . id ) ;
var pageStats = µm . pageStatsFromPageUrl ( pageURL ) ;
var pageStats = µm . pageStatsFromPageUrl ( pageURL ) ;
var µmuri = µm . URI . set ( details . locationURL ) ;
var µmuri = µm . URI . set ( details . locationURL ) ;
@ -327,8 +336,9 @@ var contentScriptSummaryHandler = function(details, sender) {
µm . onPageLoadCompleted ( pageURL ) ;
µm . onPageLoadCompleted ( pageURL ) ;
} ;
} ;
/******************************************************************************/
var contentScriptLocalStorageHandler = function ( pageURL ) {
var contentScriptLocalStorageHandler = function ( pageURL ) {
var µm = µMatrix ;
var µmuri = µm . URI . set ( pageURL ) ;
var µmuri = µm . URI . set ( pageURL ) ;
var response = µm . mustBlock ( µm . scopeFromURL ( pageURL ) , µmuri . hostname , 'cookie' ) ;
var response = µm . mustBlock ( µm . scopeFromURL ( pageURL ) , µmuri . hostname , 'cookie' ) ;
µm . recordFromPageUrl (
µm . recordFromPageUrl (
@ -344,6 +354,8 @@ var contentScriptLocalStorageHandler = function(pageURL) {
return response ;
return response ;
} ;
} ;
/******************************************************************************/
var onMessage = function ( request , sender , callback ) {
var onMessage = function ( request , sender , callback ) {
// Async
// Async
switch ( request . what ) {
switch ( request . what ) {
@ -365,21 +377,22 @@ var onMessage = function(request, sender, callback) {
case 'checkScriptBlacklisted' :
case 'checkScriptBlacklisted' :
response = {
response = {
scriptBlacklisted : µMatrix . mustBlock (
µMatrix . scopeFromURL ( request . url ) ,
µMatrix . hostnameFromURL ( request . url ) ,
scriptBlacklisted : µm . mustBlock (
µm . scopeFromURL ( request . url ) ,
µm . hostnameFromURL ( request . url ) ,
'script'
'script'
)
)
} ;
} ;
break ;
break ;
case 'getUserAgentReplaceStr' :
case 'getUserAgentReplaceStr' :
response = µMatrix . userSettings . spoofUserAgent ? µMatrix . userAgentReplaceStr : undefined ;
response = µm . tMatrix . evaluateSwitchZ ( 'ua-spoof' , request . hostname ) ?
µm . userAgentReplaceStr :
undefined ;
break ;
break ;
default :
default :
return µMatrix . messaging . defaultHandler ( request , sender , callback ) ;
return µm . messaging . defaultHandler ( request , sender , callback ) ;
}
}
callback ( response ) ;
callback ( response ) ;
@ -388,6 +401,8 @@ var onMessage = function(request, sender, callback) {
µMatrix . messaging . listen ( 'contentscript-start.js' , onMessage ) ;
µMatrix . messaging . listen ( 'contentscript-start.js' , onMessage ) ;
µMatrix . messaging . listen ( 'contentscript-end.js' , onMessage ) ;
µMatrix . messaging . listen ( 'contentscript-end.js' , onMessage ) ;
/******************************************************************************/
} ) ( ) ;
} ) ( ) ;
/******************************************************************************/
/******************************************************************************/