Page MenuHomePhabricator

exception in module-execute in module ext.centralNotice.startUp: Cannot read property 'name' of undefined / "campaign is undefined
Closed, ResolvedPublic

Description

Seeing this on mobile (https://en.m.wikipedia.beta.wmflabs.org/wiki/Main_Page) on Chrome:

exception in module-execute in module ext.centralNotice.startUp:
load.php?lang=en&modules=startup&only=scripts&raw=1&skin=minerva&target=mobile:2 TypeError: Cannot read property 'name' of undefined
    at makePossibleBanners (<anonymous>:237:76)
    at Object.chooseBanner (<anonymous>:239:228)
    at reallyChooseAndMaybeDisplay (<anonymous>:222:751)
    at fire (load.php?lang=en&modules=ext.eventLogging|ext.growthExperiments.Help%2CHelpPanel|jquery%2Coojs-ui-core%2Coojs-ui-widgets|mediawiki.ui.anchor|mobile.init%2Cstartup|mobile.pagesummary.styles|mobile.placeholder.images|skins.minerva.mainMenu.styles|skins.minerva.options%2Cscripts&skin=minerva&version=48bcp:83)
    at Object.add [as done] (load.php?lang=en&modules=ext.eventLogging|ext.growthExperiments.Help%2CHelpPanel|jquery%2Coojs-ui-core%2Coojs-ui-widgets|mediawiki.ui.anchor|mobile.init%2Cstartup|mobile.pagesummary.styles|mobile.placeholder.images|skins.minerva.mainMenu.styles|skins.minerva.options%2Cscripts&skin=minerva&version=48bcp:84)
    at Object.always (load.php?lang=en&modules=ext.eventLogging|ext.growthExperiments.Help%2CHelpPanel|jquery%2Coojs-ui-core%2Coojs-ui-widgets|mediawiki.ui.anchor|mobile.init%2Cstartup|mobile.pagesummary.styles|mobile.placeholder.images|skins.minerva.mainMenu.styles|skins.minerva.options%2Cscripts&skin=minerva&version=48bcp:86)
    at Object.chooseAndMaybeDisplay (<anonymous>:224:976)
    at <anonymous>:244:125
    at index.js (<anonymous>:244:405)
    at runScript (load.php?lang=en&modules=startup&only=scripts&raw=1&skin=minerva&target=mobile:13)
logError @ load.php?lang=en&modules=startup&only=scripts&raw=1&skin=minerva&target=mobile:2

On Firefox I see:

TypeError: "campaign is undefined"

Event Timeline

Jdlrobson renamed this task from exception in module-execute in module ext.centralNotice.startUp: Cannot read property 'name' of undefined to exception in module-execute in module ext.centralNotice.startUp: Cannot read property 'name' of undefined / "campaign is undefined.Oct 3 2019, 5:22 PM

Change 540657 had a related patch set uploaded (by Mepps; owner: Mepps):
[mediawiki/extensions/CentralNotice@master] Add handling for undefined campaign in reallyChooseAndMaybeDisplay

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

I couldn't reproduce locally, but based on what I saw stepping through the debugger, it looks like when there is no campaign or iterations, the campaign variable is undefined. There is logic for the campaign being null but not undefined. I assumed we'd handle both the same way and added an or campaign === undefined. @AndyRussG Let me know what you think!

Change 540657 merged by jenkins-bot:
[mediawiki/extensions/CentralNotice@master] Campaign is null by default in reallyChooseAndMaybeDisplay

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