Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 1
if(!dojo._hasResource["dojo._base._loader.loader_xd"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2
dojo._hasResource["dojo._base._loader.loader_xd"] = true;
3
//Cross-domain resource loader.
4
dojo.provide("dojo._base._loader.loader_xd");
5
 
6
dojo._xdReset = function(){
7
	//summary: Internal xd loader function. Resets the xd state.
8
 
9
	//This flag indicates where or not we have crossed into xdomain territory. Once any resource says
10
	//it is cross domain, then the rest of the resources have to be treated as xdomain because we need
11
	//to evaluate resources in order. If there is a xdomain resource followed by a xhr resource, we can't load
12
	//the xhr resource until the one before it finishes loading. The text of the xhr resource will be converted
13
	//to match the format for a xd resource and put in the xd load queue.
14
	this._isXDomain = djConfig.useXDomain || false;
15
 
16
	this._xdTimer = 0;
17
	this._xdInFlight = {};
18
	this._xdOrderedReqs = [];
19
	this._xdDepMap = {};
20
	this._xdContents = [];
21
	this._xdDefList = [];
22
}
23
 
24
//Call reset immediately to set the state.
25
dojo._xdReset();
26
 
27
dojo._xdCreateResource = function(/*String*/contents, /*String*/resourceName, /*String*/resourcePath){
28
	//summary: Internal xd loader function. Creates an xd module source given an
29
	//non-xd module contents.
30
 
31
	//Remove comments. Not perfect, but good enough for dependency resolution.
32
	var depContents = contents.replace(/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg , "");
33
 
34
	//Find dependencies.
35
	var deps = [];
36
    var depRegExp = /dojo.(require|requireIf|provide|requireAfterIf|platformRequire|requireLocalization)\(([\w\W]*?)\)/mg;
37
    var match;
38
	while((match = depRegExp.exec(depContents)) != null){
39
		if(match[1] == "requireLocalization"){
40
			//Need to load the local bundles asap, since they are not
41
			//part of the list of modules watched for loading.
42
			eval(match[0]);
43
		}else{
44
			deps.push('"' + match[1] + '", ' + match[2]);
45
		}
46
	}
47
 
48
	//Create resource object and the call to _xdResourceLoaded.
49
	var output = [];
50
	output.push("dojo._xdResourceLoaded({\n");
51
 
52
	//Add dependencies
53
	if(deps.length > 0){
54
		output.push("depends: [");
55
		for(var i = 0; i < deps.length; i++){
56
			if(i > 0){
57
				output.push(",\n");
58
			}
59
			output.push("[" + deps[i] + "]");
60
		}
61
		output.push("],");
62
	}
63
 
64
	//Add the contents of the file inside a function.
65
	//Pass in dojo as an argument to the function to help with
66
	//allowing multiple versions of dojo in a page.
67
	output.push("\ndefineResource: function(dojo){");
68
 
69
	//Don't put in the contents in the debugAtAllCosts case
70
	//since the contents may have syntax errors. Let those
71
	//get pushed up when the script tags are added to the page
72
	//in the debugAtAllCosts case.
73
	if(!djConfig["debugAtAllCosts"] || resourceName == "dojo._base._loader.loader_debug"){
74
		output.push(contents);
75
	}
76
	//Add isLocal property so we know if we have to do something different
77
	//in debugAtAllCosts situations.
78
	output.push("\n}, resourceName: '" + resourceName + "', resourcePath: '" + resourcePath + "'});");
79
 
80
	return output.join(""); //String
81
}
82
 
83
dojo._xdIsXDomainPath = function(/*string*/relpath) {
84
    //summary: Figure out whether the path is local or x-domain
85
	//If there is a colon before the first / then, we have a URL with a protocol.
86
 
87
	var colonIndex = relpath.indexOf(":");
88
	var slashIndex = relpath.indexOf("/");
89
 
90
	if(colonIndex > 0 && colonIndex < slashIndex){
91
		return true;
92
	}else{
93
		//Is the base script URI-based URL a cross domain URL?
94
		//If so, then the relpath will be evaluated relative to
95
		//baseUrl, and therefore qualify as xdomain.
96
		//Only treat it as xdomain if the page does not have a
97
		//host (file:// url) or if the baseUrl does not match the
98
		//current window's domain.
99
		var url = this.baseUrl;
100
		colonIndex = url.indexOf(":");
101
		slashIndex = url.indexOf("/");
102
		if(colonIndex > 0 && colonIndex < slashIndex && (!location.host || url.indexOf("http://" + location.host) != 0)){
103
			return true;
104
		}
105
	}
106
    return false;
107
}
108
 
109
dojo._loadPath = function(/*String*/relpath, /*String?*/module, /*Function?*/cb){
110
	//summary: Internal xd loader function. Overrides loadPath() from loader.js.
111
	//xd loading requires slightly different behavior from loadPath().
112
 
113
	var currentIsXDomain = this._xdIsXDomainPath(relpath);
114
    this._isXDomain |= currentIsXDomain;
115
 
116
	var uri = this.baseUrl + relpath;
117
	if(currentIsXDomain){
118
        // check whether the relpath is an absolute URL itself. If so, we
119
        // ignore baseUrl
120
    	var colonIndex = relpath.indexOf(":");
121
    	var slashIndex = relpath.indexOf("/");
122
        if(colonIndex > 0 && colonIndex < slashIndex){
123
		    uri = relpath;
124
    	}
125
    }
126
 
127
	if(djConfig.cacheBust && dojo.isBrowser) { uri += "?" + String(djConfig.cacheBust).replace(/\W+/g,""); }
128
	try{
129
		return ((!module || this._isXDomain) ? this._loadUri(uri, cb, currentIsXDomain, module) : this._loadUriAndCheck(uri, module, cb)); //Boolean
130
	}catch(e){
131
		console.debug(e);
132
		return false; //Boolean
133
	}
134
}
135
 
136
dojo._loadUri = function(/*String*/uri, /*Function?*/cb, /*boolean*/currentIsXDomain, /*String?*/module){
137
	//summary: Internal xd loader function. Overrides loadUri() from loader.js.
138
	//		xd loading requires slightly different behavior from loadPath().
139
	//description: Wanted to override getText(), but it is used by
140
	//		the widget code in too many, synchronous ways right now.
141
	if(this._loadedUrls[uri]){
142
		return 1; //Boolean
143
	}
144
 
145
	//Add the module (resource) to the list of modules.
146
	//Only do this work if we have a modlue name. Otherwise,
147
	//it is a non-xd i18n bundle, which can load immediately and does not
148
	//need to be tracked. Also, don't track dojo.i18n, since it is a prerequisite
149
	//and will be loaded correctly if we load it right away: it has no dependencies.
150
	if(this._isXDomain && module && module != "dojo.i18n"){
151
		this._xdOrderedReqs.push(module);
152
 
153
		//Add to waiting resources if it is an xdomain resource.
154
		//Don't add non-xdomain i18n bundles, those get evaled immediately.
155
		if(currentIsXDomain || uri.indexOf("/nls/") == -1){
156
			this._xdInFlight[module] = true;
157
 
158
			//Increment inFlightCount
159
			//This will stop the modulesLoaded from firing all the way.
160
			this._inFlightCount++;
161
		}
162
 
163
		//Start timer
164
		if(!this._xdTimer){
165
			this._xdTimer = setInterval("dojo._xdWatchInFlight();", 100);
166
		}
167
		this._xdStartTime = (new Date()).getTime();
168
	}
169
 
170
	if (currentIsXDomain){
171
		//Fix name to be a .xd.fileextension name.
172
		var lastIndex = uri.lastIndexOf('.');
173
		if(lastIndex <= 0){
174
			lastIndex = uri.length - 1;
175
		}
176
 
177
		var xdUri = uri.substring(0, lastIndex) + ".xd";
178
		if(lastIndex != uri.length - 1){
179
			xdUri += uri.substring(lastIndex, uri.length);
180
		}
181
 
182
		//Add to script src
183
		var element = document.createElement("script");
184
		element.type = "text/javascript";
185
		element.src = xdUri;
186
		if(!this.headElement){
187
			this._headElement = document.getElementsByTagName("head")[0];
188
 
189
			//Head element may not exist, particularly in html
190
			//html 4 or tag soup cases where the page does not
191
			//have a head tag in it. Use html element, since that will exist.
192
			//Seems to be an issue mostly with Opera 9 and to lesser extent Safari 2
193
			if(!this._headElement){
194
				this._headElement = document.getElementsByTagName("html")[0];
195
			}
196
		}
197
		this._headElement.appendChild(element);
198
	}else{
199
		var contents = this._getText(uri, null, true);
200
		if(contents == null){ return 0; /*boolean*/}
201
 
202
		//If this is not xdomain, or if loading a i18n resource bundle, then send it down
203
		//the normal eval/callback path.
204
		if(this._isXDomain
205
			&& uri.indexOf("/nls/") == -1
206
			&& module != "dojo.i18n"){
207
			var res = this._xdCreateResource(contents, module, uri);
208
			dojo.eval(res);
209
		}else{
210
			if(cb){ contents = '('+contents+')'; }
211
			var value = dojo.eval(contents);
212
			if(cb){
213
				cb(value);
214
			}
215
		}
216
	}
217
 
218
	//These steps are done in the non-xd loader version of this function.
219
	//Maintain these steps to fit in with the existing system.
220
	this._loadedUrls[uri] = true;
221
	this._loadedUrls.push(uri);
222
	return true; //Boolean
223
}
224
 
225
dojo._xdResourceLoaded = function(/*Object*/res){
226
	//summary: Internal xd loader function. Called by an xd module resource when
227
	//it has been loaded via a script tag.
228
	var deps = res.depends;
229
	var requireList = null;
230
	var requireAfterList = null;
231
	var provideList = [];
232
	if(deps && deps.length > 0){
233
		var dep = null;
234
		var insertHint = 0;
235
		var attachedResource = false;
236
		for(var i = 0; i < deps.length; i++){
237
			dep = deps[i];
238
 
239
			//Look for specific dependency indicators.
240
			if (dep[0] == "provide"){
241
				provideList.push(dep[1]);
242
			}else{
243
				if(!requireList){
244
					requireList = [];
245
				}
246
				if(!requireAfterList){
247
					requireAfterList = [];
248
				}
249
 
250
				var unpackedDeps = this._xdUnpackDependency(dep);
251
				if(unpackedDeps.requires){
252
					requireList = requireList.concat(unpackedDeps.requires);
253
				}
254
				if(unpackedDeps.requiresAfter){
255
					requireAfterList = requireAfterList.concat(unpackedDeps.requiresAfter);
256
				}
257
			}
258
 
259
			//Call the dependency indicator to allow for the normal dojo setup.
260
			//Only allow for one dot reference, for the i18n._preloadLocalizations calls
261
			//(and maybe future, one-dot things).
262
			var depType = dep[0];
263
			var objPath = depType.split(".");
264
			if(objPath.length == 2){
265
				dojo[objPath[0]][objPath[1]].apply(dojo[objPath[0]], dep.slice(1));
266
			}else{
267
				dojo[depType].apply(dojo, dep.slice(1));
268
			}
269
		}
270
 
271
 
272
		//If loading the debugAtAllCosts module, eval it right away since we need
273
		//its functions to properly load the other modules.
274
		if(provideList.length == 1 && provideList[0] == "dojo._base._loader.loader_debug"){
275
			res.defineResource(dojo);
276
		}else{
277
			//Save off the resource contents for definition later.
278
			var contentIndex = this._xdContents.push({
279
					content: res.defineResource,
280
					resourceName: res["resourceName"],
281
					resourcePath: res["resourcePath"],
282
					isDefined: false
283
				}) - 1;
284
 
285
			//Add provide/requires to dependency map.
286
			for(var i = 0; i < provideList.length; i++){
287
				this._xdDepMap[provideList[i]] = { requires: requireList, requiresAfter: requireAfterList, contentIndex: contentIndex };
288
			}
289
		}
290
 
291
		//Now update the inflight status for any provided resources in this loaded resource.
292
		//Do this at the very end (in a *separate* for loop) to avoid shutting down the
293
		//inflight timer check too soon.
294
		for(var i = 0; i < provideList.length; i++){
295
			this._xdInFlight[provideList[i]] = false;
296
		}
297
	}
298
}
299
 
300
dojo._xdLoadFlattenedBundle = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale, /*Object*/bundleData){
301
	//summary: Internal xd loader function. Used when loading
302
	//a flattened localized bundle via a script tag.
303
	locale = locale || "root";
304
	var jsLoc = dojo.i18n.normalizeLocale(locale).replace('-', '_');
305
 	var bundleResource = [moduleName, "nls", bundleName].join(".");
306
	var bundle = dojo["provide"](bundleResource);
307
	bundle[jsLoc] = bundleData;
308
 
309
	//Assign the bundle for the original locale(s) we wanted.
310
	var mapName = [moduleName, jsLoc, bundleName].join(".");
311
	var bundleMap = dojo._xdBundleMap[mapName];
312
	if(bundleMap){
313
		for(var param in bundleMap){
314
			bundle[param] = bundleData;
315
		}
316
	}
317
};
318
 
319
 
320
dojo._xdInitExtraLocales = function(){
321
	// Simulate the extra locale work that dojo.requireLocalization does.
322
 
323
	var extra = djConfig.extraLocale;
324
	if(extra){
325
		if(!extra instanceof Array){
326
			extra = [extra];
327
		}
328
 
329
		dojo._xdReqLoc = dojo.xdRequireLocalization;
330
		dojo.xdRequireLocalization = function(m, b, locale, fLocales){
331
			dojo._xdReqLoc(m,b,locale, fLocales);
332
			if(locale){return;}
333
			for(var i=0; i<extra.length; i++){
334
				dojo._xdReqLoc(m,b,extra[i], fLocales);
335
			}
336
		};
337
	}
338
}
339
 
340
dojo._xdBundleMap = {};
341
 
342
dojo.xdRequireLocalization = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale, /*String*/availableFlatLocales){
343
	//summary: Internal xd loader function. The xd version of dojo.requireLocalization.
344
 
345
 
346
	//Account for allowing multiple extra locales. Do this here inside the function
347
	//since dojo._xdInitExtraLocales() depends on djConfig being set up, but that only
348
	//happens after hostenv_browser runs. loader_xd has to come before hostenv_browser
349
	//though since hostenv_browser can do a dojo.require for the debug module.
350
	if(dojo._xdInitExtraLocales){
351
		dojo._xdInitExtraLocales();
352
		dojo._xdInitExtraLocales = null;
353
		dojo.xdRequireLocalization.apply(dojo, arguments);
354
		return;
355
	}
356
 
357
	var locales = availableFlatLocales.split(",");
358
 
359
	//Find the best-match locale to load.
360
	//Assumes dojo.i18n has already been loaded. This is true for xdomain builds,
361
	//since it is included in dojo.xd.js.
362
	var jsLoc = dojo.i18n.normalizeLocale(locale);
363
 
364
	var bestLocale = "";
365
	for(var i = 0; i < locales.length; i++){
366
		//Locale must match from start of string.
367
		if(jsLoc.indexOf(locales[i]) == 0){
368
			if(locales[i].length > bestLocale.length){
369
				bestLocale = locales[i];
370
			}
371
		}
372
	}
373
 
374
	var fixedBestLocale = bestLocale.replace('-', '_');
375
	//See if the bundle we are going to use is already loaded.
376
 	var bundleResource = dojo.getObject([moduleName, "nls", bundleName].join("."));
377
	if(bundleResource && bundleResource[fixedBestLocale]){
378
		bundle[jsLoc.replace('-', '_')] = bundleResource[fixedBestLocale];
379
	}else{
380
		//Need to remember what locale we wanted and which one we actually use.
381
		//Then when we load the one we are actually using, use that bundle for the one
382
		//we originally wanted.
383
		var mapName = [moduleName, (fixedBestLocale||"root"), bundleName].join(".");
384
		var bundleMap = dojo._xdBundleMap[mapName];
385
		if(!bundleMap){
386
			bundleMap = dojo._xdBundleMap[mapName] = {};
387
		}
388
		bundleMap[jsLoc.replace('-', '_')] = true;
389
 
390
		//Do just a normal dojo.require so the resource tracking stuff works as usual.
391
		dojo.require(moduleName + ".nls" + (bestLocale ? "." + bestLocale : "") + "." + bundleName);
392
	}
393
}
394
 
