Page MenuHomePhabricator

[Regression] VisualEditor: Error in load() leaves page in dimmed state (Uncaught TypeError: Cannot call method 'removeAllListeners' of null)
Closed, ResolvedPublic

Description

Steps to reproduce issue:

  • MediaWiki + VisualEditor (no Parsoid)
  • Edit page (dims the page while loading)
  • Error pops up (parsoidserver-http-curl-error)
  • Cancel

Expected:
Page undims.

Actual:
Page still dimmed.


Version: unspecified
Severity: normal

Details

Reference
bz46456

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:40 AM
bzimport set Reference to bz46456.

Caused by I7769bd5a5b79f1ab36f258ef9f2be583ca503ce6.

In the refactoring Trevor moved the initialisation of the DOM element for the save/cancel buttons from the ve.init.mw.ViewPageTarget constructor to ve.init.mw.ViewPageTarget#setupToolbarButtons, which isn't called until after a successful load.

So, when #load() is called from #activate() and fails a loadError is emitted. onLoadError then calls #deacativate() which calls #tearDownToolbarButtons()

But tearDownToolbarButtons is unable to call this.toolbarCancelButton.removeAllListeners because the button doesn't exist yet because setupToolbarButtons was never called.

Change-Id: I91ad2b110c2c523a4bb367407e3f33a953328ab4

That should fix it for now (quick fix). I'm now going to look into how much of this can be refactored to avoid this in the first place. It's all a bit too fragile.