Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#7660 closed defect (fixed)

addOnLoad() called before layer load is finished

Reported by: bill Owned by: James Burke
Priority: high Milestone: 1.2
Component: General Version: 1.2beta
Keywords: Cc: Adam Peller
Blocked By: Blocking:

Description

On http://archive.dojotoolkit.org/nightly/dojotoolkit/demos/i18n/demo.html whenever I click a new language in the tree, I get an error that:

dojo.parser is undefined
[Break on this error] dojo.parser.parse();

This is on FF3/mac in firebug. Refreshing the page makes it display correctly.

Problem appears to be that the first script load is finished but the second one (which contains the parser) isn't.

<script type="text/javascript" src="../../dojo/dojo.js" charset="utf-8"></script>
<script type="text/javascript" src="src.js" charset="utf-8"></script>

Not sure what should be done, maybe a change to the demo(s)?

Change History (11)

comment:1 Changed 11 years ago by Adam Peller

Cc: Adam Peller added

comment:2 Changed 11 years ago by James Burke

I have not looked too closely yet, but this sounds like the Mozilla bug: https://bugzilla.mozilla.org/show_bug.cgi?id=444322

I just tried the archive link above though just now, but did not seem to see an error like this. However, I also do not see the locale applied? For instance, I still see English for the calendar even though I selected what I think is a German locale:

http://archive.dojotoolkit.org/nightly/dojotoolkit/demos/i18n/demo.html?locale=de-AT&dir=ltr

Do you have Firebug activated for that domain? I do -- Firebug 1.2.1b1.

comment:3 Changed 11 years ago by bill

Hmm, I guess so.... I thought the test was designed incorrectly because we weren't waiting for the second <script> tag to finish loading but Pete tells me it's supposed to be synchronous.

I do have the Firebug 1.2.1 enabled for that domain.

As for the locale thing.... try Japanese. You are seeing English because German isn't built by default, as per the comment in the demo "This won't work perfectly unless you've done a full build of dojo.cldr, see the CLDR readme."

comment:4 Changed 11 years ago by Adam Peller

the Austrian variant of German may not be built by default, but German certainly should be. If German resources don't appear, that sounds like a bug also.

comment:5 Changed 11 years ago by Adam Peller

fwiw, I see German on that link.

comment:6 Changed 11 years ago by James Burke

So I tried the following:

  • Load page
  • Click on Japanese. Page loads fine, and stuff is localized.
  • I then select Chinese:

http://archive.dojotoolkit.org/nightly/dojotoolkit/demos/i18n/demo.html?locale=zh-CN&dir=ltr

Then I see the dojo.parser error, and I do not see a request for the i18n bundle for zh-CN. I reload, then I see the request for zh-CN: http://archive.dojotoolkit.org/nightly/dojotoolkit/demos/i18n/nls/src_zh-cn.js

But then I get an "Error: bundle not found" exception in Firebug. That normally means the bundle is bad in some way. So just chalking that up to bad bundle.

As far as the dojo.parser error, it does feel like the Mozilla bug report where Firefox is triggering DOMContentLoaded too soon: the first line in the dojo.addOnLoad() callback is a call to dojo.parser.parse().

Maybe some weirdnesses with the web server setup that could be interfering:

  • That web server is serving JavaScript? files with a "text/x-js" Content-Type. That seems bad, but other JS seems to load.

These are just weird things, may have nothing to do with the real issue.

James

comment:7 Changed 11 years ago by bill

Hmm, interesting. I would guess that src.js is chunked because it's so large (>200K) but I could be wrong. I bet there's some apache setting that would fix that.

comment:8 Changed 11 years ago by Adam Peller

The Chinese didn't load because the page was setting djConfig.locale to zh-CN, and it expects locales in all lower-case. Fixed in [15252]

comment:9 Changed 11 years ago by bill

Milestone: tbd1.2

James is looking at this now.

comment:10 Changed 11 years ago by James Burke

Resolution: fixed
Status: newclosed

(In [15285]) Fixes #7660, I hope. I think it is just the known FF 3 loading bug, so switching to the standard dojo.require approach to loading the code. I'll try the error path again tomorrow after the nightly build runs to see if it happens again.

comment:11 Changed 11 years ago by James Burke

Confirmed this is working on archive.dojotoolkit.org now with the new changes.

Note: See TracTickets for help on using tickets.