Closed Bug 1383782 Opened 7 years ago Closed 7 years ago

Reloading a temporary add-on from about:debugging results in an install date of "Invalid Date"

Categories

(Toolkit :: Add-ons Manager, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: bsilverberg, Assigned: bsilverberg)

Details

Attachments

(1 file)

I noticed this when working on ext-url-overrides and doing some interactive testing. When a temporary add-on is reloaded from about:debugging, and it contains a chrome_url_overrides.newtab manifest key, the setting is first removed from the setting store (onClose) and then added back (onManifestEntry). When the latter code runs, it calls `addon = await AddonManager.getAddonByID(id)` and at that point `addon.installDate` contains the string "Invalid Date", rather than an actual date, which is the case when the add-on is initially installed.

I'm not sure this will cause much of an issue, but I thought it best to at least report it. I can address it in the SettingsStore code, but I won't do that if it's going to be addressed in the Add-ons Manager.
Priority: -- → P5
Bob, aswan was thinking this is something we should fix soon. Would you be able to have a look?
Assignee: nobody → bob.silverberg
Priority: P5 → P2
I tried to do what we discussed in IRC, which was to make the installDate for the reloaded add-on the same as the installDate of the old add-on, and the updateDate for the reloaded add-on be the current time, but I couldn't get the latter to work. Simply setting updateDate at the same time I am setting installDate didn't work (i.e., the add-on didn't end up with that updateDate). It looks like updateDate is based on the date of the file that was loaded. As updateDate isn't needed by the code in question, I chose to just implement the fix for installDate for now and punt on updateDate.
Comment on attachment 8896249 [details]
Bug 1383782 - Record an installDate when a temporary add-on is reloaded,

https://reviewboard.mozilla.org/r/167544/#review172800

::: toolkit/mozapps/extensions/test/xpcshell/test_webextension_install.js:111
(Diff revision 1)
>      AddonManager.installTemporaryAddon(addonDir),
>      promiseWebExtensionStartup(),
>    ]);
>    // The IDs should be the same.
>    equal(secondAddon.id, addon.id, "Reinstalled add-on has the expected ID");
> +  equal(secondAddon.installDate - addon.installDate, 0, "Reloaded add-on has the expected installDate.");

Why not just `equal(secondAddon.installDate, addon.installDate, ...)`
Attachment #8896249 - Flags: review?(aswan) → review+
Comment on attachment 8896249 [details]
Bug 1383782 - Record an installDate when a temporary add-on is reloaded,

https://reviewboard.mozilla.org/r/167544/#review172800

> Why not just `equal(secondAddon.installDate, addon.installDate, ...)`

That fails, I am guessing because the objects are not the same.
Comment on attachment 8896249 [details]
Bug 1383782 - Record an installDate when a temporary add-on is reloaded,

https://reviewboard.mozilla.org/r/167544/#review172800

> That fails, I am guessing because the objects are not the same.

`equal(secondAddon.installDate.valueOf(), addon.installDate.valueOf(), "...")`
Pushed by bsilverberg@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6cdbab15f8de
Record an installDate when a temporary add-on is reloaded, r=aswan
https://hg.mozilla.org/mozilla-central/rev/6cdbab15f8de
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: