Skip to content

Commit

Permalink
Revert "Give up to pre-initialize the context menu if the mouse butto…
Browse files Browse the repository at this point in the history
…n is released before the process is finished"

This reverts commit 3f323f1.
  • Loading branch information
piroor committed Aug 2, 2024
1 parent 2ae5a68 commit 2d164d8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
14 changes: 0 additions & 14 deletions webextensions/background/tab-context-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,8 @@ function hasVisiblePrecedingItem(separator) {

let mOverriddenContext = null;
let mLastContextTabId = null;
let mMenuInitializationCanceled = false;

async function onShown(info, contextTab) {
mMenuInitializationCanceled = false;
if (!mInitialized)
return;

Expand Down Expand Up @@ -712,9 +710,6 @@ async function onShown(info, contextTab) {
const { hasUnmutedTab, hasUnmutedDescendant } = Commands.getUnmutedState(contextTabs);
const { hasAutoplayBlockedTab, hasAutoplayBlockedDescendant } = Commands.getAutoplayBlockedState(contextTabs);

if (mMenuInitializationCanceled)
return;

if (mOverriddenContext)
return onOverriddenMenuShown(info, contextTab, windowId);

Expand Down Expand Up @@ -1008,9 +1003,6 @@ async function onShown(info, contextTab) {

/* eslint-enable no-unused-expressions */

if (mMenuInitializationCanceled)
return;

if (modifiedItemsCount > 0)
browser.menus.refresh().catch(ApiTabs.createErrorSuppressor());
}
Expand Down Expand Up @@ -1572,12 +1564,6 @@ function onMessage(message, _sender) {
onTSTTabContextMenuShown.dispatch(message, message.tab);
}
break;

// ...but if the mouse button is released before pre-initialization is finished, we should give up it.
case TSTAPI.kNOTIFY_TAB_MOUSEUP:
if (message.button == 2)
mMenuInitializationCanceled = true;
break;
}
}

Expand Down
10 changes: 0 additions & 10 deletions webextensions/sidebar/mouse-event-listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,16 +456,6 @@ async function onMouseUp(event) {
}

if (tab) {
browser.runtime.sendMessage({
type: TSTAPI.kNOTIFY_TAB_MOUSEUP,
button: lastMousedown.button,
altKey: lastMousedown.altKey,
ctrlKey: lastMousedown.ctrlKey,
metaKey: lastMousedown.metaKey,
shiftKey: lastMousedown.shiftKey,
tab: tab && tab.$TST.export(true),
}).catch(ApiTabs.createErrorHandler());

const mouseupInfo = {
...lastMousedown,
detail: EventUtils.getMouseEventDetail(event, tab),
Expand Down

0 comments on commit 2d164d8

Please sign in to comment.