Closed Bug 1192924 Opened 9 years ago Closed 9 years ago

Find and install new sets of system add-ons

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox43 --- affected
firefox44 --- fixed

People

(Reporter: mossop, Assigned: mossop)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Periodically check for a new known-good set of system add-ons, download any new add-ons to the system add-on location. Once all of the add-ons are available switch to the new known-good set.
Assignee: nobody → dtownsend
Depends on: 1204156
Depends on: 1204158
Depends on: 1204159
Bug 1192924: Expose the update URL formatting code in the app update service and switch the GMP install manager to use it. r?rstrong

The GMP manager uses a copy of the update service's url formatting code and has
since fallen out of sync. We'll also want to use the same formatting code for
the system add-on update checks so this just exposes it in the update service
component where anyone can call it.
Attachment #8660996 - Flags: review?(robert.strong.bugs)
Bug 1192924: Split out add-on update.xml parsing code from GMP modules. r?spohl

The system add-on update checks will use the same update.xml format as GMP so
this splits out the code for parsing and downloading files into a standalone
module that both can reuse.
Attachment #8660997 - Flags: review?(spohl.mozilla.bugs)
Bug 1192924: Check for updated system add-ons and download and install them. r?rhelmer

This performs the update check for system add-ons. It runs as part of the daily
add-on update checks similar to hotfix checks. Currently no URL is set so builds
won't actually start checking yet.

