Dojo Problems with NoScript Enabled

Post a reply

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Dojo Problems with NoScript Enabled

Re: Dojo Problems with NoScript Enabled

by Giorgio Maone » Wed Sep 02, 2009 7:23 am

NealWalters wrote: 1) I had NoScript set to the supposed dangerous 'Allow Scripts Globally'. If that is set - what more would be there be to set?
Nothing else.
NealWalters wrote: 2) As to the race condition, I agree that if I need widget/dijits, etc..., that I would do a dojo.require in the onLoad. But we have a catch 22, if "dojo" itself is not available, I cannot do a dojo.require or a dojo.onLoad. So I don't believe that is the issue here.
The first inclusion (using a static SCRIPT element) is more stable and subject to timing / event loop / cross-browser issues than dojo.require and dojo.onLoad. They're definitely diffent beasts.
NealWalters wrote: 3) Firebug and Fiddler both show that the dojo.js was never retrieved. (Unless FireFox itself thinks it has it cached somewhere.)
This hints at a temporary networking issue.
NealWalters wrote: So my question is, if I have checked "Scripts Globally Allowed (dangerous)" why should I have to whitelist anything?
As I already said, no you shouldn't.
In facts, it's working fine for me "out of the box" with Scripts Globally Allowed and the default whitelist.

Re: Dojo Problems with NoScript Enabled

by NealWalters » Wed Sep 02, 2009 12:30 am

Thanks. But let me recap:

1) I had NoScript set to the supposed dangerous 'Allow Scripts Globally'. If that is set - what more would be there be to set?

2) As to the race condition, I agree that if I need widget/dijits, etc..., that I would do a dojo.require in the onLoad. But we have a catch 22, if "dojo" itself is not available, I cannot do a dojo.require or a dojo.onLoad. So I don't believe that is the issue here.

3) Firebug and Fiddler both show that the dojo.js was never retrieved. (Unless FireFox itself thinks it has it cached somewhere.)

Google has an actual planned maintenance right now, so I can't retest everything, but I tried my local copy, and
adding ajax.googleapis.com to the "whitelist" seems also to fix it.

So my question is, if I have checked "Scripts Globally Allowed (dangerous)" why should I have to whitelist anything?


Thanks for the input.
Neal Walters

Re: Dojo Problems with NoScript Enabled

by Foam Head » Tue Sep 01, 2009 10:17 pm

I've been developing a Dojo 1.3.* web application in FireFox 3.0.* -> 3.5.2 (on Windows) and I've never had any issues like this with NoScript. It's possible that you and I have something configured differently, but once I've configured NoScript to include the necessary hosts (for the example you gave at stackoverflow.com, you'd need ajax.googleapis.com and 3wcloud-com-provisioning-qa.appspot.com to be trusted), it has never interfered with Dojo.

Looking at your example, I think the problem is your use of Dojo. It is very poorly documented, but the Dojo XD loader is an *asynchronous* loader. When using the XD loader, dojo.require returns immediately, but the module is loaded in the background. You aren't using any dojo.require's, but the concept applies to page loading as well. The only way to know when all dojo.require'd modules have been loaded is by using dojo.addOnLoad. My replies aren't visible (stupid Drupal software Dojo uses...), but you should be able to get the point from this Dojo thread.

Back to your example, you aren't using any addOnLoad's. This means you are completely relying on race conditions to define dojo.* before your inline JavaScript runs. I'm guessing that with NoScript doing some extra validations, the timing is different and you see an error. However, the root cause is the race condition. Use some addOnLoad's and you should see your problem fixed even with NoScript enabled :D.

-Foam

Re: Dojo Problems with NoScript Enabled

by Giorgio Maone » Tue Sep 01, 2009 10:09 pm

It's working fine here.
I just needed to allow 3wcloud-com-provisioning-qa.appspot.com and ajax.googleapis.com.

Dojo Problems with NoScript Enabled

by NealWalters » Tue Sep 01, 2009 9:40 pm

I finally had to "disable" No-Script to get Dojo to work in FireFox 3.5.2. Somehow, NoScript seemed to be preventing a JavaScript to download from a CDN source, even though I had "allow scripts globally".

Please see here for full details.
http://stackoverflow.com/questions/1362 ... -3-5-issue

Thanks,
Neal

Top