Right_Links icon indicating copy to clipboard operation
Right_Links copied to clipboard

Use faster canvas.toBlob() instead of canvas.toDataURL()

Open Infocatcher opened this issue 9 years ago • 4 comments

Just like built-in "View Image" from page context menu

canvas.toBlob(function(blob) {
    var url = URL.createObjectURL(blob);
    // ...
});

Infocatcher avatar Oct 05 '16 20:10 Infocatcher

Preferences:

  • extensions.rightlinks.enabledOnCanvasImages – completely enable/disable <canvas> handling
  • extensions.rightlinks.enabledOnCanvasImages.sizeLimit – handle only small <canvas> (or 0 to disable limits and handle everything)
  • extensions.rightlinks.enabledOnCanvasImages.useBlob – use faster blob:… URIs instead of base64 data:…

Infocatcher avatar Oct 12 '16 20:10 Infocatcher

Looks interesting. Do you know if this technique will be compatible with the canvas blocking tools such as:

https://addons.mozilla.org/firefox/addon/canvas-fingerprint-blocker/ https://addons.mozilla.org/firefox/addon/canvasblocker/ https://addons.mozilla.org/firefox/addon/no-canvas-fingerprinting/

Gitoffthelawn avatar Oct 14 '16 18:10 Gitoffthelawn

Do you know if this technique will be compatible with the canvas blocking tools

Hmm... In CanvasBlocker (also looks like this extensions handles most of all canvas APIs): https://addons.mozilla.org/files/browse/479595/file/lib/modifiedAPI.js#L65

        toBlob: {
                type: "readout",
                object: "HTMLCanvasElement",
                fake: function toBlob(callback){
                    var window = getWindow(this);
                    return window.HTMLCanvasElement.prototype.toBlob.apply(getFakeCanvas(window, this), arguments);
                },
                exportOptions: {allowCallbacks: true}
            },

In Canvas Defender (canvas_defender-1.0.9-an+fx.xpi/data/js/content.js):

        overrideCanvasInternal("toDataURL", root.prototype.toDataURL);
        overrideCanvasInternal("toBlob", root.prototype.toBlob);
        overrideCanvasInternal("mozGetAsFile", root.prototype.mozGetAsFile);

And Canvas Fingerprint Blocker doesn't contains toBlob string in sources...

Infocatcher avatar Oct 15 '16 18:10 Infocatcher

Great research! What's your conclusion?

Gitoffthelawn avatar Oct 17 '16 20:10 Gitoffthelawn