From 5d9fe1ec34230ed98024b1b432eb3a9cb17d0cd4 Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Fri, 7 Aug 2015 18:25:55 -0700 Subject: [PATCH] Override document.writeln to prevent it from blanking pages Follow-up for Ic9056d7a77. Same rationale. Bug: T108423 Change-Id: I664ba9b0af4355ac83f2e5892e484a3f3aff0428 --- resources/src/mediawiki.legacy/wikibits.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/src/mediawiki.legacy/wikibits.js b/resources/src/mediawiki.legacy/wikibits.js index 1f01110955..05954ffcfc 100644 --- a/resources/src/mediawiki.legacy/wikibits.js +++ b/resources/src/mediawiki.legacy/wikibits.js @@ -215,10 +215,12 @@ win.importScript = importScript; win.importStylesheet = importStylesheet; - // Replace document.write with basic html parsing that appends + // Replace document.write/writeln with basic html parsing that appends // to the to avoid blanking pages. Added JavaScript will not run. - mw.log.deprecate( document, 'write', function ( html ) { - $( 'body' ).append( $.parseHTML( html ) ); - }, 'Use jQuery or mw.loader.load instead.' ); + $.each( [ 'write', 'writeln' ], function ( idx, method ) { + mw.log.deprecate( document, method, function ( html ) { + $( 'body' ).append( $.parseHTML( html ) ); + }, 'Use jQuery or mw.loader.load instead.' ); + } ); }( mediaWiki, jQuery ) ); -- 2.20.1