Page MenuHomePhabricator

[Regression wmf.15] Ace editor doesn't load in debug mode (local 'require' var ends up removed half-way)
Closed, ResolvedPublic1 Story Points

Description

The exception is that 'require' is undefined.

This is because inside jQuery it is triggering queueModuleScript (line 1192) which does this when a script has loaded:

// Clear environment
delete window.require;
delete window.module;

however ext-language_tools.js in Ace editor is loaded separately and expects that require is still defined (having been defined in ace.js)

Event Timeline

Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptFeb 21 2016, 12:45 PM
Jdforrester-WMF triaged this task as High priority.Feb 22 2016, 8:51 PM
Jdforrester-WMF added a project: Regression.
Krinkle renamed this task from CodeEditor doesn't load in debug mode to CodeEditor doesn't load in debug mode (local 'require' var ends up removed half-way).Feb 23 2016, 3:13 PM
Esanders renamed this task from CodeEditor doesn't load in debug mode (local 'require' var ends up removed half-way) to Ace editor doesn't load in debug mode (local 'require' var ends up removed half-way).Mar 2 2016, 5:17 PM
Esanders added a project: VisualEditor.

This also affects the SyntaxHighlight, Math and Maps plugins in VE, which all use Ace editor.

Jdforrester-WMF renamed this task from Ace editor doesn't load in debug mode (local 'require' var ends up removed half-way) to [Regression wmf.15] Ace editor doesn't load in debug mode (local 'require' var ends up removed half-way).Mar 2 2016, 6:22 PM

Change 276789 had a related patch set uploaded (by Jdlrobson):
Only provide global require in debug mode when needed

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

Change 276789 abandoned by Jdlrobson:
Only provide global require in debug mode when needed

Reason:
This doesn't work.
The ace module seems to make use of window.require quite heavily.

I'm not sure how to make this work sanely given its an external library that I know little about. Which bits

Best solution I can think of right now is RL modules could have a flag which can opt in/out of the RL require experience.

Will think about this some more.

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

Change 276795 had a related patch set uploaded (by Jdlrobson):
Ace should use its own require method

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

Change 277176 had a related patch set uploaded (by TheDJ):
Namespace define, require calls when building Ace

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

i've added a patch to update the Makefile to build ace with the proper options. I haven't update Ace in a while, so i'll have to run some checks if the compiled result isn't introducing other regressions.

Change 277178 had a related patch set uploaded (by TheDJ):
Update Ace and use scoped require / define

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

Change 277241 had a related patch set uploaded (by Esanders):
AceEditorWidget: Use namespaced 'require'

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

Change 277283 had a related patch set uploaded (by Jforrester):
AceEditorWidget: Use namespaced 'require'

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

Change 277176 merged by jenkins-bot:
Namespace define, require calls when building Ace

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

Change 276795 abandoned by Jdlrobson:
Ace should use its own require method

Reason:
See https://gerrit.wikimedia.org/r/#/c/277176/

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

Change 277283 merged by jenkins-bot:
AceEditorWidget: Use namespaced 'require'

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

Change 277241 merged by jenkins-bot:
AceEditorWidget: Use namespaced 'require'

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

Change 277178 merged by jenkins-bot:
Update Ace and use scoped require / define

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

Krinkle closed this task as Resolved.Mar 15 2016, 10:33 PM
Krinkle claimed this task.
Jdforrester-WMF set the point value for this task to 1.May 10 2016, 1:22 AM
Krinkle reassigned this task from Krinkle to TheDJ.Aug 18 2016, 8:14 PM
Krinkle removed a project: Patch-For-Review.