[tbb-commits] [tor-browser/tor-browser-24.7.0esr-4.x-2] fixup! Bug #6253: Add canvas image extraction prompt.

mikeperry at torproject.org mikeperry at torproject.org
Wed Aug 20 04:03:15 UTC 2014


commit 00ad0bffa709d34e393a3b271d768d4e8a466864
Author: Isis Lovecruft <isis at torproject.org>
Date:   Tue Jul 29 06:04:57 2014 +0000

    fixup! Bug #6253: Add canvas image extraction prompt.
    
    Bug #12684: Make "Not now" default for HTML5 canvas permission dialogue.
    
    This alters the `PopupNotification`s [0] which notify users that a
    website has attempted to access an HTML5 canvas. The new default
    ordering for buttons is:
    
        Not Now
        Never for this site (recommended)
        Allow in the future
    
     * FIXES #12684 [1] by making "Not Now" the default in the HTML5 canvas
       fingerprinting permissions dialogue.
    
     * ADDS palette icons for HTML5 canvas permissions PopupNotification UI.
       The image is freely licensed and obtainable from:
       https://openclipart.org/image/300px/svg_to_png/21620/ben_palette.png
    
     * ADDS a CSS whitespace hack from Pearl Crescent to the
       `CanvasPermissionPromptHelper_init()` function in
       `browser/base/content/browser.js` for causing the newlines in the
       `canvas.siteprompt` string (in torbutton.git, in
       `chrome/locale/en/torbutton.properties`) to render correctly in
       PopupNotification XUL <description> elements. [2]
    
    NOTE: Applying this patch requires an additional patch to TorButton, to
    store the additional UI strings before localisation. [3]
    
    [0]: https://mxr.mozilla.org/mozilla-esr24/source/toolkit/modules/PopupNotifications.jsm
    [1]: https://bugs.torproject.org/12684
    [2]: https://trac.torproject.org/projects/tor/ticket/12684#comment:21
    [3]: https://github.com/isislovecruft/torbutton/commit/368e74d62df349b27cf578525c3fa15da19ccdc2
---
 browser/base/content/browser.js         |   19 ++++++++++++++++---
 browser/themes/linux/browser.css        |   10 ++++++++--
 browser/themes/linux/canvas-popup.svg   |   19 +++++++++++++++++++
 browser/themes/linux/jar.mn             |    1 +
 browser/themes/osx/browser.css          |   10 ++++++++--
 browser/themes/osx/canvas-popup.svg     |   19 +++++++++++++++++++
 browser/themes/osx/jar.mn               |    1 +
 browser/themes/windows/browser.css      |   10 ++++++++--
 browser/themes/windows/canvas-popup.svg |   19 +++++++++++++++++++
 browser/themes/windows/jar.mn           |    1 +
 10 files changed, 100 insertions(+), 9 deletions(-)

diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 1df295a..b4da3f6 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6034,6 +6034,12 @@ var CanvasPermissionPromptHelper = {
 
   init:
   function CanvasPermissionPromptHelper_init() {
+    if (document.styleSheets && (document.styleSheets.length > 0)) try {
+      let ruleText = "panel[popupid=canvas-permissions-prompt] description { white-space: pre-wrap; }";
+      let sheet = document.styleSheets[0];
+      sheet.insertRule(ruleText, sheet.cssRules.length);
+    } catch (e) {};
+
     Services.obs.addObserver(this, this._permissionsPrompt, false);
   },
 
@@ -6077,10 +6083,10 @@ var CanvasPermissionPromptHelper = {
     var message = getLocalizedString("canvas.siteprompt", [ uri.asciiHost ]);
 
     var mainAction = {
-      label: getLocalizedString("canvas.allow"),
-      accessKey: getLocalizedString("canvas.allowAccessKey"),
+      label: getLocalizedString("canvas.notNow"),
+      accessKey: getLocalizedString("canvas.notNowAccessKey"),
       callback: function() {
-          setCanvasPermission(uri, Ci.nsIPermissionManager.ALLOW_ACTION);
+        return null;
       }
     };
 
@@ -6091,6 +6097,13 @@ var CanvasPermissionPromptHelper = {
         callback: function() {
           setCanvasPermission(uri, Ci.nsIPermissionManager.DENY_ACTION);
         }
+      },
+      {
+        label: getLocalizedString("canvas.allow"),
+        accessKey: getLocalizedString("canvas.allowAccessKey"),
+        callback: function() {
+            setCanvasPermission(uri, Ci.nsIPermissionManager.ALLOW_ACTION);
+        }
       }
     ];
 
diff --git a/browser/themes/linux/browser.css b/browser/themes/linux/browser.css
index 9395669..a47ea4e 100644
--- a/browser/themes/linux/browser.css
+++ b/browser/themes/linux/browser.css
@@ -1207,7 +1207,10 @@ toolbar[iconsize="small"] #webrtc-status-button {
   list-style-image: url("moz-icon://stock/gtk-cancel?size=menu");
 }
 
