<commit_before><!DOCTYPE HTML>

<!--
  Tested class: jquery.sap.promise
  Author: d046314
-->

<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title>Test Page for jquery.sap.promise</title>
	<script>
		//Ensure that custom API is populated to global namespace for testimng purposes
		window.sap = {__ui5PublishPromisePolyfill : true};
	</script>
	<script id="sap-ui-bootstrap"
		type="text/javascript"
		src="../../../../../resources/sap-ui-core.js"
		data-sap-ui-theme="sap_bluecrystal"
		data-sap-ui-noConflict="true">
	</script>
	<link rel="stylesheet" href="../../../../../resources/sap/ui/thirdparty/qunit.css" type="text/css" media="screen" />
	<script type="text/javascript" src="../../../../../resources/sap/ui/thirdparty/qunit.js"></script>
	<script type="text/javascript" src="../../../../../resources/sap/ui/qunit/qunit-junit.js"></script>

	<script type="text/javascript" src="../../../../../resources/sap/ui/qunit/QUnitUtils.js"></script>

	<!-- Initialization -->
	<script language="javascript">

	/**
	* Returns true if the browser has native Promise support according to our knowledge.
	* We could just test whether window.Promise is the Polyfill or the native object, but this makes sure
	*/
	function hasNativePromiseSupport() {
		return (
			sap.ui.Device.browser.firefox && sap.ui.Device.browser.version > 28 ||
			sap.ui.Device.browser.chrome  && sap.ui.Device.browser.version > 32 ||
			sap.ui.Device.browser.safari  && sap.ui.Device.browser.version >= 7.1 ||
			sap.ui.Device.os.ios          && sap.ui.Device.browser.safari && sap.ui.Device.os.version >= 8 ||
			sap.ui.Device.browser.edge
		);
	}

	sap.ui.getCore().attachInit(function() {
		var bNativePromise = window.Promise !== window.ES6Promise.Promise;
		if (bNativePromise) {
			testPromise(window.Promise, "Native: ");
		}
		testPromise(window.ES6Promise.Promise, "Polyfill: ");
	});

	</script>

	<!-- Test functions -->
	<script language="javascript">

	function testPromise(P, sTestPrefix) {

		/////////////////////////////////////////////// Helper Functions ///////////////////////////////////////////////

		function doOnNativeSupport(fDoWhenNativeSupport, fDoWhenNotNativeSupport) {
			if(hasNativePromiseSupport()) {
				if(fDoWhenNativeSupport) {
					return fDoWhenNativeSupport();
				}
			}else{
				if(fDoWhenNotNativeSupport) {
					return fDoWhenNotNativeSupport();
				}
			}
			return null;
		}

		function asyncAction(bFail, oObj, iDelay, bStart){
			return new P(function(fResolve, fReject) {
				var f = bFail ? fReject : fResolve;
				setTimeout(function(){
					f(oObj);
					if(bStart){
						start();
					}
				}, iDelay || 10);
			});
		}

		function asyncAction_Deferred(bFail, oObj, iDelay, bStart){
			var d = new jQuery.Deferred();
			(function(fResolve, fReject) {
				var f = bFail ? fReject : fResolve;
				setTimeout(function(){
					f(oObj);
					if(bStart){
						start();
					}
				}, iDelay || 10);
			})(function(o){d.resolve(o);}, function(o){d.reject(o);});
			return d.promise();
		}

		function createLog(){
			var aLog = [];
			return function(txt, flush){
				aLog.push(txt);
				if(flush){
					var s = aLog.join(" -> ");
					return s;
				}
			};
		}




		///////////////////////////////////////////////// Actual Tests /////////////////////////////////////////////////

		// qutils.delayTestStart();

		module(sTestPrefix + "Basics");

		var bNative = P !== window.ES6Promise.Promise;

		test((bNative ? "Native" : "Custom") +" API tested", function() {
			var p = new P(function(res, rej) {
				rej();
			});
			ok(!p._subscribers && bNative || p._subscribers && !bNative , (bNative ? "Native" : "Custom") + " Promise implementation active.");
		});

		test(sTestPrefix + "Native Support", function() {
			doOnNativeSupport(function(){
				ok(window.Promise != window.ES6Promise.Promise, "Firefox, Chrome and Safari support Promises natively.");
			}, function(){
				ok(window.Promise == window.ES6Promise.Promise, "Browsers other than Firefox, Chrome and Safari does not support Promises natively.");
			});
		});


		module(sTestPrefix + "promise.then");

		test(sTestPrefix + "API available", function() {
			var p = new P(function(res, rej){rej();});<commit_msg>[FIX] Promise Polyfill Tests - correcly identify polyfill in IE<commit_after><!DOCTYPE HTML>

<!--
  Tested class: jquery.sap.promise
  Author: d046314
-->

<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title>Test Page for jquery.sap.promise</title>
	<script>
		//Ensure that custom API is populated to global namespace for testimng purposes
		window.sap = {__ui5PublishPromisePolyfill : true};
	</script>
	<script id="sap-ui-bootstrap"
		type="text/javascript"
		src="../../../../../resources/sap-ui-core.js"
		data-sap-ui-theme="sap_bluecrystal"
		data-sap-ui-noConflict="true">
	</script>
	<link rel="stylesheet" href="../../../../../resources/sap/ui/thirdparty/qunit.css" type="text/css" media="screen" />
	<script type="text/javascript" src="../../../../../resources/sap/ui/thirdparty/qunit.js"></script>
	<script type="text/javascript" src="../../../../../resources/sap/ui/qunit/qunit-junit.js"></script>

	<script type="text/javascript" src="../../../../../resources/sap/ui/qunit/QUnitUtils.js"></script>

	<!-- Initialization -->
	<script language="javascript">

	/**
	* Returns true if the browser has native Promise support according to our knowledge.
	* We could just test whether window.Promise is the Polyfill or the native object, but this makes sure
	*/
	function hasNativePromiseSupport() {
		return (
			sap.ui.Device.browser.firefox && sap.ui.Device.browser.version > 28 ||
			sap.ui.Device.browser.chrome  && sap.ui.Device.browser.version > 32 ||
			sap.ui.Device.browser.safari  && sap.ui.Device.browser.version >= 7.1 ||
			sap.ui.Device.os.ios          && sap.ui.Device.browser.safari && sap.ui.Device.os.version >= 8 ||
			sap.ui.Device.browser.edge
		);
	}

	sap.ui.getCore().attachInit(function() {
		var bNativePromise = window.Promise.toString().indexOf("[native code]") > -1;
		if (bNativePromise) {
			testPromise(window.Promise, "Native: ");
		}
		testPromise(window.ES6Promise.Promise, "Polyfill: ");
	});

	</script>

	<!-- Test functions -->
	<script language="javascript">

	function testPromise(P, sTestPrefix) {

		/////////////////////////////////////////////// Helper Functions ///////////////////////////////////////////////

		function doOnNativeSupport(fDoWhenNativeSupport, fDoWhenNotNativeSupport) {
			if(hasNativePromiseSupport()) {
				if(fDoWhenNativeSupport) {
					return fDoWhenNativeSupport();
				}
			}else{
				if(fDoWhenNotNativeSupport) {
					return fDoWhenNotNativeSupport();
				}
			}
			return null;
		}

		function asyncAction(bFail, oObj, iDelay, bStart){
			return new P(function(fResolve, fReject) {
				var f = bFail ? fReject : fResolve;
				setTimeout(function(){
					f(oObj);
					if(bStart){
						start();
					}
				}, iDelay || 10);
			});
		}

		function asyncAction_Deferred(bFail, oObj, iDelay, bStart){
			var d = new jQuery.Deferred();
			(function(fResolve, fReject) {
				var f = bFail ? fReject : fResolve;
				setTimeout(function(){
					f(oObj);
					if(bStart){
						start();
					}
				}, iDelay || 10);
			})(function(o){d.resolve(o);}, function(o){d.reject(o);});
			return d.promise();
		}

		function createLog(){
			var aLog = [];
			return function(txt, flush){
				aLog.push(txt);
				if(flush){
					var s = aLog.join(" -> ");
					return s;
				}
			};
		}




		///////////////////////////////////////////////// Actual Tests /////////////////////////////////////////////////

		// qutils.delayTestStart();

		module(sTestPrefix + "Basics");

		var bNative = P.toString().indexOf("[native code]") > -1;

		test((bNative ? "Native" : "Custom") +" API tested", function() {
			var p = new P(function(res, rej) {
				rej();
			});
			ok(!p._subscribers && bNative || p._subscribers && !bNative , (bNative ? "Native" : "Custom") + " Promise implementation active.");
		});

		test(sTestPrefix + "Native Support", function() {
			doOnNativeSupport(function(){
				ok(window.Promise.toString().indexOf("[native code]") > -1, "Firefox, Chrome and Safari support Promises natively.");
			}, function(){
				ok(window.Promise.toString().indexOf("[native code]") == -1, "Browsers other than Firefox, Chrome and Safari does not support Promises natively.");
			});
		});


		module(sTestPrefix + "promise.then");

		test(sTestPrefix + "API available", function() {
			var p = new P(function(res, rej){rej();});
{'fraction_non_alphanumeric': 0.21434421434421436, 'fraction_numerical': 0.005382005382005382, 'mean_word_length': 2.7772867874502873, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 62, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5044892', 'n_tokens_mistral': 3130, 'n_tokens_neox': 2704, 'n_words': 549}