[OpenLayers-Commits] r11145 - in trunk/openlayers: lib/OpenLayers/Handler tests tests/Handler

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Fri Feb 18 10:22:13 EST 2011


Author: ahocevar
Date: 2011-02-18 07:22:12 -0800 (Fri, 18 Feb 2011)
New Revision: 11145

Added:
   trunk/openlayers/tests/Handler/Box.html
Modified:
   trunk/openlayers/lib/OpenLayers/Handler/Box.js
   trunk/openlayers/tests/list-tests.html
Log:
fixing error when closing page in IE. Thanks bartvde for the testcase. r=bartvde (closes #3003)

Modified: trunk/openlayers/lib/OpenLayers/Handler/Box.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Handler/Box.js	2011-02-18 13:20:07 UTC (rev 11144)
+++ trunk/openlayers/lib/OpenLayers/Handler/Box.js	2011-02-18 15:22:12 UTC (rev 11145)
@@ -68,11 +68,11 @@
      * Method: destroy
      */
     destroy: function() {
+        OpenLayers.Handler.prototype.destroy.apply(this, arguments);
         if (this.dragHandler) {
             this.dragHandler.destroy();
             this.dragHandler = null;
         }            
-        OpenLayers.Handler.prototype.destroy.apply(this, arguments);
     },
 
     /**

Added: trunk/openlayers/tests/Handler/Box.html
===================================================================
--- trunk/openlayers/tests/Handler/Box.html	                        (rev 0)
+++ trunk/openlayers/tests/Handler/Box.html	2011-02-18 15:22:12 UTC (rev 11145)
@@ -0,0 +1,26 @@
+<html>
+<head>
+  <script src="../../lib/OpenLayers.js"></script>
+  <script type="text/javascript">
+    function test_Handler_Box_destroy(t) {
+        t.plan(1);
+        var map = new OpenLayers.Map('map');
+        var control = new OpenLayers.Control();
+        map.addControl(control);
+        var handler = new OpenLayers.Handler.Box(control);
+        handler.activate();
+        try {
+            handler.destroy();
+            t.ok(true, "destroying the box handler should not raise any error");
+        } catch(err) {
+            t.fail("destroying the box handler causes trouble: " + err);
+        }
+        map.destroy();
+    }
+
+  </script>
+</head>
+<body>
+    <div id="map" style="width: 300px; height: 150px;"/>
+</body>
+</html>

Modified: trunk/openlayers/tests/list-tests.html
===================================================================
--- trunk/openlayers/tests/list-tests.html	2011-02-18 13:20:07 UTC (rev 11144)
+++ trunk/openlayers/tests/list-tests.html	2011-02-18 15:22:12 UTC (rev 11145)
@@ -112,6 +112,7 @@
     <li>Geometry/Rectangle.html</li>
     <li>Geometry/Surface.html</li>
     <li>Handler.html</li>
+    <li>Handler/Box.html</li>
     <li>Handler/Click.html</li>
     <li>Handler/Drag.html</li>
     <li>Handler/Feature.html</li>



More information about the Commits mailing list