jenkins-bot has submitted this change and it was merged.

Change subject: Properly escape attributes in test results
......................................................................


Properly escape attributes in test results

Quotes were not escaped in attributes, which lead to errors as in this result:
http://parsoid.wmflabs.org:8001/result/804ead03252b9694f146b1027b8b5a55d67b4450/hewiki/%D7%A0%D7%A0%D7%95%D7%98%D7%9B%D7%A0%D7%95%D7%9C%D7%95%D7%92%D7%99%D7%99%D7%AA_%D7%93%D7%A0%22%D7%90

Change-Id: I313e803892285e7aa382cc53bd0af5e6a455617b
---
M tests/roundtrip-test.js
1 file changed, 8 insertions(+), 2 deletions(-)

Approvals:
  Marcoil: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/roundtrip-test.js b/tests/roundtrip-test.js
index bb8f420..544393f 100755
--- a/tests/roundtrip-test.js
+++ b/tests/roundtrip-test.js
@@ -64,12 +64,18 @@
                          .replace( />/g, '>' );
 };
 
+function encodeAttribute (str) {
+       return encodeXmlEntities(str)
+               .replace(/"/g, '"');
+}
+
+
 var xmlCallback = function ( env, err, results ) {
        var i, result;
        var prefix = ( env && env.conf && env.conf.wiki && env.conf.wiki.iwp ) 
|| '';
        var title = ( env && env.page && env.page.name ) || '';
 
-       var output = '<testsuite name="Roundtrip article ' + encodeXmlEntities( 
prefix + ':' + title ) + '">';
+       var output = '<testsuite name="Roundtrip article ' + encodeAttribute( 
prefix + ':' + title ) + '">';
 
        if ( err ) {
                output += '<testcase name="entire article"><error 
type="parserFailedToFinish">';
@@ -80,7 +86,7 @@
                for ( i = 0; i < results.length; i++ ) {
                        result = results[i];
 
-                       output += '<testcase name="' + encodeXmlEntities( 
prefix + ':' + title ) + ' character ' + result.offset[0].start + '">';
+                       output += '<testcase name="' + encodeAttribute( prefix 
+ ':' + title ) + ' character ' + result.offset[0].start + '">';
 
                        if ( result.type === 'fail' ) {
                                output += '<failure 
type="significantHtmlDiff">\n';

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I313e803892285e7aa382cc53bd0af5e6a455617b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <gwi...@wikimedia.org>
Gerrit-Reviewer: Marcoil <marc...@wikimedia.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to