a chrome code does not work

Ask for help about NoScript, no registration needed to post
Alice0775
Posts: 7
Joined: Sat Apr 17, 2010 1:31 am

a chrome code does not work

Post by Alice0775 »

The following code would not run if NoScript installed.
The problem does not happen if disabled NoScript.

Step to Reproduce:
1. Run Firefox with clean profile
2. Install NoScript2.4.5 and restart
3. Set devtools.chrome.enabled to true in about:config
4. Open any web page
5. Open Scrachpad(Shift+F4)
6. Set Environment > browser
7. Paste the following

Code: Select all

(function(){
  var win = content;
  var tab = gBrowser.addTab( "about:blank");
  var browser = gBrowser.getBrowserForTab(tab);
  browser.addEventListener('load', function(event) {
    browser.removeEventListener('load', arguments.callee, true);
    var doc = browser.contentDocument;
    var canvas = doc.body.appendChild(doc.createElement('canvas'));
    canvas.style.display = 'inline';
    canvas.width = 200;
    canvas.height = 200;
    var ctx = canvas.getContext("2d");
    ctx.drawWindow(win, 0, 0, 200, 200, "rgb(255,255,255)");
    gBrowser.selectedTab = tab;
  }, true);
})();
8. Execute > Run (Ctrl+R)

Actual results:
an empty tab is opened

Expected results:
a tab is opened with canvas (captured image for step4)
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20100101 Firefox/9.0
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: a chrome code does not work

Post by Thrawn »

Hmm...I'm not much familiar with DevTools, but when I tried this on startpage.com, it worked as expected (copied a 200*200 chunk of the original page), even if I didn't whitelist StartPage. I'm using NoScript 2.4.6; can you try it (or try latest development build) and see whether your problem is fixed?
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:11.0) Gecko/20100101 Firefox/11.0
User avatar
therube
Ambassador
Posts: 7980
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: a chrome code does not work

Post by therube »

I get the same results as Alice0775, so not working for me.

FF13.0.1 & NoScript (I'd tell you what version if I could figure out where the NoScript icon is? How people use FF is beyond me.)

Restart in Safe Mode & it works.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120619 Firefox/15.0a2 SeaMonkey/2.12a2
Post Reply