Steps to replicate the issue (include links if applicable):
- Install MobileFrontend and needed dependencies
- Make sure not to have VisualEditor installed
- Go to any page in the mobile version (e.g., useformat=mobile)
- Click the button to edit the page
What happens?:
The editor does not load, and the following error is logged in the console:
oojs.js:867 Uncaught TypeError: Cannot read properties of null (reading 'namespaces') at t.value (mobile.common.js:1:17590) at P (mobile.init.js:1:2338) at r.eval (mobile.init.js:1:3447) at r._matchRoute (mobile.common.js:1:15138) at r.eval (mobile.common.js:1:14727) at Array.reduce (<anonymous>) at r._checkRoute (mobile.common.js:1:14691) at OO.EventEmitter.emit (oojs.js:858:12) at eval (oojs-router.js:46:11) at OO.EventEmitter.emit (oojs.js:858:12)
What should have happened instead?:
The editor should load (without VE).
Software version (skip for WMF-hosted wikis like Wikipedia):
Everything master.
Other information (browser name/version, screenshots, etc.):
VE is an optional dependency to MF, and therefore the latter should work even if the former is not available. The code in question (introduced in r434730, 2023-06-09) is:
isVEVisualAvailable() { var config = mw.config.get( 'wgVisualEditorConfig' ); var visualEditorNamespaces = config.namespaces || []; return this.isVEAvailable() && visualEditorNamespaces.indexOf( mw.config.get( 'wgNamespaceNumber' ) ) !== -1; }
This should be rearranged to return early if isVEAvailable is false.