Merge pull request #643 from twpayne/fix-dispose

Fix dispose
This commit is contained in:
Tom Payne
2013-04-23 05:20:05 -07:00
7 changed files with 25 additions and 18 deletions

View File

@@ -3,6 +3,7 @@ goog.require('goog.array');
goog.require('goog.async.Deferred'); goog.require('goog.async.Deferred');
goog.require('goog.async.DeferredList'); goog.require('goog.async.DeferredList');
goog.require('goog.date'); goog.require('goog.date');
goog.require('goog.dispose');
goog.require('goog.dom.xml'); goog.require('goog.dom.xml');
goog.require('goog.events'); goog.require('goog.events');
goog.require('goog.net.EventType'); goog.require('goog.net.EventType');
@@ -881,7 +882,7 @@ ol.parser.KML.prototype.parseLinks = function(deferreds, obj, done) {
goog.events.listen(xhr, goog.net.EventType.COMPLETE, function(e) { goog.events.listen(xhr, goog.net.EventType.COMPLETE, function(e) {
if (e.target.isSuccess()) { if (e.target.isSuccess()) {
var data = e.target.getResponseXml(); var data = e.target.getResponseXml();
e.target.dispose(); goog.dispose(e.target);
if (data && data.nodeType == 9) { if (data && data.nodeType == 9) {
data = data.documentElement; data = data.documentElement;
} }

View File

@@ -13,17 +13,18 @@ describe('ol.control.Control', function() {
}); });
afterEach(function() { afterEach(function() {
map.dispose(); goog.dispose(map);
}); });
describe('dispose', function() { describe('dispose', function() {
it('removes the control element from its parent', function() { it('removes the control element from its parent', function() {
control.dispose(); goog.dispose(control);
expect(goog.dom.getParentElement(control.element)).to.be(null); expect(goog.dom.getParentElement(control.element)).to.be(null);
}); });
}); });
}); });
goog.require('goog.dispose');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.dom.TagName'); goog.require('goog.dom.TagName');
goog.require('ol.Map'); goog.require('ol.Map');

View File

@@ -15,8 +15,8 @@ describe('ol.control.ZoomSlider', function() {
}); });
afterEach(function() { afterEach(function() {
zoomslider.dispose(); goog.dispose(zoomslider);
map.dispose(); goog.dispose(map);
document.body.removeChild(target); document.body.removeChild(target);
zoomslider = null; zoomslider = null;
map = null; map = null;
@@ -72,7 +72,7 @@ describe('ol.control.ZoomSlider', function() {
var horizontal = ol.control.ZoomSlider.direction.HORIZONTAL; var horizontal = ol.control.ZoomSlider.direction.HORIZONTAL;
expect(control.direction_).to.be(horizontal); expect(control.direction_).to.be(horizontal);
control.dispose(); goog.dispose(control);
}); });
it('is vertical for tall containers', function() { it('is vertical for tall containers', function() {
@@ -85,12 +85,13 @@ describe('ol.control.ZoomSlider', function() {
var vertical = ol.control.ZoomSlider.direction.VERTICAL; var vertical = ol.control.ZoomSlider.direction.VERTICAL;
expect(control.direction_).to.be(vertical); expect(control.direction_).to.be(vertical);
control.dispose(); goog.dispose(control);
}); });
}); });
}); });
goog.require('goog.dispose');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.dom.classes'); goog.require('goog.dom.classes');
goog.require('goog.fx.Dragger'); goog.require('goog.fx.Dragger');

View File

