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

Issue 8336004: Improve web-app type safety. (Closed)

Created:
9 years, 2 months ago by Jamie
Modified:
9 years, 2 months ago
Reviewers:
simonmorris
CC:
chromium-reviews, jamiewalch+watch_chromium.org, hclam+watch_chromium.org, simonmorris+watch_chromium.org, wez+watch_chromium.org, dmaclach+watch_chromium.org, garykac+watch_chromium.org, lambroslambrou+watch_chromium.org, ajwong+watch_chromium.org, sergeyu+watch_chromium.org, jshin+watch_chromium.org
Visibility:
Public.

Description

Improve web-app typing. BUG=None TEST=Manual Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=106072

Patch Set 1 #

Total comments: 30

Patch Set 2 : Incorporated comments from simonmorris@. #

Patch Set 3 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+245 lines, -148 lines) Patch
M remoting/webapp/me2mom/client_session.js View 1 2 11 chunks +22 lines, -20 lines 0 comments Download
M remoting/webapp/me2mom/debug_log.js View 1 3 chunks +12 lines, -10 lines 0 comments Download
M remoting/webapp/me2mom/host_plugin_proto.js View 1 chunk +1 line, -0 lines 0 comments Download
M remoting/webapp/me2mom/l10n.js View 1 chunk +1 line, -1 line 0 comments Download
M remoting/webapp/me2mom/oauth2.js View 14 chunks +45 lines, -31 lines 0 comments Download
M remoting/webapp/me2mom/remoting.js View 1 2 17 chunks +88 lines, -34 lines 0 comments Download
M remoting/webapp/me2mom/viewer_plugin_proto.js View 1 chunk +41 lines, -24 lines 0 comments Download
M remoting/webapp/me2mom/wcs.js View 5 chunks +9 lines, -6 lines 0 comments Download
M remoting/webapp/me2mom/wcs_iq_client_proto.js View 1 chunk +2 lines, -2 lines 0 comments Download
M remoting/webapp/me2mom/wcs_loader.js View 6 chunks +12 lines, -7 lines 0 comments Download
M remoting/webapp/me2mom/xhr.js View 6 chunks +12 lines, -13 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Jamie
PTAL. http://codereview.chromium.org/8336004/diff/1/remoting/webapp/me2mom/client_session.js File remoting/webapp/me2mom/client_session.js (left): http://codereview.chromium.org/8336004/diff/1/remoting/webapp/me2mom/client_session.js#oldcode19 remoting/webapp/me2mom/client_session.js:19: (function() { JSCompiler doesn't recognise types inside anonymous ...
9 years, 2 months ago (2011-10-18 00:19:27 UTC) #1
simonmorris
http://codereview.chromium.org/8336004/diff/1/remoting/webapp/me2mom/client_session.js File remoting/webapp/me2mom/client_session.js (left): http://codereview.chromium.org/8336004/diff/1/remoting/webapp/me2mom/client_session.js#oldcode19 remoting/webapp/me2mom/client_session.js:19: (function() { On 2011/10/18 00:19:27, Jamie wrote: > JSCompiler ...
9 years, 2 months ago (2011-10-18 00:55:36 UTC) #2
Jamie
http://codereview.chromium.org/8336004/diff/1/remoting/webapp/me2mom/client_session.js File remoting/webapp/me2mom/client_session.js (right): http://codereview.chromium.org/8336004/diff/1/remoting/webapp/me2mom/client_session.js#newcode151 remoting/webapp/me2mom/client_session.js:151: /** @type {remoting.ClientSession} */ var that = this; On ...
9 years, 2 months ago (2011-10-18 01:42:01 UTC) #3
simonmorris
9 years, 2 months ago (2011-10-18 15:26:02 UTC) #4
LGTM

http://codereview.chromium.org/8336004/diff/1/remoting/webapp/me2mom/client_s...
File remoting/webapp/me2mom/client_session.js (right):

http://codereview.chromium.org/8336004/diff/1/remoting/webapp/me2mom/client_s...
remoting/webapp/me2mom/client_session.js:151: /** @type {remoting.ClientSession}
*/ var that = this;
On 2011/10/18 01:42:01, Jamie wrote:
> On 2011/10/18 00:55:36, simonmorris wrote:
> > On 2011/10/18 00:19:27, Jamie wrote:
> > > I don't know why the compiler can't infer the type of |that|, but it seems
> > that
> > > it can't. This annotation crops up a few times.
> > 
> > Probably because |this| is a keyword, not a variable.
> > If this function is called from as a callback, I think
> > |this| needn't be a remoting.ClientSession.
> 
> Good point about the callback behaviour. I'd forgotten what an unholy hack
> |this| is in Javascript.
> 
> Regarding the new-line, I've tended to put type annotations on the same line,
as
> they won't be in a typed languages. Where I'm annotating function parameters,
> I've tended to put them above the function as there are often more than one.
> That said, I suspect I haven't been very consistent about it.

OK.

http://codereview.chromium.org/8336004/diff/1/remoting/webapp/me2mom/client_s...
remoting/webapp/me2mom/client_session.js:187: if (this.plugin) {
On 2011/10/18 01:42:01, Jamie wrote:
> On 2011/10/18 00:55:36, simonmorris wrote:
> > On 2011/10/18 00:19:27, Jamie wrote:
> > > We've stored the plugin already--not sure why we were looking it up again.
> > 
> > Are you certain |this| is always what you think it is here?
> > I think it depends how removePlugin() is invoked. That might
> > be the reason |plugin| used to be looked up - or it might
> > just be inadvertent, as you say.
> 
> Previously the function referred to both this.plugin and the version it had
> looked up, so I'm pretty sure it's a case of different parts of the function
> being written at different times.

Right - there's a |this.plugin| in the previous version, so
the function must be invoked in the way that makes |this| do
the right thing. grep confirms.

Powered by Google App Engine
This is Rietveld 408576698