Page MenuHomePhabricator

Loading of Javascript doesn't work in embedded special pages
Closed, InvalidPublic


It appears that special pages defined as inheriting from 'IncludableSpecialPage', and then embedded within another page, don't get their Javascript loaded correctly. The extension Semantic Forms defines such a special page, 'RunQuery', and you can see the problem when trying to press the button here:

Here, by contrast, is the same page when not embedded:

If you look at the HTML source for the two pages, in the former page the Javascript resources that the special page loads are missing.

This problem seems to have been in effect since at least MediaWiki 1.16.

I looked into it a little, and it looks like the problem comes about because, when the special page is embedded, the OutputPage object that gets displayed to the screen is different from the $wgOut that the special page adds its Javascript to.

Version: unspecified
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:17 PM
bzimport set Reference to bz26450.
bzimport added a subscriber: Unknown Object (MLST).

When embedding, you should add the necessary things into ParserOutput. Otherwise it will only works first time on uncached vies.

Hi Niklas,

Could you be more specific about what needs to be added? Or point to some code that does it the right way?

edgardbernardino wrote:

Hi guys. Any news? :)

There is no right way to do it. Until there is one, I assume global $wgParser works.

edgardbernardino wrote:

What you think, Yaron? :)

edgardbernardino wrote:

Niklas, I sorry to bother. Yaron doesnt have time right now to help with this issue. Is it possible for you to help me with a workaround for now? This functionality really would make a difference for my wiki... Would it be hard to implement? Edgard

Please come to MediaWiki-General IRC channel if you need help, bugzilla is not the best place for that.

Niklas - thanks for the hint; using $wgParser did indeed work. I'm marking this bug as "invalid".