Page 1 of 1

a chrome code does not work

Posted: Mon Jun 11, 2012 3:57 am
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)

Re: a chrome code does not work

Posted: Tue Jun 19, 2012 10:36 am
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?

Re: a chrome code does not work

Posted: Thu Jun 21, 2012 3:13 am
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.