Index: ui/webui/resources/js/cr.js |
diff --git a/ui/webui/resources/js/cr.js b/ui/webui/resources/js/cr.js |
index 7fadc2aaf54f6a5cd3191afa24039ada5a96add8..cdaed720b2b921447045bf28e220a3f1e80deecf 100644 |
--- a/ui/webui/resources/js/cr.js |
+++ b/ui/webui/resources/js/cr.js |
@@ -2,6 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+<include src="assert.js"> |
+ |
/** |
* The global object. |
* @type {!Object} |
@@ -10,7 +12,7 @@ |
var global = this; |
/** Platform, package, object property, and Event support. **/ |
-this.cr = (function() { |
+var cr = (function() { |
'use strict'; |
/** |
@@ -68,7 +70,7 @@ this.cr = (function() { |
/** |
* The kind of property to define in {@code defineProperty}. |
- * @enum {number} |
+ * @enum {string} |
* @const |
*/ |
var PropertyKind = { |
@@ -94,7 +96,7 @@ this.cr = (function() { |
* Helper function for defineProperty that returns the getter to use for the |
* property. |
* @param {string} name The name of the property. |
- * @param {cr.PropertyKind} kind The kind of the property. |
+ * @param {PropertyKind} kind The kind of the property. |
* @return {function():*} The getter for the property. |
*/ |
function getGetter(name, kind) { |
@@ -115,6 +117,9 @@ this.cr = (function() { |
return this.hasAttribute(attributeName); |
}; |
} |
+ |
+ assertNotReached(); |
+ return function() {}; |
} |
/** |
@@ -122,9 +127,9 @@ this.cr = (function() { |
* kind. |
* @param {string} name The name of the property we are defining the setter |
* for. |
- * @param {cr.PropertyKind} kind The kind of property we are getting the |
+ * @param {PropertyKind} kind The kind of property we are getting the |
* setter for. |
- * @param {function(*):void} opt_setHook A function to run after the property |
+ * @param {function():void=} opt_setHook A function to run after the property |
* is set, but before the propertyChange event is fired. |
* @return {function(*):void} The function to use as a setter. |
*/ |
@@ -172,6 +177,9 @@ this.cr = (function() { |
} |
}; |
} |
+ |
+ assertNotReached(); |
+ return function() {}; |
} |
/** |
@@ -179,15 +187,15 @@ this.cr = (function() { |
* property change event with the type {@code name + 'Change'} is fired. |
* @param {!Object} obj The object to define the property for. |
* @param {string} name The name of the property. |
- * @param {cr.PropertyKind=} opt_kind What kind of underlying storage to use. |
- * @param {function(*):void} opt_setHook A function to run after the |
+ * @param {PropertyKind=} opt_kind What kind of underlying storage to use. |
+ * @param {function(*):void=} opt_setHook A function to run after the |
* property is set, but before the propertyChange event is fired. |
*/ |
function defineProperty(obj, name, opt_kind, opt_setHook) { |
if (typeof obj == 'function') |
obj = obj.prototype; |
- var kind = opt_kind || PropertyKind.JS; |
+ var kind = /** @type {PropertyKind} */ (opt_kind || PropertyKind.JS); |
if (!obj.__lookupGetter__(name)) |
obj.__defineGetter__(name, getGetter(name, kind)); |