0

Remove use of 'this' in static method in JS mojo lite bindings.

As mentioned in:
https://developers.google.com/closure/compiler/docs/limitations#implications-of-object-property-flattening

'this' should not be used outside of the constructor or prototype
methods. Using 'this' in a static method will break under the
--collapse_properties flag in Closure.

--collapse_properties is a recommended flag in google3, hence fixing this makes
it easier to use mojo lite bindings in google3.

Bug: 1132142
Change-Id: I046615009d76f919cab6569285e9dfba6922b98e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2428269
Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810494}
This commit is contained in:
Darren Shen
2020-09-25 06:52:46 +00:00
committed by Commit Bot
parent cacb4cfbcd
commit 9234f90712

@ -166,7 +166,7 @@ goog.provide('{{module.namespace}}.{{interface.name}}PendingReceiver');
*/
static getRemote() {
let remote = new {{module.namespace}}.{{interface.name}}Remote;
Mojo.bindInterface(this.$interfaceName,
Mojo.bindInterface({{module.namespace}}.{{interface.name}}.$interfaceName,
remote.$.bindNewPipeAndPassReceiver().handle);
return remote;
}