Closed
Bug 610036
Opened 15 years ago
Closed 15 years ago
Sync adds Utils global with helper functions
Categories
(Firefox :: Sync, defect)
Firefox
Sync
Tracking
()
RESOLVED
INVALID
People
(Reporter: mkaply, Unassigned)
Details
So I was looking at the code for the Prospector addons and I saw these references:
Utils.delay(function() urlBar.controller.startSearch(urlBar.value));
let stmt = Utils.createStatement(Svc.History.DBConnection, query);
Utils.queryAsync(stmt, cols).forEach(function({input, url, title}) {
At first I thought some new API for Utils was introduced in Firefox 4 but not documented.
Upon further investigation, I found this:
http://mxr.mozilla.org/mozilla-central/source/services/sync/modules/util.js
the sync code adds a global called "Utils"
I have two problems with this:
1. Utils is a very generic name being added to the global namespace.
2. Other addons are using this API without it being documented.
If "Utils" is going to be some handy new thing, it needs to be outside of sync.
And if It is intended for Sync only, it should be named "SyncUtils" or something like that.
Updated•15 years ago
|
Component: Extension Compatibility → Firefox Sync: UI
Product: Firefox → Mozilla Services
QA Contact: extension.compatibility → sync-ui
Version: Trunk → unspecified
Comment 1•15 years ago
|
||
I don't see a "Utils" in the global browser window scope on a recent trunk build. When you say "Sync", are you referring to the addon?
Comment 2•15 years ago
|
||
Only when you import resource://services-sync/util.js you get Utils imported into your namespace. Prospector might do this for its code, but it's definitely not there by default in browser code. It *is* exposed as Weave.Utils in browser code, though (Weave being the namespace for Sync).
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
Comment 3•15 years ago
|
||
The Prospector code does explicitly import it:
jar:http://releases.mozilla.org/pub/mozilla.org/addons/242706/mozilla_labs__prospector_-_speak_words-1-fx.xpi!/bootstrap.js
>function startup(data) AddonManager.getAddonByID(data.id, function(addon) {
> Cu.import("resource://services-sync/util.js");
| Reporter | ||
Comment 4•15 years ago
|
||
Sorry, I missed the import because it wasn't contained with the other import
the addons.
This probably belongs over in developer documentation then.
If addon developers are going to start importing and using this (even if they
are Mozilla addon developers), there should probably be some documentation
around it.
Comment 5•15 years ago
|
||
As far as Sync is concerned these utils are internal to Sync. Labs add-ons might use them for convenience now, but we won't promise that this "API" will be stable.
That said, perhaps we should some of the popular to a more official and prominent location... resource://services-utils/ perhaps...
| Assignee | ||
Updated•8 years ago
|
Component: Firefox Sync: UI → Sync
Product: Cloud Services → Firefox
You need to log in
before you can comment on or make changes to this bug.
Description
•