Page MenuHomePhabricator

VisualEditor doesn't seem to execute mw.libs.ve.addPlugin reliably
Open, LowPublic1 Story Points

Description

During working on reviewing articles on Wikipedia I often get a problem that plugins don't get loaded. This is not a strict thing that has always-occur steps.

Rough steps

  1. Open review page (e.g. pl.wiki: https://pl.wikipedia.org/w/index.php?title=Specjalna:Zdezaktualizowane_przejrzane_strony).
  2. Open 10-20 review links.
  3. Press edit.

Result - plugin is not loaded.

Test code

Below is a test code you can use. You will notice addPlugin is not shown in console when the problem occures.

mw.loader.using('ext.visualEditor.desktopArticleTarget.init', function () {
	console.log('init');	// happens when VE is already loaded too
	// Register plugins to VE. will be loaded once the user opens VE
	mw.libs.ve.addPlugin(function () {
		console.log('addPlugin');	// only happens on-switch to VE (not when VE is already loaded)
		//return $.getScript('//pl.wikipedia.org/w/index.php?title=User:Nux/veCustomSearch.plugin.js&action=raw&ctype=text/javascript'); 
		//return $.getScript('https://localhost:8443/_wiki_js/_przyciski%20edycji/veCustomSearch/veCustomSearch.plugin.js'); 
	});
});

What I noticed is that addPlugin function doesn't work after the page is loaded. You will see init message in console when you run this after the editor is loaded, but not addPlugin message. So this is probably a problem.

Event Timeline

Nux created this task.Nov 2 2016, 12:04 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 2 2016, 12:04 AM

Not sure I understand the steps to reproduce. Are you saying this only happens rarely or on certain pages?

Nux added a comment.Nov 5 2016, 4:03 PM

I'm saying this happens very often on many pages. It's just not happening every time.

Just now I had to reload below page about 5 times for a plugin to load.
https://pl.wikipedia.org/wiki/%C5%81%C4%85ck_(wie%C5%9B_w_wojew%C3%B3dztwie_mazowieckim)

Jdforrester-WMF renamed this task from VisualEditor plugin loading problem to VisualEditor doesn't seem to execute mw.libs.ve.addPlugin reliably.Nov 8 2016, 8:25 PM
Jdforrester-WMF triaged this task as Normal priority.
Jdforrester-WMF moved this task from To Triage to TR0: Interrupt on the VisualEditor board.
Jdforrester-WMF set the point value for this task to 1.
Deskana lowered the priority of this task from Normal to Low.Aug 30 2018, 10:06 AM
Deskana moved this task from TR0: Interrupt to Freezer on the VisualEditor board.