Page MenuHomePhabricator

VisualEditor: onbeforeunload throws Uncaught TypeError when leaving page from "Read" mode
Closed, ResolvedPublic

Description

Steps to reproduce:

  • Go to a page
  • Switch to Edit mode
  • Switch to Read mode
  • Go to a different page (e.g. "View history" or "Main Page")

Uncaught TypeError: Cannot call method 'getModel' of null


Version: unspecified
Severity: normal

Details

Reference
bz38902

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 12:48 AM
bzimport set Reference to bz38902.

Either onbeforeunload() needs logic that we might have already torn down the surface and not complain if that's happened, or we need to not clean up after switching from the Edit tab to the Read tab. :-)

Also:

Uncaught RangeError: Maximum call stack size exceeded

jQuery.extend.proxy.proxy
ve.init.mw.ViewPageTarget.onBeforeUnload
jQuery.extend.proxy.proxy
ve.init.mw.ViewPageTarget.onBeforeUnload
[..]
jQuery.extend.proxy.proxy
ve.init.mw.ViewPageTarget.onBeforeUnload
jQuery.extend.proxy.proxy
ve.init.mw.ViewPageTarget.onBeforeUnload

Resolved in I13a2f02d256937b7da3aca3ad3c3404bd8f31244 by checking that the surface object was still around before using it.

Not fixed - that fixes a type error for undefined, not a range error.

Fixed a long time ago (September?). Closing.