395
// Replace dojo.requireLocalization with a wrapper
396
dojo._xdRealRequireLocalization = dojo.requireLocalization;
397
dojo.requireLocalization = function(/*String*/moduleName, /*String*/bundleName, /*String?*/locale, /*String*/availableFlatLocales){
398
    // summary: loads a bundle intelligently based on whether the module is
399
    // local or xd. Overrides the local-case implementation.
400
 
401
    var modulePath = this.moduleUrl(moduleName).toString();
402
    if (this._xdIsXDomainPath(modulePath)) {
403
        // call cross-domain loader
404
        return dojo.xdRequireLocalization.apply(dojo, arguments);
405
    } else {
406
        // call local-loader
407
        return dojo._xdRealRequireLocalization.apply(dojo, arguments);
408
    }
409
}
410
 
411
//This is a bit brittle: it has to know about the dojo methods that deal with dependencies
412
//It would be ideal to intercept the actual methods and do something fancy at that point,
413
//but I have concern about knowing which provide to match to the dependency in that case,
414
//since scripts can load whenever they want, and trigger new calls to dojo._xdResourceLoaded().
415
dojo._xdUnpackDependency = function(/*Array*/dep){
416
	//summary: Internal xd loader function. Determines what to do with a dependency
417
	//that was listed in an xd version of a module contents.
418
 
419
	//Extract the dependency(ies).
420
	var newDeps = null;
421
	var newAfterDeps = null;
422
	switch(dep[0]){
423
		case "requireIf":
424
		case "requireAfterIf":
425
			//First arg (dep[1]) is the test. Depedency is dep[2].
426
			if(dep[1] === true){
427
				newDeps = [{name: dep[2], content: null}];
428
			}
429
			break;
430
		case "platformRequire":
431
			var modMap = dep[1];
432
			var common = modMap["common"]||[];
433
			var newDeps = (modMap[dojo.hostenv.name_]) ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]);
