C. Scott Ananian has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376438 )

Change subject: Parsoid doesn't support $wgRawHtml==true
......................................................................

Parsoid doesn't support $wgRawHtml==true

This tweak to parserTests.txt removes some unnecessary entries from
our test blacklist.

Change-Id: I7ab14281402f3dcc851b1bfa23e591017bc6bca9
---
M tests/parserTests-blacklist.js
M tests/parserTests.txt
2 files changed, 4 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/38/376438/1

diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js
index 5ab429e..52fddda 100644
--- a/tests/parserTests-blacklist.js
+++ b/tests/parserTests-blacklist.js
@@ -178,7 +178,6 @@
 add("wt2html", "Width-sized image (using px, no following whitespace)", "<p 
data-parsoid='{\"dsr\":[0,26,0,0]}'><span typeof=\"mw:Image\" 
data-parsoid='{\"optList\":[{\"ck\":\"width\",\"ak\":\"640px\"}],\"dsr\":[0,26,null,null]}'><a
 href=\"./File:Foobar.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./File:Foobar.jpg\"},\"sa\":{\"href\":\"Image:foobar.jpg\"}}'><img
 resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"73\" width=\"640\" 
data-parsoid='{\"a\":{\"resource\":\"./File:Foobar.jpg\",\"height\":\"73\",\"width\":\"640\"},\"sa\":{\"resource\":\"Image:foobar.jpg\"}}'/></a></span></p>");
 add("wt2html", "Width-sized image (using px, with following whitespace - test 
regression from r39467)", "<p data-parsoid='{\"dsr\":[0,27,0,0]}'><span 
typeof=\"mw:Image\" 
data-parsoid='{\"optList\":[{\"ck\":\"width\",\"ak\":\"640px 
\"}],\"dsr\":[0,27,null,null]}'><a href=\"./File:Foobar.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./File:Foobar.jpg\"},\"sa\":{\"href\":\"Image:foobar.jpg\"}}'><img
 resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"73\" width=\"640\" 
data-parsoid='{\"a\":{\"resource\":\"./File:Foobar.jpg\",\"height\":\"73\",\"width\":\"640\"},\"sa\":{\"resource\":\"Image:foobar.jpg\"}}'/></a></span></p>");
 add("wt2html", "Width-sized image (using px, with preceding whitespace - test 
regression from r39467)", "<p data-parsoid='{\"dsr\":[0,27,0,0]}'><span 
typeof=\"mw:Image\" data-parsoid='{\"optList\":[{\"ck\":\"width\",\"ak\":\" 
640px\"}],\"dsr\":[0,27,null,null]}'><a href=\"./File:Foobar.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./File:Foobar.jpg\"},\"sa\":{\"href\":\"Image:foobar.jpg\"}}'><img
 resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"73\" width=\"640\" 
data-parsoid='{\"a\":{\"resource\":\"./File:Foobar.jpg\",\"height\":\"73\",\"width\":\"640\"},\"sa\":{\"resource\":\"Image:foobar.jpg\"}}'/></a></span></p>");
-add("wt2html", "HTML with raw HTML ($wgRawHtml==true)", "<p 
data-parsoid='{\"dsr\":[0,39,0,0]}'>&lt;html>&lt;script>alert(1);&lt;/script>&lt;/html></p>");
 add("wt2html", "Parents of subpages, one level up, not named", "<p 
data-parsoid='{\"dsr\":[0,7,0,0]}'><a rel=\"mw:WikiLink\" 
href=\"./Subpage_test/L1/L2\" title=\"Subpage test/L1/L2\" 
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Subpage_test/L1/L2\"},\"sa\":{\"href\":\"../\"},\"dsr\":[0,7,2,2]}'>Subpage_test/L1/L2</a></p>");
 add("wt2html", "Parents of subpages, two levels up, with lots of extra 
trailing slashes.", "<p data-parsoid='{\"dsr\":[0,14,0,0]}'><a 
rel=\"mw:WikiLink\" href=\"./Subpage_test/L1\" title=\"Subpage test/L1\" 
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Subpage_test/L1\"},\"sa\":{\"href\":\"../../////\"},\"dsr\":[0,14,2,2]}'>Subpage_test/L1</a></p>");
 add("wt2html", "RAW magic word", "<p data-parsoid='{\"dsr\":[0,14,0,0]}'><span 
about=\"#mwt2\" typeof=\"mw:Error mw:Transclusion\" 
data-parsoid='{\"pi\":[[]],\"dsr\":[0,14,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"RAW:QUERTY\",\"href\":\"./Template:RAW:QUERTY\"},\"params\":{},\"errors\":[{\"key\":\"mw-api-tplfetch-error\",\"message\":\"Page
 / template fetching disabled, and no cache for 
Template:RAW:QUERTY\"}],\"i\":0}}]}'>{{RAW:QUERTY}}</span></p>");
@@ -211,7 +210,6 @@
 add("wt2html", "Special parser function", "<p 
data-parsoid='{\"dsr\":[0,65,0,0]}'><span about=\"#mwt1\" 
typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[]],\"dsr\":[0,23,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#special:RandomPage\",\"function\":\"special\"},\"params\":{},\"i\":0}}]}'>Parser
 function implementation for pf_special missing in Parsoid.</span>\n<span 
about=\"#mwt2\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[]],\"dsr\":[24,45,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#special:BaDtItLe\",\"function\":\"special\"},\"params\":{},\"i\":0}}]}'>Parser
 function implementation for pf_special missing in Parsoid.</span>\n<span 
about=\"#mwt3\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[]],\"dsr\":[46,65,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"#special:Foobar\",\"function\":\"special\"},\"params\":{},\"i\":0}}]}'>Parser
 function implementation for pf_special missing in Parsoid.</span></p>");
 add("wt2html", "1. SOL-sensitive wikitext tokens as template-args", "<p 
data-parsoid='{\"dsr\":[0,35,0,0]}'><span about=\"#mwt1\" 
typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[0,11,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"*a\"}},\"i\":0}}]}'>*a</span>\n<span
 about=\"#mwt2\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,23,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"#a\"}},\"i\":0}}]}'>#a</span>\n<span
 about=\"#mwt3\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,35,null,null]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\":a\"}},\"i\":0}}]}'>:a</span></p>");
 add("wt2html", "Empty table rows go away", "<table 
data-parsoid='{\"dsr\":[0,39,2,2]}'>\n<tbody 
data-parsoid='{\"dsr\":[3,37,0,0]}'><tr 
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[3,18,0,0]}'><td
 data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[3,10,1,0]}'> Hello</td>\n<td 
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[11,18,1,0]}'> 
there</td></tr>\n<tr class=\"foo\" 
data-parsoid='{\"startTagSrc\":\"|-\",\"autoInsertedEnd\":true,\"dsr\":[19,33,14,0]}'></tr>\n<tr
 
data-parsoid='{\"startTagSrc\":\"|-\",\"autoInsertedEnd\":true,\"dsr\":[34,36,2,0]}'></tr>\n</tbody></table>");
-add("wt2html", "Validating that <style> isn't eaten by tidy (T167349)", "<div 
class=\"foo\" data-parsoid='{\"stx\":\"html\",\"dsr\":[0,170,17,6]}'>\n<p 
data-parsoid='{\"dsr\":[18,163,0,0]}'>&lt;html>&lt;style>.foo::before { 
content: \"&lt;foo>\"; }&lt;/style>&lt;/html>\n&lt;html>&lt;style 
data-mw-foobar=\"baz\">.foo::after { content: \"&lt;bar>\"; 
}&lt;/style>&lt;/html></p>\n</div>");
 
 
 // Blacklist for wt2wt
@@ -452,7 +450,6 @@
 add("html2html", "Width-sized image (using px, no following whitespace)", "<p 
data-parsoid='{\"dsr\":[0,64,0,0]}'><img 
src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg\"; 
alt=\"640px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[0,64,null,null]}'/></p>\n");
 add("html2html", "Width-sized image (using px, with following whitespace - 
test regression from r39467)", "<p data-parsoid='{\"dsr\":[0,64,0,0]}'><img 
src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg\"; 
alt=\"640px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[0,64,null,null]}'/></p>\n");
 add("html2html", "Width-sized image (using px, with preceding whitespace - 
test regression from r39467)", "<p data-parsoid='{\"dsr\":[0,64,0,0]}'><img 
src=\"http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg\"; 
alt=\"640px-Foobar.jpg\" rel=\"mw:externalImage\" 
data-parsoid='{\"dsr\":[0,64,null,null]}'/></p>\n");
-add("html2html", "HTML with raw HTML ($wgRawHtml==true)", "<p 
data-parsoid='{\"dsr\":[0,26,0,0]}'>&lt;script>alert(1);&lt;/script></p>\n");
 add("html2html", "Parents of subpages, one level up", "<p 
data-parsoid='{\"dsr\":[0,62,0,0]}'>[/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1
 L2]</p>\n");
 add("html2html", "Parents of subpages, one level up, not named", "<p 
data-parsoid='{\"dsr\":[0,78,0,0]}'>[/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1
 Subpage test/L1/L2]</p>\n");
 add("html2html", "Parents of subpages, two levels up", "<p 
data-parsoid='{\"dsr\":[0,60,0,0]}'>[/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1
 L1]2</p>\n\n<p 
data-parsoid='{\"dsr\":[62,122,0,0]}'>[/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1
 L1l]</p>\n");
@@ -473,7 +470,6 @@
 add("html2html", "T73074: More fostering fun", "<link 
rel=\"mw:PageProp/Category\" href=\"./Category:Two\" 
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Category:Two\"},\"sa\":{\"href\":\"Category:Two\"},\"dsr\":[0,16,null,null]}'/>\n<link
 rel=\"mw:PageProp/Category\" href=\"./Category:Two\" 
data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Category:Two\"},\"sa\":{\"href\":\"Category:Two\"},\"fostered\":true,\"dsr\":[17,17]}'/><table
 
data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[17,70,7,0]}'><tbody
 data-parsoid='{\"dsr\":[24,70,0,0]}'><tr 
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[24,33,0,0]}'><td
 data-parsoid='{\"stx\":\"html\",\"dsr\":[24,33,4,5]}'></td></tr><tr 
about=\"#mwt1\" typeof=\"mw:Transclusion\" 
data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[33,70,null,0],\"pi\":[[{\"k\":\"1\"}]]}'
 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&lt;tr>\"}},\"i\":0}},\"&lt;!--c-->[[Category:Two]]\"]}'><!--c--></tr></tbody></table>");
 add("html2html", "Image: upright option (parsoid)", "<figure 
class=\"mw-default-size\" typeof=\"mw:Image/Thumb\" 
data-parsoid='{\"optList\":[{\"ck\":\"thumbnail\",\"ak\":\"thumb\"},{\"ck\":\"caption\",\"ak\":\"caption\"}],\"dsr\":[0,33,2,2]}'><a
 href=\"./File:Foobar.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./File:Foobar.jpg\"},\"sa\":{\"href\":\"File:Foobar.jpg\"},\"dsr\":[2,null,null,null]}'><img
 resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"25\" width=\"220\" 
data-parsoid='{\"a\":{\"resource\":\"./File:Foobar.jpg\",\"height\":\"25\",\"width\":\"220\"},\"sa\":{\"resource\":\"File:Foobar.jpg\"}}'/></a><figcaption
 
data-parsoid='{\"dsr\":[null,31,null,null]}'>caption</figcaption></figure>\n<figure
 class=\"mw-default-size\" typeof=\"mw:Image/Thumb\" 
data-parsoid='{\"optList\":[{\"ck\":\"thumbnail\",\"ak\":\"thumb\"},{\"ck\":\"caption\",\"ak\":\"caption\"}],\"dsr\":[34,67,2,2]}'><a
 href=\"./File:Foobar.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./File:Foobar.jpg\"},\"sa\":{\"href\":\"File:Foobar.jpg\"},\"dsr\":[36,null,null,null]}'><img
 resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"25\" width=\"220\" 
data-parsoid='{\"a\":{\"resource\":\"./File:Foobar.jpg\",\"height\":\"25\",\"width\":\"220\"},\"sa\":{\"resource\":\"File:Foobar.jpg\"}}'/></a><figcaption
 
data-parsoid='{\"dsr\":[null,65,null,null]}'>caption</figcaption></figure>\n<figure
 typeof=\"mw:Image/Thumb\" 
data-parsoid='{\"optList\":[{\"ck\":\"thumbnail\",\"ak\":\"thumb\"},{\"ck\":\"width\",\"ak\":\"500x500px\"},{\"ck\":\"caption\",\"ak\":\"caption\"}],\"dsr\":[68,111,2,2]}'><a
 href=\"./File:Foobar.jpg\" 
data-parsoid='{\"a\":{\"href\":\"./File:Foobar.jpg\"},\"sa\":{\"href\":\"File:Foobar.jpg\"},\"dsr\":[70,null,null,null]}'><img
 resource=\"./File:Foobar.jpg\" 
src=\"//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg\" 
data-file-width=\"1941\" data-file-height=\"220\" data-file-type=\"bitmap\" 
height=\"57\" width=\"500\" 
data-parsoid='{\"a\":{\"resource\":\"./File:Foobar.jpg\",\"height\":\"57\",\"width\":\"500\"},\"sa\":{\"resource\":\"File:Foobar.jpg\"}}'/></a><figcaption
 
data-parsoid='{\"dsr\":[null,109,null,null]}'>caption</figcaption></figure>\n");
 add("html2html", "Consecutive <pre>s should not get merged", "<pre 
data-parsoid='{\"dsr\":[0,2,1,0]}'>a</pre>\n\n<pre 
data-parsoid='{\"dsr\":[4,6,1,0]}'>b</pre>\n\n<pre 
data-parsoid='{\"dsr\":[8,10,1,0]}'>c</pre>\n\n<pre 
data-parsoid='{\"dsr\":[12,14,1,0]}'>d</pre>\n\n<pre 
data-parsoid='{\"dsr\":[16,19,1,0]}'>e</pre>\n\n\n <p 
data-parsoid='{\"dsr\":[23,23,0,0]}'><br 
data-parsoid='{\"dsr\":[23,23,0,0]}'/></p>\n<pre 
data-parsoid='{\"dsr\":[24,26,1,0]}'>f</pre>\n");
-add("html2html", "Validating that <style> isn't eaten by tidy (T167349)", 
"<div class=\"foo\" data-parsoid='{\"stx\":\"html\",\"dsr\":[0,144,17,6]}'>\n<p 
data-parsoid='{\"dsr\":[18,137,0,0]}'>&lt;style>.foo::before { content: 
\"&lt;foo>\"; }&lt;/style>\n&lt;style data-mw-foobar=\"baz\">.foo::after { 
content: \"&lt;bar>\"; }&lt;/style></p>\n</div>");
 
 
 // Blacklist for html2wt
@@ -928,7 +924,6 @@
 add("html2wt", "Width-sized image (using px, no following whitespace)", 
"http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg\n";);
 add("html2wt", "Width-sized image (using px, with following whitespace - test 
regression from r39467)", 
"http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg\n";);
 add("html2wt", "Width-sized image (using px, with preceding whitespace - test 
regression from r39467)", 
"http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg\n";);
-add("html2wt", "HTML with raw HTML ($wgRawHtml==true)", 
"<script>alert(1);</script>\n");
 add("html2wt", "Parents of subpages, one level up", 
"[/index.php?title=Subpage_test/L1/L2&action=edit&redlink=1 L2]\n");
 add("html2wt", "Parents of subpages, one level up, not named", 
"[/index.php?title=Subpage_test/L1/L2&action=edit&redlink=1 Subpage 
test/L1/L2]\n");
 add("html2wt", "Parents of subpages, two levels up", 
"[/index.php?title=Subpage_test/L1&action=edit&redlink=1 
L1]2\n\n[/index.php?title=Subpage_test/L1&action=edit&redlink=1 L1l]\n");
@@ -1020,7 +1015,6 @@
 add("html2wt", "Parsoid should not accept invalid interwiki shortcuts", 
"[[news:Foo|Foo]]\n[news:Foo Foo]\n[news:Foo Foo]\n");
 add("html2wt", "Image: upright option (parsoid)", 
"[[File:Foobar.jpg|thumb|caption]]\n[[File:Foobar.jpg|thumb|caption]]\n[[File:Foobar.jpg|thumb|500x500px|caption]]\n");
 add("html2wt", "Image: upright option is ignored on inline and frame images 
(parsoid)", "[[File:Foobar.jpg|500x500px|caption]]\n");
-add("html2wt", "Validating that <style> isn't eaten by tidy (T167349)", "<div 
class=\"foo\">\n<style>.foo::before { content: \"<foo>\"; }</style>\n<style 
data-mw-foobar=\"baz\">.foo::after { content: \"<bar>\"; }</style>\n</div>");
 
 
 // Blacklist for selser
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 3f93793..0e4092e 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -20910,7 +20910,7 @@
 wgRawHtml=1
 !! wikitext
 <html><script>alert(1);</script></html>
-!! html
+!! html/php
 <p><script>alert(1);</script>
 </p>
 !! end
@@ -29240,17 +29240,18 @@
 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
 !! end
 
+# Use $wgRawHtml to inject a <style> tag, since you normally can't in wikitext
+# (Parsoid doesn't support $wgRawHtml==true)
 !! test
 Validating that <style> isn't eaten by tidy (T167349)
 !! options
-# Use $wgRawHtml to inject a <style> tag, since you normally can't in wikitext
 wgRawHtml=1
 !! wikitext
 <div class="foo">
 <html><style>.foo::before { content: "<foo>"; }</style></html>
 <html><style data-mw-foobar="baz">.foo::after { content: "<bar>"; 
}</style></html>
 </div>
-!! html+tidy
+!! html/php+tidy
 <div class="foo">
 <style>.foo::before { content: "<foo>"; }</style>
 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ab14281402f3dcc851b1bfa23e591017bc6bca9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org>

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

Reply via email to