Addon Provider's getInstallForUrl is never called

UNCONFIRMED
Unassigned

Status

()

Toolkit
Add-ons Manager
UNCONFIRMED
5 years ago
5 years ago

People

(Reporter: Anthony Lieuallen, Unassigned)

Tracking

18 Branch
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0
Build ID: 20130104154748

Steps to reproduce:

Drag and drop a ".user.js" file into the Addon Manager.


Actual results:

A dialog that says "This add-on could not be installed because it appears to be corrupt"


Expected results:

Downstream bug:
https://github.com/greasemonkey/greasemonkey/issues/1663

Greasemonkey defines:
https://github.com/greasemonkey/greasemonkey/blob/0d758f7ddfb48a7b33d64ece88cb5343f6d1399e/modules/addons4.js#L39
And registers:
https://github.com/greasemonkey/greasemonkey/blob/0d758f7ddfb48a7b33d64ece88cb5343f6d1399e/modules/addons4.js#L371
an Addon Provider.


In extensions.js, gDragDrop.onDrop calls AddonManager.getInstallForURL, which does:

...
for (let provider of providers) {
  if (callProvider(provider, "supportsMimetype", false, aMimetype)) {
    callProvider(provider, "getInstallForURL", null,
...

Since my provider is registered, I'd expect to get a supportsMimetype / getInstallForURL call.  I added these methods to my provider, but neither supportsMimetype, getInstallForFile ,nor getInstallForURL is ever called.
Component: Untriaged → Add-ons Manager
Product: Firefox → Toolkit
(Reporter)

Comment 1

5 years ago
This appears ultimately to be:
http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/content/extensions.js#3294

The "application/x-xpinstall" string is hard coded, regardless of what file is being dropped.  The XPIProvider is registered early/first, supports that mime type, and grabs all dropped files regardless of type.  If the file isn't ".xpi" that mime type should not be passed.
You need to log in before you can comment on or make changes to this bug.