From d0259d497d7e76deecb357558beed51e1d21a807 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 20 Mar 2014 05:15:25 +0100 Subject: [PATCH] ResourceLoaderStartUpModule: Remove no-op "delete isCompatible" Due to the way this function being defined as a function or var declaration instead of a function expression assigned to a property it can't be deleted. JavaScript doesn't throw an error when deletion is not permitted though, the operator returns false instead. > delete isCompatible; false We already removed 'delete startUp' from mediawiki.js in favour of startUp = undefined; (r107402, r74325). Change-Id: I7aa02e3f4deb3a4f00177b70978bfcb83c80988a --- includes/resourceloader/ResourceLoaderStartUpModule.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 64fafd70be..3482bfad75 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -234,8 +234,9 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { // Startup function $configuration = $this->getConfig( $context ); $registrations = self::getModuleRegistrations( $context ); - $registrations = str_replace( "\n", "\n\t", trim( $registrations ) ); // fix indentation - $out .= "var startUp = function() {\n" . + // Fix indentation + $registrations = str_replace( "\n", "\n\t", trim( $registrations ) ); + $out .= "var startUp = function () {\n" . "\tmw.config = new " . Xml::encodeJsCall( 'mw.Map', array( $wgLegacyJavaScriptGlobals ) ) . "\n" . "\t$registrations\n" . "\t" . Xml::encodeJsCall( 'mw.config.set', array( $configuration ) ) . @@ -245,8 +246,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { $scriptTag = Html::linkedScript( self::getStartupModulesUrl( $context ) ); $out .= "if ( isCompatible() ) {\n" . "\t" . Xml::encodeJsCall( 'document.write', array( $scriptTag ) ) . - "}\n" . - "delete isCompatible;"; + "}"; } return $out; -- 2.20.1