jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/340066 )

Change subject: Bug fix in Async Token Transform Manager
......................................................................


Bug fix in Async Token Transform Manager

* Token chunk ranks were not being propagated properly on some
  async code paths in transformTokens

* This bug fix is required for the followup patch that adds
  support for templated template names. That patch exposed
  this bug.

Change-Id: Ic3a0379d287b9abb2de4917966472cc70c842687
---
M lib/wt2html/TokenTransformManager.js
1 file changed, 5 insertions(+), 3 deletions(-)

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



diff --git a/lib/wt2html/TokenTransformManager.js 
b/lib/wt2html/TokenTransformManager.js
index 2ccd12b..5252a90 100644
--- a/lib/wt2html/TokenTransformManager.js
+++ b/lib/wt2html/TokenTransformManager.js
@@ -665,11 +665,12 @@
                                        if (!resTokens.rank || resTokens.rank < 
this.phaseEndRank) {
                                                // There might still be 
something to do for these
                                                // tokens. Prepare them for the 
workStack.
+                                               var oldRank = resTokens.rank;
                                                resTokens = resTokens.slice();
                                                // Don't apply earlier 
transforms to results of a
                                                // transformer to avoid loops 
and keep the
                                                // execution model sane.
-                                               resTokens.rank = resTokens.rank 
|| transformer.rank;
+                                               resTokens.rank = oldRank || 
transformer.rank;
                                                // resTokens.rank = Math.max( 
resTokens.rank || 0, transformer.rank );
                                                if (res.async) {
                                                        resTokens.inAsyncMode = 
true;
@@ -763,13 +764,14 @@
                this.env.log('debug', 'maybeSyncReturn transforming', s.c, ret);
                if (ret.tokens && ret.tokens.length > 0) {
                        if (s.res.tokens) {
+                               var newRank = ret.tokens.rank;
                                var oldRank = s.res.tokens.rank;
                                s.res.tokens = JSUtils.pushArray(s.res.tokens, 
ret.tokens);
-                               if (oldRank && ret.tokens.rank) {
+                               if (oldRank && newRank) {
                                        // Conservatively set the overall rank 
to the minimum.
                                        // This assumes that multi-pass 
expansion for some tokens
                                        // is safe. We might want to revisit 
that later.
-                                       s.res.tokens.rank = Math.min(oldRank, 
ret.tokens.rank);
+                                       s.res.tokens.rank = Math.min(oldRank, 
newRank);
                                }
                        } else {
                                s.res = ret;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic3a0379d287b9abb2de4917966472cc70c842687
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: C. Scott Ananian <canan...@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