Last modified: 2014-03-12 21:30:56 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T59901, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 57901 - VisualEditor: Deactivating editor after activating by url query leaves veaction=edit
VisualEditor: Deactivating editor after activating by url query leaves veacti...
Status: RESOLVED FIXED
Product: VisualEditor
Classification: Unclassified
MediaWiki integration (Other open bugs)
unspecified
All All
: Normal minor
: VE-deploy-2014-03-13
Assigned To: Krinkle
:
: 57902 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-02 23:50 UTC by Rummana Yasmeen
Modified: 2014-03-12 21:30 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
screenshot (174.35 KB, image/png)
2013-12-02 23:50 UTC, Rummana Yasmeen
Details

Description Rummana Yasmeen 2013-12-02 23:50:49 UTC
Created attachment 13965 [details]
screenshot

Steps to reproduce:

1.Click on the Edit beta button
2.Switch to Edit Source
3.Switch back to VE
4.Click on Cancel
5.Reload the page


Observed Result:
Even after cancelling the edit, in the URL "&veaction=edit" still remains appended , therefore after reloading the page, VE opens up.
Comment 1 James Forrester 2013-12-03 01:58:54 UTC
*** Bug 57902 has been marked as a duplicate of this bug. ***
Comment 2 Alex Monk 2014-03-03 17:45:16 UTC
This appears to be to do with actFromPopState in ve.init.mw.ViewPageTarget
Comment 3 Krinkle 2014-03-12 18:17:14 UTC
I can't reproduce this on mediawiki.org or en.wikipedia.org, but I can locally and on en.wikipedia.beta.wmflabs.org
Comment 4 Rummana Yasmeen 2014-03-12 18:27:34 UTC
I can reproduce it on en.wikipedia.org but not on mediawiki.org
Comment 5 Krinkle 2014-03-12 20:18:37 UTC
It should be reliably reproducible on all of the above.

It happens when you access veaction=edit directly in the url on a fresh load.

Chrome has the nasty habit of firing a popstate event (sometimes?) on a regular load that wasn't via the history.

This can be worked around by storing a piece of data with the state and using that to tell events apart (to distinguish between a state pop to one we pushed/replaced into the history, from a pop state to one some other application pushed in or one the browser is faultily firing, like Chrome does).

jquery-pjax (the plugin GitHub uses to ajax navigate everywhere, powered by popState), does the same thing. Generate an ID or tag, store that with the push/replace state, and on the popstate, use that to identify ours and ignore others.

This will fix lots of other potential bugs as well.

Assigning back to me as it's on my mind now, might as well fix it.
Comment 6 Gerrit Notification Bot 2014-03-12 21:26:57 UTC
Change 118357 had a related patch set uploaded by Krinkle:
mw.ViewPageTarget: Tag our state changes and reject foreign states

https://gerrit.wikimedia.org/r/118357
Comment 7 Krinkle 2014-03-12 21:27:07 UTC
Rephrasing bug.

There is explicit logic in place to not update the url sometimes. This is for when we're reacting to a popstate event (e.g. you open VisualEditor from the read page, this activates the editor without a refresh, if you then click back, the browser has already updated the url and it is now telling us to react to that, we don't want to update the url again in that case).

Whenever the editor is initialised in Chrome by direct query parameter  (e.g. by clicking "Edit" on a page where we don't load visualeditor, e.g. MediaWiki's Edit source page), the weird initial popstate fired by Chrome was misinterpreted as a dynamic state change.

Then, when leaving the editor, we still think we're reacting to a popstate event so we don't touch the url.
Comment 8 Gerrit Notification Bot 2014-03-12 21:30:11 UTC
Change 118357 merged by jenkins-bot:
mw.ViewPageTarget: Tag our state changes and reject foreign states

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links