Move the IE memory leak prevention voodoo together to after the callback, and put...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 16 Feb 2012 22:56:44 +0000 (22:56 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 16 Feb 2012 22:56:44 +0000 (22:56 +0000)
resources/mediawiki/mediawiki.js

index 370aba9..2ed894e 100644 (file)
@@ -648,17 +648,21 @@ var mw = ( function ( $, undefined ) {
        
                                                                done = true;
        
-                                                               // Handle memory leak in IE
-                                                               script.onload = script.onreadystatechange = null;
-       
                                                                callback();
        
-                                                               if ( script.parentNode ) {
-                                                                       script.parentNode.removeChild( script );
-                                                               }
-       
-                                                               // Dereference the script
-                                                               script = undefined;
+                                                               // Handle memory leak in IE. This seems to fail in
+                                                               // IE7 sometimes (Permission Denied error when
+                                                               // accessing script.parentNode) so wrap it in
+                                                               // a try catch.
+                                                               try {
+                                                                       script.onload = script.onreadystatechange = null;
+                                                                       if ( script.parentNode ) {
+                                                                               script.parentNode.removeChild( script );
+                                                                       }
+               
+                                                                       // Dereference the script
+                                                                       script = undefined;
+                                                               } catch ( e ) { }
                                                        }
                                                };
                                        }