Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/126942

Change subject: ApiSandbox broken because of undefined variable
......................................................................

ApiSandbox broken because of undefined variable

"TypeError: match is undefined". Ouch.

Also changed a regex a bit to avoid horrible backtracking.

Change-Id: Idf10ddfb0cca2d8c5fe91b8b5e582adba8b48824
---
M resources/main.js
1 file changed, 2 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ApiSandbox 
refs/changes/42/126942/1

diff --git a/resources/main.js b/resources/main.js
index 172d6f3..b79df7a 100644
--- a/resources/main.js
+++ b/resources/main.js
@@ -447,15 +447,14 @@
                // Starting with MediaWiki 1.23 (b20f740e38), the backend 
response time
                // is embedded in the page source as a JavaScript configuration 
variable
                // set to whole milliseconds.
-               html.match( /"wgBackendResponseTime":\s*(\d+)/ );
+               match = html.match( /"wgBackendResponseTime":\s*(\d+)/ );
                if ( match !== null ) {
                        return parseInt( match[1], 10 ) / 1000;
                }
 
-
                // Earlier versions embed the backend response time in seconds 
in an
                // HTML comment.
-               match = html.match( /<!-- Served .*?in (\d+(\.\d+)?) secs. -->/ 
);
+               match = html.match( /<!-- Served [^>]*?in (\d+(\.\d+)?) secs. 
-->/ );
                if ( match !== null ) {
                        return parseFloat( match[1] );
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/126942
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf10ddfb0cca2d8c5fe91b8b5e582adba8b48824
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ApiSandbox
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to