434
			//Flatten the array of arrays into a one-level deep array.
435
			//Each result could be an array of 3 elements  (the 3 arguments to dojo.require).
436
			//We only need the first one.
437
			if(newDeps){
438
				for(var i = 0; i < newDeps.length; i++){
439
					if(newDeps[i] instanceof Array){
440
						newDeps[i] = {name: newDeps[i][0], content: null};
441
					}else{
442
						newDeps[i] = {name: newDeps[i], content: null};
443
					}
444
				}
445
			}
446
			break;
447
		case "require":
448
			//Just worry about dep[1]
449
			newDeps = [{name: dep[1], content: null}];
450
			break;
451
		case "i18n._preloadLocalizations":
452
			//We can eval these immediately, since they load i18n bundles.
453
			//Since i18n bundles have no dependencies, whenever they are loaded
454
			//in a script tag, they are evaluated immediately, so we do not have to
455
			//treat them has an explicit dependency for the dependency mapping.
456
			//We can call it immediately since dojo.i18n is part of dojo.xd.js.
457
			dojo.i18n._preloadLocalizations.apply(dojo.i18n._preloadLocalizations, dep.slice(1));
458
			break;
459
	}
460
 
461
	//The requireIf and requireAfterIf needs to be evaluated after the current resource is evaluated.