-.popup-notification-icon[popupid="canvas-permissions-prompt"],
+.popup-notification-icon[popupid="canvas-permissions-prompt"] {
+  list-style-image: url(chrome://browser/skin/canvas-popup.svg);
+}
+
 .popup-notification-icon[popupid="indexedDB-permissions-prompt"],
 .popup-notification-icon[popupid="indexedDB-quota-prompt"],
 .popup-notification-icon[popupid*="offline-app-requested"],
@@ -1291,7 +1294,10 @@ toolbar[iconsize="small"] #webrtc-status-button {
   list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png);
 }
 
-#canvas-notification-icon,
+#canvas-notification-icon {
+  list-style-image: url(chrome://browser/skin/canvas-popup.svg);
+}
+
 .indexedDB-notification-icon,
 #indexedDB-notification-icon {
   list-style-image: url(chrome://global/skin/icons/question-16.png);
diff --git a/browser/themes/linux/canvas-popup.svg b/browser/themes/linux/canvas-popup.svg
new file mode 100644
index 0000000..f99eac3
--- /dev/null
+++ b/browser/themes/linux/canvas-popup.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
+
+ <metadata>image/svg+xmlOpen Clip Art Librarypalette2009-02-17T21:15:25http://openclipart.org/detail/21620/palette-by-benbenclip artclipartcolorcoloriconiconimagemediapaintpaintpalettepalettepngpublic domainsvg</metadata>
+ <g>
+  <title>Layer 1</title>
+  <g id="layer1">
+   <rect fill="#000000" stroke-width="2" stroke-miterlimit="4" stroke-dashoffset="0" ry="23.587006" rx="26.785715" y="0" x="0" height="200" width="200" id="rect6786"/>
+   <g transform="matrix(4.65116, 0, 0, 4.65116, -1717.85, -314.201)" id="g6820">
+    <path fill="#ffffff" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" d="m388.618042,70.128563c-4.746887,0 -18.367279,0.849472 -18.34375,12.3125c0.001312,0.644249 1.226776,2.886879 2.25,3.125c7.5755,1.762962 7.986664,7.834511 7.53125,12.625c-0.03479,0.362747 0.589233,2.891006 1.125,3.53125c4.344635,5.191872 5.822723,7.468742 11.6875,7.46875c11.729614,0 18.3125,-5.93206 18.3125,-17.8125c0,-11.880463 -10.832916,-21.25 -22.5625,-21.25zm-11.875,8.1875c0.986481,0.058029 2.139893,0.464394 3.21875,1.1875c2.157715,1.44622 3.225708,3.668251 2.375,4.9375c-0.850739,1.269257 -3.311005,1.10247 -5.46875,-0.34375c-2.157745,-1.446228 -3.194458,-3.637001 -2.34375,-4.90625c0.425354,-0.634628 1.232269,-0.933029 2.21875,-0.875z" id="path6822"/>
+    <path fill="#ff7a00" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6824" d="m392.586761,76.615746a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#95d300" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6826" d="m402.524292,81.553246a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#00a6e4" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6828" d="m408.461792,90.615746a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#f9de00" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6830" d="m403.643463,99.60791a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#e600ad" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6832" d="m393.518463,100.60791a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+   </g>
+  </g>
+ </g>
+</svg>
\ No newline at end of file
diff --git a/browser/themes/linux/jar.mn b/browser/themes/linux/jar.mn
index b4eaf14..4d1892d 100644
--- a/browser/themes/linux/jar.mn
+++ b/browser/themes/linux/jar.mn
@@ -231,6 +231,7 @@ browser.jar:
   skin/classic/browser/syncQuota.css
   skin/classic/browser/syncProgress.css
 #endif
+  skin/classic/browser/canvas-popup.svg
   skin/classic/browser/webapps-16.png
   skin/classic/browser/webapps-64.png
   skin/classic/browser/notification-pluginNormal.png  (../shared/plugins/notification-pluginNormal.png)
diff --git a/browser/themes/osx/browser.css b/browser/themes/osx/browser.css
index 4166ed0..085a1da 100644
--- a/browser/themes/osx/browser.css
+++ b/browser/themes/osx/browser.css
@@ -3103,7 +3103,10 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
   -moz-margin-start: 0; /* override default label margin to match description margin */
 }
 
