Chromium Code Reviews| 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..dbc7946598f1c09fe5f96d4c1cd126225f7903dc 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() { |
|
arv (Not doing code reviews)
2014/07/24 16:44:24
There was a reason someone changed this... maybe s
Dan Beam
2014/07/25 01:52:33
yeah, i don't think that materialized.
we can fin
|
| '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,8 +96,8 @@ 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. |
| - * @return {function():*} The getter for the property. |
| + * @param {PropertyKind} kind The kind of the property. |
| + * @return {Function} The getter for the property. |
|
arv (Not doing code reviews)
2014/07/24 16:44:24
Function is less precise than function() : *
Dan Beam
2014/07/25 01:52:33
Done.
|
| */ |
| function getGetter(name, kind) { |
| switch (kind) { |
| @@ -115,6 +117,9 @@ this.cr = (function() { |
| return this.hasAttribute(attributeName); |
| }; |
| } |
| + |
| + notReached(); |
| + return function() {}; |
| } |
| /** |
| @@ -122,11 +127,11 @@ 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 |
| - * is set, but before the propertyChange event is fired. |
| - * @return {function(*):void} The function to use as a setter. |
| + * @param {Function=} opt_setHook A function to run after the property is set, |
|
arv (Not doing code reviews)
2014/07/24 16:44:24
Same here. Function is less precise.
Dan Beam
2014/07/25 01:52:33
Done.
|
| + * but before the propertyChange event is fired. |
| + * @return {Function} The function to use as a setter. |
| */ |
| function getSetter(name, kind, opt_setHook) { |
| switch (kind) { |
| @@ -172,6 +177,9 @@ this.cr = (function() { |
| } |
| }; |
| } |
| + |
| + notReached(); |
| + 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)); |