462
	if(dep[0] == "requireAfterIf" || dep[0] == "requireIf"){
463
		newAfterDeps = newDeps;
464
		newDeps = null;
465
	}
466
	return {requires: newDeps, requiresAfter: newAfterDeps}; //Object
467
}
468
 
469
dojo._xdWalkReqs = function(){
470
	//summary: Internal xd loader function.
471
	//Walks the requires and evaluates module resource contents in
472
	//the right order.
473
	var reqChain = null;
474
	var req;
475
	for(var i = 0; i < this._xdOrderedReqs.length; i++){
476
		req = this._xdOrderedReqs[i];
477
		if(this._xdDepMap[req]){
478
			reqChain = [req];
479
			reqChain[req] = true; //Allow for fast lookup of the req in the array
480
			this._xdEvalReqs(reqChain);
481
		}
482
	}
483
}
484
 
485
dojo._xdEvalReqs = function(/*Array*/reqChain){
486
	//summary: Internal xd loader function.
487
	//Does a depth first, breadth second search and eval of required modules.
488
	while(reqChain.length > 0){
489
		var req = reqChain[reqChain.length - 1];
490
		var res = this._xdDepMap[req];
491
		if(res){
492
			//Trace down any requires for this resource.
493
			//START dojo._xdTraceReqs() inlining for small Safari 2.0 call stack
494
			var reqs = res.requires;
495
			if(reqs && reqs.length > 0){
496
				var nextReq;
497
				for(var i = 0; i < reqs.length; i++){
498
					nextReq = reqs[i].name;
499
					if(nextReq && !reqChain[nextReq]){
500
						//New req depedency. Follow it down.
501
						reqChain.push(nextReq);
502
						reqChain[nextReq] = true;
503
						this._xdEvalReqs(reqChain);
504
					}
505
				}
506
			}
507
			//END dojo._xdTraceReqs() inlining for small Safari 2.0 call stack
508
 
509
			//Evaluate the resource.
510
			var contents = this._xdContents[res.contentIndex];
511
			if(!contents.isDefined){
512
				var content = contents.content;
513
				content["resourceName"] = contents["resourceName"];
514
				content["resourcePath"] = contents["resourcePath"];
515
				this._xdDefList.push(content);
516
				contents.isDefined = true;
517
			}
518
			this._xdDepMap[req] = null;
519
 
520
			//Trace down any requireAfters for this resource.
521
			//START dojo._xdTraceReqs() inlining for small Safari 2.0 call stack
522
			var reqs = res.requiresAfter;
523
			if(reqs && reqs.length > 0){
524
				var nextReq;
525
				for(var i = 0; i < reqs.length; i++){
526
					nextReq = reqs[i].name;
527
					if(nextReq && !reqChain[nextReq]){
528
						//New req depedency. Follow it down.
529
						reqChain.push(nextReq);
530
						reqChain[nextReq] = true;
531
						this._xdEvalReqs(reqChain);
532
					}
533
				}
534
			}
535
			//END dojo._xdTraceReqs() inlining for small Safari 2.0 call stack
536
		}
537
 
538
		//Done with that require. Remove it and go to the next one.
539
		reqChain.pop();
540
	}
541
}
542
 
