GWicke has uploaded a new change for review.

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


Change subject: Bug 56489: Allow content attribute on parsoid-generated meta 
tokens
......................................................................

Bug 56489: Allow content attribute on parsoid-generated meta tokens

Change-Id: I3280c61225ccfab072248f305ebc7bf743f0f61a
---
M js/lib/ext.core.Sanitizer.js
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/08/93108/1

diff --git a/js/lib/ext.core.Sanitizer.js b/js/lib/ext.core.Sanitizer.js
index d8c2abc..28d3a76 100644
--- a/js/lib/ext.core.Sanitizer.js
+++ b/js/lib/ext.core.Sanitizer.js
@@ -909,7 +909,7 @@
 // SSS FIXME: There is a test in mediawiki.environment.js that doles out
 // and tests about ids. There are probably some tests in mediawiki.Util.js
 // as well. We should move all these kind of tests somewhere else.
-Sanitizer.prototype.isParsoidAttr = function(k, v) {
+Sanitizer.prototype.isParsoidAttr = function(k, v, attrs) {
        // NOTES:
        // 1. Currently the tokenizer unconditionally escapes typeof and about
        //    attributes from wikitxt to data-x-typeof and data-x-about. So,
@@ -922,7 +922,8 @@
        //    That further processing will catch and discard any dangerous
        //    strings in the rest of the attribute
        return (/^(?:typeof|property|rel)$/).test(k) && 
/(?:^|\s)mw:.+?(?=$|\s)/.test(v) ||
-               k === "about" && /^#mwt\d+$/.test(v);
+               k === "about" && /^#mwt\d+$/.test(v) ||
+               k === "content" && 
/(?:^|\s)mw:.+?(?=$|\s)/.test(Util.lookup(attrs, 'property'));
 };
 
 Sanitizer.prototype.sanitizeTagAttrs = function(newToken, attrs) {
@@ -943,7 +944,7 @@
                        origK = a.ksrc || k,
                        v = a.v,
                        origV = a.vsrc || v,
-                       psdAttr = this.isParsoidAttr(k, v);
+                       psdAttr = this.isParsoidAttr(k, v, attrs);
 
                //console.warn('k = ' + k + '; v = ' + v);
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3280c61225ccfab072248f305ebc7bf743f0f61a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>

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

Reply via email to