Subramanya Sastry has uploaded a new change for review.

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


Change subject: Bug fix in AttributeExpander introduced by git SHA 46119efb
......................................................................

Bug fix in AttributeExpander introduced by git SHA 46119efb

* AttributeExpander stopped cloning tokens always -- it started
  cloning them on demand to eliminate useless work/memory use.

  However, this broke RTing of certain pages in 'roundtrip-test.js'
  (not when run via node server for some reason) because the KV
  obj. of original token was being modified via newAttrs object.

  This is because AttributeTransformManager was reusing the original
  KV object from the token's attributes when its k and v properties
  were strings (the common case).  But, in that scenario, there is
  no ksrc and vsrc to be updated either.  So, the fix is to not
  bother updating ksrc and vsrc in newAttrs[i] in AttributeExpander
  if they dont exist.

* Verified by testing with "node roundtrip-test.js Yelena_Romanova"

* No change in parser test results.

Change-Id: I54c53ae4f380532048a59240a03f9e4a7c867d1b
---
M js/lib/ext.core.AttributeExpander.js
1 file changed, 6 insertions(+), 2 deletions(-)


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

diff --git a/js/lib/ext.core.AttributeExpander.js 
b/js/lib/ext.core.AttributeExpander.js
index 4566c5f..2db92ea 100644
--- a/js/lib/ext.core.AttributeExpander.js
+++ b/js/lib/ext.core.AttributeExpander.js
@@ -68,8 +68,12 @@
                newK = newAttrs[i].k;
 
                // Preserve the key and value source, if available
-               newAttrs[i].ksrc = a.ksrc;
-               newAttrs[i].vsrc = a.vsrc;
+               if (a.ksrc) {
+                       newAttrs[i].ksrc = a.ksrc;
+               }
+               if (a.vsrc) {
+                       newAttrs[i].vsrc = a.vsrc;
+               }
 
                if (newK) {
                        if (newK !== a.k) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54c53ae4f380532048a59240a03f9e4a7c867d1b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org>

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

Reply via email to