Closed Bug 1471811 Opened 4 years ago Closed 4 years ago

"ReferenceError: Services is not defined" in autocomplete.xml


(Toolkit :: Autocomplete, defect)

60 Branch
Not set



Tracking Status
firefox65 --- fixed


(Reporter: tessarakt, Assigned: mak)





(1 file, 1 obsolete file)

I tried to make the Quickerfiler addon work again.

After fixing some easy issues, I got this message in the error console:

ReferenceError: Services is not defined[Learn More]  autocomplete.xml:1764:11

The file given is is chrome://global/content/bindings/autocomplete.xml . Line 1764 is in this part of the file:

      <method name="_unescapeUrl">
        <parameter name="url"/>
          return Services.textToSubURI.unEscapeURIForUI("UTF-8", url);
Does this happen without the add-on? autocomplete.xml is Mozilla core code used for Firefox. Does Firefox show a problem? Otherwise, it will be hard to convince the Mozilla core people that a fix is needed here.
Component: Untriaged → General
As far as my tests go I have determined that this guide to make custom autocomplete search component does not work either for the same reason as mentioned above. So if someone could make the changes to this guide to make this work we're all good or perhaps it is in fact a bug.
Yes, ChromeUtils.import("resource://gre/modules/Services.jsm"); is missing in one/more of the <constructor>s in autocomplete.xml.

That should be fixed, right, Marco?
Component: General → Autocomplete
Flags: needinfo?(mak77)
Product: Thunderbird → Toolkit
Version: 60 → 60 Branch
This regressed in bug 1436559, autocomplete.xml may need to either import Services, or grow a this._services field.
Gijs, what do you think?
Blocks: 1436559
Flags: needinfo?(mak77) → needinfo?(gijskruitbosch+bugs)
(In reply to Marco Bonardo [::mak] from comment #4)
> This regressed in bug 1436559, autocomplete.xml may need to either import
> Services, or grow a this._services field.
> Gijs, what do you think?

We should really just make Services/AppConstants/XPCOMUtils available on every privileged scope. Though the binding is likely to go away soon as well... Anyway, in the meantime, I guess we could take a patch that adds a field or adds an import or something.
Flags: needinfo?(gijskruitbosch+bugs)
Attached patch 1471811-add-missing-import.patch (obsolete) — Splinter Review
This should do it. Services is used in two bindings, so I added it to the corresponding constructors.

Please excuse the following comment (no offence intended): I've never understood why you leave fixing regressions to others, perhaps you can explain that.
Attachment #9025872 - Flags: review?(mak77)
Regarding your question, I think it's no surprise that the Firefox codebase is undergoing a large rewrite, that affects other products based on the same codebase, and that our resources are limited (barely sufficient for Firefox, in my opinion). From a Firefox point of view this is not a regression, we import Services pretty much everywhere. Having a fix in a week would be a P1, that this is not, so if you want a quick fix, I don't see alternatives to contributing a patch. As usual we try to assist as best as possible with available time.

I'm looking at the patch, but I'm not convinced of the approach, so I'm asking for a second opinion around, stay tuned.
I'm sorry for late, picking this.
Assignee: nobody → mak77
Attachment #9025872 - Flags: review?(mak77)
Attachment #9025872 - Attachment is obsolete: true
Pushed by
"ReferenceError: Services is not defined" in autocomplete.xml. r=Gijs,jorgk
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in before you can comment on or make changes to this bug.