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.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user