Chapter11/11.1/node_modules/accessibility-developer-tools/lib/closure-library/closure/goog/promise/promise_test.js
/**
 * Creates a malicious thenable that throws when the {@code then} method is
 * accessed to ensure that it is caught and converted to a rejected promise
 * instead of allowed to cause a synchronous exception.
 * @param {*} value The value to throw.
 * @return {!Thenable}
 */
Creates a malicious thenable that throws when the  then method is
accessed to ensure that it is caught and converted to a rejected promise
instead of allowed to cause a synchronous exception.
@param {*} value The value to throw.
@return {!Thenable}
Creates a malicious thenable that throws when the then method is accessed to ensure that it is caught and converted to a rejected promise instead of allowed to cause a synchronous exception . @param { * } value The value to throw . @return { !Thenable }
function createThrowingThenable(value) {
  if (!SUPPORTS_ACCESSORS) {
    return rejectThenableSoon(value, 0);
  }
  var thenable = {};
  window.Object.defineProperty(
      thenable, 'then', {get: function() { throw value; }});
  return thenable;
}
function createThrowingThenable ( value ) { if ( ! SUPPORTS_ACCESSORS ) { return rejectThenableSoon ( value , 0 ) ; } var thenable = { } ; window . Object . defineProperty ( thenable , 'then' , { get : function ( ) { throw value ; } } ) ; return thenable ; }
Creates a malicious thenable that throws when the {@code then} method is
 accessed to ensure that it is caught and converted to a rejected promise
 instead of allowed to cause a synchronous exception.
Creates a malicious thenable that throws when the { @code then } method is accessed to ensure that it is caught and converted to a rejected promise instead of allowed to cause a synchronous exception .
// If the environment does not provide Object.defineProperty, then just // use an immediately rejected promise to allow tests which use this to // continue.