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

Change subject: (Bug 62663) Temp fix for handling non-string extension 
attribute values
......................................................................


(Bug 62663) Temp fix for handling non-string extension attribute values

* This patch forcibly converts non-string extension attribute values
  to string and passes them along. On RT-ing, this does introduce
  dirty diffs (  --> " "), but selser should cover most of these
  uses.

  This eliminates the crasher reported in the bug report.

Change-Id: I765c5d7c55503681ce21c92a20a4db53569bcd4e
---
M lib/ext.core.ExtensionHandler.js
M lib/mediawiki.Util.js
2 files changed, 9 insertions(+), 7 deletions(-)

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



diff --git a/lib/ext.core.ExtensionHandler.js b/lib/ext.core.ExtensionHandler.js
index 0a40d4d..1c642bc 100644
--- a/lib/ext.core.ExtensionHandler.js
+++ b/lib/ext.core.ExtensionHandler.js
@@ -50,7 +50,7 @@
        return {
                dict: {
                        name: extName,
-                       attrs: Util.KVtoHash(extToken.getAttribute("options")),
+                       attrs: Util.KVtoHash(extToken.getAttribute("options"), 
true),
                        body: { extsrc: Util.extractExtBody(extName, extSrc) }
                }
        };
diff --git a/lib/mediawiki.Util.js b/lib/mediawiki.Util.js
index 8066754..6cceedc 100644
--- a/lib/mediawiki.Util.js
+++ b/lib/mediawiki.Util.js
@@ -790,20 +790,22 @@
         * Convert an array of key-value pairs into a hash of keys to values. 
For
         * duplicate keys, the last entry wins.
         */
-       KVtoHash: function ( kvs ) {
+       KVtoHash: function ( kvs, convertValuesToString ) {
                if ( ! kvs ) {
                        console.warn( "Invalid kvs!: " + JSON.stringify( kvs, 
null, 2 ) );
                        return Object.create(null);
                }
+
                var res = Object.create(null);
                for ( var i = 0, l = kvs.length; i < l; i++ ) {
                        var kv = kvs[i],
-                               key = this.tokensToString( kv.k ).trim();
-                       //if( res[key] === undefined ) {
-                       res[key.toLowerCase()] = this.tokenTrim( kv.v );
-                       //}
+                               key = this.tokensToString( kv.k ).trim(),
+                               // SSS FIXME: Temporary fix to handle 
extensions which use
+                               // entities in attribute values. We need more 
robust handling
+                               // of non-string template attribute values in 
general.
+                               val = convertValuesToString ? 
this.tokensToString(kv.v) : kv.v;
+                       res[key.toLowerCase()] = this.tokenTrim(val);
                }
-               //console.warn( 'KVtoHash: ' + JSON.stringify( res ));
                return res;
        },
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I765c5d7c55503681ce21c92a20a4db53569bcd4e
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Marcoil <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to