-#canvas-notification-icon,
+#canvas-notification-icon {
+  list-style-image: url(chrome://browser/skin/canvas-popup.svg);
+}
+
 .indexedDB-notification-icon,
 #indexedDB-notification-icon {
   list-style-image: url(chrome://global/skin/icons/question-16.png);
@@ -3375,7 +3378,10 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
   -moz-image-region: rect(0px, 48px, 16px, 32px);
 }
 
-.popup-notification-icon[popupid="canvas-permissions-prompt"],
+.popup-notification-icon[popupid="canvas-permissions-prompt"] {
+  list-style-image: url(chrome://browser/skin/canvas-popup.svg);
+}
+
 .popup-notification-icon[popupid="indexedDB-permissions-prompt"],
 .popup-notification-icon[popupid="indexedDB-quota-prompt"],
 .popup-notification-icon[popupid*="offline-app-requested"],
diff --git a/browser/themes/osx/canvas-popup.svg b/browser/themes/osx/canvas-popup.svg
new file mode 100644
index 0000000..f99eac3
--- /dev/null
+++ b/browser/themes/osx/canvas-popup.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
+
+ <metadata>image/svg+xmlOpen Clip Art Librarypalette2009-02-17T21:15:25http://openclipart.org/detail/21620/palette-by-benbenclip artclipartcolorcoloriconiconimagemediapaintpaintpalettepalettepngpublic domainsvg</metadata>
+ <g>
+  <title>Layer 1</title>
+  <g id="layer1">
+   <rect fill="#000000" stroke-width="2" stroke-miterlimit="4" stroke-dashoffset="0" ry="23.587006" rx="26.785715" y="0" x="0" height="200" width="200" id="rect6786"/>
+   <g transform="matrix(4.65116, 0, 0, 4.65116, -1717.85, -314.201)" id="g6820">
+    <path fill="#ffffff" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" d="m388.618042,70.128563c-4.746887,0 -18.367279,0.849472 -18.34375,12.3125c0.001312,0.644249 1.226776,2.886879 2.25,3.125c7.5755,1.762962 7.986664,7.834511 7.53125,12.625c-0.03479,0.362747 0.589233,2.891006 1.125,3.53125c4.344635,5.191872 5.822723,7.468742 11.6875,7.46875c11.729614,0 18.3125,-5.93206 18.3125,-17.8125c0,-11.880463 -10.832916,-21.25 -22.5625,-21.25zm-11.875,8.1875c0.986481,0.058029 2.139893,0.464394 3.21875,1.1875c2.157715,1.44622 3.225708,3.668251 2.375,4.9375c-0.850739,1.269257 -3.311005,1.10247 -5.46875,-0.34375c-2.157745,-1.446228 -3.194458,-3.637001 -2.34375,-4.90625c0.425354,-0.634628 1.232269,-0.933029 2.21875,-0.875z" id="path6822"/>
+    <path fill="#ff7a00" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6824" d="m392.586761,76.615746a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#95d300" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6826" d="m402.524292,81.553246a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#00a6e4" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6828" d="m408.461792,90.615746a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#f9de00" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6830" d="m403.643463,99.60791a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#e600ad" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6832" d="m393.518463,100.60791a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+   </g>
+  </g>
+ </g>
+</svg>
\ No newline at end of file
diff --git a/browser/themes/osx/jar.mn b/browser/themes/osx/jar.mn
index 8295008..de119b1 100644
--- a/browser/themes/osx/jar.mn
+++ b/browser/themes/osx/jar.mn
@@ -329,6 +329,7 @@ browser.jar:
   skin/classic/browser/tabbrowser/alltabs-box-bkgnd-icon at 2x.png        (tabbrowser/alltabs-box-bkgnd-icon-lion at 2x.png)
   skin/classic/browser/lion/tabview/tabview.png                        (tabview/tabview-lion.png)
   skin/classic/browser/lion/places/toolbar.png              (places/toolbar-lion.png)
+  skin/classic/browser/canvas-popup.svg
   skin/classic/browser/webapps-16.png
   skin/classic/browser/webapps-16 at 2x.png
   skin/classic/browser/webapps-64.png
diff --git a/browser/themes/windows/browser.css b/browser/themes/windows/browser.css
index edb064c..7012c41 100644
--- a/browser/themes/windows/browser.css
+++ b/browser/themes/windows/browser.css
@@ -2449,7 +2449,10 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
   -moz-image-region: rect(32px, 32px, 48px, 16px);
 }
 
