mw.loader.store: Detect malformed function stringification
authorBartosz Dziewoński <matma.rex@gmail.com>
Fri, 27 Dec 2013 22:03:13 +0000 (23:03 +0100)
committerOri.livneh <ori@wikimedia.org>
Fri, 27 Dec 2013 22:18:00 +0000 (22:18 +0000)
See the bug for details.

This seems to happen somewhat consistently on Opera 12, let's
try to work around the browser bug before we blacklist it.

Includes some console logging.

Bug: 57567
Change-Id: Ifd7b203fb0ca61e4a749e6b0fc031e62121cc45a

resources/mediawiki/mediawiki.js

index 89da4a2..f3bb414 100644 (file)
@@ -1960,6 +1960,12 @@ var mw = ( function ( $, undefined ) {
                                                                JSON.stringify( descriptor.style ),
                                                                JSON.stringify( descriptor.messages )
                                                        ];
+                                                       // Attempted workaround for a possible Opera bug (bug 57567).
+                                                       // This regex should never match under sane conditions.
+                                                       if ( /^\s*\(/.test( args[1] ) ) {
+                                                               args[1] = 'function' + args[1];
+                                                               log( 'Detected malformed function stringification (bug 57567)' );
+                                                       }
                                                } catch ( e ) {
                                                        return;
                                                }