Arlolra has uploaded a new change for review.

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

Change subject: Fix up conditions when consuming nowiki tokens in tmpl args
......................................................................

Fix up conditions when consuming nowiki tokens in tmpl args

 * An error was being suppressed on cawiki/2011_en_els_vols_espacials

 * Uncaught errors in domHandlers should panic.

Change-Id: Icad18c7d2c22714ddbb2aef96b643bfd22c4aeb9
---
M lib/mediawiki.WikitextSerializer.js
M lib/wts.escapeWikitext.js
2 files changed, 8 insertions(+), 5 deletions(-)


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

diff --git a/lib/mediawiki.WikitextSerializer.js 
b/lib/mediawiki.WikitextSerializer.js
index 4837248..2567afc 100644
--- a/lib/mediawiki.WikitextSerializer.js
+++ b/lib/mediawiki.WikitextSerializer.js
@@ -1019,7 +1019,7 @@
                                                        nextNode = 
domHandler.handle(node, state, cb, wrapperUnmodified);
                                                }
                                        } catch(e) {
-                                               this.env.log("error", e);
+                                               this.env.log("fatal", e);
                                        }
                                        // The handler is responsible for 
serializing its children
                                } else {
diff --git a/lib/wts.escapeWikitext.js b/lib/wts.escapeWikitext.js
index b94b1cf..6f1a27c 100644
--- a/lib/wts.escapeWikitext.js
+++ b/lib/wts.escapeWikitext.js
@@ -686,9 +686,10 @@
        }
 
        var tokens = tokenizeStr(state, arg, false);
-       var buf = '';
+       var t, da, buf = '';
        for (var i = 0, n = tokens.length; i < n; i++) {
-               var t = tokens[i], da = t.dataAttribs;
+               t = tokens[i];
+               da = t.dataAttribs;
 
                // For mw:Entity spans, the opening and closing tags have 0 
width
                // and the enclosed content is the decoded entity. Hence the
@@ -701,10 +702,12 @@
                                continue;
                        } else if (type === "mw:Nowiki") {
                                i++;
-                               while (i < n && (tokens[i].constructor !== 
pd.EndTagTk || tokens[i].getAttribute("typeof") !== "mw:Nowiki")) {
+                               while (i < n && tokens[i].constructor !== 
pd.EndTagTk) {
                                        i++;
                                }
-                               buf += arg.substring(da.tsr[0], 
tokens[i].dataAttribs.tsr[1]);
+                               if (i < n) {
+                                       buf += arg.substring(da.tsr[0], 
tokens[i].dataAttribs.tsr[1]);
+                               }
                                continue;
                        }
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icad18c7d2c22714ddbb2aef96b643bfd22c4aeb9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>

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

Reply via email to