Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Unified Diff: remoting/webapp/base/js/base.js

Issue 803653004: Update Chromoting to use /third_party/closure_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused types Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/base/js/base.js
diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js
index c337a7bd2019fd92f53beefd06222b5b2230f24c..afd88fe226df8cc815e504f005f8541d6ed0f64d 100644
--- a/remoting/webapp/base/js/base.js
+++ b/remoting/webapp/base/js/base.js
@@ -46,8 +46,8 @@ base.debug.assert = function(expr, opt_msg) {
base.debug.callstack = function() {
try {
throw new Error();
- } catch (e) {
- var error = /** @type {Error} */ e;
+ } catch (/** @type {*} */ e) {
kelvinp 2015/01/12 22:51:28 I noticed that in some other files it is no longer
garykac 2015/01/13 00:28:38 Done.
+ var error = /** @type {Error} */ (e);
var callstack = error.stack
.replace(/^\s+(at eval )?at\s+/gm, '') // Remove 'at' and indentation.
.split('\n');
@@ -91,7 +91,7 @@ base.mix = function(dest, src) {
* Adds a mixin to a class.
* @param {Object} dest
* @param {Object} src
- * @suppress {checkTypes}
+ * @suppress {checkTypes|reportUnknownTypes}
*/
base.extend = function(dest, src) {
base.mix(dest.prototype, src.prototype || src);
@@ -195,32 +195,32 @@ base.escapeHTML = function(str) {
*/
base.Deferred = function() {
/**
- * @type {?function(?=)}
+ * @type {?function(?):void}
* @private
*/
this.resolve_ = null;
/**
- * @type {?function(?)}
+ * @type {?function(?):void}
* @private
*/
this.reject_ = null;
/**
+ * @this {base.Deferred}
+ * @param {function(?):void} resolve
+ * @param {function(*):void} reject
+ */
+ var recordPromise = function(resolve, reject) {
kelvinp 2015/01/12 22:51:28 rename to initPromise?
garykac 2015/01/13 00:28:38 Done.
+ this.resolve_ = resolve;
+ this.reject_ = reject;
+ };
+
+ /**
* @type {Promise}
* @private
*/
- this.promise_ = new Promise(
- /**
- * @param {function(?=):void} resolve
- * @param {function(?):void} reject
- * @this {base.Deferred}
- */
- function(resolve, reject) {
- this.resolve_ = resolve;
- this.reject_ = reject;
- }.bind(this)
- );
+ this.promise_ = new Promise(recordPromise.bind(this));
};
/** @param {*} reason */
@@ -246,7 +246,7 @@ base.Promise = function() {};
*/
base.Promise.sleep = function(delay) {
return new Promise(
- /** @param {function():void} fulfill */
+ /** @param {function(*):void} fulfill */
function(fulfill) {
window.setTimeout(fulfill, delay);
});
@@ -436,11 +436,12 @@ base.generateXsrfToken = function() {
/**
* @param {string} jsonString A JSON-encoded string.
- * @return {*} The decoded object, or undefined if the string cannot be parsed.
+ * @return {Object|undefined} The decoded object, or undefined if the string
+ * cannot be parsed.
*/
base.jsonParseSafe = function(jsonString) {
try {
- return JSON.parse(jsonString);
+ return /** @type {Object} */ (JSON.parse(jsonString));
} catch (err) {
return undefined;
}

Powered by Google App Engine
This is Rietveld 408576698