Fix MenuButton for the case where multiple listeners are defined.
commit2405b3063aa466a5133cac621962068088381087
authorjamiewalch <jamiewalch@chromium.org>
Fri, 19 Sep 2014 19:22:02 +0000 (19 12:22 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 19 Sep 2014 19:22:17 +0000 (19 19:22 +0000)
tree05a43351c82991fb904f09ddbecd4edd7a6bd922
parentb35d075d92b70680c815ba0787215aceb695d0b0
Fix MenuButton for the case where multiple listeners are defined.

This is a minimal fix suitable for merging to M38. The underlying problem
is that we create a new MenuButton instance (with its own click handler)
for every connection. I recently changed the behaviour of MenuButton so
that it toggles the 'active' class instead of adding it so that clicking
on the button while a menu is open will dismiss it. However, this breaks
if there an even number of MenuButton instances for a single DOM element.

The correct fix is to make the tool-bar buttons owned by the tool-bar,
which is a singleton. However, this minimal fix, which restores the M37
behaviour, is a better option for merging to M38.

BUG=415410

Review URL: https://codereview.chromium.org/584693003

Cr-Commit-Position: refs/heads/master@{#295759}
remoting/webapp/menu_button.js
remoting/webapp/unittests/menu_button_unittest.js