Index: mojo/public/js/bindings.js |
diff --git a/mojo/public/js/bindings.js b/mojo/public/js/bindings.js |
index c6c98d5ff713ee9d574ffec0318009f09a8819e0..44aa9f4e9fed6529dbfa495db9712c939e01d38e 100644 |
--- a/mojo/public/js/bindings.js |
+++ b/mojo/public/js/bindings.js |
@@ -4,7 +4,8 @@ |
define("mojo/public/js/bindings", [ |
"mojo/public/js/router", |
-], function(router) { |
+ "mojo/public/js/core", |
+], function(router, core) { |
var Router = router.Router; |
@@ -30,12 +31,31 @@ define("mojo/public/js/bindings", [ |
throw new Error("no stub object"); |
} |
+ function connectionHandle(connection) { |
+ return connection && |
+ connection.router && |
+ connection.router.connector_ && |
+ connection.router.connector_.handle_; |
+ } |
+ |
+ ProxyProperties.prototype.close = function() { |
+ var handle = connectionHandle(this.connection); |
+ if (handle) |
+ core.close(handle); |
+ } |
+ |
// Public stub class properties that are managed at runtime by the JS |
// bindings. See StubBindings below. |
function StubProperties(delegate) { |
this.delegate = delegate; |
} |
+ StubProperties.prototype.close = function() { |
+ var handle = connectionHandle(this.connection); |
+ if (handle) |
+ core.close(handle); |
+ } |
+ |
// The base class for generated proxy classes. |
function ProxyBase(receiver) { |
this[kProxyProperties] = new ProxyProperties(receiver); |