I've taken a few shortcuts here by only staging updates and needing a restart to
install as well as always downloading updates rather than using existing local
copies. At least the latter probably needs fixing before turning this on but
it makes more sense to iterate on those in tree.
Attachment #8660998 - Flags: review?(rhelmer)
Dave, I think this would be cleaner to just move into UpdateChannel.jsm. Perhaps rename the jsm as well. Make sense?
Flags: needinfo?(dtownsend)
(In reply to Robert Strong [:rstrong] (use needinfo to contact me) from comment #4)
> Dave, I think this would be cleaner to just move into UpdateChannel.jsm.
> Perhaps rename the jsm as well. Make sense?

I think so but the issue I ran into was that we use the gOSVersion and gABI values to control whether updates are enabled and to send some telemetry. I could expose those properties from the JSM as well if that makes sense?
Flags: needinfo?(dtownsend) → needinfo?(robert.strong.bugs)
Comment on attachment 8660998 [details]
MozReview Request: Bug 1192924: Check for updated system add-ons and download and install them. r=rhelmer

https://reviewboard.mozilla.org/r/19243/#review17263

::: testing/xpcshell/head.js:1508
(Diff revision 1)
> +    prefs.setCharPref("extensions.systemAddon.update.url", "http://%(server)s/dummy-system-addons.xml");

Why http not https? Does this whole pref get overridden anyway?

::: toolkit/mozapps/extensions/internal/XPIProvider.jsm:2850
(Diff revision 1)
> +            logger.warn(`Failed to remove temporary file ${item.path}.`);

Any reason not to log the exception too?
Attachment #8660998 - Flags: review?(rhelmer)
(In reply to Dave Townsend [:mossop] from comment #5)
> (In reply to Robert Strong [:rstrong] (use needinfo to contact me) from
> comment #4)
> > Dave, I think this would be cleaner to just move into UpdateChannel.jsm.
> > Perhaps rename the jsm as well. Make sense?
> 
> I think so but the issue I ran into was that we use the gOSVersion and gABI
> values to control whether updates are enabled and to send some telemetry. I
> could expose those properties from the JSM as well if that makes sense?
I think it makes sense to do that. It would be a good thing to make the blocklist use it as well if possible.
Flags: needinfo?(robert.strong.bugs)
Attachment #8660996 - Flags: review?(robert.strong.bugs)
Comment on attachment 8660998 [details]
MozReview Request: Bug 1192924: Check for updated system add-ons and download and install them. r=rhelmer

https://reviewboard.mozilla.org/r/19243/#review17435
Attachment #8660998 - Flags: review+
Comment on attachment 8660996 [details]
MozReview Request: Bug 1192924: Expose the update URL formatting code a new UpdateUtils module. r?rstrong

Bug 1192924: Expose the update URL formatting code a new UpdateUtils module. r?rstrong

The GMP manager uses a copy of the update service's url formatting code and has
since fallen out of sync. We'll also want to use the same formatting code for
the system add-on update checks so this just exposes it in a shared API.

I've moved the contents of UpdateChannel.jsm to UpdateUtils.jsm and exposed
formatUpdateURL there as well as a few properties that the update service still
needs access to.

UpdateUtils.UpdateChannel is intended to be a lazy getter but isn't for now
since tests expect to be able to change the update channel at runtime.
Attachment #8660996 - Attachment description: MozReview Request: Bug 1192924: Expose the update URL formatting code in the app update service and switch the GMP install manager to use it. r?rstrong → MozReview Request: Bug 1192924: Expose the update URL formatting code a new UpdateUtils module. r?rstrong
Attachment #8660996 - Flags: review?(robert.strong.bugs)
Comment on attachment 8660997 [details]
MozReview Request: Bug 1192924: Split out add-on update.xml parsing code from GMP modules. r=spohl

Bug 1192924: Split out add-on update.xml parsing code from GMP modules. r?spohl

The system add-on update checks will use the same update.xml format as GMP so
this splits out the code for parsing and downloading files into a standalone
module that both can reuse.
Comment on attachment 8660998 [details]
MozReview Request: Bug 1192924: Check for updated system add-ons and download and install them. r=rhelmer

Bug 1192924: Check for updated system add-ons and download and install them. r=rhelmer

This performs the update check for system add-ons. It runs as part of the daily
add-on update checks similar to hotfix checks. Currently no URL is set so builds
won't actually start checking yet.

I've taken a few shortcuts here by only staging updates and needing a restart to
install as well as always downloading updates rather than using existing local
copies. At least the latter probably needs fixing before turning this on but
it makes more sense to iterate on those in tree.
Attachment #8660998 - Attachment description: MozReview Request: Bug 1192924: Check for updated system add-ons and download and install them. r?rhelmer → MozReview Request: Bug 1192924: Check for updated system add-ons and download and install them. r=rhelmer
Attachment #8660997 - Flags: review?(spohl.mozilla.bugs) → review+
Comment on attachment 8660997 [details]
MozReview Request: Bug 1192924: Split out add-on update.xml parsing code from GMP modules. r=spohl

https://reviewboard.mozilla.org/r/19241/#review17851

Sorry about the delay! A lot of code that moved, with some dramatic code improvements that I had to wrap my head around first. :-) Only a few minor nits and questions. Thanks!

::: toolkit/modules/GMPInstallManager.jsm:102
(Diff revision 2)
> -      this._request = this._request.wrappedJSObject;
> +      certs = gCertUtils.readCertPrefs(GMPPrefs.KEY_CERTS_BRANCH);

|certs| is now set regardless of whether or not |GMPPrefs.get(GMPPrefs.KEY_CERT_CHECKATTRS, true)| returns true. Is this intentional? If yes, let's remove the pref from GMPPrefs and avoid setting it in test_GMPInstallManager.js.

::: toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm:37
(Diff revision 2)
> + * Gets the status of an XMLHttpRequest either directory or from its underlying

nit: s/directory/directly/

::: toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm:56
(Diff revision 2)
> +  return request.channel.QueryInterface(Ci.nsIRequest).status;

This is existing behavior, but wanted to double-check: |request.channel| is guaranteed to be created here (i.e. != null), correct?

::: toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm:150
(Diff revision 2)
> +  let addons = document.querySelector("updates:root > addons:last-child");

I realize that |addons:last-child| is existing behavior, but is there any concern about the possibility of multiple "addons" nodes? We're currently selecting the last one regardless of how many are in the document. I get the impression that the original implementation probably meant to add all the addon elements contained in "addons" nodes and accidentally used |gmpResults = GMPAddon.parseGMPAddonsNode(updatesChildElement);| instead of |gmpResults += GMPAddon.parseGMPAddonsNode(updatesChildElement);| (or similar) in parseResponseXML().

::: toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm:151
(Diff revision 2)
> +  if (!addons)

nit: please use curly braces around return statement.

::: toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm:205
(Diff revision 2)
> +                       DOWNLOAD_INTERVAL);

nit: fix indentation or move to previous line

::: toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm:218
(Diff revision 2)
> +      hex = "0" + hex;

nit: Let's add curly braces around this too, even though it was just a copy/paste.

::: toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm:231
(Diff revision 2)
> + * @return a promise that resolves to hash of the file or rejects with a JS

nit: let's add "the" before "hash" in the comment for @return

::: toolkit/mozapps/extensions/test/xpcshell/test_ProductAddonChecker.js:46
(Diff revision 2)
> +  // Check the returned size versus the expected size.

nit: This (previously existing) comment does not seem to apply anymore. Let's remove it.
Comment on attachment 8660996 [details]
MozReview Request: Bug 1192924: Expose the update URL formatting code a new UpdateUtils module. r?rstrong

Bug 1192924: Expose the update URL formatting code a new UpdateUtils module. r?rstrong

The GMP manager uses a copy of the update service's url formatting code and has
since fallen out of sync. We'll also want to use the same formatting code for
the system add-on update checks so this just exposes it in a shared API.

I've moved the contents of UpdateChannel.jsm to UpdateUtils.jsm and exposed
formatUpdateURL there as well as a few properties that the update service still
needs access to.

UpdateUtils.UpdateChannel is intended to be a lazy getter but isn't for now
since tests expect to be able to change the update channel at runtime.
Comment on attachment 8660997 [details]
MozReview Request: Bug 1192924: Split out add-on update.xml parsing code from GMP modules. r=spohl

Bug 1192924: Split out add-on update.xml parsing code from GMP modules. r=spohl

The system add-on update checks will use the same update.xml format as GMP so
this splits out the code for parsing and downloading files into a standalone
module that both can reuse.
Attachment #8660997 - Attachment description: MozReview Request: Bug 1192924: Split out add-on update.xml parsing code from GMP modules. r?spohl → MozReview Request: Bug 1192924: Split out add-on update.xml parsing code from GMP modules. r=spohl
Comment on attachment 8660998 [details]
MozReview Request: Bug 1192924: Check for updated system add-ons and download and install them. r=rhelmer

Bug 1192924: Check for updated system add-ons and download and install them. r=rhelmer

This performs the update check for system add-ons. It runs as part of the daily
add-on update checks similar to hotfix checks. Currently no URL is set so builds
won't actually start checking yet.

I've taken a few shortcuts here by only staging updates and needing a restart to
install as well as always downloading updates rather than using existing local
copies. At least the latter probably needs fixing before turning this on but
it makes more sense to iterate on those in tree.
Attachment #8660996 - Flags: review?(robert.strong.bugs) → review+
Was comm-central also patched?
Comment on attachment 8660996 [details]
MozReview Request: Bug 1192924: Expose the update URL formatting code a new UpdateUtils module. r?rstrong

Bug 1192924: Expose the update URL formatting code a new UpdateUtils module. r?rstrong

The GMP manager uses a copy of the update service's url formatting code and has
since fallen out of sync. We'll also want to use the same formatting code for
the system add-on update checks so this just exposes it in a shared API.

I've moved the contents of UpdateChannel.jsm to UpdateUtils.jsm and exposed
formatUpdateURL there as well as a few properties that the update service still
needs access to.

UpdateUtils.UpdateChannel is intended to be a lazy getter but isn't for now
since tests expect to be able to change the update channel at runtime.
Attachment #8660996 - Flags: review+ → review?(robert.strong.bugs)
Comment on attachment 8660997 [details]
MozReview Request: Bug 1192924: Split out add-on update.xml parsing code from GMP modules. r=spohl

Bug 1192924: Split out add-on update.xml parsing code from GMP modules. r=spohl

The system add-on update checks will use the same update.xml format as GMP so
this splits out the code for parsing and downloading files into a standalone
module that both can reuse.
Comment on attachment 8660998 [details]
MozReview Request: Bug 1192924: Check for updated system add-ons and download and install them. r=rhelmer

Bug 1192924: Check for updated system add-ons and download and install them. r=rhelmer

This performs the update check for system add-ons. It runs as part of the daily
add-on update checks similar to hotfix checks. Currently no URL is set so builds
won't actually start checking yet.

I've taken a few shortcuts here by only staging updates and needing a restart to
install as well as always downloading updates rather than using existing local
copies. At least the latter probably needs fixing before turning this on but
it makes more sense to iterate on those in tree.
Comment on attachment 8660996 [details]
MozReview Request: Bug 1192924: Expose the update URL formatting code a new UpdateUtils module. r?rstrong

Changes look fine. Would be a good thing to send to try.
Attachment #8660996 - Flags: review?(robert.strong.bugs) → review+
(In reply to Robert Strong [:rstrong] (use needinfo to contact me) from comment #23)
> Comment on attachment 8660996 [details]
> MozReview Request: Bug 1192924: Expose the update URL formatting code a new
> UpdateUtils module. r?rstrong
> 
> Changes look fine. Would be a good thing to send to try.

Already there: https://treeherder.mozilla.org/#/jobs?repo=try&revision=12dfb5182fc9
Flags: needinfo?(dtownsend)
No longer depends on: 1204156
No longer depends on: 1204158
No longer depends on: 1204159
On 64bit Windows running 32bit Firefox the patches in this bug changed %BUILD_TARGET% to be "WINNT_x86-msvc-x64". Previously it was "WINNT_x86-msvc". Making the build target for a 32bit build include "x64" seems wrong. 

This has broken both OpenH264 and Adobe Primetime GMP updates, as they use the %BUILD_TARGET% as part of their URL to their AUS update.xml file. Curiously this only breaks updates in newly created profiles, not in existing profiles.

Dave: can you fix this regression, otherwise we'll have to back this out as it's breaking Adobe Primetime/Netflix and OpenH264.

STR:
1. Create a new profile on x64 Win 7 or later in 32bit Firefox.
2. Set prefs media.gmp.log.dump=true, media.gmp.log.level=0
3. Open Add-ons manager > Plugins
4. Observe the "Primetime Content Decryption Module ... will be installed shortly" being shown for the Adobe Primetime plugin's entry.
5. Right click on "Primetime Content Decryption Module" > Find updates.
6. Observe that "Primetime Content Decryption Module ... will be installed shortly" never goes away.

If you compare the GMP installer logs in the browser console with an existing profile, you'll see that the %BUILD_TARGET% has an "-x64" appended to it.
Flags: needinfo?(spohl.mozilla.bugs)
Flags: needinfo?(dtownsend)
(In reply to Chris Pearce (:cpearce) from comment #27)
> On 64bit Windows running 32bit Firefox the patches in this bug changed
> %BUILD_TARGET% to be "WINNT_x86-msvc-x64". Previously it was
> "WINNT_x86-msvc". Making the build target for a 32bit build include "x64"
> seems wrong. 
> 
> This has broken both OpenH264 and Adobe Primetime GMP updates, as they use
> the %BUILD_TARGET% as part of their URL to their AUS update.xml file.
> Curiously this only breaks updates in newly created profiles, not in
> existing profiles.
> 
> Dave: can you fix this regression, otherwise we'll have to back this out as
> it's breaking Adobe Primetime/Netflix and OpenH264.

*sigh*. Looks like bug 1183077 added the OS architecture for app update BUILD_TARGET but not GMP updates. Stephen, was that intentional? I'd really like it if we could unify all of these place where we generate URLs so we don't have to fix the same bugs in many places. Can we update Balrog's rules to handle this or do we have to make the GMP update URLs unique again?
Flags: needinfo?(bhearsum)
(In reply to Chris Pearce (:cpearce) from comment #27)
> On 64bit Windows running 32bit Firefox the patches in this bug changed
> %BUILD_TARGET% to be "WINNT_x86-msvc-x64". Previously it was
> "WINNT_x86-msvc". Making the build target for a 32bit build include "x64"
> seems wrong. 

I can see why this seems wrong, but it's actually very important: The first arch is the target architecture of the build, the second is what the machine is actually running. This let's us distinguish between 64-bit builds running on 32-bit machines, and 64-bit builds running on 64-bit machines, which will eventually allow us to upgrade users who are on a 64-bit system to 64-bit Firefox, while keeping users with 32-bit systems on 32-bit. The reason this spilled over to GMP is beacuse we share an update URL format between Firefox updates, GMP, and some other things.

> This has broken both OpenH264 and Adobe Primetime GMP updates, as they use
> the %BUILD_TARGET% as part of their URL to their AUS update.xml file.
> Curiously this only breaks updates in newly created profiles, not in
> existing profiles.

This is an easy fix on the update server - we can alias the new build targets to the old ones. My bad for missing this when we changed the build targets. I'll fix this shortly.
Flags: needinfo?(bhearsum)
(In reply to Dave Townsend [:mossop] from comment #28)
> *sigh*. Looks like bug 1183077 added the OS architecture for app update
> BUILD_TARGET but not GMP updates. Stephen, was that intentional? I'd really
> like it if we could unify all of these place where we generate URLs so we
> don't have to fix the same bugs in many places.

No, that was not intentional and should have been changed for GMP updates as well. I didn't see that attachment 8660996 [details] was touching this. Good to hear that this is an easy fix on the update server side.
Flags: needinfo?(spohl.mozilla.bugs)
(In reply to Stephen A Pohl [:spohl] from comment #30)
> (In reply to Dave Townsend [:mossop] from comment #28)
> > *sigh*. Looks like bug 1183077 added the OS architecture for app update
> > BUILD_TARGET but not GMP updates. Stephen, was that intentional? I'd really
> > like it if we could unify all of these place where we generate URLs so we
> > don't have to fix the same bugs in many places.
> 
> No, that was not intentional and should have been changed for GMP updates as
> well. I didn't see that attachment 8660996 [details] was touching this. Good
> to hear that this is an easy fix on the update server side.

Oh sorry - I think I misunderstood the issue. I thought we *were* including arch in these URLs, and the problem was that the update server wasn't returning anything for them. I actually went ahead updated the server such that URLs like https://aus5.mozilla.org/update/3/GMP/38.0a1/20120222174716/WINNT_x86-msvc-x64/en-US/nightly/default/default/default/update.xml return the appropriate plugins.

If the GMP URLs are using different build targets than app update, I think that should be fixed. This is what happens when we fork our own update code :(.
(In reply to Ben Hearsum (:bhearsum) from comment #31)
> (In reply to Stephen A Pohl [:spohl] from comment #30)
> > (In reply to Dave Townsend [:mossop] from comment #28)
> > > *sigh*. Looks like bug 1183077 added the OS architecture for app update
> > > BUILD_TARGET but not GMP updates. Stephen, was that intentional? I'd really
> > > like it if we could unify all of these place where we generate URLs so we
> > > don't have to fix the same bugs in many places.
> > 
> > No, that was not intentional and should have been changed for GMP updates as
> > well. I didn't see that attachment 8660996 [details] was touching this. Good
> > to hear that this is an easy fix on the update server side.
> 
> Oh sorry - I think I misunderstood the issue. I thought we *were* including
> arch in these URLs, and the problem was that the update server wasn't
> returning anything for them. I actually went ahead updated the server such
> that URLs like
> https://aus5.mozilla.org/update/3/GMP/38.0a1/20120222174716/WINNT_x86-msvc-
> x64/en-US/nightly/default/default/default/update.xml return the appropriate
> plugins.
> 
> If the GMP URLs are using different build targets than app update, I think
> that should be fixed. This is what happens when we fork our own update code
> :(.

They were using different build targets and this bug fixed that. Sounds like we're all good here now then.
Flags: needinfo?(dtownsend)
On Win10 x64 with 32bit Firefox Nightly I'm getting an AUS URL of:

https://aus5.mozilla.org/update/3/GMP/44.0a1/20150925030206/WINNT_x86-msvc-x64/en-US/nightly/Windows_NT%2010.0.0.0%20(x64)/default/default/update.xml

This doesn't have an Adobe Primetime entry. So we're not done yet.
Flags: needinfo?(bhearsum)
(In reply to Chris Pearce (:cpearce) from comment #33)
> On Win10 x64 with 32bit Firefox Nightly I'm getting an AUS URL of:
> 
> https://aus5.mozilla.org/update/3/GMP/44.0a1/20150925030206/WINNT_x86-msvc-
> x64/en-US/nightly/Windows_NT%2010.0.0.0%20(x64)/default/default/update.xml
> 
> This doesn't have an Adobe Primetime entry. So we're not done yet.

Sorry about that - I only added the alias' for OpenH264. Should be fixed now.
Removing needinfo because I think the issue with GMP updates is resolved. Please let me know if it isn't.
Flags: needinfo?(bhearsum)
Depends on: 1358552
No longer depends on: 1358552
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: