Closed
Bug 577048
Opened 14 years ago
Closed 14 years ago
Notifications about add-on installs and error aren't shown when loading from a tab with no host (any about: page)
Categories
(Toolkit :: Add-ons Manager, defect)
Toolkit
Add-ons Manager
Tracking
()
VERIFIED
FIXED
mozilla2.0b3
Tracking | Status | |
---|---|---|
blocking2.0 | --- | final+ |
People
(Reporter: whimboo, Assigned: mossop)
References
Details
(Whiteboard: [AddonsRewrite])
Attachments
(2 files, 1 obsolete file)
105.99 KB,
application/x-xpinstall
|
Details | |
17.04 KB,
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
Given by bug 407315 and bug 292854 we fail in showing up a message when an extension cannot be installed. Right now I have catched the following two situations:
* Invalid XML file (install.rdf)
* Invalid extension type, i.e. 245
Assignee | ||
Updated•14 years ago
|
blocking2.0: ? → beta2+
Assignee | ||
Comment 1•14 years ago
|
||
I cannot reproduce this. In both the mentioned cases I see error messages. Can you attach an extension that does not produce an error message.
blocking2.0: beta2+ → final+
Reporter | ||
Comment 2•14 years ago
|
||
(In reply to comment #0)
> * Invalid XML file (install.rdf)
That case throws an error in the error console. Would it be possible to expose that as a direct error message to the user?
Error: unclosed token
Source File: jar:file:///Volumes/data/acr.xpi!/install.rdf
Line: 1, Column: 1
Source Code:
<?xml version="1.0" encoding="UTF-8">
> * Invalid extension type, i.e. 245
See this attached extension, where I have simply changed the id to an unsupported value. We fail silently or skip the installation completely.
Reporter | ||
Comment 3•14 years ago
|
||
The same happens for add-ons which are not supported via the targetPlatform entry.
Assignee | ||
Comment 4•14 years ago
|
||
(In reply to comment #2)
> Created attachment 458183 [details]
> test extension
>
> (In reply to comment #0)
> > * Invalid XML file (install.rdf)
>
> That case throws an error in the error console. Would it be possible to expose
> that as a direct error message to the user?
It shows an error in the notification box for me.
> > * Invalid extension type, i.e. 245
>
> See this attached extension, where I have simply changed the id to an
> unsupported value. We fail silently or skip the installation completely.
When I click on the attached extension I see the message "The add-on downloaded from bugzilla.mozilla.org could not be installed because it appears to be corrupt." Is this not what you see?
Reporter | ||
Comment 5•14 years ago
|
||
Oh, I haven't tried to install the XPI from a website. For testing purposes I have downloaded all of my testing add-ons to disk. Eventually that's the reason. But even installing the XPI via this attachment fails on trunk, because of a "Error Downloading", whatever that means. It works in 3.6.
Assignee | ||
Comment 6•14 years ago
|
||
So what are the steps to reproduce here?
Reporter | ||
Comment 7•14 years ago
|
||
Save it to the local disk and use "File | Open File" to install the extension.
Reporter | ||
Comment 8•14 years ago
|
||
I can confirm that the error is shown when installing via the web but not from local disk. Updating summary.
Summary: In certain situations we don't show a message when extensions can't be installed → In certain situations we don't show a message when extensions from the local disk can't be installed
Assignee | ||
Comment 9•14 years ago
|
||
Using the method in comment 7 still gives me the error notification.
Do you see anything in the error console when this happens? What OS are you testing on?
Reporter | ||
Comment 10•14 years ago
|
||
I'm running on OS X and well, there is another bug here:
Once you have tried to install an extension via bugzilla attachment and then trying again via local disk, it will always use the first extension. Even after a restart it mentions "download from Bugzilla". But that's probably another issue I should file as a new bug? For now just rename the xpi on your disk so we really use the downloaded file and not the one from Bugzilla.
Assignee | ||
Comment 11•14 years ago
|
||
(In reply to comment #10)
> I'm running on OS X and well, there is another bug here:
>
> Once you have tried to install an extension via bugzilla attachment and then
> trying again via local disk, it will always use the first extension. Even after
> a restart it mentions "download from Bugzilla". But that's probably another
> issue I should file as a new bug? For now just rename the xpi on your disk so
> we really use the downloaded file and not the one from Bugzilla.
That is a different issue, but I'm confused how you are seeing it when you aren't seeing a notification for local installs.
Reporter | ||
Comment 12•14 years ago
|
||
Ok, I tested again in a fresh profile and there I get this error notification. Looks like something in the profile suppresses the notification bar to appear. I will investigate tomorrow.
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → dtownsend
Comment 13•14 years ago
|
||
I can reproduce the missing notification error with an incompatible extension. It only happens if you open a new blank tab. It wont reproduce if you replace the path in an existing URL tab
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b3pre) Gecko/20100721 Minefield/4.0b3pre
Repro:
1) open a new tab
2) enter in a path to an incompatible extension outside of AMO (eg. ftp://ftp.mozilla.org/pub/labs/weave/development/1.4.x/weave-1.4.2b1-dev.xpi)
3) Verify no notification occurs.
4) now do the same, but replace the URL in an existing tab that already has a site open
5) Verify notification pops down saying extension is not compatibible with 4.0b3
6) Also verify the extension sits in the addons manager awaiting to be downloaded.
Expected:
- notification still occurs in an about:blank page when trying to download the incompatible extension
Assignee | ||
Comment 14•14 years ago
|
||
Thanks Tony, I've got a rough idea of what might be causing this now.
Summary: In certain situations we don't show a message when extensions from the local disk can't be installed → Notifications about add-on installs and error aren't shown when loading from a blank tab
Reporter | ||
Comment 15•14 years ago
|
||
We also don't show notifications for about:config and eventual other about: pages (not tested yet)
Assignee | ||
Updated•14 years ago
|
Summary: Notifications about add-on installs and error aren't shown when loading from a blank tab → Notifications about add-on installs and error aren't shown when loading from a tab with no host (any about: page)
Assignee | ||
Comment 16•14 years ago
|
||
There are two problems here, first is falling back to the active tab's currentURI when there was no referring URI (for urls typed into the address bar, loaded from file - open, dragged into the window etc.), the second is assuming that all URLs have a host.
In the case of the blocked notification we know we always have a referer that has a host (otherwise it would not have been blocked).
In the other cases we should use the referring host if possible and if not fall back to the host of the URI that the add-on is being downloaded from. If we have no host at all then the add-on must be being installed locally in which case we need some better messages.
I've added tests for these cases as well as updating the existing cases with checks that the displayed message is correct.
Attachment #460742 -
Flags: review?(gavin.sharp)
Assignee | ||
Updated•14 years ago
|
Status: NEW → ASSIGNED
Comment 17•14 years ago
|
||
(In reply to comment #16)
> In the case of the blocked notification we know we always have a referer that
> has a host (otherwise it would not have been blocked).
Can you elaborate here? Couldn't you e.g. be installing from a file with xpinstall disabled?
Comment 18•14 years ago
|
||
Assuming that URIs with no hosts represent local files is somewhat bothersome to me as well, since it's possible for other URI types to not have hosts (granted, they are edge cases). Not sure there's a better solution for that, though. I suppose you could add an explicit check for scheme=="file" and then have an even more generic message for the other cases...
Assignee | ||
Comment 19•14 years ago
|
||
(In reply to comment #17)
> (In reply to comment #16)
> > In the case of the blocked notification we know we always have a referer that
> > has a host (otherwise it would not have been blocked).
>
> Can you elaborate here? Couldn't you e.g. be installing from a file with
> xpinstall disabled?
That is a good point, I think the old code was broken in this case too. Luckily there is a simple way out, the message for xpinstall.disabled doesn't actually require a hostname. For cases where the url isn't in the whitelist we are safe because any url without a host is automatically allowed.
Assignee | ||
Comment 20•14 years ago
|
||
(In reply to comment #18)
> Assuming that URIs with no hosts represent local files is somewhat bothersome
> to me as well, since it's possible for other URI types to not have hosts
> (granted, they are edge cases). Not sure there's a better solution for that,
> though. I suppose you could add an explicit check for scheme=="file" and then
> have an even more generic message for the other cases...
I think the existing messages are probably generic enough, but I could rename the keys if you think that is worthwhile.
Comment 21•14 years ago
|
||
"because of a filesystem error" was what threw me off, but I can get over that.
Assignee | ||
Comment 22•14 years ago
|
||
Updated patch that doesn't try to use the host for the disabled case since that string doesn't actually require any formatting.
Attachment #460742 -
Attachment is obsolete: true
Attachment #461255 -
Flags: review?(gavin.sharp)
Attachment #460742 -
Flags: review?(gavin.sharp)
Comment 23•14 years ago
|
||
Comment on attachment 461255 [details] [diff] [review]
patch rev 2
>diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
> case "addon-install-failed":
> // TODO This isn't terribly ideal for the multiple failure case
> installInfo.installs.forEach(function(aInstall) {
>- var error = "addonError";
>+ // Some URIs (file:, about:) have no host and trying to get one will throw
>+ var host = null;
>+ if (installInfo.originatingURI) {
>+ try {
>+ host = installInfo.originatingURI.host;
>+ }
>+ catch (e) {
>+ }
>+ }
>+
>+ // Fallback to the host the add-on was downloaded from
>+ if (!host && aInstall.sourceURI) {
>+ try {
>+ host = aInstall.sourceURI.host;
>+ }
>+ catch (e) {
>+ }
>+ }
This could all just be:
var host = (installInfo.originatingURI instanceof Ci.nsIStandardURL) && installInfo.originatingURI.host;
if (!host)
host = (aInstall.sourceURI instanceof Ci.nsIStandardURL) && aInstall.sourceURI.host;
>+ if (host)
>+ messageString = messageString.replace("#2", host);
>diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties
> # LOCALIZATION NOTE (addonError-1, addonError-2, addonError-3, addonError-4, addonErrorIncompatible, addonErrorBlocklisted):
> # #1 is the add-on name, #2 is the host name, #3 is the application name
> # #4 is the application version
Perhaps worth noting here that localizers shouldn't add #2 to strings that don't have it, since it isn't replaced consistently?
Attachment #461255 -
Flags: review?(gavin.sharp) → review+
Assignee | ||
Comment 24•14 years ago
|
||
Fixed: http://hg.mozilla.org/mozilla-central/rev/2f1f78c2adf9
I separated out the items in the locale to make it clearer.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Flags: in-litmus-
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b3
Reporter | ||
Comment 25•14 years ago
|
||
Verified fixed with Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b5pre) Gecko/20100825 Minefield/4.0b5pre
Status: RESOLVED → VERIFIED
Comment 26•14 years ago
|
||
The installation of an add-on from disk shouldn't be triggering a site level notification (doorhanger). I've filed follow up bug 594564 to convert this to a traditional dialog box.
You need to log in
before you can comment on or make changes to this bug.
Description
•