GWicke has uploaded a new change for review.

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


Change subject: Fix selective serialization with cached page DOM
......................................................................

Fix selective serialization with cached page DOM

Fix several bugs in the use of cached HTML for selective serialization that
prevented it from being used at all.

Change-Id: I83f291aaf929ca86f5f6f9d2eeaeed99cb68bbcd
---
M js/lib/mediawiki.SelectiveSerializer.js
1 file changed, 10 insertions(+), 8 deletions(-)


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

diff --git a/js/lib/mediawiki.SelectiveSerializer.js 
b/js/lib/mediawiki.SelectiveSerializer.js
index 3cede3e..9e61dde 100644
--- a/js/lib/mediawiki.SelectiveSerializer.js
+++ b/js/lib/mediawiki.SelectiveSerializer.js
@@ -175,26 +175,28 @@
                this.parseOriginalSource( doc, cb, finalcb, null, 
this.env.page.src );
        } else if (this.env.page.id && this.env.page.id !== '0') {
                // Start by getting the old text of this page
-               if (this.env.conf.parsoidCacheURI) {
+               if (this.env.conf.parsoid.parsoidCacheURI) {
                        var cacheRequest = new ParsoidCacheRequest(this.env,
-                                       this.env.page.meta.title, 
this.env.page.id, {evenIfNotCached: true});
+                                       this.env.page.name, this.env.page.id, 
{evenIfNotCached: true});
                        // Fetch the page source and previous revison's DOM in 
parallel
                        async.parallel(
                                        [
-                                               Util.getPageSrc( this.env, 
this.env.page.name,
+                                               Util.getPageSrc.bind(Util, 
this.env, this.env.page.name,
                                                        this.env.page.id || 
null),
                                                
cacheRequest.once.bind(cacheRequest, 'src')
                                        ], function (err, results) {
                                                if (err) {
-                                                       console.error('Error 
while fetchin page source or original DOM!');
+                                                       console.error('Error 
while fetching page source or original DOM!');
                                                } else {
                                                        // no error.
 
-                                                       // set the page source
-                                                       
this.env.setPageSrcInfo(results[0]);
+                                                       // Set the page source.
+                                                       
self.env.setPageSrcInfo(results[0]);
 
-                                                       // and the original dom
-                                                       this.env.page.dom = 
results[1].body;
+                                                       // And the original 
dom. results[1] is an array
+                                                       // with the html and 
the content type. Ignore the
+                                                       // content type here.
+                                                       self.env.page.dom = 
Util.parseHTML(results[1][0]);
                                                }
 
                                                // Selective serialization if 
there was no error, full

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83f291aaf929ca86f5f6f9d2eeaeed99cb68bbcd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to