function loadExtensionFile (params, cb) {
    var xhr = new XMLHttpRequest()

    if (params.source === 'external') {
        xhr.open('GET', params.url)
        if (params.etag) {
            xhr.setRequestHeader('If-None-Match', params.etag)
        }
    } else {
        // set type xhr type tag. Safari internal xhr requests
        // don't set a 200 status so we'll check this type
        xhr.type = 'internal'
        xhr.open('GET', browserWrapper.getExtensionURL(params.url))
    }

    xhr.send(null)

    xhr.onreadystatechange = function () {
        let done = XMLHttpRequest.DONE ? XMLHttpRequest.DONE : 4
        if (xhr.readyState === done) {
            if (xhr.status === 200 || (xhr.type && xhr.type === 'internal')) {
                cb(returnResponse(xhr, params.returnType), xhr)
            }
        }
    }
}
/*
 * Params:
 *  - url: request URL
 *  - source: requests are internal by default. set source to 'external' for non-extension URLs
 *  - etag: set an if-none-match header
 */
- url: request URL
- source: requests are internal by default. set source to 'external' for non-extension URLs
- etag: set an if-none-match header
- url : request URL - source : requests are internal by default . set source to ' external ' for non - extension URLs - etag : set an if - none - match header
function loadExtensionFile (params, cb) {
    var xhr = new XMLHttpRequest()
    if (params.source === 'external') {
        xhr.open('GET', params.url)
        if (params.etag) {
            xhr.setRequestHeader('If-None-Match', params.etag)
        }
    } else {
        xhr.type = 'internal'
        xhr.open('GET', browserWrapper.getExtensionURL(params.url))
    }
    xhr.send(null)
    xhr.onreadystatechange = function () {
        let done = XMLHttpRequest.DONE ? XMLHttpRequest.DONE : 4
        if (xhr.readyState === done) {
            if (xhr.status === 200 || (xhr.type && xhr.type === 'internal')) {
                cb(returnResponse(xhr, params.returnType), xhr)
            }
        }
    }
}
function loadExtensionFile ( params , cb ) { var xhr = new XMLHttpRequest ( ) if ( params . source === 'external' ) { xhr . open ( 'GET' , params . url ) if ( params . etag ) { xhr . setRequestHeader ( 'If-None-Match' , params . etag ) } } else { xhr . type = 'internal' xhr . open ( 'GET' , browserWrapper . getExtensionURL ( params . url ) ) } xhr . send ( null ) xhr . onreadystatechange = function ( ) { let done = XMLHttpRequest . DONE ? XMLHttpRequest . DONE : 4 if ( xhr . readyState === done ) { if ( xhr . status === 200 || ( xhr . type && xhr . type === 'internal' ) ) { cb ( returnResponse ( xhr , params . returnType ) , xhr ) } } } }
Params:
  - url: request URL
  - source: requests are internal by default.
Params : - url : request URL - source : requests are internal by default .
// set type xhr type tag. Safari internal xhr requests // don't set a 200 status so we'll check this type