#1489 closed defect (fixed)
Error in dojo.widget.manager.getImplementationName + Namespace code Dojo & Me Dojo Mail
Reported by: | Owned by: | sjmiles | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Widgets | Version: | 0.4 |
Keywords: | Namespace Widget | Cc: | |
Blocked By: | Blocking: |
Description
There's a bug in the dojo namespace loading code. It occurs in the dojo.widget.manager.getImplementationName function when it is auto-loading a namespace manifest.js file. If the function can't find a previously loaded version of the Namespace object, it executes the code:
lookup namespace var nsObj = dojonamespace?.get(ns); if(!nsObj){
default to <ns>.widget by convention dojo.namespace.register(ns, ns + '.widget'); nsObj = dojonamespace?.get(ns);
}
which seems to create some kind of dummy namespace manifest. I'm not sure what purpose this serves, but obviously it must achieve something. However, when it gets around to loading the proper manifest.js file, which calls the dojo.registerNamespaceManifest function, which eventually results in the dojo.namespace.register function being called, the real Namespace object is ignored by the code:
register: function(name, module, resolver /*optional*/, noOverride) {
if((!noOverride)&&(!this.namespaces[name])){
this.namespaces[name] = new dojonamespace?.Namespace(name, module, resolver);
}
}
because the previous, dummy, Namespace was registered.
Removing the dummy namespace instantiation fixed the problem of course, but that's not a satisfactory solution since I don't know what that code was supposed to achieve.
The problem is here:
That expression can be read
when it should be
NB: overriding is default (hence the otherwise confusing variable name noOverride).
Should be fixed in r5890.
The earlier code you mentioned is there to support the default widget module mapping <module>.widget. Defaults are prepared for all values in the canonical case for custom widget packages (i.e. /dojo/../<custom>/<widget>).
Thanks for the ticketing this bug. If you could verify the fix I'd appreciate it.