Page MenuHomePhabricator

Uncaught Error: Unknown dependency: site
Closed, ResolvedPublic

Description

I get the following when I visit Commons (user_talk history) and reload a page on my mobile.

Running Chrome 53

To replicate:

If you delete the page the error disappears

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 9 2016, 4:11 PM
Lokal_Profil renamed this task from Unkaught Error: Unknown dependency site to Unkaught Error: Unknown dependency: site.Oct 9 2016, 4:11 PM
Reedy renamed this task from Unkaught Error: Unknown dependency: site to Uncaught Error: Unknown dependency: site.Oct 9 2016, 4:36 PM
Reedy added a project: Mobile.

@Lokal_Profil can you share a URL too?

site is not available on mobile. I'm not sure why this is being marked as dependency of something. It sounds like a gadget is depending on this. @Krinkle any ideas what might be happening here?

ovasileva triaged this task as High priority.Oct 11 2016, 5:11 PM
ovasileva moved this task from Incoming to Needs Prioritization on the Readers-Web-Backlog board.
Jdlrobson updated the task description. (Show Details)Oct 11 2016, 6:01 PM

@bmansurov can you reproduce now with the steps i've added?

Yes, I see it's happening now. For those who want to see it in action:
https://commons.m.wikimedia.org/wiki/Special:History/User_talk:Bmansurov_(WMF)

@bmansurov to be clear - you saw it happening when following the steps in the description on a local instance?
Note I cannot replicate it on https://commons.m.wikimedia.org/wiki/Special:History/User_talk:Bmansurov_(WMF) as I don't have your gadget so it's a little confusing sharing that link.

bmansurov added a comment.EditedOct 11 2016, 6:54 PM

I was not able to reproduce it locally. I don't think I have gadgets either on commons.

By gadget I mean this (mine is empty which is why I cannot replicate). What do you see when you test locally with the above steps? Is it possible you don't have $wgAllowUserJs = true; set locally?

Jdlrobson updated the task description. (Show Details)Oct 11 2016, 6:57 PM

After adding $wgAllowUserJs = true; I see the error locally too.

I can reproduce this in production, on commons.m.wikimedia.org. I only have a common.js page on my user account, no minerva.js and it still causes the error.

Krinkle added a comment.EditedOct 11 2016, 7:24 PM

This is caused by the mobile site now loading the "user" module (it used to have its own version of the user module). This module has a hardcoded internal dependency on the "site" module since its execution must happen after the site module finished loading. This is a legacy requirement that has always been the case with user scripts since they cannot explicitly express this dependency anywhere else.

Before 2015, when our script loading was still synchronous, this was implicitly done by one being after the other in the HTML as separate script tags. Now that loading happens asynchronously, this is ensured by ResourceLoader. This has been the case since at least August of last year.

Since MobileFrontend has a custom user and site module without the 'common.js' portion, the only remaining script is minerva.js which has presumably has had an expectation from very early on that it does not depend on the site-wide Minerva.js script.

I'm not sure why this is being marked as dependency of something. It sounds like a gadget is depending on this.

It's not being loaded by a gadget. It's loaded directly from the HTML output:

<script>(window.RLQ=window.RLQ||[]).push(function(){
mw.loader.load("/w/load.php?debug=false\u0026lang=en\u0026modules=mobile.usermodule\u0026only=scripts\u0026skin=..user=Krinkle..);
mw.loader.load([..]);});</script>
..
<script>(window.RLQ=window.RLQ||[]).push(function(){
mw.loader.load("/w/load.php?debug=false\u0026lang=en\u0026modules=user\u0026skin=..user=Krinkle..
Krinkle added a project: Regression.
Krinkle moved this task from Inbox to Radar on the Performance-Team board.
Krinkle added a subscriber: Regression.
Krinkle removed a subscriber: Regression.

@bmansurov @ovasileva Any more analysis needed or can we schedule this work (move to triaged but future)?

TheDJ added a subscriber: TheDJ.Mar 10 2017, 10:10 AM

I do't see this problem any longer. was it solved ?

Jdlrobson closed this task as Resolved.Mar 10 2017, 5:42 PM
Jdlrobson claimed this task.

Yup. Looks fixed to me (although minerva js is run twice still - that's captured in another bug).

The error message in the console went away after rMW7e2e2db806f6: mw.loader: For using() errors, reject Promise instead of throwing. The site module is still not available on mobile (and shouldn't be, per MobileFrontend design). And as before, the user module will continue to execute unaffected after ResourceLoader fails to load the implicit site dependency.