Page MenuHomePhabricator

VisualEditor: [Regression wmf8] TypeError:this.documentView is null appearing after saving an edit and then reopening the VE again, also cannot switch to edit source mode after that in Firefox
Closed, ResolvedPublic

Description

Screenshot

Steps to reproduce:

1.Open any page in Betalabs or test2 with VE in Firefox

2.Make an edit

3.Save the page

4.Reopen the page

Observed Result:

In the console the following error appears:

TypeError: this.documentView is null

Also, another issue that is happening is, after editing if you try to switch to edit source mode, it is not opening the wikitext editor.Rather showing a message:
Some parts of the edit form did not reach the server; double-check that your edits are intact and try again.


Version: unspecified
Severity: major

Attached:

Screen_Shot_2014-06-05_at_3.22.33_PM.png (722×1 px, 230 KB)

Details

Reference
bz66222

Event Timeline

This seems to be happening because, somehow, the old torn-down ce.Surface gets a focus event, calls this.surfaceObserver.startTimerLoop(), but this explodes because the SurfaceObserver has been detached already and its .documentView is null.

We should make sure we properly destroy the old surface.

Also getting this error now:

Error: Range error: Range is no longer valid after DOM mutation ([WrappedRange("link":0, "link":4)])
after applying link to the text "link"

The "Switching to edit source mode not opening the wikitext editor" issue is happening in Chrome as well, however the error found for Firefox in not appearing for Chrome, so I am taking this issue to a different bug, assuming it is not related.

The error from comment 2 happens because the old destroyed surface is getting blurred, and DesktopContext is responding to that.

The fundamental issue is this.fragment.select(); in the teardown process of ve.ui.Dialog, which runs 200ms after the save dialog closes, at which point the surface is already hidden and lots of stuff goes wrong.

Beside that, though, we should be much more aggressive about destroying things properly. And also audit things we do after a delay like this (so potentially anything in a setup/teardown process) because the user might have deactivated the editor in the meantime.

Change 138014 had a related patch set uploaded by Catrope:
*Actual* death and/or *actual* destruction

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

Change 138014 merged by jenkins-bot:
*Actual* death and/or *actual* destruction

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

This is still happening in Firefox for Betalabs, So reopening it

MW hasn't had a core update since this was merged.

FYI: If there isn't a commit called 'Update VE core submodule to master' above a core commit you are testing on this page:

https://gerrit.wikimedia.org/r/#/q/is:watched+status:merged,n,z

it won't be in MW yet.

(In reply to Ed Sanders from comment #8)

MW hasn't had a core update since this was merged.

FYI: If there isn't a commit called 'Update VE core submodule to master'
above a core commit you are testing on this page:

https://gerrit.wikimedia.org/r/#/q/is:watched+status:merged,n,z

For that link to work, you need to be logged in and be watching the right projects :)

More portable link: https://gerrit.wikimedia.org/r/#/q/status:merged+AND+%28+project:mediawiki/extensions/VisualEditor+OR+project:VisualEditor/VisualEditor+%29,n,z

This is happening in production.Didn't we backport it?

Change 139207 had a related patch set uploaded by Catrope:
*Actual* death and/or *actual* destruction

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

Change 139207 merged by Catrope:
*Actual* death and/or *actual* destruction

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

Verified the fix in production en.wiki