Merge pull request #461 from tschaub/ie9-leaks
OpenLayers-2.12-rc2 + jQuery-1.7.2 Memory leak in Internet Explorer 9 (p=@tschaub,r=@marcjansen,@elemoine)
This commit is contained in:
@@ -45,8 +45,15 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, {
|
||||
/**
|
||||
* Property: geolocation
|
||||
* {Object} The geolocation engine, as a property to be possibly mocked.
|
||||
* This is set lazily to avoid a memory leak in IE9.
|
||||
*/
|
||||
geolocation: navigator.geolocation,
|
||||
geolocation: null,
|
||||
|
||||
/**
|
||||
* Property: available
|
||||
* {Boolean} The navigator.geolocation object is available.
|
||||
*/
|
||||
available: ('geolocation' in navigator),
|
||||
|
||||
/**
|
||||
* APIProperty: bind
|
||||
@@ -90,6 +97,10 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, {
|
||||
* {Boolean} The control was effectively activated.
|
||||
*/
|
||||
activate: function () {
|
||||
if (this.available && !this.geolocation) {
|
||||
// set lazily to avoid IE9 memory leak
|
||||
this.geolocation = navigator.geolocation;
|
||||
}
|
||||
if (!this.geolocation) {
|
||||
this.events.triggerEvent("locationuncapable");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user