@ -67,12 +67,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
} ,
_tags = ( Ext . platformTags = { } ) ,
// All calls to _debug are commented out to speed up old browsers a bit;
// yes that makes a difference because the cost of concatenating strings
// and passing them into _debug() adds up pretty quickly.
_debug = function ( message ) {
//console.log(message);
} ,
_apply = function ( object , config , defaults ) {
if ( defaults ) {
_apply ( object , defaults ) ;
@ -173,7 +167,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
/ *
* simple helper method for debugging
* /
debug : _debug ,
/ * *
* enables / disables loading scripts via script / link elements rather
@ -573,7 +566,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
}
if ( ! Boot . scripts [ key = Boot . canonicalUrl ( src ) ] ) {
// _debug("creating entry " + key + " in Boot.init");
entry = new Entry ( {
key : key ,
url : src ,
@ -719,7 +711,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
} ,
load : function ( request ) {
// _debug("Boot.load called");
var request = new Request ( request ) ;
if ( request . sync || Boot . syncMode ) {
@ -729,7 +720,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
// If there is a request in progress, we must
// queue this new request to be fired when the current request completes.
if ( Boot . currentRequest ) {
// _debug("current active request, suspending this request");
// trigger assignment of entries now to ensure that overlapping
// entries with currently running requests will synchronize state
// with this pending one as they complete
@ -743,7 +733,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
} ,
loadSync : function ( request ) {
// _debug("Boot.loadSync called");
var request = new Request ( request ) ;
Boot . syncMode ++ ;
@ -772,7 +761,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
while ( Boot . suspendedQueue . length > 0 ) {
next = Boot . suspendedQueue . shift ( ) ;
if ( ! next . done ) {
// _debug("resuming suspended request");
Boot . load ( next ) ;
break ;
}
@ -857,7 +845,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
}
try {
// _debug("fetching " + url + " " + (async ? "async" : "sync"));
xhr . open ( 'GET' , url , async ) ;
xhr . send ( null ) ;
} catch ( err ) {
@ -1212,7 +1199,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
var listeners = this . listeners ,
listener ;
if ( listeners ) {
// _debug("firing request listeners");
while ( ( listener = listeners . shift ( ) ) ) {
listener ( this ) ;
}
@ -1229,7 +1215,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
return cfg ;
}
// _debug("creating entry for " + cfg.url);
var charset = cfg . charset || Boot . config . charset ,
manifest = Ext . manifest ,
@ -1270,7 +1255,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
isCrossDomain : function ( ) {
var me = this ;
if ( me . crossDomain === undefined ) {
// _debug("checking " + me.getLoadUrl() + " for prefix " + Boot.origin);
me . crossDomain = ( me . getLoadUrl ( ) . indexOf ( Boot . origin ) !== 0 ) ;
}
return me . crossDomain ;
@ -1293,7 +1277,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
var me = this ,
el = me . el ;
if ( ! el ) {
// _debug("creating element for " + me.url);
if ( me . isCss ( ) ) {
tag = tag || "link" ;
el = doc . createElement ( tag ) ;
@ -1354,11 +1337,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
me . loaded = true ;
if ( ( exception || status === 0 ) && ! _environment . phantom ) {
me . error =
( "Failed loading synchronously via XHR: '" + url +
"'. It's likely that the file is either being loaded from a " +
"different domain or from the local file system where cross " +
"origin requests are not allowed for security reasons. Try " +
"asynchronous loading instead." ) ||
true ;
me . evaluated = true ;
}
@ -1370,9 +1348,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
}
else {
me . error =
( "Failed loading synchronously via XHR: '" + url +
"'. Please verify that the file exists. XHR status code: " +
status ) ||
true ;
me . evaluated = true ;
}
@ -1420,7 +1395,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
} ,
inject : function ( content , asset ) {
// _debug("injecting content for " + this.url);
var me = this ,
head = Boot . getHead ( ) ,
url = me . url ,
@ -1667,7 +1641,6 @@ Ext.Boot = Ext.Boot || (function (emptyFn) {
var listeners = this . listeners ,
listener ;
if ( listeners && listeners . length > 0 ) {
// _debug("firing event listeners for url " + this.url);
while ( ( listener = listeners . shift ( ) ) ) {
listener ( this ) ;
}
@ -1803,9 +1776,6 @@ var Ext = Ext || window['Ext'] || {};
* /
Ext . Microloader = Ext . Microloader || ( function ( ) {
var Boot = Ext . Boot ,
_debug = function ( message ) {
//console.log(message);
} ,
_warn = function ( message ) {
console . log ( "[WARN] " + message ) ;
} ,
@ -1853,7 +1823,6 @@ Ext.Microloader = Ext.Microloader || (function () {
}
for ( i in removeKeys ) {
_debug ( "Removing " + removeKeys [ i ] + " from Local Storage" ) ;
_storage . removeItem ( removeKeys [ i ] ) ;
}
}
@ -1881,7 +1850,6 @@ Ext.Microloader = Ext.Microloader || (function () {
}
catch ( e ) {
if ( _storage && e . code == e . QUOTA _EXCEEDED _ERR ) {
_warn ( "LocalStorage Quota exceeded, cannot store " + key + " locally" ) ;
}
}
}
@ -2028,13 +1996,9 @@ Ext.Microloader = Ext.Microloader || (function () {
if ( this . shouldCache ( ) ) {
LocalStorage . setAsset ( this . key , JSON . stringify ( content || this . content ) ) ;
}
else {
_debug ( "Manifest caching is disabled." ) ;
}
} ,
is : function ( manifest ) {
_debug ( "Testing Manifest: " + this . hash + " VS " + manifest . hash ) ;
return this . hash === manifest . hash ;
} ,
@ -2105,7 +2069,6 @@ Ext.Microloader = Ext.Microloader || (function () {
// Manifest found in local storage, use this for immediate boot except in PhantomJS environments for building.
if ( content ) {
_debug ( "Manifest file, '" + url + "', was found in Local Storage" ) ;
manifest = new Manifest ( {
url : url ,
content : content ,
@ -2119,7 +2082,6 @@ Ext.Microloader = Ext.Microloader || (function () {
// Manifest is not in local storage. Fetch it from the server
} else {
_debug ( "Manifest file was not found in Local Storage, loading: " + url ) ;
if ( location . href . indexOf ( 'file:/' ) === 0 ) {
Manifest . url = Microloader . applyCacheBuster ( url + 'p' ) ;
@ -2134,7 +2096,6 @@ Ext.Microloader = Ext.Microloader || (function () {
// Embedded Manifest into JS file
} else {
_debug ( "Manifest was embedded into application javascript file" ) ;
manifest = new Manifest ( {
content : manifest
} ) ;
@ -2178,14 +2139,12 @@ Ext.Microloader = Ext.Microloader || (function () {
if ( manifest . shouldCache ( ) && asset . shouldCache ( ) ) {
// Asset already has content from localStorage, instantly seed that into boot
if ( asset . content ) {
_debug ( "Asset: " + asset . assetConfig . path + " was found in local storage. No remote load for this file" ) ;
entry = Boot . registerContent ( asset . assetConfig . path , asset . type , asset . content ) ;
if ( entry . evaluated ) {
_warn ( "Asset: " + asset . assetConfig . path + " was evaluated prior to local storage being consulted." ) ;
}
//load via AJAX and seed content into Boot
} else {
_debug ( "Asset: " + asset . assetConfig . path + " was NOT found in local storage. Adding to load queue" ) ;
cachedAssets . push ( asset ) ;
}
}
@ -2199,7 +2158,6 @@ Ext.Microloader = Ext.Microloader || (function () {
Microloader . remainingCachedAssets = cachedAssets . length ;
while ( cachedAssets . length > 0 ) {
asset = cachedAssets . pop ( ) ;
_debug ( "Preloading/Fetching Cached Assets from: " + asset . assetConfig . path ) ;
Boot . fetch ( asset . assetConfig . path , ( function ( asset ) {
return function ( result ) {
Microloader . onCachedAssetLoaded ( asset , result ) ;
@ -2226,7 +2184,6 @@ Ext.Microloader = Ext.Microloader || (function () {
asset . uncache ( ) ;
}
_debug ( "Checksum for Cached Asset: " + asset . assetConfig . path + " is " + checksum ) ;
Boot . registerContent ( asset . assetConfig . path , asset . type , result . content ) ;
asset . updateContent ( result . content ) ;
asset . cache ( ) ;
@ -2258,11 +2215,9 @@ Ext.Microloader = Ext.Microloader || (function () {
Microloader . notify ( ) ;
if ( navigator . onLine !== false ) {
_debug ( "Application is online, checking for updates" ) ;
Microloader . checkAllUpdates ( ) ;
}
else {
_debug ( "Application is offline, adding online listener to check for updates" ) ;
if ( window [ 'addEventListener' ] ) {
window . addEventListener ( 'online' , Microloader . checkAllUpdates , false ) ;
}
@ -2281,7 +2236,6 @@ Ext.Microloader = Ext.Microloader || (function () {
* @ private
* /
notify : function ( ) {
_debug ( "notifying microloader ready listeners." ) ;
var listener ;
while ( ( listener = _listeners . shift ( ) ) ) {
listener ( ) ;
@ -2312,7 +2266,6 @@ Ext.Microloader = Ext.Microloader || (function () {
} ,
checkAllUpdates : function ( ) {
_debug ( "Checking for All Updates" ) ;
if ( window [ 'removeEventListener' ] ) {
window . removeEventListener ( 'online' , Microloader . checkAllUpdates , false ) ;
}
@ -2328,12 +2281,9 @@ Ext.Microloader = Ext.Microloader || (function () {
} ,
checkForAppCacheUpdate : function ( ) {
_debug ( "Checking App Cache status" ) ;
if ( _cache . status === _cache . UPDATEREADY || _cache . status === _cache . OBSOLETE ) {
_debug ( "App Cache is already in an updated" ) ;
Microloader . appCacheState = 'updated' ;
} else if ( _cache . status !== _cache . IDLE && _cache . status !== _cache . UNCACHED ) {
_debug ( "App Cache is checking or downloading updates, adding listeners" ) ;
Microloader . appCacheState = 'checking' ;
_cache . addEventListener ( 'error' , Microloader . onAppCacheError ) ;
_cache . addEventListener ( 'noupdate' , Microloader . onAppCacheNotUpdated ) ;
@ -2341,14 +2291,12 @@ Ext.Microloader = Ext.Microloader || (function () {
_cache . addEventListener ( 'updateready' , Microloader . onAppCacheReady ) ;
_cache . addEventListener ( 'obsolete' , Microloader . onAppCacheObsolete ) ;
} else {
_debug ( "App Cache is current or uncached" ) ;
Microloader . appCacheState = 'current' ;
}
} ,
checkForUpdates : function ( ) {
// Fetch the Latest Manifest from the server
_debug ( "Checking for updates at: " + Microloader . manifest . url ) ;
Boot . fetch ( Microloader . applyCacheBuster ( Microloader . manifest . url ) , Microloader . onUpdatedManifestLoaded ) ;
} ,
@ -2369,13 +2317,11 @@ Ext.Microloader = Ext.Microloader || (function () {
} ,
appCacheUpdated : function ( ) {
_debug ( "App Cache Updated" ) ;
Microloader . appCacheState = 'updated' ;
Microloader . notifyUpdateReady ( ) ;
} ,
onAppCacheNotUpdated : function ( ) {
_debug ( "App Cache Not Updated Callback" ) ;
Microloader . appCacheState = 'current' ;
Microloader . notifyUpdateReady ( ) ;
} ,
@ -2411,7 +2357,6 @@ Ext.Microloader = Ext.Microloader || (function () {
// If the updated manifest has turned off caching we need to clear out all local storage
// and trigger a appupdate as all content is now uncached
if ( ! manifest . shouldCache ( ) ) {
_debug ( "New Manifest has caching disabled, clearing out any private storage" ) ;
Microloader . updatedManifest = manifest ;
LocalStorage . clearAllPrivate ( manifest ) ;
@ -2433,7 +2378,6 @@ Ext.Microloader = Ext.Microloader || (function () {
include = Microloader . filterAsset ( newAsset ) ;
if ( include && ( ! currentAsset || ( newAsset . shouldCache ( ) && ( ! currentAsset . is ( newAsset ) ) ) ) ) {
_debug ( "New/Updated Version of Asset: " + newAsset . assetConfig . path + " was found in new manifest" ) ;
updatingAssets . push ( { _new : newAsset , _current : currentAsset } ) ;
}
}
@ -2447,7 +2391,6 @@ Ext.Microloader = Ext.Microloader || (function () {
include = ! Microloader . filterAsset ( newAsset ) ;
if ( ! include || ! newAsset || ( currentAsset . shouldCache ( ) && ! newAsset . shouldCache ( ) ) ) {
_debug ( "Asset: " + currentAsset . assetConfig . path + " was not found in new manifest, has been filtered out or has been switched to not cache. Marked for removal" ) ;
Microloader . removedAssets . push ( currentAsset ) ;
}
}
@ -2463,11 +2406,6 @@ Ext.Microloader = Ext.Microloader || (function () {
// Full Updates will simply download the file and replace its current content
if ( newAsset . assetConfig . update === "full" || ! currentAsset ) {
if ( newAsset . assetConfig . update === "delta" ) {
_debug ( "Delta updated asset found without current asset available: " + newAsset . assetConfig . path + " fetching full file" ) ;
} else {
_debug ( "Full update found for: " + newAsset . assetConfig . path + " fetching" ) ;
}
// Load the asset and cache its its content into Boot to be evaluated in sequence
Boot . fetch ( newAsset . assetConfig . path , ( function ( asset ) {
@ -2482,7 +2420,6 @@ Ext.Microloader = Ext.Microloader || (function () {
deltas = manifest . deltas ;
deltaPath = deltas + "/" + newAsset . assetConfig . path + "/" + currentAsset . assetConfig . hash + ".json" ;
// Fetch the Delta Patch and update the contents of the asset
_debug ( "Delta update found for: " + newAsset . assetConfig . path + " fetching" ) ;
Boot . fetch ( deltaPath ,
( function ( asset , oldAsset ) {
return function ( result ) {
@ -2493,11 +2430,9 @@ Ext.Microloader = Ext.Microloader || (function () {
}
}
} else {
_debug ( "No Assets needed updating" ) ;
Microloader . onAllUpdatedAssetsReady ( ) ;
}
} else {
_debug ( "Manifest files have matching hash's" ) ;
Microloader . onAllUpdatedAssetsReady ( ) ;
}
} else {
@ -2513,9 +2448,7 @@ Ext.Microloader = Ext.Microloader || (function () {
if ( ! result . error ) {
checksum = Microloader . checksum ( result . content , asset . assetConfig . hash ) ;
_debug ( "Checksum for Full asset: " + asset . assetConfig . path + " is " + checksum ) ;
if ( ! checksum ) {
_debug ( "Full Update Asset: " + asset . assetConfig . path + " has failed checksum. This asset will be uncached for future loading" ) ;
// uncache this asset as there is a new version somewhere that has not been loaded.
asset . uncache ( ) ;
@ -2524,7 +2457,6 @@ Ext.Microloader = Ext.Microloader || (function () {
Microloader . updatedAssets . push ( asset ) ;
}
} else {
_debug ( "Error loading file at" + asset . assetConfig . path + ". This asset will be uncached for future loading" ) ;
// uncache this asset as there is a new version somewhere that has not been loaded.
asset . uncache ( ) ;
@ -2541,14 +2473,11 @@ Ext.Microloader = Ext.Microloader || (function () {
Microloader . remainingUpdatingAssets -- ;
if ( ! result . error ) {
_debug ( "Delta patch loaded successfully, patching content" ) ;
try {
json = JSON . parse ( result . content ) ;
content = Microloader . patch ( oldAsset . content , json ) ;
checksum = Microloader . checksum ( content , asset . assetConfig . hash ) ;
_debug ( "Checksum for Delta Patched asset: " + asset . assetConfig . path + " is " + checksum ) ;
if ( ! checksum ) {
_debug ( "Delta Update Asset: " + asset . assetConfig . path + " has failed checksum. This asset will be uncached for future loading" ) ;
// uncache this asset as there is a new version somewhere that has not been loaded.
asset . uncache ( ) ;
@ -2580,18 +2509,15 @@ Ext.Microloader = Ext.Microloader || (function () {
if ( Microloader . updatedManifest ) {
while ( Microloader . removedAssets . length > 0 ) {
asset = Microloader . removedAssets . pop ( ) ;
_debug ( "Asset: " + asset . assetConfig . path + " was removed, un-caching" ) ;
asset . uncache ( ) ;
}
if ( Microloader . updatedManifest ) {
_debug ( "Manifest was updated, re-caching" ) ;
Microloader . updatedManifest . cache ( ) ;
}
while ( Microloader . updatedAssets . length > 0 ) {
asset = Microloader . updatedAssets . pop ( ) ;
_debug ( "Asset: " + asset . assetConfig . path + " was updated, re-caching" ) ;
asset . cache ( ) ;
}
@ -2603,7 +2529,6 @@ Ext.Microloader = Ext.Microloader || (function () {
notifyUpdateReady : function ( ) {
if ( Microloader . appCacheState !== 'checking' && Microloader . updatedAssetsReady ) {
if ( Microloader . appCacheState === 'updated' || Microloader . updatedManifest ) {
_debug ( "There was an update here you will want to reload the app, trigger an event" ) ;
Microloader . appUpdate = {
updated : true ,
app : Microloader . appCacheState === 'updated' ,
@ -2612,10 +2537,6 @@ Ext.Microloader = Ext.Microloader || (function () {
Microloader . fireAppUpdate ( ) ;
}
else {
_debug ( "AppCache and LocalStorage Cache are current, no updating needed" ) ;
Microloader . appUpdate = { } ;
}
}
} ,