function loadSyncXHR(oModule) {
		var xhr = new XMLHttpRequest();

		function createXHRLoadError(error) {
			error = new Error(xhr.statusText ? xhr.status + " - " + xhr.statusText : xhr.status);
			error.name = "XHRLoadError";
			error.status = xhr.status;
			error.statusText = xhr.statusText;
			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 = createXHRLoadError();
			}
		});
		// 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 = createXHRLoadError();
		});
		xhr.open('GET', oModule.url, false);
		try {
			xhr.send();
		} catch (error) {
			oModule.error = 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.
@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 . @param { Module } oModule Module to load the source for @throws { Error } When loading failed for some reason .
function loadSyncXHR(oModule) {
		var xhr = new XMLHttpRequest();
		function createXHRLoadError(error) {
			error = new Error(xhr.statusText ? xhr.status + " - " + xhr.statusText : xhr.status);
			error.name = "XHRLoadError";
			error.status = xhr.status;
			error.statusText = xhr.statusText;
			return error;
		}
		xhr.addEventListener('load', function(e) {
			if ( xhr.status === 200 || xhr.status === 0 ) {
				oModule.state = LOADED;
				oModule.data = xhr.responseText;
			} else {
				oModule.error = createXHRLoadError();
			}
		});
		xhr.addEventListener('error', function(e) {
			oModule.error = createXHRLoadError();
		});
		xhr.open('GET', oModule.url, false);
		try {
			xhr.send();
		} catch (error) {
			oModule.error = error;
		}
	}
function loadSyncXHR ( oModule ) { var xhr = new XMLHttpRequest ( ) ; function createXHRLoadError ( error ) { error = new Error ( xhr . statusText ? xhr . status + " - " + xhr . statusText : xhr . status ) ; error . name = "XHRLoadError" ; error . status = xhr . status ; error . statusText = xhr . statusText ; return error ; } xhr . addEventListener ( 'load' , function ( e ) { if ( xhr . status === 200 || xhr . status === 0 ) { oModule . state = LOADED ; oModule . data = xhr . responseText ; } else { oModule . error = createXHRLoadError ( ) ; } } ) ; xhr . addEventListener ( 'error' , function ( e ) { oModule . error = createXHRLoadError ( ) ; } ) ; xhr . open ( 'GET' , oModule . url , false ) ; try { xhr . send ( ) ; } catch ( error ) { oModule . error = error ; } }
Loads the source for the given module with a sync XHR.
Loads the source for the given module with a sync XHR .
// File protocol (file://) always has status code 0 // 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