543
dojo._xdClearInterval = function(){
544
	//summary: Internal xd loader function.
545
	//Clears the interval timer used to check on the
546
	//status of in-flight xd module resource requests.
547
	clearInterval(this._xdTimer);
548
	this._xdTimer = 0;
549
}
550
 
551
dojo._xdWatchInFlight = function(){
552
	//summary: Internal xd loader function.
553
	//Monitors in-flight requests for xd module resources.
554
 
555
	var noLoads = "";
556
	var waitInterval = (djConfig.xdWaitSeconds || 15) * 1000;
557
	var expired = (this._xdStartTime + waitInterval) < (new Date()).getTime();
558
 
559
	//If any xdInFlight are true, then still waiting for something to load.
560
	//Come back later. If we timed out, report the things that did not load.
561
	for(var param in this._xdInFlight){
562
		if(this._xdInFlight[param] === true){
563
			if(expired){
564
				noLoads += param + " ";
565
			}else{
566
				return;
567
			}
568
		}
569
	}
570
 
571
	//All done. Clean up and notify.
572
	this._xdClearInterval();
573
 
574
	if(expired){
575
		throw "Could not load cross-domain resources: " + noLoads;
576
	}
577
 
578
	this._xdWalkReqs();
579
 
580
	var defLength = this._xdDefList.length;
581
	for(var i= 0; i < defLength; i++){
582
		var content = dojo._xdDefList[i];
583
		if(djConfig["debugAtAllCosts"] && content["resourceName"]){
584
			if(!this["_xdDebugQueue"]){
585
				this._xdDebugQueue = [];
586
			}
587
			this._xdDebugQueue.push({resourceName: content.resourceName, resourcePath: content.resourcePath});
588
		}else{
589
			//Evaluate the resource to bring it into being.
590
			//Pass dojo in so that later, to support multiple versions of dojo
591
			//in a page, we can pass which version of dojo to use.
592
			content(dojo);
593
		}
594
	}
595
 
596
	//Evaluate any resources that were not evaled before.
597
	//This normally shouldn't happen with proper dojo.provide and dojo.require
598
	//usage, but providing it just in case. Note that these may not be executed
599
	//in the original order that the developer intended.
600
	//Pass dojo in so that later, to support multiple versions of dojo
601
	//in a page, we can pass which version of dojo to use.
602
	for(var i = 0; i < this._xdContents.length; i++){
603
		var current = this._xdContents[i];
604
		if(current.content && !current.isDefined){
605
			current.content(dojo);
606
		}
607
	}
608
 
609
	//Clean up for the next round of xd loading.
610
	this._xdReset();
611
 
612
	if(this["_xdDebugQueue"] && this._xdDebugQueue.length > 0){
613
		this._xdDebugFileLoaded();
614
	}else{
615
		this._xdNotifyLoaded();
616
	}
617
}
618
 
619
dojo._xdNotifyLoaded = function(){
620
	//Clear inflight count so we will finally do finish work.
621
	this._inFlightCount = 0;
622
 
623
	//Only trigger call loaded if dj_load_init has run.
624
	if(this._initFired && !this._loadNotifying){
625
		this._callLoaded();
626
	}
627
}
628
 
629
}