GWicke has uploaded a new change for review.

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

Change subject: Work around Cite reset issue
......................................................................

Work around Cite reset issue

The Cite extension does not currently handle resetState calls in
sub-pipelines, and relies on sharing a single Cite instance between all
pipelines. Fixing this is a longer project, so this patch works around the
issue for now by passing a flag indicating resetState calls in sub-pipelines
and ignoring the call in Cite in that case.

Change-Id: If3d426a5311a55d1c1530860d2b665d3681f1aa9
---
M lib/ext.Cite.js
M lib/mediawiki.parser.js
2 files changed, 8 insertions(+), 6 deletions(-)


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

diff --git a/lib/ext.Cite.js b/lib/ext.Cite.js
index f22f322..1e002c5 100644
--- a/lib/ext.Cite.js
+++ b/lib/ext.Cite.js
@@ -469,9 +469,11 @@
        this.references = new References(this);
 };
 
-Cite.prototype.resetState = function() {
-       this.ref.reset();
-       this.references.reset( null, true );
+Cite.prototype.resetState = function(inSubPipeline) {
+       if (!inSubPipeline) {
+               this.ref.reset();
+               this.references.reset( null, true );
+       }
 };
 
 if (typeof module === "object") {
diff --git a/lib/mediawiki.parser.js b/lib/mediawiki.parser.js
index a0d2a2c..308639e 100644
--- a/lib/mediawiki.parser.js
+++ b/lib/mediawiki.parser.js
@@ -314,7 +314,7 @@
        var pipe;
        if ( this.pipelineCache[cacheKey].length ) {
                pipe = this.pipelineCache[cacheKey].pop();
-               pipe.resetState();
+               pipe.resetState(true); // signal that we are resetting a 
sub-pipeline
                // Clear both 'end' and 'document' handlers
                pipe.removeAllListeners('end');
                pipe.removeAllListeners('document');
@@ -425,8 +425,8 @@
  * Ex: parser tests. Currently only parser tests exercise
  * this functionality.
  */
-ParserPipeline.prototype.resetState = function() {
-       this._applyToStage("resetState", []);
+ParserPipeline.prototype.resetState = function(inSubPipeline) {
+       this._applyToStage("resetState", [inSubPipeline]);
 };
 
 /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If3d426a5311a55d1c1530860d2b665d3681f1aa9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <gwi...@wikimedia.org>

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

Reply via email to