Commit 71f8e567 authored by jhawkins's avatar jhawkins Committed by Commit bot

remoting: Fix JSCompiler issues blocking ES6 transition.

* @suppress reportUnknownTypes for code using |arguments|, which is not well-handled by the JSCompiler type system.
* Fix up ad hoc documentation into proper JSDoc annotation so the type system doesn't get hung up.

R=garykac@chromium.org
BUG=none

Review URL: https://codereview.chromium.org/1204023003

Cr-Commit-Position: refs/heads/master@{#336044}
parent 56c1d881
...@@ -65,6 +65,7 @@ base.Disposable.prototype.dispose = function() {}; ...@@ -65,6 +65,7 @@ base.Disposable.prototype.dispose = function() {};
* @constructor * @constructor
* @param {...base.Disposable} var_args * @param {...base.Disposable} var_args
* @implements {base.Disposable} * @implements {base.Disposable}
* @suppress {reportUnknownTypes}
*/ */
base.Disposables = function(var_args) { base.Disposables = function(var_args) {
/** /**
...@@ -76,6 +77,7 @@ base.Disposables = function(var_args) { ...@@ -76,6 +77,7 @@ base.Disposables = function(var_args) {
/** /**
* @param {...base.Disposable} var_args * @param {...base.Disposable} var_args
* @suppress {reportUnknownTypes}
*/ */
base.Disposables.prototype.add = function(var_args) { base.Disposables.prototype.add = function(var_args) {
var disposables = Array.prototype.slice.call(arguments, 0); var disposables = Array.prototype.slice.call(arguments, 0);
...@@ -90,6 +92,7 @@ base.Disposables.prototype.add = function(var_args) { ...@@ -90,6 +92,7 @@ base.Disposables.prototype.add = function(var_args) {
/** /**
* @param {...base.Disposable} var_args Dispose |var_args| and remove * @param {...base.Disposable} var_args Dispose |var_args| and remove
* them from the current object. * them from the current object.
* @suppress {reportUnknownTypes}
*/ */
base.Disposables.prototype.remove = function(var_args) { base.Disposables.prototype.remove = function(var_args) {
var disposables = Array.prototype.slice.call(arguments, 0); var disposables = Array.prototype.slice.call(arguments, 0);
......
...@@ -54,6 +54,7 @@ remoting.Error.prototype.getDetail = function() { ...@@ -54,6 +54,7 @@ remoting.Error.prototype.getDetail = function() {
* @param {remoting.Error.Tag} tag * @param {remoting.Error.Tag} tag
* @param {...remoting.Error.Tag} var_args * @param {...remoting.Error.Tag} var_args
* @return {boolean} True if this object has one of the specified tags. * @return {boolean} True if this object has one of the specified tags.
* @suppress {reportUnknownTypes}
*/ */
remoting.Error.prototype.hasTag = function(tag, var_args) { remoting.Error.prototype.hasTag = function(tag, var_args) {
var thisTag = this.tag_; var thisTag = this.tag_;
......
...@@ -146,6 +146,7 @@ base.Ipc.prototype.onMessage_ = function(message, sender, sendResponse) { ...@@ -146,6 +146,7 @@ base.Ipc.prototype.onMessage_ = function(message, sender, sendResponse) {
* @param {...} var_args * @param {...} var_args
* @return {Promise} A Promise that would resolve to the return value of the * @return {Promise} A Promise that would resolve to the return value of the
* handler or reject if the handler throws an exception. * handler or reject if the handler throws an exception.
* @suppress {reportUnknownTypes}
*/ */
base.Ipc.invoke = function(methodName, var_args) { base.Ipc.invoke = function(methodName, var_args) {
var params = Array.prototype.slice.call(arguments, 1); var params = Array.prototype.slice.call(arguments, 1);
......
...@@ -51,6 +51,7 @@ browserTest.FakeDesktopViewport.prototype.getBumpScrollerForTesting = ...@@ -51,6 +51,7 @@ browserTest.FakeDesktopViewport.prototype.getBumpScrollerForTesting =
return this.bumpScroller_; return this.bumpScroller_;
}; };
/** @suppress {reportUnknownTypes} */
browserTest.FakeDesktopViewport.prototype.raiseEvent = browserTest.FakeDesktopViewport.prototype.raiseEvent =
function() { function() {
return this.bumpScroller_.raiseEvent.apply(this.bumpScroller_, arguments); return this.bumpScroller_.raiseEvent.apply(this.bumpScroller_, arguments);
......
...@@ -37,6 +37,7 @@ chromeMocks.Event.prototype.removeListener = function(callback) { ...@@ -37,6 +37,7 @@ chromeMocks.Event.prototype.removeListener = function(callback) {
/** /**
* @param {...*} var_args * @param {...*} var_args
* @return {void} * @return {void}
* @suppress {reportUnknownTypes}
*/ */
chromeMocks.Event.prototype.mock$fire = function(var_args) { chromeMocks.Event.prototype.mock$fire = function(var_args) {
var params = Array.prototype.slice.call(arguments); var params = Array.prototype.slice.call(arguments);
......
...@@ -30,9 +30,10 @@ function assertInitialState(/** QUnit.Assert */ assert) { ...@@ -30,9 +30,10 @@ function assertInitialState(/** QUnit.Assert */ assert) {
} }
/** /**
* @param {!QUnit.Assert} assert
* @return {!Promise} * @return {!Promise}
*/ */
function finish(/** QUnit.Assert */ assert) { function finish(assert) {
return base.SpyPromise.settleAll().then(function() { return base.SpyPromise.settleAll().then(function() {
assert.equal( assert.equal(
base.SpyPromise.unsettledCount, 0, base.SpyPromise.unsettledCount, 0,
...@@ -143,11 +144,13 @@ QUnit.test('reject/catch', function(assert) { ...@@ -143,11 +144,13 @@ QUnit.test('reject/catch', function(assert) {
QUnit.test('all', function(assert) { QUnit.test('all', function(assert) {
var done = assert.async(); var done = assert.async();
base.SpyPromise.all([Promise.resolve(1), Promise.resolve(2)]). base.SpyPromise.all([Promise.resolve(1), Promise.resolve(2)]).
then(function(/**string*/ value) { then(
assert.equal(base.SpyPromise.unsettledCount, 0); /** @param {string} value */
assert.deepEqual(value, [1, 2]); function(value) {
done(); assert.equal(base.SpyPromise.unsettledCount, 0);
}); assert.deepEqual(value, [1, 2]);
done();
});
assert.equal(base.SpyPromise.unsettledCount, 1); assert.equal(base.SpyPromise.unsettledCount, 1);
return finish(assert); return finish(assert);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment