jenkins-bot has submitted this change and it was merged.

Change subject: Remove option to pass in wikiConfig when constructing env
......................................................................


Remove option to pass in wikiConfig when constructing env

 * This isn't ever used.

Change-Id: I44518b69b2b32c8d0cbb8e327dddcec491b74338
---
M bin/parse.js
M bin/parserTests.js
M bin/roundtrip-test.js
M lib/api/routes.js
M lib/config/MWParserEnvironment.js
M tests/mocha/test.helpers.js
M tools/fetch-wt.js
7 files changed, 17 insertions(+), 23 deletions(-)

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



diff --git a/bin/parse.js b/bin/parse.js
index 29348f7..e8478d0 100755
--- a/bin/parse.js
+++ b/bin/parse.js
@@ -199,7 +199,7 @@
 };
 
 var parse = exports.parse = function(input, argv, parsoidConfig, prefix, 
domain) {
-       return ParserEnv.getParserEnv(parsoidConfig, null, {
+       return ParserEnv.getParserEnv(parsoidConfig, {
                prefix: prefix,
                domain: domain,
                pageName: argv.page,
diff --git a/bin/parserTests.js b/bin/parserTests.js
index 9c67b9f..e2fef59 100755
--- a/bin/parserTests.js
+++ b/bin/parserTests.js
@@ -1686,7 +1686,7 @@
        var parsoidConfig = new ParsoidConfig({ setup: setup }, options);
 
        // Create a new parser environment
-       MWParserEnvironment.getParserEnv(parsoidConfig, null, { prefix: 
'enwiki' },
+       MWParserEnvironment.getParserEnv(parsoidConfig, { prefix: 'enwiki' },
                        function(err, env) {
                // For posterity: err will never be non-null here, because we 
expect
                // the WikiConfig to be basically empty, since the parserTests
diff --git a/bin/roundtrip-test.js b/bin/roundtrip-test.js
index c32e14a..3edfc16 100755
--- a/bin/roundtrip-test.js
+++ b/bin/roundtrip-test.js
@@ -566,7 +566,7 @@
        var data = {};
        return Promise[err ? 'reject' : 'resolve'](err).then(function() {
                return MWParserEnvironment.getParserEnv(
-                       parsoidConfig, null, { prefix: prefix, pageName: title }
+                       parsoidConfig, { prefix: prefix, pageName: title }
                );
        }).then(function(_env) {
                env = _env;
diff --git a/lib/api/routes.js b/lib/api/routes.js
index b210d1c..e528748 100644
--- a/lib/api/routes.js
+++ b/lib/api/routes.js
@@ -138,7 +138,7 @@
                        cookie: req.headers.cookie,
                        reqId: req.headers['x-request-id'],
                };
-               MWParserEnv.getParserEnv(parsoidConfig, null, 
options).then(function(env) {
+               MWParserEnv.getParserEnv(parsoidConfig, 
options).then(function(env) {
                        env.logger.registerBackend(/fatal(\/.*)?/, 
errBack.bind(this, env));
                        if (env.conf.parsoid.allowCORS) {
                                // Allow cross-domain requests (CORS) so that 
parsoid service
diff --git a/lib/config/MWParserEnvironment.js 
b/lib/config/MWParserEnvironment.js
index e06c94d..493628c 100644
--- a/lib/config/MWParserEnvironment.js
+++ b/lib/config/MWParserEnvironment.js
@@ -22,9 +22,8 @@
  *
  * @constructor
  * @param {ParsoidConfig|null} parsoidConfig
- * @param {WikiConfig|null} wikiConfig
  */
-var MWParserEnvironment = function(parsoidConfig, wikiConfig, options) {
+var MWParserEnvironment = function(parsoidConfig, options) {
        options = options || {};
 
        // page information
@@ -75,17 +74,13 @@
 
        this.configureLogging();
 
-       if (!wikiConfig) {
-               // Local things, per-wiki
-               console.assert(parsoidConfig.mwApiMap.has(options.prefix));
-               wikiConfig = new WikiConfig(
-                       this, null, options.prefix,
-                       parsoidConfig.mwApiMap.get(options.prefix).uri,
-                       this.getAPIProxy(options.prefix)
-               );
-       }
-
-       this.conf.wiki = wikiConfig;
+       // Local things, per-wiki
+       console.assert(parsoidConfig.mwApiMap.has(options.prefix));
+       this.conf.wiki = new WikiConfig(
+               this, null, options.prefix,
+               parsoidConfig.mwApiMap.get(options.prefix).uri,
+               this.getAPIProxy(options.prefix)
+       );
 
        this.initializeForPageName(options.pageName || this.defaultPageName);
 
@@ -239,14 +234,13 @@
  *
  * @method
  * @param {ParsoidConfig|null} parsoidConfig
- * @param {WikiConfig|null} wikiConfig
  * @param {Object} options
  * @param {Function} cb
  * @param {Error} cb.err
  * @param {MWParserEnvironment} cb.env The finished environment object
  * @static
  */
-MWParserEnvironment.getParserEnv = function(parsoidConfig, wikiConfig, 
options, cb) {
+MWParserEnvironment.getParserEnv = function(parsoidConfig, options, cb) {
        // Get that wiki's config
        return Promise.method(function() {
                options = options || {};
@@ -256,7 +250,7 @@
                if (!options.prefix || 
!parsoidConfig.mwApiMap.has(options.prefix)) {
                        throw new Error('No API URI available for prefix: ' + 
options.prefix);
                }
-               var env = new MWParserEnvironment(parsoidConfig, wikiConfig, 
options);
+               var env = new MWParserEnvironment(parsoidConfig, options);
                return env.switchToConfig(options.prefix).then(function() {
                        if (!options.pageName) {
                                
env.initializeForPageName(env.conf.wiki.mainpage, true);
diff --git a/tests/mocha/test.helpers.js b/tests/mocha/test.helpers.js
index 1e99ba8..81382bf 100644
--- a/tests/mocha/test.helpers.js
+++ b/tests/mocha/test.helpers.js
@@ -4,7 +4,7 @@
 
 var parse = function(parsoidConfig, src, options) {
        options = options || {};
-       return MWParserEnvironment.getParserEnv(parsoidConfig, null, {
+       return MWParserEnvironment.getParserEnv(parsoidConfig, {
                prefix: options.prefix || 'enwiki',
                pageName: options.pageName || 'Main_Page',
        }).then(function(env) {
@@ -23,7 +23,7 @@
 
 var serialize = function(parsoidConfig, doc, dp, options) {
        options = options || {};
-       return MWParserEnvironment.getParserEnv(parsoidConfig, null, {
+       return MWParserEnvironment.getParserEnv(parsoidConfig, {
                prefix: options.prefix || 'enwiki',
                pageName: options.pageName || 'Main_Page',
        }).then(function(env) {
diff --git a/tools/fetch-wt.js b/tools/fetch-wt.js
index 6be3c3a..c96bfe2 100755
--- a/tools/fetch-wt.js
+++ b/tools/fetch-wt.js
@@ -53,7 +53,7 @@
 
        var env;
        var target;
-       MWParserEnvironment.getParserEnv(parsoidConfig, null, {
+       MWParserEnvironment.getParserEnv(parsoidConfig, {
                prefix: prefix,
                domain: domain,
                pageName: page,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I44518b69b2b32c8d0cbb8e327dddcec491b74338
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Cscott <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