From: Roan Kattouw Date: Thu, 16 Feb 2012 22:56:44 +0000 (+0000) Subject: Move the IE memory leak prevention voodoo together to after the callback, and put... X-Git-Tag: 1.31.0-rc.0~24660 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=41d636d369dfc8d67271d80a5b3ddd1b71ccf586;p=lhc%2Fweb%2Fwiklou.git Move the IE memory leak prevention voodoo together to after the callback, and put it in a try catch block. The first statement after the callback seems to mysteriously fail in IE7 sometimes with a permission denied error. I think the root cause might be the fact that the callback itself also calls addScript() --- diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index 370aba9789..2ed894e19b 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -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 ) { } } }; }