[Pkg-mozext-commits] [lightbeam] 03/03: Imported Upstream version 1.2.1+dfsg
Dmitry Smirnov
onlyjob at moszumanska.debian.org
Mon Apr 20 10:24:12 UTC 2015
This is an automated email from the git hooks/post-receive script.
onlyjob pushed a commit to branch upstream
in repository lightbeam.
commit 94d160b (upstream)
Author: Dmitry Smirnov <onlyjob at member.fsf.org>
Date: Mon Apr 20 10:23:26 2015
Imported Upstream version 1.2.1+dfsg
---
bootstrap.js | 15 +-
defaults/preferences/prefs.js | 1 -
harness-options.json | 52 +--
install.rdf | 6 +-
options.xul | 1 -
resources/lightbeam/data/aggregate.js | 8 +-
resources/lightbeam/data/content-script.js | 5 +
resources/lightbeam/data/dialog.js | 66 +---
resources/lightbeam/data/first-run.html | 13 +-
resources/lightbeam/data/graph.js | 25 +-
.../data/image/lightbeam_popup_stopsharing2.png | Bin 2395 -> 0 bytes
.../data/image/lightbeam_popup_warningsharing.png | Bin 5001 -> 0 bytes
resources/lightbeam/data/index.html | 25 +-
resources/lightbeam/data/infobar.js | 7 +-
.../data/picoModal/picoModal-1.0.0.min.js | 1 -
resources/lightbeam/data/picoModal/picoModal.js | 417 +++++++++++++++++++++
resources/lightbeam/data/style.css | 11 +-
resources/lightbeam/data/ui.js | 97 ++---
resources/lightbeam/data/upgrade.html | 1 -
resources/lightbeam/lib/connection.js | 1 -
resources/lightbeam/lib/main.js | 10 +-
resources/lightbeam/lib/persist.js | 74 +---
resources/lightbeam/lib/shared/menuitems.js | 2 +-
resources/lightbeam/lib/tab/events.js | 20 -
resources/lightbeam/lib/tab/utils.js | 13 +-
resources/lightbeam/lib/ui.js | 55 ++-
26 files changed, 588 insertions(+), 338 deletions(-)
diff --git a/bootstrap.js b/bootstrap.js
index d430d70..840103a 100644
--- a/bootstrap.js
+++ b/bootstrap.js
@@ -37,6 +37,12 @@ let unload = null;
let cuddlefishSandbox = null;
let nukeTimer = null;
+let resourceDomains = [];
+function setResourceSubstitution(domain, uri) {
+ resourceDomains.push(domain);
+ resourceHandler.setSubstitution(domain, uri);
+}
+
// Utility function that synchronously reads local resource from the given
// `uri` and returns content string.
function readURI(uri) {
@@ -105,7 +111,7 @@ function startup(data, reasonCode) {
let prefixURI = 'resource://' + domain + '/';
let resourcesURI = ioService.newURI(rootURI + '/resources/', null, null);
- resourceHandler.setSubstitution(domain, resourcesURI);
+ setResourceSubstitution(domain, resourcesURI);
// Create path to URLs mapping supported by loader.
let paths = {
@@ -169,7 +175,7 @@ function startup(data, reasonCode) {
// failure that happens with file:// URI and be close to production env
let resourcesURI = ioService.newURI(fileURI, null, null);
let resName = 'extensions.modules.' + domain + '.commonjs.path' + name;
- resourceHandler.setSubstitution(resName, resourcesURI);
+ setResourceSubstitution(resName, resourcesURI);
result[path] = 'resource://' + resName + '/';
return result;
@@ -305,6 +311,11 @@ function shutdown(data, reasonCode) {
// We need to keep a reference to the timer, otherwise it is collected
// and won't ever fire.
nukeTimer = setTimeout(nukeModules, 1000);
+
+ // Bug 944951 - bootstrap.js must remove the added resource: URIs on unload
+ resourceDomains.forEach(domain => {
+ resourceHandler.setSubstitution(domain, null);
+ })
}
}
};
diff --git a/defaults/preferences/prefs.js b/defaults/preferences/prefs.js
index 932a19b..d6c40b7 100644
--- a/defaults/preferences/prefs.js
+++ b/defaults/preferences/prefs.js
@@ -1,3 +1,2 @@
-pref("extensions.jid1-F9UJ2thwoAm5gQ at jetpack.contributeData", false);
pref("extensions.jid1-F9UJ2thwoAm5gQ at jetpack.defaultVisualization", "graph");
pref("extensions.jid1-F9UJ2thwoAm5gQ at jetpack.defaultFilter", "daily");
diff --git a/harness-options.json b/harness-options.json
index 2a1e39f..88abb8e 100644
--- a/harness-options.json
+++ b/harness-options.json
@@ -1,4 +1,5 @@
{
+ "abort_on_missing": false,
"check_memory": false,
"enable_e10s": false,
"is-sdk-bundled": false,
@@ -9,7 +10,7 @@
"manifest": {
"lightbeam/connection": {
"docsSHA256": null,
- "jsSHA256": "7886c027d302e70900886e9eb4c2c142745fc890163c23535a2db29e376e2ba3",
+ "jsSHA256": "6e04c7d0f55418e3ac5515f5a078bf0087acd843e7028835025cf6607aca0376",
"moduleName": "connection",
"packageName": "lightbeam",
"requirements": {
@@ -17,7 +18,6 @@
"./tab/utils": "lightbeam/tab/utils",
"chrome": "chrome",
"sdk/event/core": "sdk/event/core",
- "sdk/request": "sdk/request",
"sdk/self": "sdk/self",
"sdk/simple-storage": "sdk/simple-storage",
"sdk/timers": "sdk/timers"
@@ -25,14 +25,12 @@
"sectionName": "lib"
},
"lightbeam/main": {
- "docsSHA256": "efe0e4fb21cb5cda6cf17034aabd42097260ba5dac2083d1160e12dcde488f5f",
- "jsSHA256": "e1a65f7be45e2e6bd828c384845d4f2641df579525192b2f36e4361b54d731fd",
+ "docsSHA256": "e60ed986f0f22ee750f6b64bac6bb5370aef7d7ba0ab484ce41e3406e8fd04ab",
+ "jsSHA256": "399fe28a54e3eecc23e7e2b86009ecc497b4613d967fb889bb3247d4c2d3de45",
"moduleName": "main",
"packageName": "lightbeam",
"requirements": {
"./connection": "lightbeam/connection",
- "./persist": "lightbeam/persist",
- "./tab/events": "lightbeam/tab/events",
"./ui": "lightbeam/ui",
"sdk/page-mod": "sdk/page-mod",
"sdk/self": "sdk/self",
@@ -43,22 +41,19 @@
},
"lightbeam/persist": {
"docsSHA256": null,
- "jsSHA256": "71dba92441163aa9577934ce83d947fdb80603510ff78f8b6fec843cd83ffcec",
+ "jsSHA256": "46d6801e944e9eaf2dbaa516d088a92a186987da3e54bc88ab068d30645bf231",
"moduleName": "persist",
"packageName": "lightbeam",
"requirements": {
- "chrome": "chrome",
- "sdk/preferences/service": "sdk/preferences/service",
"sdk/request": "sdk/request",
"sdk/simple-prefs": "sdk/simple-prefs",
- "sdk/simple-storage": "sdk/simple-storage",
- "sdk/system/xul-app": "sdk/system/xul-app"
+ "sdk/simple-storage": "sdk/simple-storage"
},
"sectionName": "lib"
},
"lightbeam/shared/menuitems": {
"docsSHA256": null,
- "jsSHA256": "0439dfbb105ef83c0f57d55519946079bf4b9b24691d825b76de4994ba13ab81",
+ "jsSHA256": "fd132327851fe2c9f6f0990899fdc2cc3f8e124e5a8815d012f56d8d35070b4d",
"moduleName": "shared/menuitems",
"packageName": "lightbeam",
"requirements": {
@@ -101,47 +96,35 @@
},
"sectionName": "lib"
},
- "lightbeam/tab/events": {
- "docsSHA256": null,
- "jsSHA256": "7ac2b53840fa6075c83a66e5e45632df94b0adcba912dd107366164589ab2bfe",
- "moduleName": "tab/events",
- "packageName": "lightbeam",
- "requirements": {
- "./utils": "lightbeam/tab/utils",
- "sdk/tabs": "sdk/tabs"
- },
- "sectionName": "lib"
- },
"lightbeam/tab/utils": {
"docsSHA256": null,
- "jsSHA256": "926f08f5219618c18b763cf3e16364481c6ef33a30510618d412cb1916b54478",
+ "jsSHA256": "b8214407c3483cf4317c4971c64f20773290fe4310fb4485eced7697ac981501",
"moduleName": "tab/utils",
"packageName": "lightbeam",
"requirements": {
"chrome": "chrome",
"sdk/tabs": "sdk/tabs",
- "sdk/tabs/utils": "sdk/tabs/utils",
- "sdk/window/utils": "sdk/window/utils"
+ "sdk/tabs/utils": "sdk/tabs/utils"
},
"sectionName": "lib"
},
"lightbeam/ui": {
"docsSHA256": null,
- "jsSHA256": "7dabed2a1510a9b5b5e5cbb11859618aa5107cc3d93a5be4199c91d8ec4aeb5b",
+ "jsSHA256": "6eb39bb49339649c5fbf2c746ad94bcfa4f05f64e7c82903c73505c195e9aa2a",
"moduleName": "ui",
"packageName": "lightbeam",
"requirements": {
"./connection": "lightbeam/connection",
"./persist": "lightbeam/persist",
- "sdk/event/core": "sdk/event/core",
+ "sdk/preferences/service": "sdk/preferences/service",
"sdk/private-browsing": "sdk/private-browsing",
"sdk/self": "sdk/self",
"sdk/simple-prefs": "sdk/simple-prefs",
"sdk/simple-storage": "sdk/simple-storage",
+ "sdk/system": "sdk/system",
"sdk/system/xul-app": "sdk/system/xul-app",
"sdk/tabs": "sdk/tabs",
"sdk/ui/button/action": "sdk/ui/button/action",
- "sdk/widget": "sdk/widget",
"shared/menuitems": "lightbeam/shared/menuitems",
"shared/policy": "lightbeam/shared/policy"
},
@@ -172,20 +155,13 @@
"permissions": {
"private-browsing": true
},
- "version": "1.0.10.2"
+ "version": "1.2.1"
}
},
"name": "lightbeam",
"parseable": false,
"preferences": [
{
- "description": "Contribute your Lightbeam data to Mozilla",
- "name": "contributeData",
- "title": "Contribute data",
- "type": "bool",
- "value": false
- },
- {
"description": "Graph or list",
"name": "defaultVisualization",
"options": [
@@ -229,7 +205,7 @@
}
],
"preferencesBranch": "jid1-F9UJ2thwoAm5gQ at jetpack",
- "sdkVersion": "1.16",
+ "sdkVersion": "1.17",
"staticArgs": {},
"verbose": false
}
\ No newline at end of file
diff --git a/install.rdf b/install.rdf
index 181461c..8cc9e0b 100644
--- a/install.rdf
+++ b/install.rdf
@@ -3,7 +3,7 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --><RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>jid1-F9UJ2thwoAm5gQ at jetpack</em:id>
- <em:version>1.0.10.2</em:version>
+ <em:version>1.2.1</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>
<em:unpack>false</em:unpack>
@@ -12,8 +12,8 @@
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>21.0</em:minVersion>
- <em:maxVersion>29.0a1</em:maxVersion>
+ <em:minVersion>26.0</em:minVersion>
+ <em:maxVersion>30.0</em:maxVersion>
</Description>
</em:targetApplication>
diff --git a/options.xul b/options.xul
index 329cb7c..803dded 100644
--- a/options.xul
+++ b/options.xul
@@ -1,6 +1,5 @@
<?xml version="1.0" ?>
<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <setting data-jetpack-id="jid1-F9UJ2thwoAm5gQ at jetpack" pref="extensions.jid1-F9UJ2thwoAm5gQ at jetpack.contributeData" pref-name="contributeData" title="Contribute data" type="bool">Contribute your Lightbeam data to Mozilla</setting>
<setting data-jetpack-id="jid1-F9UJ2thwoAm5gQ at jetpack" pref="extensions.jid1-F9UJ2thwoAm5gQ at jetpack.defaultVisualization" pref-name="defaultVisualization" title="Default visualization" type="menulist">
Graph or list
<menulist>
diff --git a/resources/lightbeam/data/aggregate.js b/resources/lightbeam/data/aggregate.js
index c97aef4..9dfa313 100644
--- a/resources/lightbeam/data/aggregate.js
+++ b/resources/lightbeam/data/aggregate.js
@@ -147,6 +147,11 @@ function updateUIFromMetadata(metadata) {
global.updateUIFromMetadata(metadata);
}
+function updateUIFromBrowserPrefs(browserPrefs) {
+ console.debug("in aggregate browser prefs");
+ global.updateUIFromBrowserPrefs(browserPrefs);
+}
+
function updateUIFromPrefs(prefs) {
console.debug("in aggregate prefs");
global.updateUIFromPrefs(prefs);
@@ -154,6 +159,7 @@ function updateUIFromPrefs(prefs) {
aggregate.on('load', onLoad);
aggregate.on("updateUIFromMetadata", updateUIFromMetadata);
+aggregate.on("updateUIFromBrowserPrefs", updateUIFromBrowserPrefs);
aggregate.on("updateUIFromPrefs", updateUIFromPrefs);
// Constants for indexes of properties in array format
@@ -511,7 +517,7 @@ var debounce = function debounce(func, wait, immediate) {
aggregate.update = debounce(function update() {
// FIXME: maybe not for list view
if (global.currentVisualization && global.currentVisualization.name !== 'graph') {
- console.log('do not update aggregate for view', currentVisualization.name);
+ console.debug('do not update aggregate for view', currentVisualization.name);
}
if (aggregate.initialized) {
global.filteredAggregate = aggregate.filters[aggregate.currentFilter]();
diff --git a/resources/lightbeam/data/content-script.js b/resources/lightbeam/data/content-script.js
index 5de2a1d..d92bab5 100644
--- a/resources/lightbeam/data/content-script.js
+++ b/resources/lightbeam/data/content-script.js
@@ -35,6 +35,11 @@ self.port.on("updateUIFromMetadata", function (metadata) {
global.aggregate.emit("updateUIFromMetadata", metadata);
});
+self.port.on("updateUIFromBrowserPrefs", function (browserPrefs) {
+ console.debug("Got set browser prefs", browserPrefs);
+ global.aggregate.emit("updateUIFromBrowserPrefs", browserPrefs);
+});
+
self.port.on("updateUIFromPrefs", function (prefs) {
console.debug("Got set prefs", prefs);
global.aggregate.emit("updateUIFromPrefs", prefs);
diff --git a/resources/lightbeam/data/dialog.js b/resources/lightbeam/data/dialog.js
index 072d1cb..5c2a1b2 100644
--- a/resources/lightbeam/data/dialog.js
+++ b/resources/lightbeam/data/dialog.js
@@ -5,25 +5,16 @@
// dialog names (used as dialog identifiers)
const dialogNames = {
- "promptToShare": "promptToShareData",
"resetData": "resetData",
"blockSites": "blockSites",
"hideSites": "hideSites",
"startUploadData": "startUploadData",
"stopUploadData": "stopUploadData",
"privateBrowsing": "privateBrowsing",
+ "trackingProtection": "trackingProtection",
"saveOldData": "saveOldData"
};
-const allDialogs = {
- 'Reset Data Confirmation': confirmResetDataDialog,
- 'Block Sites Confirmation': confirmBlockSitesDialog,
- 'Hide Sites Confirmation': confirmHideSitesDialog,
- 'Upload Data Confirmation': askForDataSharingConfirmationDialog,
- 'Stop Uploading Data Confirmation': stopSharingDialog,
- 'Private Browsing Notification': informUserOfUnsafeWindowsDialog,
-};
-
// options: name, title, message, type, dnsPrompt(Do Not Show), imageUrl
function dialog(options, callback) {
createDialog(options, callback);
@@ -90,7 +81,7 @@ function dialogControls(options) {
}
function addDialogEventHandlers(modal, options, callback) {
- var dialogContainer = modal.modalElem;
+ var dialogContainer = modal.modalElem();
// OK button click event handler
var okButton = dialogContainer.querySelector(".pico-close.dialog-ok");
okButton.addEventListener("click", function () {
@@ -103,9 +94,6 @@ function addDialogEventHandlers(modal, options, callback) {
var cancelButton = dialogContainer.querySelector(".pico-close.dialog-cancel");
if (cancelButton) {
cancelButton.addEventListener("click", function () {
- if (options.name == dialogNames.promptToShare) {
- if (dialogContainer.querySelector(".dialog-dns input").checked) {}
- }
modal.close();
callback(false);
});
@@ -124,7 +112,7 @@ function addDialogEventHandlers(modal, options, callback) {
};
document.addEventListener("keydown", keyDownHandler);
- modal.onClose(function () {
+ modal.afterClose(function () {
document.removeEventListener("keydown", keyDownHandler);
});
@@ -139,7 +127,7 @@ function addDialogEventHandlers(modal, options, callback) {
}
function restrictTabWithinDialog(modal) {
- var dialogContainer = modal.modalElem;
+ var dialogContainer = modal.modalElem();
assignTabIndices(modal);
dialogContainer.addEventListener("keypress", function (event) {
event.stopPropagation();
@@ -163,7 +151,7 @@ function restrictTabWithinDialog(modal) {
}
function assignTabIndices(modal) {
- var dialogContainer = modal.modalElem;
+ var dialogContainer = modal.modalElem();
var allElemsInDialog = dialogContainer.querySelectorAll("*");
var tabIndex = 0;
toArray(allElemsInDialog).forEach(function (elem, i) {
@@ -175,35 +163,6 @@ function assignTabIndices(modal) {
dialogContainer.querySelector("[tabIndex='0']").focus();
}
-function askForDataSharingConfirmationDialog(callback) {
- dialog({
- "name": dialogNames.startUploadData,
- "title": "Upload Data",
- "message": '<p>You are about to start uploading data to the Lightbeam server. Your data will continue to be uploaded periodically until you turn off sharing. For more information about the data we upload, how we take steps to minimize risk of re-identification, and what Mozilla\'s privacy policies are, please read the <a class="toggle-pp">the Lightbeam Privacy Policy</a>.</p>' +
- // Lightbeam Privacy Policy.
- '<div class="privacy-policy"> <header><b>Lightbeam Privacy Notice</b></header> <p> We care about your privacy. Lightbeam is a browser add-on that collects and helps you visualize third party requests on any site you visit. If you choose to send Lightbeam data to Mozilla (that’s us), our <a href="#mozillaprivacypolicy">privacy policy</a> describes how we handle that data. </p> <header><b>Things you should know</b></header> <ul class="bullet-form"> <li> After you install Lightbeam, t [...]
- // Lightbeam Privacy Policy ends
- '<br />' +
- '<p>By clicking OK, you are agreeing to the data practices in our privacy notice.</p>',
- "imageUrl": "image/lightbeam_popup_warningsharing.png"
- },
- callback);
-}
-
-function stopSharingDialog(callback) {
- dialog({
- "name": dialogNames.stopUploadData,
- "title": "Stop Uploading Data",
- "message": '<p>You are about to stop sharing data with the Lightbeam server.</p>' +
- '<p>By clicking OK you will no longer be uploading data.</p>',
- "imageUrl": "image/lightbeam_popup_stopsharing2.png"
- },
- function (confirmed) {
- callback(confirmed);
- }
- );
-}
-
function informUserOfUnsafeWindowsDialog() {
dialog({
"type": "alert",
@@ -211,7 +170,7 @@ function informUserOfUnsafeWindowsDialog() {
"dnsPrompt": true,
"title": "Private Browsing",
"message": "<p>You have one or more private browsing windows open.</p>" +
- "<p>Connections made in private browsing windows will be visualized in Lightbeam but that data is neither stored locally nor will it ever be shared, even if sharing is enabled. </p>" +
+ "<p>Connections made in private browsing windows will be visualized in Lightbeam but that data is not stored.</p>" +
"<p> Information gathered in private browsing mode will be deleted whenever Lightbeam is restarted, and is not collected at all when Lightbeam is not open..</p>",
"imageUrl": "image/lightbeam_popup_privacy.png"
},
@@ -255,3 +214,16 @@ function confirmResetDataDialog(callback) {
"imageUrl": "image/lightbeam_popup_warningreset.png"
}, callback);
}
+
+function confirmTrackingProtectionDialog(callback) {
+ dialog({
+ "name": dialogNames.trackingProtection,
+ "title": "Tracking Protection",
+ "message": "<p><b>Warning:</b></p>" +
+ "<p>Enabling this experimental feature will block elements that track your online behavior.</p>" +
+ "<p>This can prevent some sites from working and degrade your internet experience. Please use this feature carefully.</p>" +
+ "<p>Please report any problems you find.</p>" +
+ '<p><a href="https://support.mozilla.org/kb/tracking-protection-firefox#w_how-to-use-tracking-protection">Learn more...</a></p>',
+ "imageUrl": "image/lightbeam_popup_blocked.png"
+ }, callback);
+}
diff --git a/resources/lightbeam/data/first-run.html b/resources/lightbeam/data/first-run.html
index 6dc76b9..cd8a2a8 100644
--- a/resources/lightbeam/data/first-run.html
+++ b/resources/lightbeam/data/first-run.html
@@ -9,16 +9,12 @@
document.addEventListener("DOMContentLoaded", function() {
const firefoxVersionRe = /Firefox\/(([0-9]+)\.([0-9]+))/;
const firefoxMajorVersion = Number(firefoxVersionRe.exec(window.navigator.userAgent)[2]);
- const usingAustralis = firefoxMajorVersion >= 29 ? true : false;
-
const australisSubs = {
".platform-dependent, #icon-placement": '<img src="icons/lightbeam_logo-only_32x32.png" style="width:20px;"/> logo in the Toolbar.'
}
- if (usingAustralis) {
- for (var qs in australisSubs) {
- document.querySelector(qs).innerHTML = australisSubs[qs];
- }
+ for (var qs in australisSubs) {
+ document.querySelector(qs).innerHTML = australisSubs[qs];
}
});
</script>
@@ -39,13 +35,8 @@
<p><strong>To start visualizing your online interactions</strong>, open a new tab, navigate to a site, and then check back to the Lightbeam tab to see how your connections graph appears.</p>
</li>
<li>
- <p><strong>Consider contributing data to Mozilla!</strong> We'll use it to study the tracking landscape and develop new privacy-protecting technologies for the web.</p>
- <p>You can opt in to sharing your data by flipping the "Contribute Data" toggle in the top right corner of the Lightbeam tab to "On".</p>
- </li>
- <li>
<ul id="contact">
<li>Learn more about Mozilla's Lightbeam for Firefox on our <a href="https://mozilla.org/lightbeam">project page</a></li>
- <li>Question? Idea? Email the mailing list: <a href="mailto:lightbeam-feedback at mozilla.org" target="_blank">lightbeam at mozilla.org</a></li>
<li>Found a bug? <a href="https://github.com/mozilla/lightbeam/issues/new" target="_blank">Report an issue</a> on Github</li>
<li>Don't forget to <a href="https://addons.mozilla.org/en-US/firefox/addon/lightbeam/reviews/add" target="_blank">leave a review</a> on our Mozilla Addons page!</li>
</ul>
diff --git a/resources/lightbeam/data/graph.js b/resources/lightbeam/data/graph.js
index 8bf8065..096eb60 100644
--- a/resources/lightbeam/data/graph.js
+++ b/resources/lightbeam/data/graph.js
@@ -48,7 +48,7 @@ var highlight = {
function onUpdate() {
// new nodes, reheat graph simulation
if (force) {
- // console.log('restarting graph due to update');
+ console.debug('restarting graph due to update');
force.stop();
force.nodes(filteredAggregate.nodes);
force.links(filteredAggregate.edges);
@@ -56,34 +56,35 @@ function onUpdate() {
updateGraph();
colourHighlightNodes(highlight);
} else {
- console.log('the force is not with us');
+ console.debug('the force is not with us');
}
}
function onInit() {
- // console.log('graph::onInit()');
- // console.log('initializing graph from %s connections', filteredAggregate.nodes.length);
+ console.debug('graph::onInit()');
+ console.debug('initializing graph from ' + filteredAggregate.nodes.length +
+ ' connections');
// Handles all of the panning and scaling.
vis = d3.select(vizcanvas);
// A D3 visualization has a two main components, data-shaping, and setting up the D3 callbacks
// This binds our data to the D3 visualization and sets up the callbacks
initGraph();
aggregate.on('update', onUpdate);
- // Differenct visualizations may have different viewBoxes, so make sure we use the right one
+ // Different visualizations may have different viewBoxes, so make sure we use the right one
vizcanvas.setAttribute('viewBox', [0, 0, width, height].join(' '));
- // console.log('graph::onInit end');
+ console.debug('graph::onInit end');
document.querySelector(".filter-display").classList.remove("hidden");
}
function onRemove() {
- // var startTime = Date.now();
+ var startTime = Date.now();
if (force) {
force.stop();
force = null;
}
resetCanvas();
document.querySelector(".filter-display").classList.add("hidden");
- // console.log('it took %s ms to remove graph view', Date.now() - startTime);
+ console.debug('it took %s ms to remove graph view', Date.now() - startTime);
}
function onReset() {
@@ -189,7 +190,7 @@ function colourHighlightNodes(highlight) {
function initGraph() {
// Initialize D3 layout and bind data
- // console.log('initGraph()');
+ console.debug('initGraph()');
force = d3.layout.force()
.nodes(filteredAggregate.nodes)
.links(filteredAggregate.edges)
@@ -197,6 +198,10 @@ function initGraph() {
.size([width, height])
.start();
updateGraph();
+ // Terrible hack. Something about the d3 setup is wrong, and forcing onClick
+ // causes d3 to redraw in a way that most of the graph is visible on screen.
+ global.helpOnClick();
+ global.helpOnClick();
colourHighlightNodes(highlight);
// update method
@@ -275,7 +280,7 @@ function initGraph() {
}
function updateGraph() {
- // console.log('updateGraph()');
+ console.debug('updateGraph()');
// Data binding for links
edges = vis.selectAll('.edge')
.data(filteredAggregate.edges, nodeName);
diff --git a/resources/lightbeam/data/image/lightbeam_popup_stopsharing2.png b/resources/lightbeam/data/image/lightbeam_popup_stopsharing2.png
deleted file mode 100644
index db8cdf5..0000000
Binary files a/resources/lightbeam/data/image/lightbeam_popup_stopsharing2.png and /dev/null differ
diff --git a/resources/lightbeam/data/image/lightbeam_popup_warningsharing.png b/resources/lightbeam/data/image/lightbeam_popup_warningsharing.png
deleted file mode 100644
index 3a5d61c..0000000
Binary files a/resources/lightbeam/data/image/lightbeam_popup_warningsharing.png and /dev/null differ
diff --git a/resources/lightbeam/data/index.html b/resources/lightbeam/data/index.html
index 87b4b65..50d5629 100644
--- a/resources/lightbeam/data/index.html
+++ b/resources/lightbeam/data/index.html
@@ -59,9 +59,9 @@
<div class="stat third-party-sites large-header"></div>
</section>
</div>
- <div class="sharing-section">
- <div class="label all-cap-header">CONTRIBUTE DATA</div>
- <div class="toggle-btn share-btn">
+ <div class="tracking-section hidden">
+ <div class="label all-cap-header">TRACKING PROTECTION</div>
+ <div class="toggle-btn tracking-btn">
<label><input type="checkbox" name="" id="" />
<div class="toggle-btn-innner">
<div class="switch"></div>
@@ -210,7 +210,7 @@
<section>
<div class="blue-text all-cap-header">About this Add-on</div>
<p>
- Using interactive visualizations, Lightbeam allows you to see the first and third party sites you interact with on the Web. As you browse, Lightbeam reveals the full depth of the Web today, including parts that are not transparent to the average user. Using three distinct interactive graphic representations — Graph, Clock and List — Lightbeam enables you to examine individual third parties over time and space, identify where they connect to your online [...]
+ Using interactive visualizations, Lightbeam allows you to see the first and third party sites you interact with on the Web. As you browse, Lightbeam reveals the full depth of the Web today, including parts that are not transparent to the average user. Using two distinct interactive graphic representations — Graph and List — Lightbeam enables you to examine individual third parties, identify where they connect to your online activity and provides ways f [...]
</p>
<p>
Mozilla partnered with the Social + Interactive Media (SIM) Centre at Emily Carr University of Art + Design to produce the aesthetic and functional data visualizations for Lightbeam. To read more about the collaboration please visit: <a href="http://www.simcentre.ca/">http://www.simcentre.ca/</a>.
@@ -232,20 +232,6 @@
<li>
By default, data collected by Lightbeam remains in your browser and is not sent to us.
</li>
- <li>
- You can choose to contribute your Lightbeam data to us. Data from Lightbeam 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.
- <ul>
- <li>If you do contribute Lightbeam data to us, your browser will send us your Lightbeam data (you can see a list of the kind of data involved <a href="https://github.com/mozilla/lightbeam/blob/master/doc/data_format.v1.1.md">here.</a>).
- We will post your data along with data from others in an aggregated and open database in a manner which we believe minimizes your risk of being re-identified. Opening this data can help users and researchers make more informed decisions based on the collective information.
- </li>
- <li>
- Clicking "Reset data" at any time will delete the data stored locally in your browser.
- </li>
- <li>
- Uninstalling Lightbeam prevents collection of any further Lightbeam data.
- </li>
- </ul>
- </li>
</ul>
</section>
<section>
@@ -298,7 +284,7 @@
</b></header>
<p> We are committed to protecting your personal information once we have it. We implement physical, business and technical security measures. Despite our efforts, if we learn of a security breach, we'll notify you so that you can take appropriate protective steps.</p>
<p>We also don't want your personal information for any longer than we need it, so we only keep it long enough to do what we collected it for. Once we don't need it, we take steps to destroy it unless we are required by law to keep it longer.</p>
- <header><b>What else do we want you know?
+ <header><b>What else do we want you to know?
</b></header>
<p>We're a global organization and our computers are in several different places around the world. We also use service providers whose computers may also be in various countries. This means that your information might end up on one of those computers in another country, and that country may have a different level of data protection regulation than yours. By giving us information, you consent to this kind of transfer of your information. No matt [...]
@@ -336,6 +322,7 @@
<header></header>
<div class="blue-text all-cap-header">Graph View</div>
</div>
+ <!-- Used by d3 for drawing the graph -->
<svg class="vizcanvas" width="100%" height="100%" viewBox="-350 -450 700 500">
<defs>
<radialGradient fy="50%" fx="50%" r="50%" cy="50%" cx="50%" id="selected-glow">
diff --git a/resources/lightbeam/data/infobar.js b/resources/lightbeam/data/infobar.js
index c7bf1d3..b455e08 100644
--- a/resources/lightbeam/data/infobar.js
+++ b/resources/lightbeam/data/infobar.js
@@ -299,12 +299,13 @@ document.querySelector(".toggle-about").addEventListener("click", function () {
});
/* Toggle Help Sections */
-document.querySelector(".toggle-help").addEventListener("click", function () {
+global.helpOnClick = function helpOnClick() {
var tabClicked = document.querySelector(".toggle-help");
- var contentToBeShown = document.querySelector(".help-content ." + g.currentVisualization.name + "-view-help");
+ var contentToBeShown = document.querySelector(".help-content ." + global.currentVisualization.name + "-view-help");
toggleInfoPanelTab(tabClicked, contentToBeShown);
-});
+};
+document.querySelector(".toggle-help").addEventListener("click", helpOnClick);
function toggleInfoPanelTab(tabClicked, contentToBeShown) {
diff --git a/resources/lightbeam/data/picoModal/picoModal-1.0.0.min.js b/resources/lightbeam/data/picoModal/picoModal-1.0.0.min.js
deleted file mode 100644
index 1e625fd..0000000
--- a/resources/lightbeam/data/picoModal/picoModal-1.0.0.min.js
+++ /dev/null
@@ -1 +0,0 @@
-window.picoModal=function(a,b){"use strict";var c=function(){var b=[];return{w:function(a){b.push(a)},t:function(){for(var c=0;c<b.length;c++)a.setTimeout(b[c],1)}}},d=function(a){var c=b.createElement("div");(a||b.body).appendChild(c);var e={e:c,c:function(){return d(c)},s:function(a){a=a||{},"undefined"!=typeof a.opacity&&(a.filter="alpha(opacity="+100*a.opacity+")");for(var b in a)a.hasOwnProperty(b)&&(c.style[b]=a[b]);return e},z:function(a){return c.className+=a,e},h:function(a){ret [...]
\ No newline at end of file
diff --git a/resources/lightbeam/data/picoModal/picoModal.js b/resources/lightbeam/data/picoModal/picoModal.js
new file mode 100644
index 0000000..3086bd3
--- /dev/null
+++ b/resources/lightbeam/data/picoModal/picoModal.js
@@ -0,0 +1,417 @@
+/**
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/**
+ * A self-contained modal library
+ */
+(function(window, document) {
+ "use strict";
+
+ /** Returns whether a value is a dom node */
+ function isNode(value) {
+ if ( typeof Node === "object" ) {
+ return value instanceof Node;
+ }
+ else {
+ return value &&
+ typeof value === "object" &&
+ typeof value.nodeType === "number";
+ }
+ }
+
+ /** Returns whether a value is a string */
+ function isString(value) {
+ return typeof value === "string";
+ }
+
+ /**
+ * Generates observable objects that can be watched and triggered
+ */
+ function observable() {
+ var callbacks = [];
+ return {
+ watch: callbacks.push.bind(callbacks),
+ trigger: function( modal ) {
+
+ var unprevented = true;
+ var event = {
+ preventDefault: function preventDefault () {
+ unprevented = false;
+ }
+ };
+
+ for (var i = 0; i < callbacks.length; i++) {
+ callbacks[i](modal, event);
+ }
+
+ return unprevented;
+ }
+ };
+ }
+
+
+ /**
+ * A small interface for creating and managing a dom element
+ */
+ function Elem( elem ) {
+ this.elem = elem;
+ }
+
+ /**
+ * Creates a new div
+ */
+ Elem.div = function ( parent ) {
+ var elem = document.createElement('div');
+ (parent || document.body).appendChild(elem);
+ return new Elem(elem);
+ };
+
+ Elem.prototype = {
+
+ /** Creates a child of this node */
+ child: function () {
+ return Elem.div(this.elem);
+ },
+
+ /** Applies a set of styles to an element */
+ stylize: function(styles) {
+ styles = styles || {};
+
+ if ( typeof styles.opacity !== "undefined" ) {
+ styles.filter =
+ "alpha(opacity=" + (styles.opacity * 100) + ")";
+ }
+
+ for (var prop in styles) {
+ if (styles.hasOwnProperty(prop)) {
+ this.elem.style[prop] = styles[prop];
+ }
+ }
+
+ return this;
+ },
+
+ /** Adds a class name */
+ clazz: function (clazz) {
+ this.elem.className += " " + clazz;
+ return this;
+ },
+
+ /** Sets the HTML */
+ html: function (content) {
+ if ( isNode(content) ) {
+ this.elem.appendChild( content );
+ }
+ else {
+ this.elem.innerHTML = content;
+ }
+ return this;
+ },
+
+ /** Returns the width of this element */
+ getWidth: function () {
+ return this.elem.clientWidth;
+ },
+
+ /** Adds a click handler to this element */
+ onClick: function(callback) {
+ if (this.elem.attachEvent) {
+ this.elem.attachEvent('onclick', callback);
+ }
+ else {
+ this.elem.addEventListener('click', callback);
+ }
+ return this;
+ },
+
+ /** Removes this element from the DOM */
+ destroy: function() {
+ document.body.removeChild(this.elem);
+ },
+
+ /** Hides this element */
+ hide: function() {
+ this.elem.style.display = "none";
+ },
+
+ /** Shows this element */
+ show: function() {
+ this.elem.style.display = "block";
+ },
+
+ /** Executes a callback on all the ancestors of an element */
+ anyAncestor: function ( predicate ) {
+ var elem = this.elem;
+ while ( elem ) {
+ if ( predicate( new Elem(elem) ) ) {
+ return true;
+ }
+ else {
+ elem = elem.parentNode;
+ }
+ }
+ return false;
+ }
+ };
+
+
+ /** Generates the grey-out effect */
+ function buildOverlay( getOption, close ) {
+ return Elem.div()
+ .clazz("pico-overlay")
+ .clazz( getOption("overlayClass", "") )
+ .stylize({
+ display: "block",
+ position: "fixed",
+ top: "0px",
+ left: "0px",
+ height: "100%",
+ width: "100%",
+ zIndex: 10000
+ })
+ .stylize(getOption('overlayStyles', {
+ opacity: 0.5,
+ background: "#000"
+ }))
+ .onClick(function () {
+ if ( getOption('overlayClose', true) ) {
+ close();
+ }
+ });
+ }
+
+ /** Builds the content of a modal */
+ function buildModal( getOption, close ) {
+ var elem = Elem.div()
+ .clazz("pico-content")
+ .clazz( getOption("modalClass", "") )
+ .stylize({
+ display: 'block',
+ position: 'fixed',
+ zIndex: 10001,
+ left: "50%",
+ top: "50px"
+ })
+ .html( getOption('content') )
+ .onClick(function (event) {
+ var isCloseClick = new Elem(event.target)
+ .anyAncestor(function (elem) {
+ return /\bpico-close\b/.test(elem.elem.className);
+ });
+ if ( isCloseClick ) {
+ close();
+ }
+ });
+
+ var width = getOption('width', elem.getWidth());
+
+ elem
+ .stylize({
+ width: width + "px",
+ margin: "0 0 0 " + (-(width / 2) + "px")
+ })
+ .stylize( getOption('modalStyles', {
+ backgroundColor: "white",
+ padding: "20px",
+ borderRadius: "5px"
+ }) );
+
+ return elem;
+ }
+
+ /** Builds the close button */
+ function buildClose ( elem, getOption ) {
+ if ( getOption('closeButton', true) ) {
+ return elem.child()
+ .html( getOption('closeHtml', "×") )
+ .clazz("pico-close")
+ .clazz( getOption("closeClass") )
+ .stylize( getOption('closeStyles', {
+ borderRadius: "2px",
+ cursor: "pointer",
+ height: "15px",
+ width: "15px",
+ position: "absolute",
+ top: "5px",
+ right: "5px",
+ fontSize: "16px",
+ textAlign: "center",
+ lineHeight: "15px",
+ background: "#CCC"
+ }) );
+ }
+ }
+
+ /** Builds a method that calls a method and returns an element */
+ function buildElemAccessor( builder ) {
+ return function () {
+ return builder().elem;
+ };
+ }
+
+
+ /**
+ * Displays a modal
+ */
+ function picoModal(options) {
+
+ if ( isString(options) || isNode(options) ) {
+ options = { content: options };
+ }
+
+ var afterCreateEvent = observable();
+ var beforeShowEvent = observable();
+ var afterShowEvent = observable();
+ var beforeCloseEvent = observable();
+ var afterCloseEvent = observable();
+
+ /**
+ * Returns a named option if it has been explicitly defined. Otherwise,
+ * it returns the given default value
+ */
+ function getOption ( opt, defaultValue ) {
+ var value = options[opt];
+ if ( typeof value === "function" ) {
+ value = value( defaultValue );
+ }
+ return value === undefined ? defaultValue : value;
+ }
+
+ /** Hides this modal */
+ function forceClose () {
+ shadowElem().hide();
+ modalElem().hide();
+ afterCloseEvent.trigger(iface);
+ }
+
+ /** Gracefully hides this modal */
+ function close () {
+ if ( beforeCloseEvent.trigger(iface) ) {
+ forceClose();
+ }
+ }
+
+ /** Wraps a method so it returns the modal interface */
+ function returnIface ( callback ) {
+ return function () {
+ callback.apply(this, arguments);
+ return iface;
+ };
+ }
+
+
+ // The constructed dom nodes
+ var built;
+
+ /** Builds a method that calls a method and returns an element */
+ function build ( name ) {
+ if ( !built ) {
+ var modal = buildModal(getOption, close);
+ built = {
+ modal: modal,
+ overlay: buildOverlay(getOption, close),
+ close: buildClose(modal, getOption)
+ };
+ afterCreateEvent.trigger(iface);
+ }
+ return built[name];
+ }
+
+ var modalElem = build.bind(window, 'modal');
+ var shadowElem = build.bind(window, 'overlay');
+ var closeElem = build.bind(window, 'close');
+
+
+ var iface = {
+
+ /** Returns the wrapping modal element */
+ modalElem: buildElemAccessor(modalElem),
+
+ /** Returns the close button element */
+ closeElem: buildElemAccessor(closeElem),
+
+ /** Returns the overlay element */
+ overlayElem: buildElemAccessor(shadowElem),
+
+ /** Shows this modal */
+ show: function () {
+ if ( beforeShowEvent.trigger(iface) ) {
+ shadowElem().show();
+ closeElem();
+ modalElem().show();
+ afterShowEvent.trigger(iface);
+ }
+ return this;
+ },
+
+ /** Hides this modal */
+ close: returnIface(close),
+
+ /**
+ * Force closes this modal. This will not call beforeClose
+ * events and will just immediately hide the modal
+ */
+ forceClose: returnIface(forceClose),
+
+ /** Destroys this modal */
+ destroy: function () {
+ modalElem = modalElem().destroy();
+ shadowElem = shadowElem().destroy();
+ closeElem = undefined;
+ },
+
+ /**
+ * Updates the options for this modal. This will only let you
+ * change options that are re-evaluted regularly, such as
+ * `overlayClose`.
+ */
+ options: function ( opts ) {
+ options = opts;
+ },
+
+ /** Executes after the DOM nodes are created */
+ afterCreate: returnIface(afterCreateEvent.watch),
+
+ /** Executes a callback before this modal is closed */
+ beforeShow: returnIface(beforeShowEvent.watch),
+
+ /** Executes a callback after this modal is shown */
+ afterShow: returnIface(afterShowEvent.watch),
+
+ /** Executes a callback before this modal is closed */
+ beforeClose: returnIface(beforeCloseEvent.watch),
+
+ /** Executes a callback after this modal is closed */
+ afterClose: returnIface(afterCloseEvent.watch)
+ };
+
+ return iface;
+ }
+
+ if ( typeof window.define === "function" && window.define.amd ) {
+ window.define(function () {
+ return picoModal;
+ });
+ }
+ else {
+ window.picoModal = picoModal;
+ }
+
+}(window, document));
diff --git a/resources/lightbeam/data/style.css b/resources/lightbeam/data/style.css
index 4136477..147b11b 100644
--- a/resources/lightbeam/data/style.css
+++ b/resources/lightbeam/data/style.css
@@ -351,6 +351,7 @@ a:hover{
z-index: 0;
border-top: 1px solid #555555;
height: 100%;
+ min-height: 0;
}
.content-flex{
@@ -377,26 +378,25 @@ a:hover{
margin-right: 20px;
}
-.sharing-section{
+.tracking-section{
float: right;
text-align: center;
}
-.share-btn label{
+.tracking-btn label{
position: relative;
top: 10px;
}
-.sharing-section .label{
+.tracking-section .label{
color: #3E454D;
margin-right: 5px;
}
-.sharing-section div{
+.tracking-section div{
display: inline-block;
}
-
.info{
width: 8px;
height: 100%;
@@ -654,6 +654,7 @@ a:hover{
.stage{
flex: 1;
+ min-height: 0;
/*margin: 20px 0px;*/
}
.showinfo .stage-stack{
diff --git a/resources/lightbeam/data/ui.js b/resources/lightbeam/data/ui.js
index b8e6959..d6d108b 100644
--- a/resources/lightbeam/data/ui.js
+++ b/resources/lightbeam/data/ui.js
@@ -3,18 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
(function (global) {
-// In 1.0.9 and before, the contribute data pref was kept in localStorage. In
-// 1.0.10, all prefs are stored in the pref manager. If a previous pref exists,
-// send it back to the addon. This logic is ridiculous but it's what existed
-// prior to 1.0.9, so just keep it in.
-if (localStorage.userHasOptedIntoSharing === 'true') {
- console.log("Restoring contribute data pref from localStorage");
- let e = { "contributeData": true };
- global.self.port.emit("prefChanged", e);
- updateUIFromPrefs(e);
- localStorage.clear();
-}
-
// Bunch of utilities related to UI elements.
const graphNodeRadius = {
"graph": 12
@@ -84,54 +72,33 @@ btnGroupArray.forEach(function (btnGroup) {
});
});
-
-/* Share Data Toggle */
-
-document.querySelector(".toggle-btn.share-btn").addEventListener("click",
+document.querySelector(".toggle-btn.tracking-btn").addEventListener("click",
function (event) {
var elmClicked = event.target;
if (elmClicked.mozMatchesSelector("input")) {
+ var toggleBtn = document.querySelector(".tracking-btn");
if (elmClicked.checked) {
- confirmStartSharing(true, elmClicked);
+ confirmTrackingProtectionDialog(function (confirmed) {
+ if (confirmed) {
+ elmClicked.checked = true;
+ toggleBtnOnEffect(toggleBtn);
+ global.self.port.emit("browserPrefChanged", {
+ "trackingProtection": true
+ });
+ } else {
+ elmClicked.checked = false;
+ }
+ });
} else {
- confirmStopSharing(elmClicked);
+ elmClicked.checked = false;
+ toggleBtnOffEffect(toggleBtn);
+ global.self.port.emit("browserPrefChanged", {
+ "trackingProtection": false
+ });
}
}
});
-function confirmStartSharing(askForConfirmation, elmClicked) {
- let callback = function (confirmed) {
- if (confirmed) {
- console.debug("Sharing confirmed!");
- toggleBtnOnEffect(document.querySelector(".share-btn"));
- global.self.port.emit("prefChanged", {
- "contributeData": true
- });
- } else {
- elmClicked.checked = false;
- }
- };
- if (askForConfirmation) {
- askForDataSharingConfirmationDialog(callback);
- } else {
- callback(true);
- }
-
-}
-
-global.confirmStopSharing = function confirmStopSharing(elmClicked) {
- stopSharingDialog(function (confirmed) {
- if (confirmed) {
- toggleBtnOffEffect(document.querySelector(".share-btn"));
- global.self.port.emit("prefChanged", {
- "contributeData": false
- });
- } else {
- elmClicked.checked = true;
- }
- });
-};
-
function toggleBtnOnEffect(toggleBtn) {
toggleBtn.querySelector(".toggle-btn-innner").classList.add("checked");
toggleBtn.querySelector(".switch").classList.add("checked");
@@ -477,13 +444,27 @@ global.singularOrPluralNoun = function singularOrPluralNoun(num, str) {
};
function updateUIFromMetadata(event) {
- document.querySelector('#version-number').textContent = event.version;
+ if ("version" in event) {
+ document.querySelector('#version-number').textContent = event.version;
+ }
+
+ if ("browserVersion" in event) {
+ const firefoxVersionRe = /^([0-9]+)(\.([0-9]+))?/;
+ var majorVersion = Number(firefoxVersionRe.exec(event.browserVersion)[1]);
+
+ var section = document.querySelector('.tracking-section');
+ if (majorVersion >= 35) {
+ section.classList.remove("hidden");
+ } else {
+ section.classList.add("hidden");
+ }
+ }
}
-function updateUIFromPrefs(event) {
- if ("contributeData" in event && event.contributeData) {
- var toggleBtn = document.querySelector(".share-btn");
- if (event.contributeData) {
+function updateUIFromBrowserPrefs(event) {
+ if ("trackingProtection" in event) {
+ var toggleBtn = document.querySelector(".tracking-btn");
+ if (event.trackingProtection) {
toggleBtn.querySelector("input").checked = true;
toggleBtnOnEffect(toggleBtn);
} else {
@@ -491,6 +472,9 @@ function updateUIFromPrefs(event) {
toggleBtnOffEffect(toggleBtn);
}
}
+}
+
+function updateUIFromPrefs(event) {
if ("defaultVisualization" in event) {
global.currentVisualization = visualizations[event.defaultVisualization];
if (global.currentVisualization) {
@@ -512,5 +496,6 @@ function updateUIFromPrefs(event) {
// Exports
global.updateUIFromMetadata = updateUIFromMetadata;
+global.updateUIFromBrowserPrefs = updateUIFromBrowserPrefs;
global.updateUIFromPrefs = updateUIFromPrefs;
})(this);
diff --git a/resources/lightbeam/data/upgrade.html b/resources/lightbeam/data/upgrade.html
index 25ad182..bc7feff 100644
--- a/resources/lightbeam/data/upgrade.html
+++ b/resources/lightbeam/data/upgrade.html
@@ -32,7 +32,6 @@ repository</a>.</p>
<li>
<ul id="contact">
<li>Learn more about Mozilla's Lightbeam for Firefox on our <a href="https://mozilla.org/lightbeam">project page</a></li>
- <li>Question? Idea? Email the mailing list: <a href="mailto:lightbeam-feedback at mozilla.org" target="_blank">lightbeam-feedback at mozilla.org</a></li>
<li>Found a bug? <a href="https://github.com/mozilla/lightbeam/issues/new" target="_blank">Report an issue</a> on Github</li>
<li>Don't forget to <a href="https://addons.mozilla.org/en-US/firefox/addon/lightbeam/reviews/add" target="_blank">leave a review</a> on our Mozilla Addons page!</li>
</ul>
diff --git a/resources/lightbeam/lib/connection.js b/resources/lightbeam/lib/connection.js
index a6bf07c..af14dea 100644
--- a/resources/lightbeam/lib/connection.js
+++ b/resources/lightbeam/lib/connection.js
@@ -9,7 +9,6 @@
const {
Cc, Ci, Cr
} = require('chrome');
-const Request = require('sdk/request').Request;
const {
on, off, emit
} = require('sdk/event/core');
diff --git a/resources/lightbeam/lib/main.js b/resources/lightbeam/lib/main.js
index cbef4fe..b89b413 100644
--- a/resources/lightbeam/lib/main.js
+++ b/resources/lightbeam/lib/main.js
@@ -4,6 +4,7 @@
/* global exports, require */
"use strict";
+// require("sdk/preferences/service").set("extensions.sdk.console.logLevel", "debug");
const events = require("sdk/system/events");
const {
PageMod
@@ -15,9 +16,7 @@ const {
const {
Connection, addConnection
} = require('./connection');
-const tabEvents = require('./tab/events');
const ui = require('./ui');
-const persist = require("./persist");
var tabs = require("sdk/tabs");
@@ -38,13 +37,13 @@ PageMod({
contentScriptWhen: 'ready',
contentScriptFile: [
data.url('content-script.js'),
- data.url('d3/d3.min.js'),
+ data.url('d3/d3.js'),
data.url('events.js'),
data.url('infobar.js'),
data.url('lightbeam.js'),
data.url('svgdataset.js'),
data.url('aggregate.js'),
- data.url('picoModal/picoModal-1.0.0.min.js'),
+ data.url('picoModal/picoModal.js'),
data.url('tooltip.js'),
data.url('dialog.js'),
data.url('ui.js'),
@@ -67,7 +66,8 @@ exports.main = function (options, callbacks) {
}
if (initialPage) {
let initialPageUrl = data.url(initialPage);
- tabs.open(initialPageUrl);
+ tabs.open({url: initialPageUrl,
+ inBackground: true});
// Add a content script to open lightbeam if the corresponding button is
// pressed in the inital page
PageMod({
diff --git a/resources/lightbeam/lib/persist.js b/resources/lightbeam/lib/persist.js
index 8d49770..c01aea7 100644
--- a/resources/lightbeam/lib/persist.js
+++ b/resources/lightbeam/lib/persist.js
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* global console, require, exports */
-// All writes to storage and upload logic in the addon process goes here.
+// All writes to storage in the addon process goes here.
"use strict";
const ss = require('sdk/simple-storage');
@@ -17,74 +17,6 @@ const STORAGE_KEYS = [
"connections",
];
-// Upload logic.
-function serializeConnections(connections) {
- let exportSet = {
- format: 'Lightbeam Save File',
- version: '1.2',
- userId: storage.userId,
- userAgentData: getUserAgentData(),
- uploadTime: Date.now(),
- connections: connections
- };
- console.debug(JSON.stringify(exportSet));
- return JSON.stringify(exportSet);
-}
-
-function getUserAgentData() {
- let retval = {};
- let app = require("sdk/system/xul-app");
- retval.appname = app.name;
- retval.fxVersion = app.version;
- let prefService = require("sdk/preferences/service");
- let prefs = [ "app.update.channel",
- "network.cookie.behavior",
- "privacy.donottrackheader.enabled",
- "privacy.donottrack.header.value" ];
- prefs.forEach(function(p) { retval[p] = prefService.get(p); });
- retval.addons = getAddons();
- console.debug(JSON.stringify(retval));
- return retval;
-}
-
-function getAddons() {
- const { Cu } = require('chrome');
- let { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm");
- let addons = [];
- AddonManager.getAllAddons(function(addonList) {
- addonList.forEach(function(addon) {
- let o = {};
- let states = ['id', 'name', 'appDisabled', 'isActive', 'type',
- 'userDisabled'];
- states.forEach(function(state) { o[state] = addon[state]; });
- addons.push(o);
- });
- });
- console.debug(JSON.stringify(addons));
- return addons;
-}
-
-function upload(connections) {
- console.debug("received upload event in addon");
- let uploadServer = 'https://data.mozilla.com/submit/lightbeam';
- let request = Request({
- url: uploadServer,
- contentType: "application/json",
- onComplete: function (response) {
- let status = Number(response.status);
- if (status >= 200 && status < 300) {
- console.log("successful upload: ", response.text);
- } else {
- // Ignore errors for now. We could save last upload time and try
- // uploading again the ones that failed previously.
- console.log("error uploading: ", status, response.text);
- }
- },
- content: serializeConnections(connections)
- });
- request.post();
-}
-
// Delete oldest connections. When we hit the simple storage quota limit,
// Firefox throws an exception that the user won't see. We tried switching to
// indexdb (which is async) but abandoned it. localForage may be a viable
@@ -100,9 +32,6 @@ function checkStorageQuota() {
exports.storeConnections = function storeConnections(connections) {
checkStorageQuota();
storage.connections = storage.connections.concat(connections);
- if (prefs.contributeData) {
- upload(connections);
- }
};
// Reset stored state, including preferences
@@ -110,7 +39,6 @@ exports.reset = function reset() {
storage.connections.length = 0;
storage.blockmap = {};
storage.userId = generateUserId();
- prefs.contributeData = false;
prefs.defaultVisualization = "graph";
prefs.defaultFilter = "daily";
};
diff --git a/resources/lightbeam/lib/shared/menuitems.js b/resources/lightbeam/lib/shared/menuitems.js
index 049b1e4..c41a30b 100644
--- a/resources/lightbeam/lib/shared/menuitems.js
+++ b/resources/lightbeam/lib/shared/menuitems.js
@@ -12,7 +12,7 @@ const {
validateOptions
} = require("sdk/deprecated/api-utils");
const {
- on, emit, once, off
+ emit
} = require("sdk/event/core");
const {
isBrowser
diff --git a/resources/lightbeam/lib/tab/events.js b/resources/lightbeam/lib/tab/events.js
deleted file mode 100644
index 0ecea20..0000000
--- a/resources/lightbeam/lib/tab/events.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-/* global require, exports */
-// Simple onTab handler to figure out what tab a connection corresponds to.
-'use strict';
-
-const tabs = require('sdk/tabs');
-const {
- getTabInfo
-} = require('./utils');
-
-function onTab(eventname, fn) {
- tabs.on(eventname, function (jptab) {
- var tabinfo = getTabInfo(jptab);
- fn(tabinfo);
- });
-}
-
-exports.on = onTab;
diff --git a/resources/lightbeam/lib/tab/utils.js b/resources/lightbeam/lib/tab/utils.js
index cfeb6f5..8b6e087 100644
--- a/resources/lightbeam/lib/tab/utils.js
+++ b/resources/lightbeam/lib/tab/utils.js
@@ -10,12 +10,11 @@ exports.on = onTab;
exports.getTabInfo = getTabInfo;
const {
- Cc, Ci, Cr, components
+ Cc, Ci, components
} = require('chrome');
const tabs = require('sdk/tabs');
-const winutils = require('sdk/window/utils');
const {
- getTabForContentWindow, getBrowserForTab
+ getTabForContentWindow
} = require('sdk/tabs/utils');
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
@@ -64,7 +63,11 @@ function getTabForChannel(aHttpChannel) {
if (win) {
var tab = getTabForContentWindow(win);
// http://developer.mozilla.org/en/docs/XUL:tab
- tab.isPrivate = PrivateBrowsingUtils.isWindowPrivate(win);
+ if (PrivateBrowsingUtils.isContentWindowPrivate) {
+ tab.isPrivate = PrivateBrowsingUtils.isContentWindowPrivate(win);
+ } else {
+ tab.isPrivate = PrivateBrowsingUtils.isWindowPrivate(win); // ESR 31
+ }
return tab;
} else {
// console.error('getTabForChannel() no topWindow found');
@@ -112,7 +115,7 @@ function getWindowForChannel(aRequest) {
try {
return interfaceRequestor.getInterface(Ci.nsIDOMWindow);
} catch (e) {
- console.log("Failed to to find nsIDOMWindow from interface requestor");
+ console.log("Failed to to find nsIDOMWindow from interface requestor: " + e);
return null;
}
}
diff --git a/resources/lightbeam/lib/ui.js b/resources/lightbeam/lib/ui.js
index b21ff74..a1ca432 100644
--- a/resources/lightbeam/lib/ui.js
+++ b/resources/lightbeam/lib/ui.js
@@ -14,28 +14,18 @@ const {
ContentPolicy
} = require('shared/policy');
const ss = require('sdk/simple-storage');
-const {
- on, once, off, emit
-} = require("sdk/event/core");
const prefs = require("sdk/simple-prefs").prefs;
+const prefService = require("sdk/preferences/service");
+const system = require("sdk/system");
+
const persist = require("./persist");
const {
Connection, getAllConnections
} = require("./connection");
const xulapp = require("sdk/system/xul-app");
-const usingAustralis = xulapp.satisfiesVersion(">=29");
-if (usingAustralis) {
- const {
- ActionButton
- } = require("sdk/ui/button/action");
-} else {
- const {
- Widget
- } = require("sdk/widget");
-}
-exports.usingAustralis = usingAustralis;
+const { ActionButton } =require("sdk/ui/button/action");
const mainPage = data.url("index.html");
var uiworker = null;
@@ -154,11 +144,15 @@ function attachToLightbeamPage(worker) {
});
}
+ function onBrowserPrefChanged(event) {
+ console.debug("Received updated browser prefs", JSON.stringify(event));
+ if ("trackingProtection" in event) {
+ prefService.set("privacy.trackingprotection.enabled", event.trackingProtection);
+ }
+ }
+
function onPrefChanged(event) {
console.debug("Received updated prefs", JSON.stringify(event));
- if ("contributeData" in event) {
- prefs.contributeData = event.contributeData;
- }
if ("defaultVisualization" in event) {
prefs.defaultVisualization = event.defaultVisualization;
}
@@ -185,7 +179,13 @@ function attachToLightbeamPage(worker) {
}
function onUIReady() {
- worker.port.emit("updateUIFromMetadata", { version: self.version });
+ worker.port.emit("updateUIFromMetadata", {
+ version: self.version,
+ browserVersion: system.version
+ });
+ worker.port.emit("updateUIFromBrowserPrefs", {
+ "trackingProtection": prefService.get("privacy.trackingprotection.enabled")
+ });
worker.port.emit("updateUIFromPrefs", prefs);
worker.port.emit("passStoredConnections", getAllConnections());
}
@@ -196,6 +196,7 @@ function attachToLightbeamPage(worker) {
this.port.removeListener('reset', onWorkerReset);
this.port.removeListener('uiready', onUIReady);
this.port.removeListener('updateBlocklist', onWorkerUpdateBlocklist);
+ this.port.removeListener("browserPrefChanged", onBrowserPrefChanged);
this.port.removeListener("prefChanged", onPrefChanged);
uiworker = null;
this.destroy();
@@ -205,6 +206,7 @@ function attachToLightbeamPage(worker) {
worker.port.on("reset", onWorkerReset);
worker.port.on('uiready', onUIReady);
worker.port.on('updateBlocklist', onWorkerUpdateBlocklist);
+ worker.port.on("browserPrefChanged", onBrowserPrefChanged);
worker.port.on("prefChanged", onPrefChanged);
worker.port.emit('init');
@@ -264,10 +266,7 @@ function openOrSwitchToOrClose() {
exports.openOrSwitchToOrClose = openOrSwitchToOrClose;
// Set up the status bar button to open the main UI page:
-var button;
-if (usingAustralis) {
- console.debug("Using australis");
- button = ActionButton({
+var button = ActionButton({
id: "lightbeam_Widget",
label: "Lightbeam",
tooltip: "Show Lightbeam",
@@ -281,15 +280,3 @@ if (usingAustralis) {
openOrSwitchToOrClose();
}
});
-} else {
- console.debug("Not using australis");
- button = Widget({
- id: "lightbeam_Widget",
- label: "Lightbeam",
- tooltip: "Show Lightbeam",
- contentURL: data.url("icons/lightbeam_logo-only_32x32.png"),
- onClick: function () {
- openOrSwitchToOrClose();
- }
- });
-}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/lightbeam.git
More information about the Pkg-mozext-commits
mailing list