Closed Bug 704973 Opened 8 years ago Closed 8 years ago

XPIProvider syncGUID setter should not always call to database

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla11

People

(Reporter: gps, Assigned: gps)

References

Details

Attachments

(1 file)

According to :Mossop, XPIProvider.syncGUID's setter isn't implemented properly: It should support setting syncGUID to instances not yet backed by the database.

In addition, we need to set syncGUID earlier in an object's lifetime, preferably as soon as possible, so it is available to all listeners.
Basically you want to check |if (aAddon instanceof DBAddonInternal)| before attempting to push the ID to the database.

You can probably just create the syncGUID in loadManifestFromRDF or something, then it'd always be set.
This implements what was talked about in the first few comments.

1) Moved syncGUID generation to earlier in the object creation process
2) Don't always hit the DB when setting the syncGUID

I've verified that xpcshell and mochitests all pass.
Assignee: nobody → gps
Status: NEW → ASSIGNED
Attachment #578930 - Flags: review?(dtownsend)
Comment on attachment 578930 [details] [diff] [review]
syncGUID follow-up, v1

Review of attachment 578930 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/mozapps/extensions/XPIProvider.jsm
@@ +7628,5 @@
>        return val;
>  
> +    if (aAddon instanceof DBAddonInternal) {
> +      XPIDatabase.setAddonSyncGUID(aAddon, val);
> +    }

No braces needed around a single statement here.
Attachment #578930 - Flags: review?(dtownsend) → review+
Pushed to s-c with minor formatting change.

https://hg.mozilla.org/services/services-central/rev/91881c0cf3f3
Status: ASSIGNED → NEW
Blocks: 710961
Pushed to m-c: https://hg.mozilla.org/mozilla-central/rev/91881c0cf3f3
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
Depends on: 717904
You need to log in before you can comment on or make changes to this bug.