Page MenuHomePhabricator

Special:MyPage/minerva.js is executed twice
Closed, DuplicatePublic

Description

Add

console.log( 'test' );

to Special:MyPage/minerva.js and you can see that it prints to console twice.

Event Timeline

Nirmos created this task.Jan 14 2017, 3:19 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 14 2017, 3:19 PM

I think it's very unlikely for mw.hook to fire the same events multiple times. But perhaps the code in Special:MyPage/minerva.js is executed more than once, so your handles are registered more than once?

Yes, you're absolutely right. Special:MyPage/minerva.js is executed twice. Updating title and description accordingly.

Nirmos renamed this task from mw.hook fires multiple times on mobile site to Special:MyPage/minerva.js is executed twice.Jan 15 2017, 12:37 PM
Nirmos updated the task description. (Show Details)
Nirmos updated the task description. (Show Details)Jan 15 2017, 12:46 PM

If it is of any help, the first one comes from load.php?debug=false&lang=sv&modules=mobile.usermodule&only=scripts&skin=minerva&user=Nirmos&version=0zycl1h:1

14 ms later another one comes from VM2919:1

MBinder_WMF triaged this task as Normal priority.Jan 17 2017, 6:08 PM
MBinder_WMF moved this task from Incoming to Needs Prioritization on the Readers-Web-Backlog board.
matmarex added a subscriber: Krinkle.

MobileFrontend has its own 'mobile.usermodule', loaded in SkinMinerva, which loads this script. That's the first one you're seeing.

I don't see anything in there to prevent the core 'user' module from being loaded (which loads the User:<skin>.js for the current skin, which is Minerva on mobile). I suspect that results in it being loaded again.

The reason for this is probably change 06ab9c0942f66317b20130ed12e677607783a61e in MediaWiki core, which allowed the 'user' module to load on mobile sites.


'mobile.usermodule' (MobileUserModule class) is documented as follows:

/**
 * Alternative of ResourceLoaderUserModule for mobile web.
 * Differs from the user module by not loading common.js,
 * which predate Minerva and may be incompatible.
 */

However, I can see my own common.js being loaded on the mobile site. If my guess about the reason is correct, this has been happening for half a year now, and I haven't heard anyone complaining about this. I think the solution here is simply to remove 'mobile.usermodule' (and 'mobile.usermodule.styles').

ovasileva moved this task from Backlog to Tracking on the MobileFrontend board.Jan 26 2017, 4:29 PM