|
|
|
@ -71,7 +71,9 @@
|
|
|
|
|
|
|
|
|
|
// Get response headers
|
|
|
|
|
onStateChange: function(progress, request, flags, status) {
|
|
|
|
|
if ( request && progress.currentURI && request.nsIHttpChannel && request.name == progress.currentURI.spec && request.contentType == 'text/html' && flags & Ci.nsIWebProgressListener.STATE_STOP ) {
|
|
|
|
|
if ( request != null && flags & Ci.nsIWebProgressListener.STATE_STOP ) {
|
|
|
|
|
if ( request.nsIHttpChannel && request.contentType == 'text/html' ) {
|
|
|
|
|
if ( progress.currentURI && request.name == progress.currentURI.spec ) {
|
|
|
|
|
var headers = new Object();
|
|
|
|
|
|
|
|
|
|
request.nsIHttpChannel.visitResponseHeaders(function(header, value) {
|
|
|
|
@ -81,6 +83,8 @@
|
|
|
|
|
w.analyze(progress.currentURI.host, progress.currentURI.spec, { headers: headers });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
gBrowser.tabContainer.addEventListener('TabSelect', w.driver.displayApps, false);
|
|
|
|
@ -187,52 +191,28 @@
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Anonymously track detected applications
|
|
|
|
|
* Anonymously track detected applications for research purposes
|
|
|
|
|
*/
|
|
|
|
|
track: function() {
|
|
|
|
|
if ( prefs.getBoolPref('tracking') ) {
|
|
|
|
|
var report = '';
|
|
|
|
|
|
|
|
|
|
if ( w.history ) {
|
|
|
|
|
for ( hostname in w.history ) {
|
|
|
|
|
report += '[' + hostname;
|
|
|
|
|
|
|
|
|
|
w.history[hostname].map(function(data) {
|
|
|
|
|
report += '|' + data.app + ':' + data.hits;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
report += ']';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ping: function() {
|
|
|
|
|
if ( Object.keys(w.ping.hostnames).length && prefs.getBoolPref('tracking') ) {
|
|
|
|
|
// Make POST request
|
|
|
|
|
var request = new XMLHttpRequest();
|
|
|
|
|
|
|
|
|
|
request.open('POST', w.config.websiteURL + '_track.php', true);
|
|
|
|
|
|
|
|
|
|
request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
|
|
|
|
request.open('POST', w.config.websiteURL + 'ping/', true);
|
|
|
|
|
|
|
|
|
|
request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
|
|
|
|
|
|
|
|
|
request.onreadystatechange = function(e) {
|
|
|
|
|
if ( request.readyState == 4 ) {
|
|
|
|
|
if ( request.status == 200 ) {
|
|
|
|
|
w.history = [];
|
|
|
|
|
|
|
|
|
|
w.log('w.driver.track: ' + report);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
report = '';
|
|
|
|
|
if ( request.readyState == 4 ) { w.log('w.driver.ping: status ' + request.status); }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if ( request.close ) { request.close(); }
|
|
|
|
|
request.send('json=' + encodeURIComponent(JSON.stringify(w.ping)));
|
|
|
|
|
|
|
|
|
|
request = null;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
w.log('w.driver.ping: ' + JSON.stringify(w.ping));
|
|
|
|
|
|
|
|
|
|
request.send('d=' + encodeURIComponent(report));
|
|
|
|
|
w.ping = {};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|