Last modified: 2014-05-29 19:38:54 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 T67557, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 65557 - VisualEditor: [Regression] Switching to edit source mode throws TypeError: Cannot read property 'css' of null and TypeError: Cannot read property 'each' of null for a specific case
VisualEditor: [Regression] Switching to edit source mode throws TypeError: Ca...
Status: VERIFIED FIXED
Product: VisualEditor
Classification: Unclassified
MediaWiki integration (Other open bugs)
unspecified
All All
: High normal
: VE-deploy-2014-05-22
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-20 21:51 UTC by Rummana Yasmeen
Modified: 2014-05-29 19:38 UTC (History)
6 users (show)

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


Attachments
Screenshot (223.06 KB, image/png)
2014-05-20 21:51 UTC, Rummana Yasmeen
Details

Description Rummana Yasmeen 2014-05-20 21:51:32 UTC
Created attachment 15448 [details]
Screenshot

Steps to reproduce:

1.Open a page with VE
2.Make an edit
3.Click on "Switch to source editing "
4.Click on "No, cancel"
5.Now click on the "Cancel" button of the editor 
6.Click on "Continue Editing"
7.Now again go to ""Switch to source editing "
8.This time click on "Yes, switch"

Observed Result:
It does not switch to edit source mode and throws the following errors in the console:


Uncaught TypeError: Cannot read property 'css' of null and 
Uncaught TypeError: Cannot read property 'each' of null 

See the screenshot attached
Comment 1 Roan Kattouw 2014-05-20 22:32:20 UTC
Holy crap this is an obscure bug. Steps 3 and 4 (switching to source mode the first time) can be skipped, but other than that every step is necessary.

This happens because the switch to source mode button and the cancel button share the same instance of the confirmation dialog. When you click OK in the source mode one, the cancel button code is still listening to the 'ok' event; we need to disconnect that on cancel.

Perhaps it would be nicer if these two were combined into one event so we could use .once() and not have to unbind explicitly.
Comment 2 Roan Kattouw 2014-05-21 02:07:32 UTC
(In reply to Roan Kattouw from comment #1)
> Holy crap this is an obscure bug. Steps 3 and 4 (switching to source mode
> the first time) can be skipped, but other than that every step is necessary.
> 
As Rummana points out, the second error (with 'each') does not occur if you skip those steps, so there's something else going on too. There's some code in ViewPageTarget that gets run after this.$checkboxes has been cleared.

On second inspection, there's a lot more going on. For instance, the 'ok' handler executes twice, and so we attempt to serialize twice.
Comment 3 Gerrit Notification Bot 2014-05-21 02:13:47 UTC
Change 134546 had a related patch set uploaded by Catrope:
Unbind confirm dialog handlers after either of the events fires once

https://gerrit.wikimedia.org/r/134546
Comment 4 Gerrit Notification Bot 2014-05-21 13:55:18 UTC
Change 134546 merged by jenkins-bot:
Unbind confirm dialog handlers after either of the events fires once

https://gerrit.wikimedia.org/r/134546
Comment 5 Rummana Yasmeen 2014-05-21 19:46:30 UTC
Verified the fix in Betalabs
Comment 6 Rummana Yasmeen 2014-05-23 01:31:33 UTC
Verified the fix on test 2
Comment 7 Rummana Yasmeen 2014-05-29 19:38:54 UTC
Verified the fix in production.

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


Navigation
Links