| Index: mojo/public/js/bindings.js
|
| diff --git a/mojo/public/js/bindings.js b/mojo/public/js/bindings.js
|
| index a944e2f7aaf28d4cbcf8f6d9e1dfbd14cfc016f4..ed00554eb9a1036782443ef48b7b0f5e238436c4 100644
|
| --- a/mojo/public/js/bindings.js
|
| +++ b/mojo/public/js/bindings.js
|
| @@ -53,7 +53,7 @@ define("mojo/public/js/bindings", [
|
| };
|
|
|
| InterfacePtrController.prototype.isBound = function() {
|
| - return this.router_ !== null || this.handle_ !== null;
|
| + return this.interfaceEndpointClient_ !== null || this.handle_ !== null;
|
| };
|
|
|
| // Although users could just discard the object, reset() closes the pipe
|
| @@ -77,9 +77,11 @@ define("mojo/public/js/bindings", [
|
| };
|
|
|
| InterfacePtrController.prototype.resetWithReason = function(reason) {
|
| - this.configureProxyIfNecessary_();
|
| - this.interfaceEndpointClient_.close(reason);
|
| - this.interfaceEndpointClient_ = null;
|
| + if (this.isBound()) {
|
| + this.configureProxyIfNecessary_();
|
| + this.interfaceEndpointClient_.close(reason);
|
| + this.interfaceEndpointClient_ = null;
|
| + }
|
| this.reset();
|
| };
|
|
|
| @@ -123,12 +125,11 @@ define("mojo/public/js/bindings", [
|
| if (!this.handle_)
|
| return;
|
|
|
| - this.router_ = new router.Router(this.handle_);
|
| + this.router_ = new router.Router(this.handle_, true);
|
| this.handle_ = null;
|
|
|
| this.interfaceEndpointClient_ = new InterfaceEndpointClient(
|
| - this.router_.createLocalEndpointHandle(types.kMasterInterfaceId),
|
| - this.router_);
|
| + this.router_.createLocalEndpointHandle(types.kMasterInterfaceId));
|
|
|
| this.interfaceEndpointClient_ .setPayloadValidators([
|
| this.interfaceType_.validateResponse]);
|
| @@ -207,8 +208,8 @@ define("mojo/public/js/bindings", [
|
| this.stub_ = new this.interfaceType_.stubClass(this.impl_);
|
| this.interfaceEndpointClient_ = new InterfaceEndpointClient(
|
| this.router_.createLocalEndpointHandle(types.kMasterInterfaceId),
|
| - this.router_, this.interfaceType_.kVersion);
|
| - this.interfaceEndpointClient_.setIncomingReceiver(this.stub_);
|
| + this.stub_, this.interfaceType_.kVersion);
|
| +
|
| this.interfaceEndpointClient_ .setPayloadValidators([
|
| this.interfaceType_.validateRequest]);
|
| };
|
| @@ -235,8 +236,7 @@ define("mojo/public/js/bindings", [
|
| this.close();
|
| };
|
|
|
| - Binding.prototype.setConnectionErrorHandler
|
| - = function(callback) {
|
| + Binding.prototype.setConnectionErrorHandler = function(callback) {
|
| if (!this.isBound()) {
|
| throw new Error("Cannot set connection error handler if not bound.");
|
| }
|
|
|