Opened 14 years ago

Closed 14 years ago

#6539 closed defect (fixed)

dojo._getText throws error if window has a bas tag and cacheBust is defined.

Reported by: guest Owned by: James Burke
Priority: high Milestone: 1.2
Component: General Version: 1.1.0
Keywords: Cc: [email protected]
Blocked By: Blocking:


If I have a base tag defined, the uri is not converted to a string. If uri is not a string, the indexOf call fails. Below is the section of _getText causing the issue.

	if(!hasBase && dojo._Url){
		uri = (new dojo._Url(owloc, uri)).toString();
		uri += (uri.indexOf("?") == -1 ? "?" : "&") + String(d.config.cacheBust).replace(/\W+/g,"");

Attached is an example with a modified dijit/tests/layout/test_TabContainer.html You will need to update the base href to your specific url.

Attachments (1)

test_TabContainer.html (7.7 KB) - added by guest 14 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 14 years ago by James Burke

Resolution: invalid
Status: newclosed

I believe this is an issue with IE and the BASE tag: it gets confused with a self-closing tag. Use <base></base> instead.

comment:2 Changed 14 years ago by guest

Resolution: invalid
Status: closedreopened

The same issue occurs with suggested <base></base>.

I have updated the example.


Changed 14 years ago by guest

Attachment: test_TabContainer.html added

comment:3 Changed 14 years ago by James Burke

Milestone: 1.2
Owner: changed from anonymous to James Burke
Status: reopenednew

comment:4 Changed 14 years ago by guest

I have done some more digging and the issue happens when a dijit has a templatePath defined like the TabContainer? does.

	templatePath: dojo.moduleUrl("dijit.layout", "templates/TabContainer.html"),

When this is being requested and you have a base defined, uri is not passed as string and it is not converted to a string within the _getText function so the indexOf fails.

A simple brute force fix is to test uri and convert if necessary.

		if (typeof uri != "string") {
			uri = uri.toString();
		uri += (uri.indexOf("?") == -1 ? "?" : "&") + String(d.config.cacheBust).replace(/\W+/g,"");

I'm sure there is a better solution, but hopefully this helps pinpoint that solution.


comment:5 Changed 14 years ago by James Burke

Resolution: fixed
Status: newclosed

(In [13626]) Fixes #6539. Non-string uris (like dojo._Uri objects) cause problems with cacheBust. Thanks to schallm for pinpointing the problem.

Note: See TracTickets for help on using tickets.