Bug 1539884 - Part 34: Mark StatusBarEntry::OnMessage as CAN_RUN_SCRIPT r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D134417
This commit is contained in:
Kagami Sascha Rosylight 2021-12-23 16:27:25 +00:00
Родитель 1af44698e9
Коммит 3993777bc5
1 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -39,7 +39,8 @@ class StatusBarEntry final : public LinkedListElement<RefPtr<StatusBarEntry>>,
nsresult Init();
void Destroy();
LRESULT OnMessage(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
MOZ_CAN_RUN_SCRIPT LRESULT OnMessage(HWND hWnd, UINT msg, WPARAM wp,
LPARAM lp);
const Element* GetMenu() { return mMenu; };
nsresult OnComplete(imgIContainer* aImage) override;
@ -47,7 +48,8 @@ class StatusBarEntry final : public LinkedListElement<RefPtr<StatusBarEntry>>,
private:
~StatusBarEntry();
RefPtr<mozilla::widget::IconLoader> mIconLoader;
RefPtr<Element> mMenu;
// Effectively const but is cycle collected
MOZ_KNOWN_LIVE RefPtr<Element> mMenu;
NOTIFYICONDATAW mIconData;
boolean mInitted;
};
@ -237,8 +239,8 @@ LRESULT StatusBarEntry::OnMessage(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
nsEventStatus status = nsEventStatus_eIgnore;
WidgetMouseEvent event(true, eXULSystemStatusBarClick, nullptr,
WidgetMouseEvent::eReal);
EventDispatcher::Dispatch(mMenu, menu->PresContext(), &event, nullptr,
&status);
RefPtr<nsPresContext> presContext = menu->PresContext();
EventDispatcher::Dispatch(mMenu, presContext, &event, nullptr, &status);
return DefWindowProc(hWnd, msg, wp, lp);
}
@ -271,10 +273,10 @@ LRESULT StatusBarEntry::OnMessage(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
NS_IMPL_ISUPPORTS(SystemStatusBar, nsISystemStatusBar)
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
StatusBarEntry* entry =
(StatusBarEntry*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
if (entry) {
MOZ_CAN_RUN_SCRIPT static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg,
WPARAM wp, LPARAM lp) {
if (RefPtr<StatusBarEntry> entry =
(StatusBarEntry*)GetWindowLongPtr(hWnd, GWLP_USERDATA)) {
return entry->OnMessage(hWnd, msg, wp, lp);
}
return TRUE;