#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 13 years ago by
Cc: | Adam Peller added |
---|
comment:2 Changed 13 years ago by
comment:3 Changed 13 years ago by
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 13 years ago by
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:6 Changed 13 years ago by
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.
- http://archive.dojotoolkit.org/nightly/dojotoolkit/demos/i18n/src.js is the only file that is served as transfer encoding: chunked, and it does not have a defined Content-Length. All other JS requests (including dojo.js) had defined Content-Lengths. Any thoughts as to why that file would be chunked?
These are just weird things, may have nothing to do with the real issue.
James
comment:7 Changed 13 years ago by
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 13 years ago by
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:10 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:11 Changed 13 years ago by
Confirmed this is working on archive.dojotoolkit.org now with the new changes.
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.