Only pretty-print the parser report JS vars
[lhc/web/wiklou.git] / includes / OutputPage.php
index f611980..d34ace8 100644 (file)
@@ -290,6 +290,9 @@ class OutputPage extends ContextSource {
         */
        private $copyrightUrl;
 
+       /** @var array Profiling data */
+       private $limitReportData = [];
+
        /**
         * Constructor for OutputPage. This should not be called directly.
         * Instead a new RequestContext should be created and it will implicitly create
@@ -1754,11 +1757,14 @@ class OutputPage extends ContextSource {
                        }
                }
 
-               // enable OOUI if requested via ParserOutput
+               // Enable OOUI if requested via ParserOutput
                if ( $parserOutput->getEnableOOUI() ) {
                        $this->enableOOUI();
                }
 
+               // Include profiling data
+               $this->limitReportData = $parserOutput->getLimitReportData();
+
                // Link flags are ignored for now, but may in the future be
                // used to mark individual language links.
                $linkFlags = [];
@@ -3075,7 +3081,13 @@ class OutputPage extends ContextSource {
         * @return string
         */
        function getBottomScripts() {
-               return $this->getScriptsForBottomQueue();
+               return $this->getScriptsForBottomQueue() .
+                       ResourceLoader::makeInlineScript(
+                               ResourceLoader::makeConfigSetScript(
+                                       [ 'wgPageParseReport' => $this->limitReportData ],
+                                       true
+                               )
+                       );
        }
 
        /**