Page MenuHomePhabricator

Flaky loading Userscripts with Google Chrome
Closed, InvalidPublic

Description

on Chrome 54 the loading of userscripts is flaky.

How to reproduce:

  1. open multiple tabs (i.e. use add on Linkclump, or fast with right mouse clicks) in editmode
  2. control the tabs for missing buttons.

My Skripts: Meta:User:Boshomi/global.js

Result:
In some tabs (in up to 50% of the tabs) not all of my userscripts are loaded. with one (sometimes two) reloads the scripts get loaded. Chrome had this issue for long time, but now it went from bad to worse.

Event Timeline

@Boshomi: There is a many files loaded by User:Boshomi/global.js. Which specific script is trying to add a toolbar button but not working for you?

@Krinkle

there are 5 Scripts, but with Fliegelflage.js (that contains multible userscripts)

The script with the highes missing rate is Schnarkdiff (activated by Fliegelflagel.js)

very high missing rates I find for "Boshomi/ARreplace.js and Boshomi/externalURLform
(ARreplace is a script in the top of TMg/Autoformatter activated by Fliegelflagel; externalURLform is a Copy of TMg/weblinkChecker with one minor change.

There is no correlation between loading of Schnarkdiff and ARreplace.js, but I see a correlation between loading of Boshomi/ARreplace.js and Boshomi/externalURLform, both are available or both are not available.

Interersting is that TMg/Autoformatter has a very low missing rate. (also activated by Fliegelflagel)

also TMg/autoFormatter/autoDiff.js is ervery time accessable if Schnarkdiff is loaded. TMg/autoFormatter/autoDiff.js is used by ARreplace and externalURLform with "mw.hook( 'AutoFormatterDoneWithChange' ).fire();"
This line only fail, if SchnarkDiff is missing.

Addition information: I have WikEd activated in Gadgets, but in most cases the wikEdUseWikEd is not activated. (I switch on this button, when I need a quick regexp replace, and switch it off when I am ready)

Update:

Yesterday I changed order of the scripts in Meta:User:Boshomi/global.js

and switched off wikEd with wikEdLogoImg-button (right on the top). (=> wikEdDiff is not available if SchnarkDiff fails)

My workflow was:

  1. open 50 tabs of Benutzer:Boshomi/worklist9 (history) with linkclump
  2. open externalURLform -button or click preview if not available

Result:

  1. probability of failed loading schnarkDiff.js and externalURLform decreased but still here
  2. the highest probability of failed loading I found in the first five tabs (up to 33% load of preview was necessary)
  3. the lowest probability of failed loading in tabs Nº 40-Nº50 is near by 0%
  4. when I do not change the tab while loading, the propability of good loading is near by 100%
  5. when I look for failed loaded tabs and press Alt+P (for preview) and Alt+tab (for changing tab) the probability of failed loading is as high as open multible tabs with linkclump

hth

@Krinkle

there are 5 Scripts, but with Fliegelflage.js (that contains multible userscripts)

The script with the highes missing rate is Schnarkdiff (activated by Fliegelflagel.js)

Can you explain what you mean by "missing"? Does it seem like the script is not loaded, or it loads but doesn't work? Can you verify that it is actually being loaded?

In other words, which one is true:

  • Sometimes the Schnarkdiff javascript code is not loaded.
  • The Schnarkdiff javascript code is downloaded, but nothing changes on the page (for example, it looks the same if it was not loaded).
  • The Schnarkdiff javascript code is loaded, and works incompletely. Some parts are there, some parts are missing.

You can see if the code is downloaded by looking at the "Network" activity. Look in the list for something like Schnark/diff.js (looks like "index.php?title=...page-title..js&action=raw&type=text/javascript").

Can you contact the developer Schnark to understand what goes wrong? These are large javascript files, and the problem could be anywhere.

Krinkle triaged this task as Medium priority.Nov 30 2016, 2:06 AM
Krinkle moved this task from Inbox to Backlog on the MediaWiki-ResourceLoader board.
Krinkle changed the task status from Open to Stalled.Apr 21 2017, 3:12 AM

I had this same issue, turns out the scripts were not declaring dependencies. In @Boshomi's case, I see that Benutzer:Schnark/js/fliegelflagel.js/define.js for instance is not declaring a dependency on mediawiki.user, or waiting for the DOM to be ready. I would get in touch with the author about this. You can declare dependencies like:

mw.loader.using(['mediawiki.user'], function() {
  // code that uses mw.user
});