Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webextensions.api.menus.onClicked - full tab data missing in Safari #20592

Closed
daniandl opened this issue Aug 23, 2023 · 4 comments
Closed

webextensions.api.menus.onClicked - full tab data missing in Safari #20592

daniandl opened this issue Aug 23, 2023 · 4 comments
Assignees
Labels
data:webext 🎲 Compat data for Browser Extensions. https://developer.mozilla.org/Add-ons/WebExtensions

Comments

@daniandl
Copy link

What type of issue is this?

Missing compatibility data

What information was incorrect, unhelpful, or incomplete?

First off: my extension uses activeTab.
When clicking on a context menu item while the Safari extension toolbar icon is greyed out (not activated on this page), the tab data returned inside the onClicked callback is missing crucial information like the tab url.

I assume this is due to the extension getting access to the tab after the click handler has run.
So if you need tab data, you essentially need to query({ tabId }) to find the tab. Thankfully, the tab ID is returned.

What browsers does this problem apply to, if applicable?

Safari

What did you expect to see?

This would be helpful to mention for future developers running into this issue.

Did you test this? If so, how?

Ran the extension in Safari 16.6, followed steps as described above.

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

No response

Do you have anything more you want to share?

This page may not be the right/only place to mention this specific issue.

MDN URL

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus/onClicked

MDN metadata

MDN page report details
  • Query: webextensions.api.menus.onClicked
  • Report started: 2023-08-23T16:16:38.793Z
@queengooborg queengooborg added the data:webext 🎲 Compat data for Browser Extensions. https://developer.mozilla.org/Add-ons/WebExtensions label Aug 24, 2023
@rebloor
Copy link
Collaborator

rebloor commented Feb 2, 2024

@jdatapple are you able to shed any light on this?

@jdatapple
Copy link
Contributor

This appears to be a bug. It has a fix, but it has not shipped yet.

webkit-commit-queue pushed a commit to xeenon/WebKit that referenced this issue Feb 2, 2024
https://webkit.org/b/268639
rdar://problem/122194046

Reviewed by Brian Weinstein.

Add a new test that verifies that activeTab does grant visibility into the tab's URL and title
when invoking an action's menu item. We already had a test like this for context menu items.
This was mentioned in: mdn/browser-compat-data#20592

* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIMenus.mm:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/274019@main
@rebloor
Copy link
Collaborator

rebloor commented Mar 17, 2024

@daniandl Closing as this was indicated as a bug in Safari.

@xeenon
Copy link
Contributor

xeenon commented Jun 9, 2024

@rebloor This can be closed. Safari Technology Preview 192 and later should have this fix.

@rebloor rebloor closed this as completed Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:webext 🎲 Compat data for Browser Extensions. https://developer.mozilla.org/Add-ons/WebExtensions
Projects
None yet
Development

No branches or pull requests

5 participants