function disableMethods(object, objectName, methodNames, useThrowingStubs) {
  $Array.forEach(methodNames, function(methodName) {
    logging.DCHECK($Object.getOwnPropertyDescriptor(object, methodName),
                   objectName + ': ' + methodName);
    var messagePrefix = objectName + '.' + methodName + '()';
    $Object.defineProperty(object, methodName, {
      configurable: false,
      enumerable: false,
      value: useThrowingStubs ?
                 generateThrowingMethodStub(messagePrefix) :
                 generateDisabledMethodStub(messagePrefix)
    });
  });
}
/**
 * Replaces the given methods of the passed in object with stubs that log
 * 'not available' errors to the console and return undefined.
 *
 * This should be used on methods attached via non-configurable properties,
 * such as window.alert. disableGetters should be used when possible, because
 * it is friendlier towards feature detection.
 *
 * In most cases, the useThrowingStubs should be false, so the stubs used to
 * replace the methods log an error to the console, but allow the calling code
 * to continue. We shouldn't break library code that uses feature detection
 * responsibly, such as:
 *     if(window.confirm) {
 *       var result = window.confirm('Are you sure you want to delete ...?');
 *       ...
 *     }
 *
 * useThrowingStubs should only be true for methods that are deprecated in the
 * Web platform, and should not be used by a responsible library, even in
 * conjunction with feature detection. A great example is document.write(), as
 * the HTML5 specification recommends against using it, and says that its
 * behavior is unreliable. No reasonable library code should ever use it.
 * HTML5 spec: http://www.w3.org/TR/html5/dom.html#dom-document-write
 *
 * @param {Object} object The object with methods to disable. The prototype is
 *     preferred.
 * @param {string} objectName The display name to use in the error message
 *     thrown by the stub (this is the name that the object is commonly referred
 *     to by web developers, e.g. "document" instead of "HTMLDocument").
 * @param {Array<string>} methodNames names of methods to disable.
 * @param {Boolean} useThrowingStubs if true, the replaced methods will throw
 *     an error instead of silently returning undefined
 */
Replaces the given methods of the passed in object with stubs that log
'not available' errors to the console and return undefined.

This should be used on methods attached via non-configurable properties,
such as window.alert. disableGetters should be used when possible, because
it is friendlier towards feature detection.

In most cases, the useThrowingStubs should be false, so the stubs used to
replace the methods log an error to the console, but allow the calling code
to continue. We shouldn't break library code that uses feature detection
responsibly, such as:
if(window.confirm) {
var result = window.confirm('Are you sure you want to delete ...?');

}

useThrowingStubs should only be true for methods that are deprecated in the
Web platform, and should not be used by a responsible library, even in
conjunction with feature detection. A great example is document.write(), as
the HTML5 specification recommends against using it, and says that its
behavior is unreliable. No reasonable library code should ever use it.

@param {Object} object The object with methods to disable. The prototype is
preferred.
@param {string} objectName The display name to use in the error message
thrown by the stub (this is the name that the object is commonly referred
to by web developers, e.g. "document" instead of "HTMLDocument").
@param {Array} methodNames names of methods to disable.
@param {Boolean} useThrowingStubs if true, the replaced methods will throw
an error instead of silently returning undefined
Replaces the given methods of the passed in object with stubs that log ' not available ' errors to the console and return undefined . This should be used on methods attached via non - configurable properties such as window . alert . disableGetters should be used when possible because it is friendlier towards feature detection . In most cases the useThrowingStubs should be false so the stubs used to replace the methods log an error to the console but allow the calling code to continue . We shouldn ' t break library code that uses feature detection responsibly such as : if ( window . confirm ) { var result = window . confirm ( ' Are you sure you want to delete ... ? ' ) ; } useThrowingStubs should only be true for methods that are deprecated in the Web platform and should not be used by a responsible library even in conjunction with feature detection . A great example is document . write () as the HTML5 specification recommends against using it and says that its behavior is unreliable . No reasonable library code should ever use it . @param { Object } object The object with methods to disable . The prototype is preferred . @param { string } objectName The display name to use in the error message thrown by the stub ( this is the name that the object is commonly referred to by web developers e . g . " document " instead of " HTMLDocument " ) . @param { Array } methodNames names of methods to disable . @param { Boolean } useThrowingStubs if true the replaced methods will throw an error instead of silently returning undefined
function disableMethods(object, objectName, methodNames, useThrowingStubs) {
  $Array.forEach(methodNames, function(methodName) {
    logging.DCHECK($Object.getOwnPropertyDescriptor(object, methodName),
                   objectName + ': ' + methodName);
    var messagePrefix = objectName + '.' + methodName + '()';
    $Object.defineProperty(object, methodName, {
      configurable: false,
      enumerable: false,
      value: useThrowingStubs ?
                 generateThrowingMethodStub(messagePrefix) :
                 generateDisabledMethodStub(messagePrefix)
    });
  });
}
function disableMethods ( object , objectName , methodNames , useThrowingStubs ) { $Array . forEach ( methodNames , function ( methodName ) { logging . DCHECK ( $Object . getOwnPropertyDescriptor ( object , methodName ) , objectName + ': ' + methodName ) ; var messagePrefix = objectName + '.' + methodName + '()' ; $Object . defineProperty ( object , methodName , { configurable : false , enumerable : false , value : useThrowingStubs ? generateThrowingMethodStub ( messagePrefix ) : generateDisabledMethodStub ( messagePrefix ) } ) ; } ) ; }
Replaces the given methods of the passed in object with stubs that log
 'not available' errors to the console and return undefined.
Replaces the given methods of the passed in object with stubs that log ' not available ' errors to the console and return undefined .