Closed Bug 687450 Opened 13 years ago Closed 13 years ago

Add back-end method to enable and disable add-ons

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: AlexLakatos, Assigned: AlexLakatos)

References

Details

(Whiteboard: [lib])

Attachments

(1 file, 3 obsolete files)

Add an enablePlugin() method to addons.js that uses back-end code and does not use the UI. Needed for the teardownModule in bug 674221.
Assignee: nobody → alex.lakatos
Blocks: 674221
Status: NEW → ASSIGNED
Attached patch patch v1.0 (obsolete) (deleted) — Splinter Review
Added enablePlugin that uses the AddonManager component and can be called from outside the AddonsManager tab.
Attachment #560935 - Flags: review?(hskupin)
Comment on attachment 560935 [details] [diff] [review] patch v1.0 Methods in APIs should be able to be used more widely. So it's not only about plugins but all add-ons. Further you probably also want to disable add-ons via the backend. All that should be taken care in this helper method. Also this method is working asynchronously, so we need a way of synching.
Attachment #560935 - Flags: review?(hskupin) → review-
Blocks: 687449
Blocks: 687823
Henrik, Anthony, do you guys have any tips for synching this? Should I use some sort of waitFor?
Use a local variable inside the method which is set to false at the beginning. Once the plugin callback has been executed set it to true from inside the callback. Now a waitFor call has to take place to wait for completion.
Summary: Add an enablePlugin() method to addons.js → Add an enableAddon() method to addons.js
Attached patch patch v2 (obsolete) (deleted) — Splinter Review
The method has synchronisation now and has been renamed.
Attachment #560935 - Attachment is obsolete: true
Attachment #564794 - Flags: review?(hskupin)
We should not only have a method for enabling an add-on but also for disabling it.
Summary: Add an enableAddon() method to addons.js → Add back-end method to enable and disable add-ons
Comment on attachment 564794 [details] [diff] [review] patch v2 >+function enableAddon(aAddonId) { >+ addonIsEnabled = false; You forgot 'var' or 'let' when declaring the variable. If you don't specify that it will become a global variable instead. Also it could be named as 'finished'. It will make it easier when we have mulitple of those helper functions. In that case I wonder if we could have an internal method we could use for synchronization. >+ mozmill.utils.waitFor(function () { >+ return addonIsEnabled; >+ }, "Addon is enabled"); >+} Please check the indentation and add the addon id to it for better debugging purposes.
Attachment #564794 - Flags: review?(hskupin) → review-
Attached patch patch v3 (obsolete) (deleted) — Splinter Review
Updated and created a disableAddon method.
Attachment #564794 - Attachment is obsolete: true
Attachment #566176 - Flags: review?(hskupin)
Comment on attachment 566176 [details] [diff] [review] patch v3 >+ mozmill.utils.waitFor(function () { >+ return finished; >+ }, "Addon is enabled - expected ID - " + aAddonId); nit: please fix the indentation inside the callback. Also the message should say: "Add-on 'XYZ' has been disabled". Keep an eye on disabled and not enabled. Looks like you missed to change it when copying and pasting code. Same applies to the enableAddon function.
Attachment #566176 - Flags: review?(hskupin) → review-
Attached patch patch v4 (deleted) — Splinter Review
Addressed all issues.
Attachment #566176 - Attachment is obsolete: true
Attachment #566201 - Flags: review?(hskupin)
Attachment #566201 - Flags: review?(hskupin) → review+
Component: Mozmill Shared Modules → Mozmill Tests
Whiteboard: [lib]
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: