Closed Bug 1706296 Opened 5 years ago Closed 5 years ago

er.contextMenus.create() with contexts:["image"] allows menu creation for chrome urls

Categories

(WebExtensions :: Untriaged, defect)

Firefox 87
defect

Tracking

(firefox87 affected, firefox88 affected, firefox89 affected, firefox90 affected)

RESOLVED INVALID
Tracking Status
firefox87 --- affected
firefox88 --- affected
firefox89 --- affected
firefox90 --- affected

People

(Reporter: mozilla, Unassigned)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0

Steps to reproduce:

Create extension that adds a menu to the context menu, with contexts of "image", that opens context items in new tab
Right click on chrome url image (for example, the firefox logo on "about:debugging#/runtime/this-firefox")
Click on your extension's menu

Actual results:

Extension tried to open Chrome url with error:
"Uncaught (in promise) Error: Illegal URL: chrome://devtools/skin/images/aboutdebugging-firefox-release.svg"

Expected results:

If the context item under the cursor is not openable, in an extension, due to security gates, then the menu should not be shown.

The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Product: Firefox → WebExtensions

Hello,

I reproduced the issue using the attached extension on the latest Nightly (90.0a1/20210421212740), Beta (89.0b2/20210420191345), Release (88.0/20210415204500) and Release 87.0 (87.0/20210318103112) under Windows 10 x64 and Ubuntu 16.04 LTS.

The mentioned error is logged in the extension console when clicking each of the context menu options provided by the add-on. For further details, please see the attached screenshot.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached image 2021-04-22_12h13_08.png —

This is working as intended.

If you care about the URL being loadable, pass the targetUrlPatterns: ["*://*/*"], option to the browser.contextMenus.create API call.

The menu item appears everywhere by default, to support extensions that don't care about the URL being loadable (e.g. extensions that want to offer a "Copy image URL" functionality, for example).

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: