mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 17:00:37 +00:00
Avoid exception when checking for loaded modules
The test would lead to an exception when 'mediaWiki' is not defined. The exception would then also abort the whole execution so in this context it's safer to use typeof with 'undefined'. When the mediaWiki js base is loaded though, loader.getState() is guaranteed to be available since it is part of the root module. This also uses "mw" instead of "mediaWiki" for consistency in test. Change-Id: I1262d0b5c4a1136f4d2294f125336e72118c6e2c
This commit is contained in:
parent
54702bff62
commit
79ee43fbeb
|
@ -6,7 +6,8 @@
|
|||
"node": true
|
||||
},
|
||||
"globals": {
|
||||
"browser": "readonly"
|
||||
"browser": "readonly",
|
||||
"mw": "readonly"
|
||||
},
|
||||
"rules": {
|
||||
"no-console": 0
|
||||
|
|
|
@ -41,9 +41,8 @@ class PopupsPage extends Page {
|
|||
// https://github.com/webdriverio/webdriverio/blob/master/lib/utils/Timer.js
|
||||
browser.waitUntil( () => {
|
||||
return browser.execute( ( module ) => {
|
||||
return mediaWiki &&
|
||||
mediaWiki.loader &&
|
||||
mediaWiki.loader.getState( module.name ) === module.status;
|
||||
return typeof mw !== 'undefined' &&
|
||||
mw.loader.getState( module.name ) === module.status;
|
||||
}, { status: moduleStatus, name: moduleName } );
|
||||
}, 10000, errMsg );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue