Page MenuHomePhabricator

"Script error" is not clickable when using MediaWiki's live-preview feature.
Closed, ResolvedPublic

Description

Trying to import modules into a local installation of MediaWiki 1.23.6, I had forgot to import Module:Message_box/configuration. As the title summarises, the big red "Script error" is not clickable when in preview mode. After the page is saved, it is clickable.

This bug can lead to confusion and frustration for editors who are trying to test and solve an error in preview mode. Confusion for the first-timers who hadn't experienced these errors before, and frustration because they would have to submit an edit which they can't check is correct.

I can't figure out the cause of this, but the HTML code is the same. I suspect it's because some javascript hook doesn't work in preview mode.

<span class="scribunto-error" id="mw-scribunto-error-0">Script error<!--Lua error in package.lua at line 80: module `Module:Message box/configuration' not found.--></span>

Version: REL1_23-branch
Severity: normal
OS: Linux
Platform: PC

Details

Reference
bz73618

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 3:54 AM
bzimport set Reference to bz73618.
bzimport added a subscriber: Unknown Object (MLST).
Nahiyan8 created this task.Nov 19 2014, 7:51 PM

Works fine in master, and I don't recall any changes fixing anything along these lines since 1.23.

Ahh, my bad. The problem is with WikiEditor's preview function. Is there a chance of fixing it? I have just checked, the stock editor's preview works fine.

Sorry for yet another comment, but after some testing, I've determined: The problem is with MediaWiki's live preview feature.

WikiEditor doesn't seem to be the cause. But I'm also not sure if it is related to Scribunto as I don't know the internals of how these work, so I haven't changed the bug's info fields from "MediaWiki extensions" to "MediaWiki".

Tests:

  • w/o WikiEditor, w/o live preview: Works.
  • w/ WikiEditor, w/o live preview: Works.
  • w/o WikiEditor, w/ live preview: Bugged.
  • w/ WikiEditor, w/ live preview: Bugged.

Steps to reproduce:

  1. Install the Scribunto extension, and add a module which outputs a script error.
  2. Go to Preferences -> Editing -> Enable "Use live preview (experimental)"
  3. Start to create a page with the bugged module, and use the live-preview.
  4. "Script error" is not clickable.

gerritadmin wrote:

Change 174665 had a related patch set uploaded by TheDJ:
Add error dialog handler on wikipage.content hook

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

TheDJ added a subscriber: TheDJ.Nov 24 2014, 3:46 PM

Hmm, scribunto makes uses of addInlineScript(), to collate and add all errors to the output page.
This routine is deprecated and not compatible with what LivePreview requires... If we want this supported in LivePreview then we need to find another method to add the errors to the output.

Bright ideas are welcome. I couldn't come up with something simple and scalable right away.

This routine is deprecated

I don't see any @deprecated on it.

TheDJ added a subscriber: Krinkle.Nov 27 2014, 9:59 AM

Well officially it's not, but anything that is not a RL module is 'undesirable' since 1.17

The content of this script depends on the output parser, and that's not something that RL modules are generally used for. I also considered encoding it in a different way as part of the content (which is where it belongs in my opinion), but I couldn't think of a good way to encode a json blob, without it being stripped by the sanitizer.

@Krinkle any idea ?

He7d3r added a subscriber: He7d3r.Dec 8 2014, 12:01 PM
He7d3r updated the task description. (Show Details)Dec 8 2014, 12:06 PM
He7d3r added a project: JavaScript.
He7d3r set Security to None.

Change 186503 had a related patch set uploaded (by TheDJ):
Rewrite error handling to avoid OutputPage::addInlineScript

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

Patch-For-Review

Change 186503 merged by jenkins-bot:
Rewrite error handling to avoid OutputPage::addInlineScript

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

TheDJ removed a subscriber: Unknown Object (MLST).
TheDJ closed this task as Resolved.May 11 2015, 11:50 AM
TheDJ claimed this task.