@@ -15,7 +15,7 @@ describe('ol.layer.Layer', function() {
}); });
afterEach(function() { afterEach(function() {
layer.dispose(); goog.dispose(layer);
}); });
it('creates an instance', function() { it('creates an instance', function() {
@@ -70,7 +70,7 @@ describe('ol.layer.Layer', function() {
expect(layer.getSaturation()).to.be(5); expect(layer.getSaturation()).to.be(5);
expect(layer.getVisible()).to.be(false); expect(layer.getVisible()).to.be(false);
layer.dispose(); goog.dispose(layer);
}); });
}); });
@@ -88,7 +88,7 @@ describe('ol.layer.Layer', function() {
}); });
afterEach(function() { afterEach(function() {
layer.dispose(); goog.dispose(layer);
}); });
it('accepts a positive number', function() { it('accepts a positive number', function() {
@@ -126,7 +126,7 @@ describe('ol.layer.Layer', function() {
}); });
afterEach(function() { afterEach(function() {
layer.dispose(); goog.dispose(layer);
}); });
it('accepts a small positive number', function() { it('accepts a small positive number', function() {
@@ -160,7 +160,7 @@ describe('ol.layer.Layer', function() {
}); });
afterEach(function() { afterEach(function() {
layer.dispose(); goog.dispose(layer);
}); });
it('accepts a small positive number', function() { it('accepts a small positive number', function() {
@@ -199,7 +199,7 @@ describe('ol.layer.Layer', function() {
}); });
afterEach(function() { afterEach(function() {
layer.dispose(); goog.dispose(layer);
}); });
it('accepts a positive number', function() { it('accepts a positive number', function() {
@@ -233,7 +233,7 @@ describe('ol.layer.Layer', function() {
}); });
afterEach(function() { afterEach(function() {
layer.dispose(); goog.dispose(layer);
}); });
it('accepts a small positive number', function() { it('accepts a small positive number', function() {
@@ -269,13 +269,14 @@ describe('ol.layer.Layer', function() {
layer.setVisible(true); layer.setVisible(true);
expect(layer.getVisible()).to.be(true); expect(layer.getVisible()).to.be(true);
layer.dispose(); goog.dispose(layer);
}); });
}); });
}); });
goog.require('goog.dispose');
goog.require('ol.layer.Layer'); goog.require('ol.layer.Layer');
goog.require('ol.projection'); goog.require('ol.projection');
goog.require('ol.source.Source'); goog.require('ol.source.Source');

View File

@@ -170,12 +170,13 @@ describe('ol.layer.Vector', function() {
}); });
layer.dispose(); goog.dispose(layer);
}); });
}); });
goog.require('goog.dispose');
goog.require('ol.Expression'); goog.require('ol.Expression');
goog.require('ol.Feature'); goog.require('ol.Feature');
goog.require('ol.filter.Extent'); goog.require('ol.filter.Extent');

View File

@@ -61,7 +61,7 @@ describe('ol.Map', function() {
}); });
it('removes the viewport from its parent', function() { it('removes the viewport from its parent', function() {
map.dispose(); goog.dispose(map);
expect(goog.dom.getParentElement(map.getViewport())).to.be(null); expect(goog.dom.getParentElement(map.getViewport())).to.be(null);
}); });
}); });
@@ -223,6 +223,7 @@ describe('ol.Map', function() {
}); });
goog.require('goog.async.AnimationDelay'); goog.require('goog.async.AnimationDelay');
goog.require('goog.dispose');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('ol.Collection'); goog.require('ol.Collection');
goog.require('ol.Map'); goog.require('ol.Map');

View File

@@ -37,7 +37,7 @@ describe('ol.renderer.webgl.ImageLayer', function() {
}); });
afterEach(function() { afterEach(function() {
map.dispose(); goog.dispose(map);
}); });
it('produces a correct matrix', function() { it('produces a correct matrix', function() {
@@ -77,6 +77,7 @@ describe('ol.renderer.webgl.ImageLayer', function() {
}); });
}); });
goog.require('goog.dispose');
goog.require('goog.vec.Mat4'); goog.require('goog.vec.Mat4');
goog.require('goog.vec.Vec4'); goog.require('goog.vec.Vec4');
goog.require('ol.Map'); goog.require('ol.Map');