Note: There are a few cases of duplicates in user autocompletion which are being worked on.

contextMenus do not support other protocols (ex. 'magnet:*', 'acestream:*', 'sop:*')

NEW
Unassigned

Status

()

Toolkit
WebExtensions: Untriaged
P4
normal
a year ago
3 months ago

People

(Reporter: Maciej Sitarz, Unassigned)

Tracking

50 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [contextMenus] triaged)

(Reporter)

Description

a year ago
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0
Build ID: 20160606100313

Steps to reproduce:

I'm porting an extension from Chrome to Firefox. It uses context menus, different ones for each type of target link.
The problem is in Chrome context menus are added for MatchPatterns:
"['magnet:*', 'acestream:*', 'sop:*']" but in Firefox I get an error in Browser Console.

Sample code to add context menu:
function onCreated(n) {
  if (chrome.runtime.lastError) {
    console.log("error creating item:" + chrome.runtime.lastError);
  } else {
    console.log("item created successfully");
  }
}
chrome.contextMenus.create({
  id: "test4",
  title: "TEST targetUrlPatterns magnet",
  contexts: ["link"],
  targetUrlPatterns: ['magnet:*', 'acestream:*', 'sop:*']
}, onCreated);

I'm aware that MatchPatterns documentation lists those kind of patterns as not proper, but I think the behaviour should be the same between the browsers. Also different protocols should be supported, as the URIs are not only http/https/ftp.

To test the functionality in Firefox run this on Browser Console:
Cu.import("resource://gre/modules/MatchPattern.jsm");
Cu.import("resource://gre/modules/BrowserUtils.jsm");
var match = new MatchPattern("magnet:*");



Actual results:

Firefox:
Error is thrown:
Invalid match pattern: 'magnet:*' MatchPattern.jsm:52
Invalid match pattern: 'acestream:*' MatchPattern.jsm:52
Invalid match pattern: 'sop:*'  MatchPattern.jsm:52

Chrome:
Pattern is created properly.


Expected results:

Firefox:
Pattern is created properly.

Chrome:
Pattern is created properly.
Switching context menus from MatchPattern to MatchGlob should fix this.
Summary: MatchPattern does not support other protocols (ex. 'magnet:*', 'acestream:*', 'sop:*') → contextMenus do not support other protocols (ex. 'magnet:*', 'acestream:*', 'sop:*')
I suppose we need different rules for matching links than we do for things like content scripts.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Updated

a year ago
Priority: -- → P4
Whiteboard: [good first bug, context menues] triaged

Updated

a year ago
Whiteboard: [good first bug, context menues] triaged → [good first bug][contextMenus] triaged

Updated

a year ago
Mentor: aswan@mozilla.com
Kris, can you please add some more details about the different rules we'd need?
Mentor: aswan@mozilla.com → kmaglione+bmo@mozilla.com
This isn't a good first bug.
Whiteboard: [good first bug][contextMenus] triaged → [contextMenus] triaged

Updated

3 months ago
Mentor: kmaglione+bmo@mozilla.com
You need to log in before you can comment on or make changes to this bug.