src/sap.ui.core/src/ui5loader.js
function loadSyncXHR(oModule) {
		var xhr = new XMLHttpRequest();

		function enrichXHRError(error) {
			error = error || ensureStacktrace(new Error(xhr.status + " - " + xhr.statusText));
			error.status = xhr.status;
			error.statusText = xhr.statusText;
			error.loadError = true;
			return error;
		}

		xhr.addEventListener('load', function(e) {
			// File protocol (file://) always has status code 0
			if ( xhr.status === 200 || xhr.status === 0 ) {
				oModule.state = LOADED;
				oModule.data = xhr.responseText;
			} else {
				oModule.error = enrichXHRError();
			}
		});
		// Note: according to whatwg spec, error event doesn't fire for sync send(), instead an error is thrown
		// we register a handler, in case a browser doesn't follow the spec
		xhr.addEventListener('error', function(e) {
			oModule.error = enrichXHRError();
		});
		xhr.open('GET', oModule.url, false);
		try {
			xhr.send();
		} catch (error) {
			oModule.error = enrichXHRError(error);
		}
	}
function loadSyncXHR(oModule) {
		var xhr = new XMLHttpRequest();

		function enrichXHRError(error) {
			error = error || ensureStacktrace(new Error(xhr.status + " - " + xhr.statusText));
			error.status = xhr.status;
			error.statusText = xhr.statusText;
			error.loadError = true;
			return error;
		}

		xhr.addEventListener('load', function(e) {
			// File protocol (file://) always has status code 0
			if ( xhr.status === 200 || xhr.status === 0 ) {
				oModule.state = LOADED;
				oModule.data = xhr.responseText;
			} else {
				oModule.error = enrichXHRError();
			}
		});
		// Note: according to whatwg spec, error event doesn't fire for sync send(), instead an error is thrown
		// we register a handler, in case a browser doesn't follow the spec
		xhr.addEventListener('error', function(e) {
			oModule.error = enrichXHRError();
		});
		xhr.open('GET', oModule.url, false);
		try {
			xhr.send();
		} catch (error) {
			oModule.error = enrichXHRError(error);
		}
	}
function loadSyncXHR ( oModule ) { var xhr = new XMLHttpRequest ( ) ; function enrichXHRError ( error ) { error = error || ensureStacktrace ( new Error ( xhr . status + " - " + xhr . statusText ) ) ; error . status = xhr . status ; error . statusText = xhr . statusText ; error . loadError = true ; return error ; } xhr . addEventListener ( 'load' , function ( e ) { // File protocol (file://) always has status code 0 if ( xhr . status === 200 || xhr . status === 0 ) { oModule . state = LOADED ; oModule . data = xhr . responseText ; } else { oModule . error = enrichXHRError ( ) ; } } ) ; // Note: according to whatwg spec, error event doesn't fire for sync send(), instead an error is thrown // we register a handler, in case a browser doesn't follow the spec xhr . addEventListener ( 'error' , function ( e ) { oModule . error = enrichXHRError ( ) ; } ) ; xhr . open ( 'GET' , oModule . url , false ) ; try { xhr . send ( ) ; } catch ( error ) { oModule . error = enrichXHRError ( error ) ; } }
Loads the source for the given module with a sync XHR.
@param {Module} oModule Module to load the source for
@throws {Error} When loading failed for some reason.
Loads the source for the given module with a sync XHR .