Nickolay - Test.Run-0.10

Documentation | Source
Class('Test.Run.Harness.Browser', {
    
    isa : Test.Run.Harness,
    
    my : {
        
        have : {
            scopeProvider       : 'Scope.Provider.IFrame',
            
            disableCaching      : true,
            
            isIE                : '\v' == 'v',
            
            baseUrl             : window.location.href.replace(/\?.*$/,'').replace(/\/[^/]*$/, '/index.html'),
            baseHost            : window.location.host,
            baseProtocol        : window.location.protocol
        },
        
        
        methods : {
            
            resolveURL : function (url) {
                // ref to JSAN module
                if (/^jsan:/.test(url)) url = '/jsan/index.html' + url.replace(/^jsan:/, '').replace(/\./g, '/index.html') + '/doc/s/sa/samuraijack/Test/Run/010/lib/Test/Run/Harness/.js'
                    
                
                // ref to lib in current dist (no trailing `.js`) 
                if (!/\.js$/.test(url)) {
                    url = '/doc/s/sa/samuraijack/Test/Run/010/lib/Test/Run/lib/index.html' + url.replace(/\./g, '/index.html') + '/doc/s/sa/samuraijack/Test/Run/010/lib/Test/Run/Harness/.js'
                }
                
                // otherwise assumed to be a raw filename, relative or absolute
                return this.absolutizeURL(url)
            },
            
            
            //webkit bug - base urls for iframes are broken
            //https://bugs.webkit.org/show_bug.cgi?id=13364
            absolutizeURL : function (url, onlyAbsolutize) {
                var absolute
                
                if (!/^http/.test(url))
                    if (!/^\//.test(url))
                        absolute = this.baseUrl + url
                    else
                        absolute = this.baseProtocol + '//' + this.baseHost + url
                
                if (this.disableCaching && !onlyAbsolutize) absolute += '?disableCaching=' + new Date().getTime()
                
                return absolute
            },

            
            absolutizeINC : function (INC) {
                Joose.A.each(INC, function (incPath, indx) {
                    INC[ indx ] = this.absolutizeURL(incPath, true)
                }, this)
                
                return INC
            },
            
            
            prepareINC : function (INC) {
                return Ext.encode(this.absolutizeINC(INC))
            }
        }
        
    }
    //eof my
})
//eof Test.Run.Harness.Browser