This commit is contained in:
Monica Chew 2014-03-27 12:58:33 -07:00
Родитель c12707f571
Коммит 38fd819f94
5 изменённых файлов: 34 добавлений и 75 удалений

Просмотреть файл

@ -43,26 +43,6 @@ self.port.on('init', function(lightbeamToken) {
} else {
console.error('cannot call unsafeWindow.aggregate: %s', unsafeWindow);
}
// FIXME: temporary solution for now. need to clean up the code
if (unsafeWindow && unsafeWindow.showPromptToShareDialog) {
unsafeWindow.showPromptToShareDialog();
} else {
console.error('cannot call unsafeWindow.showPromptToShare: %s', unsafeWindow);
}
});
self.port.on("passTempConnections", function(connReceived) {
// connReceived is a possibly-empty array of connection arrays [ [], [], [] ]
self.port.emit("tempConnectionTransferred", true);
localStorage.lastSaved = Date.now();
var nonPrivateConnections = connReceived.filter(function(connection) {
return (connection[unsafeWindow.FROM_PRIVATE_MODE] == false);
});
unsafeWindow.saveConnectionsByDate(nonPrivateConnections);
});
self.port.on("private-browsing", function() {

Просмотреть файл

@ -19,7 +19,6 @@ const allDialogs = {
'Upload Data Confirmation': askForDataSharingConfirmationDialog,
'Stop Uploading Data Confirmation': stopSharingDialog,
'Private Browsing Notification': informUserOfUnsafeWindowsDialog,
'Help the Ecosystem by Sharing': showPromptToShareDialog
};
@ -287,21 +286,6 @@ function confirmResetDataDialog(callback){
);
}
function showPromptToShareDialog(callback){
dialog( {
"name": dialogNames.promptToShare,
"dnsPrompt": true,
"title": "Help the Ecosystem by Sharing",
"message": "<p>As a user of Lightbeam, you can help contribute to build our data ecosystem.</p>" +
"<p>By sharing your data you can help us and others to understand third-party relationships on the web and promote further research in the field of online tracking and privacy.</p> "+
"<p>Do you want to upload your data to the <a href='http://mozilla.org/en-US/lightbeam/database/'>public database</a> now?</p>",
"imageUrl": "image/lightbeam_popup_startsharing.png"
},
callback
);
}
// Helper function for testing so we can trigger any dialog.
function showDialog(name){
if (Object.keys(allDialogs).indexOf(name) > -1){

Просмотреть файл

@ -100,10 +100,6 @@ window.addEventListener('load', function(evt){
});
window.addEventListener('beforeunload', function(){
saveConnections(allConnections);
}, false);
function initCap(str){
return str[0].toUpperCase() + str.slice(1);
}

Просмотреть файл

@ -11,7 +11,7 @@ const addonUrl = data.url("index.html");
// uiworker is defined in ui.js
const ui = require("./ui");
const connBatchSize = 200;
const { setTimeout } = require("timers");
const { setTimeout } = require("sdk/timers");
var connBatch = [];
var eTLDSvc = Cc["@mozilla.org/network/effective-tld-service;1"].
@ -28,7 +28,7 @@ function addConnection(connection){
flushToStorage();
}
// Pass the message on to the UI
ui.uiworker.port.emit('connection', connection.toLog());
ui.emit('connection', connection.toLog());
}
// Every 5 minutes, flush to storage.

Просмотреть файл

@ -21,7 +21,7 @@ exports.usingAustralis = usingAustralis;
const mainPage = data.url("index.html");
const contentScript = data.url('content-script.js');
var uiworker = null;
exports.uiworker = uiworker;
exports.mainPage = mainPage;
exports.contentScript = contentScript;
exports.attachToLightbeamPage = attachToLightbeamPage;
@ -158,46 +158,45 @@ function attachToLightbeamPage(worker) {
});
}
// Send over the the blocklist initially so we can use it.
worker.port.emit('update-blocklist-all', Object.keys(blockmap).map(function(site) {
return {
domain: site,
flag: blockmap[site]
};
}));
// Send over the the blocklist initially so we can use it.
worker.port.emit('update-blocklist-all', Object.keys(blockmap).map(function(site) {
return {
domain: site,
flag: blockmap[site]
};
}));
function onWorkerReset() {
persist.reset();
}
function onUIReady() {
uiworker.port.emit("passTempConnections", ss.storage.connections);
}
function onWorkerDetach() {
// console.error('detaching lightbeam view');
this.port.removeListener('reset', onWorkerReset);
this.port.removeListener('uiready', onUIReady);
this.port.removeListener('updateBlocklist', onWorkerUpdateBlocklist);
uiworker = null;
this.destroy();
}
function onWorkerDetach() {
// console.error('detaching lightbeam view');
this.port.removeListener('reset', onWorkerReset);
this.port.removeListener('uiready', onUIReady);
this.port.removeListener('updateBlocklist', onWorkerUpdateBlocklist);
uiworker = null;
this.destroy();
}
try {
worker.on("detach", onWorkerDetach);
worker.port.on("reset", onWorkerReset);
worker.port.on('uiready', onUIReady);
worker.port.on('updateBlocklist', onWorkerUpdateBlocklist);
} catch (e) {
console.error('Error attaching worker event listeners on load: %o', e);
}
worker.on("detach", onWorkerDetach);
worker.port.on("reset", onWorkerReset);
worker.port.on('uiready', onUIReady);
worker.port.on('updateBlocklist', onWorkerUpdateBlocklist);
// Push temporary connections to the UI page.
worker.port.emit("passTempConnections", ss.storage.connections);
worker.port.emit('init');
// Push temporary connections to the UI page.
worker.port.emit("passTempConnections", ss.storage.connections);
worker.port.emit('init');
// if there is a private window open, then alert the user about it.
try {
hasPrivateTab();
} catch (e) {
console.error('Error testing with hasPrivateTab(): %o', e);
}
// if there is a private window open, then alert the user about it.
try {
hasPrivateTab();
} catch (e) {
console.error('Error testing with hasPrivateTab(): %o', e);
}
}
// This lets us toggle between the 3 states (no lightbeam tab open, lightbeam