Page MenuHomePhabricator

Global script is not loaded on debug=true
Closed, ResolvedPublicBUG REPORT

Description

Steps to Reproduce:

The JavaScript from https://meta.wikimedia.org/wiki/Special:MyPage/global.js is loaded and executed.

  • Load a page in a WMF project with URL parameter debug=true.

Actual Results:

The JavaScript from https://meta.wikimedia.org/wiki/Special:MyPage/global.js is not loaded.

Expected Results:

The JavaScript from https://meta.wikimedia.org/wiki/Special:MyPage/global.js is loaded and executed.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I confirmed this by replacing my global.js by console.log( 'Started global.js.' ); and then loading
https://pt.wikipedia.org/wiki/Special:BlankPage?debug=true
There should be a log in the console, but it was not there.

The top-level call is calling out to Meta, which seems fine:

Output HTML
<script>(RLQ=window.RLQ||[]).push(function(){
  mw.loader.load("//meta.wikimedia.org/w/load.php?debug=true\u0026lang=en-gb\u0026modules=ext.globalCssJs.user\u0026skin=vector\u0026user=Krinkle\u0026version=18zmt");
 …
meta - ext.globalCssJs.user
mw.loader.implement( "ext.globalCssJs.user@4bfqw", [
    "/w/load.php?debug=true\u0026lang=en\u0026modules=ext.globalCssJs.user\u0026only=scripts\u0026user=Krinkle"
] );

Once on meta, it is using a relative url for the inner call (only=scripts). This is expanded relative to the current browser tab, so ends up not working due to looking on the local wiki.

Interestingly, if you were to make the top-level call on a local instead: https://pt.wikipedia.org/w/load.php?debug=true&lang=en&modules=ext.globalCssJs.user&user=Krinkle, then it does make the inner call with an absolute URL to Meta:

ptwiki - ext.globalCssJs.user
mw.loader.implement( "ext.globalCssJs.user@4bfqw", [
    "//meta.wikimedia.org/w/load.php?debug=true\u0026lang=en\u0026modules=ext.globalCssJs.user\u0026only=scripts\u0026user=Krinkle"
] );

So there are two ways forward:

  • Change the top-leval call to be for the local wiki instead of Meta. From there, we already produce a full url to Meta.
  • Keep the top-level url for Meta, But change the inner one to be a full url, even when serving the top-level from Meta.

I suspect one or both of these were different before, and a recent change may've disconnected those dots.

Krinkle triaged this task as Low priority.EditedJun 15 2020, 7:50 PM
Krinkle moved this task from Inbox to Confirmed Problem on the MediaWiki-ResourceLoader board.

Note to self: The module url is determined based on the module source.

Change 714664 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] resourceloader: Fix debug mode for RL-to-RL cross-wiki module loads

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

Change 714664 merged by jenkins-bot:

[mediawiki/core@master] resourceloader: Fix debug mode for RL-to-RL cross-wiki module loads

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

I'll verify when it rolls out next week.