Last modified: 2014-11-05 20:06:27 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 T75034, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 73034 - OOjs: EventEmitter fails when emitting unbound event with name of Object prototype
OOjs: EventEmitter fails when emitting unbound event with name of Object prot...
Status: RESOLVED FIXED
Product: OOjs
Classification: Unclassified
EventEmitter (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Editing team bugs – take if you're interested!
:
Depends on:
Blocks: 72984
  Show dependency treegraph
 
Reported: 2014-11-05 17:47 UTC by Jon
Modified: 2014-11-05 20:06 UTC (History)
5 users (show)

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


Attachments

Description Jon 2014-11-05 17:47:48 UTC
{}.watch exists in Firefox
when using OO.EventEmitter.on with the event name 'watch' in Firefox it triggers an error `get a JS error (TypeError: this.bindings[event].slice is not a function) `

When the object hasOwnProperty is should throw an exception or alternatively 'watch' should be a possible event name.

Unfortunately we've hit this bug before `watch` is such a nice event name ;-)
See also: Bug 72984
Comment 1 Ed Sanders 2014-11-05 17:49:52 UTC
watch sounds incredibly generic and as such a bad event name :)
Comment 2 Ed Sanders 2014-11-05 17:53:41 UTC
How exactly are you triggering this error?

widget.on('watch', function () {} );
widget.emit('watch');

works for me.
Comment 3 Ed Sanders 2014-11-05 17:55:14 UTC
I see if you emit without binding anything you get a problem (although that begs the question why you'd want to do that). If we just wrap that code in a hasOwnProperty check there won't be a problem. We don't need to blacklist watch or throw exceptions.
Comment 4 Gerrit Notification Bot 2014-11-05 18:03:11 UTC
Change 171293 had a related patch set uploaded by Esanders:
Use hasOwn check in EventEmitter#emit

https://gerrit.wikimedia.org/r/171293
Comment 5 Gerrit Notification Bot 2014-11-05 18:46:12 UTC
Change 171293 merged by jenkins-bot:
EventEmitter: Use hasOwn check in #emit

https://gerrit.wikimedia.org/r/171293
Comment 6 Jon 2014-11-05 18:47:54 UTC
Perfect! :) Thanks for quick response!
Comment 7 James Forrester 2014-11-05 19:16:48 UTC
Will go into OOjs v1.1.2, which we'll release today and get into MW for 1.25wmf8. Is this sufficient, or would you need it back-ported?
Comment 8 Jon 2014-11-05 20:05:38 UTC
Doesn't seem to have made it out to mediawiki.org...
Comment 9 James Forrester 2014-11-05 20:06:27 UTC
(In reply to Jon from comment #8)
> Doesn't seem to have made it out to mediawiki.org...

OOjs 1.1.2 isn't built yet, and MW 1.25wmf8 won't reach MediaWiki.org for a week…

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


Navigation
Links