[Dojo-interest] what changed in 0.4.2rc1 for custom xdomain builds ?

James Burke jburke at dojotoolkit.org
Sat Feb 17 17:44:00 MST 2007


Please disregard my previous reply. I'm confusing things. Responses inline.

James

On 2/16/07, Roberto Saccon <rsaccon at gmail.com> wrote:
> James, thanks, I went through it again, following the updated documentation,
> the dojo.debug error went away (was an error in my script copying the dojo
> release to the webserver), but now I got unfortunately a new problem:
>
> dojo.widget.Parse: error: Permission denied to call method
> XMLHttpRequest.open
>
> I am using custom widgets which do XmlHttp requests, none of them work
> anymore, but the request responses them selfs are ok, I checked with
> firebug.
>
> I am using the following markup for my custom widgets:
>
>   <div dojoType="my_namespace:CustomWidget" ... >foo</div>
>
> Are there new rules how to declare custom widgets with different namespace
> in dojo 0.4.2 ?

The XMLHttpRequest failures seem odd. Are the XHR calls part of widget
loading (ConentPane things), or dojo.io.bind() things?

Declaring custom widgets has not changed with 0.4.2, but the xdomain
support might have trouble with them. I have not given that a lot of
testing. I'll try to construct a test, but it would be good to know
how:
- Do you deploy your custom widgets as xdomain modules?
- Is your custom widgets in a directory that is a sibling to the dojo directory?

You might try doing an explicit dojo.require() call for your widget
manifest file?

> And it got even worse: next I created a simple xdomain test page to check
> XmlHttp with normal dojo widgets:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
> http://www.w3.org/TR/html4/strict.dtd">
> <html>
>  <head>
>  <
> script type="text/javascript" src="
> http://build.dojotoolkit.org/0.4.2rc1/dojo.js"></script>
>  </head>
>  <body>
>  <div
>  id="test" dojoType="ContentPane" href="/foo.txt">bar</div>
>  </body>
>
> </html>
>
>
>
> Now nothing happend when loading that page. I added
> "dojo.require('dojo.widget.ContentPane');", then the 'loading' message
> appeared/disappeared. Is this as it is supposed to be (widgets requiring
> also 'require' statement if the are not part of a custom build ?). And
> unfortunately, initial content 'bar' gets erased, foo.txt does not get
> displayed (but was downloaded), but in the dojo distribution  testcases
> these basic featured obviously work. Is this a reproducible problem related
> to custom created xdomain builds, or just some weired issue with my setup
> (which worked fine prior to dojo 0.4.2rc1) ?

I think the problem is related to xdomain code not being able to scan
the DOM and load widgets on the fly by pulling down the widget
manifest file. I suspected this might be an issue. I was able to get
the above example to work by making an explicit
dojo.require("dojo.widget.ContentPane"). I put up a test page here:
http://www.tagneto.org/dojo/xd042rc1/ContentPane.html

I'll add this to the xdomain documentation: that relying on parsing of
the DOM and "auto-loading" widget code is not supported. Explicit
dojo.require() calls for the desired widgets are needed.

James


More information about the Dojo-interest mailing list