-.popup-notification-icon[popupid="canvas-permissions-prompt"],
+.popup-notification-icon[popupid="canvas-permissions-prompt"] {
+  list-style-image: url(chrome://browser/skin/canvas-popup.svg);
+}
+
 .popup-notification-icon[popupid="indexedDB-permissions-prompt"],
 .popup-notification-icon[popupid="indexedDB-quota-prompt"],
 .popup-notification-icon[popupid*="offline-app-requested"],
@@ -2531,7 +2534,10 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
   list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png);
 }
 
-#canvas-notification-icon,
+#canvas-notification-icon {
+  list-style-image: url(chrome://browser/skin/canvas-popup.svg);
+}
+
 .indexedDB-notification-icon,
 #indexedDB-notification-icon {
   list-style-image: url(chrome://global/skin/icons/question-16.png);
diff --git a/browser/themes/windows/canvas-popup.svg b/browser/themes/windows/canvas-popup.svg
new file mode 100644
index 0000000..f99eac3
--- /dev/null
+++ b/browser/themes/windows/canvas-popup.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
+
+ <metadata>image/svg+xmlOpen Clip Art Librarypalette2009-02-17T21:15:25http://openclipart.org/detail/21620/palette-by-benbenclip artclipartcolorcoloriconiconimagemediapaintpaintpalettepalettepngpublic domainsvg</metadata>
+ <g>
+  <title>Layer 1</title>
+  <g id="layer1">
+   <rect fill="#000000" stroke-width="2" stroke-miterlimit="4" stroke-dashoffset="0" ry="23.587006" rx="26.785715" y="0" x="0" height="200" width="200" id="rect6786"/>
+   <g transform="matrix(4.65116, 0, 0, 4.65116, -1717.85, -314.201)" id="g6820">
+    <path fill="#ffffff" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" d="m388.618042,70.128563c-4.746887,0 -18.367279,0.849472 -18.34375,12.3125c0.001312,0.644249 1.226776,2.886879 2.25,3.125c7.5755,1.762962 7.986664,7.834511 7.53125,12.625c-0.03479,0.362747 0.589233,2.891006 1.125,3.53125c4.344635,5.191872 5.822723,7.468742 11.6875,7.46875c11.729614,0 18.3125,-5.93206 18.3125,-17.8125c0,-11.880463 -10.832916,-21.25 -22.5625,-21.25zm-11.875,8.1875c0.986481,0.058029 2.139893,0.464394 3.21875,1.1875c2.157715,1.44622 3.225708,3.668251 2.375,4.9375c-0.850739,1.269257 -3.311005,1.10247 -5.46875,-0.34375c-2.157745,-1.446228 -3.194458,-3.637001 -2.34375,-4.90625c0.425354,-0.634628 1.232269,-0.933029 2.21875,-0.875z" id="path6822"/>
+    <path fill="#ff7a00" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6824" d="m392.586761,76.615746a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#95d300" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6826" d="m402.524292,81.553246a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#00a6e4" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6828" d="m408.461792,90.615746a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#f9de00" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6830" d="m403.643463,99.60791a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+    <path fill="#e600ad" stroke-width="1.924773" stroke-miterlimit="4" stroke-dasharray="3.84954572, 3.84954572" stroke-dashoffset="3.657068" id="path6832" d="m393.518463,100.60791a3.5,3.5 0 1 1 -7,0a3.5,3.5 0 1 1 7,0z"/>
+   </g>
+  </g>
+ </g>
+</svg>
\ No newline at end of file
diff --git a/browser/themes/windows/jar.mn b/browser/themes/windows/jar.mn
index eff2220..b9cf33a 100644
--- a/browser/themes/windows/jar.mn
+++ b/browser/themes/windows/jar.mn
@@ -69,6 +69,7 @@ browser.jar:
         skin/classic/browser/urlbar-arrow.png
         skin/classic/browser/urlbar-popup-blocked.png
         skin/classic/browser/urlbar-history-dropmarker.png
+        skin/classic/browser/canvas-popup.svg
         skin/classic/browser/webapps-16.png
         skin/classic/browser/webapps-64.png
         skin/classic/browser/notification-pluginNormal.png           (../shared/plugins/notification-pluginNormal.png)





More information about the tbb-commits mailing list