Last modified: 2014-10-16 23:06:16 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 T71918, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 69918 - OOjs UI: Trying to close a window before it's ready causes a JS error
OOjs UI: Trying to close a window before it's ready causes a JS error
Status: RESOLVED FIXED
Product: OOjs UI
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Normal normal
: ---
Assigned To: Bartosz Dziewoński
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-22 19:12 UTC by Roan Kattouw
Modified: 2014-10-16 23:06 UTC (History)
1 user (show)

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


Attachments

Description Roan Kattouw 2014-08-22 19:12:55 UTC
An easy way to reproduce this is to add this.manager.closeWindow( this ); to the setup process (or ready process, probably) of any window.

closeWindow caches the value of this.opened, and it later assumes that this value will be non-null (it calls .resolve() on it), but this.opened is initialized by openWindow only when the window is ready, while currentWindow is set earlier. So it's possible for closeWindow to go into its "there is something to close" code path (because currentWindow is set) while this.opened is still null, and then explore later while trying to call opened.resolve().

Before you tell me that having a window that closes itself from its own setup/ready is stupid: yes, it is, but 1) something else might try to close it at exactly the right moment, and 2) self-closing from setup/ready actually happens in IE right now (that's what https://gerrit.wikimedia.org/r/155181 fixes) because setup/ready moves the focus which causes the context to close the inspector.

I don't know exactly how best to fix this. Maybe manager.opened should be initialized earlier, at the same time as currentWindow? We only expose it later when we resolve opening, but we could create it early so we can resolve it early.
Comment 1 Gerrit Notification Bot 2014-10-14 18:16:03 UTC
Change 166613 had a related patch set uploaded by Bartosz Dziewoński:
WindowManager: Wait for window to open before trying to close it

https://gerrit.wikimedia.org/r/166613
Comment 2 Gerrit Notification Bot 2014-10-16 01:10:06 UTC
Change 166613 merged by jenkins-bot:
WindowManager: Wait for window to open before trying to close it

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

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


Navigation
Links