Page 1 of 1

[RESOLVED] WebScreenShot.uc.xul blocked

Posted: Wed Jan 23, 2013 5:09 pm
by Endor
Hi.
I use Firefox 18.01, NoScript 2.6.44rc2 and Windows 7 Home
I use the Script WebScreenShot.uc.xul from here:
https://github.com/Griever/userChromeJS ... hot.uc.xul

with NoScript activated it not work and the NoScript Symbol looks so:

Image

If I disable NoScript, it works.
What can I do that it works, or is this a bug in NoScript?

Thank you for any help.
Cheers
Endor

Re: WebScreenShot.uc.xul blocked

Posted: Thu Jan 24, 2013 4:48 am
by Tom T.
Hi,

Before investigating the issue, please note that third-party add-ons from sources other than Firefox Add-ons are more likely to be problematical. Mozilla add-ons is not perfect, but they have been trying harder to ensure safety, and perhaps compatibility. If you are seeking an add-on to capture screenshots, a search of Firefox Add-ons showed a number of add-ons that claim to do this. Perhaps this would solve the problem?

Also please note that anything from a Github repository could theoretically contain malicious code uploaded by any user.

Can any of the "official" add-ons do the function you desire?

Re: WebScreenShot.uc.xul blocked

Posted: Thu Jan 24, 2013 9:59 am
by Endor
Hi Tom T.
Thank you for your answer.
Your right, Add-ons or Scripts from anywhere else than https://addons.mozilla.org,
could contain malicious content. This is a script, which provide the
same functionality as an add-on. This script not only made Screen-shots, but
also contains a base64 encoder for images. The encoder works well.

Only the screen-shot part is blocked in part by NoScript.
This script adds a sub-menu to the Tools menu, with 4 menu entries to make
screen-shots. When you click on one of this entries the script made a screen-shot
and opens the image in a new tab. Whit NoScript enabled the New Tab is empty.
No image there. Nothing to save.
I hope you or Giorgio are able to help me.
Cheers
Endor

Re: WebScreenShot.uc.xul blocked

Posted: Thu Jan 24, 2013 7:44 pm
by Giorgio Maone
The problem is about:blank being JavaScript disabled whenever a CAPS policy is in effect (it seems a Firefox bug introduced in Firefox 4 or so, but there's no incentive to fix it).

You (and the script's author) can work-around by modifying the capture method this way:

Code: Select all

capture: function(win, x, y, w, h) {
    var tab = gBrowser.addTab("about:support");
    var browser = gBrowser.getBrowserForTab(tab);
    browser.addEventListener('load', function(event) {
    browser.removeEventListener('load', arguments.callee, true);
        var doc = browser.contentDocument;

        doc.head.innerHTML = doc.body.innerHTML=""
        
        var canvas = doc.body.appendChild(doc.createElement('canvas'));
        
        canvas.style.border = "1px solid red"
        canvas.width = w;
        canvas.height = h;
        var ctx = canvas.getContext("2d");
        ctx.drawWindow(win, x, y, x + w, y + h, "rgb(255,255,255)");
        gBrowser.selectedTab = tab;

    }, true);
}

Re: WebScreenShot.uc.xul blocked

Posted: Thu Jan 24, 2013 7:57 pm
by Endor
Hi Giorgio.
Thank you very much for your help.
I modified the Script like you suggested, and it works perfect!
Image

Cheers
Endor