diff options
author | ctrlaltca <> | 2012-06-19 15:26:19 +0000 |
---|---|---|
committer | ctrlaltca <> | 2012-06-19 15:26:19 +0000 |
commit | 7fee4f81fc62253d49b36cdf79b6a1ff97184742 (patch) | |
tree | fdc0269834a984d48cafaf79435e50e7f278de89 /framework | |
parent | 789a1d6d191f364a6f2538664f8546b862285d94 (diff) |
committer patch for #408
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Web/Javascripts/source/prado/activecontrols/ajax3.js | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js index 11eec5a4..995e8e97 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js @@ -1014,11 +1014,22 @@ if (typeof(Prado.AssetManagerClass)=="undefined") { this.loadedAssets.push(url);
},
- createAssetReadyStateChangeFunction: function(url, element, callback, finalevent) {
- return function() {
- if (finalevent || (element.readyState == 'loaded') || (element.readyState == 'complete'))
- callback(url,element);
- };
+ assetReadyStateChanged: function(url, element, callback, finalevent) {
+ if (finalevent || (element.readyState == 'loaded') || (element.readyState == 'complete'))
+ if (!element.assetCallbackFired)
+ {
+ element.assetCallbackFired = true;
+ callback(url,element);
+ }
+ },
+
+ assetLoadFailed: function(url, element, callback) {
+ debugger;
+ element.assetCallbackFired = true;
+ if(typeof Logger != "undefined")
+ Logger.error("Failed to load asset: "+url, this);
+ if (!element.assetCallbackFired)
+ callback(url,element,false);
},
/**
@@ -1035,8 +1046,10 @@ if (typeof(Prado.AssetManagerClass)=="undefined") { if (callback)
{
- asset.onreadystatechange = this.createAssetReadyStateChangeFunction(url, asset, callback, false);
- asset.onload = this.createAssetReadyStateChangeFunction(url, asset, callback, true);
+ asset.onreadystatechange = this.assetReadyStateChanged.bind(this, url, asset, callback, false);
+ asset.onload = this.assetReadyStateChanged.bind(this, url, asset, callback, true);
+ asset.onerror = this.assetLoadFailed.bind(this, url, asset, callback);
+ asset.assetCallbackFired = false;
}
var head = document.getElementsByTagName('head')[0];
|