Page MenuHomePhabricator

FormWizard throws typeerror when loading on 'edit' pages
Closed, ResolvedPublic

Description

The FormWizard throws an error "TypeError: Cannot read property 'get' of undefined" on edit pages in the Wikipedia namespace. For example: https://en.wikipedia.org/w/index.php?title=Wikipedia:WikiProject_Women_writers/Missing_articles&action=edit&section=2

@Edokter first reported the issue, almost immediately after @I_JethroBT turned the gadget on by default for all logged-in users in the Project namespace. Description here and in the here.

@Jephpaul has looked into what might be going on, and we believe that the cause of the error is that mw.cookie() is not available on edit pages.

The FormWizard (code) uses a cookie to store the post-edit feedback message that is delivered to users once they create a page.

We didn't see this error before because we were using a built-in JQuery cookie function until @Mattflaschen recommended switching to mw.cookie during his code review (@T94595).

I'm not sure to assign this to, given there are no engineering resources allocated for this project. But I'll orchestrate the updates to the gadget, once we've identified the issue and know how to fix it.

Related Objects

Event Timeline

Capt_Swing raised the priority of this task from to High.
Capt_Swing updated the task description. (Show Details)
Capt_Swing added a project: Co-op.

The gadget (on enwiki) was missing the dependency on mediawiki.cookie in gadgets-definition. I've added it. Can you see if that clears the problem? I will try to recreate the error that I encountered.

Edokter closed this task as Resolved.EditedMay 12 2015, 8:31 AM
Edokter claimed this task.

Adding the dependencies (mediawiki.cookie and mediawiki.user) seems to have cleared the JavaScript exceptions and no longer conflicts with CharInsert. (The depencies still need to be set on Meta.)

The fact you didn't see the error when using jquery.cookie, is due to luck, as it was probably already loaded by something else; normally it aslo requires a dependency to be set.