src/sap.ui.core/src/ui5loader.js
function execModule(sModuleName, bAsync) {

		var oModule = mModules[sModuleName],
			oShim = mShims[sModuleName],
			bLoggable = log.isLoggable(),
			sOldPrefix, sScript, vAMD, oMatch, bOldForceSyncDefines;

		if ( oModule && oModule.state === LOADED && typeof oModule.data !== "undefined" ) {

			// check whether the module is known to use an existing AMD loader, remember the AMD flag
			vAMD = (oShim === true || (oShim && oShim.amd)) && typeof __global.define === "function" && __global.define.amd;
			bOldForceSyncDefines = bForceSyncDefines;

			try {

				if ( vAMD ) {
					// temp. remove the AMD Flag from the loader
					delete __global.define.amd;
				}
				bForceSyncDefines = !bAsync;

				if ( bLoggable ) {
					log.debug(sLogPrefix + "executing '" + sModuleName + "'");
					sOldPrefix = sLogPrefix;
					sLogPrefix = sLogPrefix + ": ";
				}

				// execute the script in the __global context
				oModule.state = EXECUTING;
				_execStack.push({
					name: sModuleName,
					used: false
				});
				if ( typeof oModule.data === "function" ) {
					oModule.data.call(__global);
				} else if ( Array.isArray(oModule.data) ) {
					ui5Define.apply(null, oModule.data);
				} else {

					sScript = oModule.data;

					// sourceURL: Firebug, Chrome, Safari and IE11 debugging help, appending the string seems to cost ZERO performance
					// Note: IE11 supports sourceURL even when running in IE9 or IE10 mode
					// Note: make URL absolute so Chrome displays the file tree correctly
					// Note: do not append if there is already a sourceURL / sourceMappingURL
					// Note: Safari fails, if sourceURL is the same as an existing XHR URL
					// Note: Chrome ignores debug files when the same URL has already been load via sourcemap of the bootstrap file (sap-ui-core)
					// Note: sourcemap annotations URLs in eval'ed sources are resolved relative to the page, not relative to the source
					if (sScript ) {
						oMatch = /\/\/[#@] source(Mapping)?URL=(.*)$/.exec(sScript);
						if ( oMatch && oMatch[1] && /^[^/]+\.js\.map$/.test(oMatch[2]) ) {
							// found a sourcemap annotation with a typical UI5 generated relative URL
							sScript = sScript.slice(0, oMatch.index) + oMatch[0].slice(0, -oMatch[2].length) + resolveURL(oMatch[2], oModule.url);
						}
						// @evo-todo use only sourceMappingURL, sourceURL or both?
						if ( !oMatch || oMatch[1] ) {
							// write sourceURL if no annotation was there or when it was a sourceMappingURL
							sScript += "\n//# sourceURL=" + resolveURL(oModule.url) + "?eval";
						}
					}

					// framework internal hook to intercept the loaded script and modify
					// it before executing the script - e.g. useful for client side coverage
					if (typeof translate === "function") {
						sScript = translate(sScript, sModuleName);
					}

					if (__global.execScript && (!oModule.data || oModule.data.length < MAX_EXEC_SCRIPT_LENGTH) ) {
						try {
							oModule.data && __global.execScript(sScript); // execScript fails if data is empty
						} catch (e) {
							_execStack.pop();
							// eval again with different approach - should fail with a more informative exception
							/* eslint-disable no-eval */
							eval(oModule.data);
							/* eslint-enable no-eval */
							throw e; // rethrow err in case globalEval succeeded unexpectedly
						}
					} else {
						__global.eval(sScript);
					}
				}
				_execStack.pop();
				queue.process(oModule);

				if ( bLoggable ) {
					sLogPrefix = sOldPrefix;
					log.debug(sLogPrefix + "finished executing '" + sModuleName + "'");
				}

			} catch (err) {
				if ( bLoggable ) {
					sLogPrefix = sOldPrefix;
				}
				oModule.data = undefined;
				oModule.fail(err);
			} finally {

				// restore AMD flag
				if ( vAMD ) {
					__global.define.amd = vAMD;
				}
				bForceSyncDefines = bOldForceSyncDefines;
			}
		}
	}
function execModule(sModuleName, bAsync) {

		var oModule = mModules[sModuleName],
			oShim = mShims[sModuleName],
			bLoggable = log.isLoggable(),
			sOldPrefix, sScript, vAMD, oMatch, bOldForceSyncDefines;

		if ( oModule && oModule.state === LOADED && typeof oModule.data !== "undefined" ) {

			// check whether the module is known to use an existing AMD loader, remember the AMD flag
			vAMD = (oShim === true || (oShim && oShim.amd)) && typeof __global.define === "function" && __global.define.amd;
			bOldForceSyncDefines = bForceSyncDefines;

			try {

				if ( vAMD ) {
					// temp. remove the AMD Flag from the loader
					delete __global.define.amd;
				}
				bForceSyncDefines = !bAsync;

				if ( bLoggable ) {
					log.debug(sLogPrefix + "executing '" + sModuleName + "'");
					sOldPrefix = sLogPrefix;
					sLogPrefix = sLogPrefix + ": ";
				}

				// execute the script in the __global context
				oModule.state = EXECUTING;
				_execStack.push({
					name: sModuleName,
					used: false
				});
				if ( typeof oModule.data === "function" ) {
					oModule.data.call(__global);
				} else if ( Array.isArray(oModule.data) ) {
					ui5Define.apply(null, oModule.data);
				} else {

					sScript = oModule.data;

					// sourceURL: Firebug, Chrome, Safari and IE11 debugging help, appending the string seems to cost ZERO performance
					// Note: IE11 supports sourceURL even when running in IE9 or IE10 mode
					// Note: make URL absolute so Chrome displays the file tree correctly
					// Note: do not append if there is already a sourceURL / sourceMappingURL
					// Note: Safari fails, if sourceURL is the same as an existing XHR URL
					// Note: Chrome ignores debug files when the same URL has already been load via sourcemap of the bootstrap file (sap-ui-core)
					// Note: sourcemap annotations URLs in eval'ed sources are resolved relative to the page, not relative to the source
					if (sScript ) {
						oMatch = /\/\/[#@] source(Mapping)?URL=(.*)$/.exec(sScript);
						if ( oMatch && oMatch[1] && /^[^/]+\.js\.map$/.test(oMatch[2]) ) {
							// found a sourcemap annotation with a typical UI5 generated relative URL
							sScript = sScript.slice(0, oMatch.index) + oMatch[0].slice(0, -oMatch[2].length) + resolveURL(oMatch[2], oModule.url);
						}
						// @evo-todo use only sourceMappingURL, sourceURL or both?
						if ( !oMatch || oMatch[1] ) {
							// write sourceURL if no annotation was there or when it was a sourceMappingURL
							sScript += "\n//# sourceURL=" + resolveURL(oModule.url) + "?eval";
						}
					}

					// framework internal hook to intercept the loaded script and modify
					// it before executing the script - e.g. useful for client side coverage
					if (typeof translate === "function") {
						sScript = translate(sScript, sModuleName);
					}

					if (__global.execScript && (!oModule.data || oModule.data.length < MAX_EXEC_SCRIPT_LENGTH) ) {
						try {
							oModule.data && __global.execScript(sScript); // execScript fails if data is empty
						} catch (e) {
							_execStack.pop();
							// eval again with different approach - should fail with a more informative exception
							/* eslint-disable no-eval */
							eval(oModule.data);
							/* eslint-enable no-eval */
							throw e; // rethrow err in case globalEval succeeded unexpectedly
						}
					} else {
						__global.eval(sScript);
					}
				}
				_execStack.pop();
				queue.process(oModule);

				if ( bLoggable ) {
					sLogPrefix = sOldPrefix;
					log.debug(sLogPrefix + "finished executing '" + sModuleName + "'");
				}

			} catch (err) {
				if ( bLoggable ) {
					sLogPrefix = sOldPrefix;
				}
				oModule.data = undefined;
				oModule.fail(err);
			} finally {

				// restore AMD flag
				if ( vAMD ) {
					__global.define.amd = vAMD;
				}
				bForceSyncDefines = bOldForceSyncDefines;
			}
		}
	}
function execModule ( sModuleName , bAsync ) { var oModule = mModules [ sModuleName ] , oShim = mShims [ sModuleName ] , bLoggable = log . isLoggable ( ) , sOldPrefix , sScript , vAMD , oMatch , bOldForceSyncDefines ; if ( oModule && oModule . state === LOADED && typeof oModule . data !== "undefined" ) { // check whether the module is known to use an existing AMD loader, remember the AMD flag vAMD = ( oShim === true || ( oShim && oShim . amd ) ) && typeof __global . define === "function" && __global . define . amd ; bOldForceSyncDefines = bForceSyncDefines ; try { if ( vAMD ) { // temp. remove the AMD Flag from the loader delete __global . define . amd ; } bForceSyncDefines = ! bAsync ; if ( bLoggable ) { log . debug ( sLogPrefix + "executing '" + sModuleName + "'" ) ; sOldPrefix = sLogPrefix ; sLogPrefix = sLogPrefix + ": " ; } // execute the script in the __global context oModule . state = EXECUTING ; _execStack . push ( { name : sModuleName , used : false } ) ; if ( typeof oModule . data === "function" ) { oModule . data . call ( __global ) ; } else if ( Array . isArray ( oModule . data ) ) { ui5Define . apply ( null , oModule . data ) ; } else { sScript = oModule . data ; // sourceURL: Firebug, Chrome, Safari and IE11 debugging help, appending the string seems to cost ZERO performance // Note: IE11 supports sourceURL even when running in IE9 or IE10 mode // Note: make URL absolute so Chrome displays the file tree correctly // Note: do not append if there is already a sourceURL / sourceMappingURL // Note: Safari fails, if sourceURL is the same as an existing XHR URL // Note: Chrome ignores debug files when the same URL has already been load via sourcemap of the bootstrap file (sap-ui-core) // Note: sourcemap annotations URLs in eval'ed sources are resolved relative to the page, not relative to the source if ( sScript ) { oMatch = / \/\/[#@] source(Mapping)?URL=(.*)$ / . exec ( sScript ) ; if ( oMatch && oMatch [ 1 ] && / ^[^/]+\.js\.map$ / . test ( oMatch [ 2 ] ) ) { // found a sourcemap annotation with a typical UI5 generated relative URL sScript = sScript . slice ( 0 , oMatch . index ) + oMatch [ 0 ] . slice ( 0 , - oMatch [ 2 ] . length ) + resolveURL ( oMatch [ 2 ] , oModule . url ) ; } // @evo-todo use only sourceMappingURL, sourceURL or both? if ( ! oMatch || oMatch [ 1 ] ) { // write sourceURL if no annotation was there or when it was a sourceMappingURL sScript += "\n//# sourceURL=" + resolveURL ( oModule . url ) + "?eval" ; } } // framework internal hook to intercept the loaded script and modify // it before executing the script - e.g. useful for client side coverage if ( typeof translate === "function" ) { sScript = translate ( sScript , sModuleName ) ; } if ( __global . execScript && ( ! oModule . data || oModule . data . length < MAX_EXEC_SCRIPT_LENGTH ) ) { try { oModule . data && __global . execScript ( sScript ) ; // execScript fails if data is empty } catch ( e ) { _execStack . pop ( ) ; // eval again with different approach - should fail with a more informative exception /* eslint-disable no-eval */ eval ( oModule . data ) ; /* eslint-enable no-eval */ throw e ; // rethrow err in case globalEval succeeded unexpectedly } } else { __global . eval ( sScript ) ; } } _execStack . pop ( ) ; queue . process ( oModule ) ; if ( bLoggable ) { sLogPrefix = sOldPrefix ; log . debug ( sLogPrefix + "finished executing '" + sModuleName + "'" ) ; } } catch ( err ) { if ( bLoggable ) { sLogPrefix = sOldPrefix ; } oModule . data = undefined ; oModule . fail ( err ) ; } finally { // restore AMD flag if ( vAMD ) { __global . define . amd = vAMD ; } bForceSyncDefines = bOldForceSyncDefines ; } } }
sModuleName must be a normalized resource name of type .js
sModuleName must be a normalized resource name of type . js