diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2020-09-01 23:25:41 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2020-09-07 00:18:43 +0200 |
commit | 34f37ce6b9feef6091e0f27a2618e3f812f42008 (patch) | |
tree | 06b9bcdead210943e96e30c398d6d1c47cc90bb7 /setup_native/source | |
parent | 49e00818c6c77ecb5e09008a7379ce4e4e54c60f (diff) |
MenuBarManager: Simplify addon menu creation
Addon menus were created with a different ctor, which called
Init instead of FillMenuManager. But the former is just a
subset of the latter, and I don't see in the latter anything
particularly harmful for addon menus.
There was however the bool _bHandlePopUp parameter, which
controlled whether to create popup menus to be used by popup
menu controllers, but: (a) it doesn't make any sense to me to
allow controllers in some addon menus but not in others, and
(b) the Activate method creates controllers unconditionally,
which means that a controller might still be created, but
then get nullptr for the popup menu, and crash.
There was also m_bIsBookmarkMenu, which was set to true for
addon menus, and used in the Select method to add Referer
argument to the executed command. As a matter of fact, this
argument is useless, as the referer is never evaluated for any
command or macro execution. Only affected case might be when
content URLs used directly as menu commands. But such usage
isn't common, and even then an empty referer is similarly
accepted by SvtSecurityOptions::isUntrustedReferer. However
seeing the message of f0a9ca24fd4bf79cac908bf0d6fdb8905dc504db
("rhbz#887420 Implement "block untrusted referer links" feature")
it appears that it's better to have the explicit referer anyway
(but with a different check, as m_bIsBookmarkMenu is now gone).
(Historically, the referer argument wasn't even introduced for
addon menus, but for the new document and wizards menus, which
used to be managed by the menu manager back then. This can be
seen in commit 40fefd8e0d5937666129278fe2b27c36cb58033c ("support
for images and target frames"). Only later this code path was
reused for addon menus. That's why the member was called
m_bIsBookmarkMenu, as "bookmark menu" was the term used for the
new and wizard menus, and there was also a related BmkMenu class.)
Change-Id: Idd48a0416f8703ef1a5c91e949345537ec9a5ec0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102136
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'setup_native/source')
0 files changed, 0 insertions, 0 deletions