mw.loader: Guard against odd setTimeout behaviour in old Firefox
authorTimo Tijhof <ttijhof@wikimedia.org>
Tue, 26 Mar 2013 17:59:07 +0000 (18:59 +0100)
committerTimo Tijhof <ttijhof@wikimedia.org>
Tue, 26 Mar 2013 17:59:07 +0000 (18:59 +0100)
Bug: 46575
Change-Id: I80af730daa815f0c273fe942c570d1f0144bbbb1

resources/mediawiki/mediawiki.js

index 2ceb3ea..d1cb41d 100644 (file)
@@ -487,7 +487,13 @@ var mw = ( function ( $, undefined ) {
                                                // TODO: Use requestAnimationFrame in the future which will
                                                // perform even better by not injecting styles while the browser
                                                // is paiting.
-                                               setTimeout( addEmbeddedCSS );
+                                               setTimeout( function () {
+                                                       // Can't pass addEmbeddedCSS to setTimeout directly because Firefox
+                                                       // (below version 13) has the non-standard behaviour of passing a
+                                                       // numerical "lateness" value as first argument to this callback
+                                                       // http://benalman.com/news/2009/07/the-mysterious-firefox-settime/
+                                                       addEmbeddedCSS();
+                                               } );
                                                return;
                                        }