this fixes #10

pull/2/head
gorhill 10 years ago
parent 9441ffe719
commit 8653401961

@ -26,8 +26,8 @@
<script src="js/storage.js"></script> <script src="js/storage.js"></script>
<script src="js/pagestats.js"></script> <script src="js/pagestats.js"></script>
<script src="js/tab.js"></script> <script src="js/tab.js"></script>
<script src="js/traffic.js"></script>
<script src="js/uritools.js"></script> <script src="js/uritools.js"></script>
<script src="js/traffic.js"></script>
<script src="js/useragent.js"></script> <script src="js/useragent.js"></script>
<script src="js/messaging-handlers.js"></script> <script src="js/messaging-handlers.js"></script>
<script src="js/start.js"></script> <script src="js/start.js"></script>

@ -73,7 +73,7 @@
if ( '.css.eot.ttf.otf.svg.woff.woff2.'.indexOf(ext) !== -1 ) { if ( '.css.eot.ttf.otf.svg.woff.woff2.'.indexOf(ext) !== -1 ) {
return 'css'; return 'css';
} }
if ( '.ico.png.gif.jpg.jpeg.'.indexOf(ext) !== -1 ) { if ( '.ico.png.gif.jpg.jpeg.bmp.'.indexOf(ext) !== -1 ) {
return 'image'; return 'image';
} }
return type; return type;

@ -23,6 +23,16 @@
/******************************************************************************/ /******************************************************************************/
// 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
µMatrix.createPageStats(µMatrix.behindTheSceneURL);
µMatrix.pageUrlToTabId[µMatrix.behindTheSceneURL] = µMatrix.behindTheSceneTabId;
µMatrix.tabIdToPageUrl[µMatrix.behindTheSceneTabId] = µMatrix.behindTheSceneURL;
/******************************************************************************/
µMatrix.turnOn(); µMatrix.turnOn();
/******************************************************************************/ /******************************************************************************/
@ -106,22 +116,6 @@ chrome.webNavigation.onBeforeNavigate.addListener(onBeforeNavigateCallback);
/******************************************************************************/ /******************************************************************************/
// Load everything
µMatrix.load();
/******************************************************************************/
// 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
µMatrix.createPageStats(µMatrix.behindTheSceneURL);
µMatrix.pageUrlToTabId[µMatrix.behindTheSceneURL] = µMatrix.behindTheSceneTabId;
µMatrix.tabIdToPageUrl[µMatrix.behindTheSceneTabId] = µMatrix.behindTheSceneURL;
/******************************************************************************/
// Initialize internal state with maybe already existing tabs // Initialize internal state with maybe already existing tabs
chrome.tabs.query({ url: '<all_urls>' }, function(tabs) { chrome.tabs.query({ url: '<all_urls>' }, function(tabs) {
@ -178,3 +172,10 @@ chrome.tabs.query({ url: '<all_urls>' }, function(tabs) {
})(); })();
/******************************************************************************/ /******************************************************************************/
// Load everything
µMatrix.load();
µMatrix.webRequest.start();
/******************************************************************************/

@ -854,72 +854,75 @@ var requestTypeNormalizer = {
/******************************************************************************/ /******************************************************************************/
chrome.webRequest.onBeforeRequest.addListener( var start = function() {
//function(details) { chrome.webRequest.onBeforeRequest.addListener(
// quickProfiler.start('onBeforeRequest'); //function(details) {
// var r = onBeforeRequestHandler(details); // quickProfiler.start('onBeforeRequest');
// quickProfiler.stop(); // var r = onBeforeRequestHandler(details);
// return r; // quickProfiler.stop();
//}, // return r;
onBeforeRequestHandler, //},
{ onBeforeRequestHandler,
"urls": [ {
"http://*/*", "urls": [
"https://*/*", "http://*/*",
"chrome-extension://*/*" "https://*/*",
], "chrome-extension://*/*"
"types": [ ],
"main_frame", "types": [
"sub_frame", "main_frame",
'stylesheet', "sub_frame",
"script", 'stylesheet',
"image", "script",
"object", "image",
"xmlhttprequest", "object",
"other" "xmlhttprequest",
] "other"
}, ]
[ "blocking" ] },
); [ "blocking" ]
);
//console.log('µMatrix > Beginning to intercept net requests at %s', (new Date()).toISOString());
//console.log('µMatrix > Beginning to intercept net requests at %s', (new Date()).toISOString());
chrome.webRequest.onBeforeSendHeaders.addListener(
onBeforeSendHeadersHandler, chrome.webRequest.onBeforeSendHeaders.addListener(
{ onBeforeSendHeadersHandler,
'urls': [ {
"http://*/*", 'urls': [
"https://*/*" "http://*/*",
] "https://*/*"
}, ]
['blocking', 'requestHeaders'] },
); ['blocking', 'requestHeaders']
);
chrome.webRequest.onHeadersReceived.addListener(
onHeadersReceived, chrome.webRequest.onHeadersReceived.addListener(
{ onHeadersReceived,
'urls': [ {
"http://*/*", 'urls': [
"https://*/*" "http://*/*",
] "https://*/*"
}, ]
['blocking', 'responseHeaders'] },
); ['blocking', 'responseHeaders']
);
chrome.webRequest.onErrorOccurred.addListener(
onErrorOccurredHandler, chrome.webRequest.onErrorOccurred.addListener(
{ onErrorOccurredHandler,
'urls': [ {
"http://*/*", 'urls': [
"https://*/*" "http://*/*",
] "https://*/*"
} ]
); }
);
};
/******************************************************************************/ /******************************************************************************/
return { return {
blockedRootFramePrefix: 'data:text/html;base64,' + btoa(rootFrameReplacement).slice(0, 80) blockedRootFramePrefix: 'data:text/html;base64,' + btoa(rootFrameReplacement).slice(0, 80),
start: start
}; };
/******************************************************************************/ /******************************************************************************/

Loading…
Cancel
Save