From f1f319d6ada50d13774e24b7492a812fb7a727ac Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 15 Sep 2013 14:22:41 -0600 Subject: [PATCH] Preemptively set global properties As mentioned in the comments, calling goog.getUid and goog.events.listen on the global object (as done in map.js and deviceorientation.js) set global properties. To let Mocha check for other leaks, we preemptively set these properties. --- test/index.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/index.html b/test/index.html index 83de1522a9..57d7f9eb76 100644 --- a/test/index.html +++ b/test/index.html @@ -33,8 +33,16 @@ * by setting goog.UID_PROPERTY_ on the monitored window. In order to test * that we don't have other global leaks, we preemptively set the property * so Mocha can compare the global before and after our tests. + * + * In addition, calling goog.events.listen on the global object (as done + * in deviceorientation.js) creates a second leak by setting + * goog.events.LISTENER_MAP_PROP_ on the global object. + * + * We preemptively set both of these properties so Mocha can compare the + * global before and after tests. The call to goog.events.listen also + * calls goog.getUid. */ - goog.getUid(this); + goog.events.listen(this, 'test', function() {}); if (window.mochaPhantomJS) { mochaPhantomJS.run();