JS error: can't access property "suggestion", lazy.QuickSuggest.weather is undefined
Categories
(Firefox :: Address Bar, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr102 | --- | unaffected |
firefox109 | --- | unaffected |
firefox110 | --- | unaffected |
firefox111 | --- | fixed |
People
(Reporter: adw, Assigned: adw)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
There's a JS error in the new UrlbarProviderWeather when running unrelated xpcshell tests:
[task 2023-02-07T15:02:37.531Z] 15:02:37 INFO - PID 24521 | console.error: (new TypeError("can't access property \\"suggestion\\", lazy.QuickSuggest.weather is undefined", "resource:///modules/UrlbarProviderWeather.sys.mjs", 201))
It's logged multiple times when running for example:
./mach test browser/components/urlbar/tests/unit/test_providerOmnibox.js
Assignee | ||
Comment 1•2 years ago
|
||
This JS error happens because QuickSuggest.weather
is undefined when the
provider's isActive()
is called while xpcshell tests perform searches. The
error is harmless because it's caught and reported by the urlbar providers
manager.
QuickSuggest.weather
is defined when QuickSuggest.init()
is called. In
normal app usage, init()
is called by BrowserGlue on app startup. Xpcshell
tests that are related to quick suggest make sure init()
is called by using
QuickSuggestTestUtils.ensureQuickSuggestInit()
. The only problem is xpcshell
tests that are not related to quick suggest. For those tests, init()
is never
called.
The fix is simple, just don't assume QuickSuggest.weather
is defined inside
isActive()
. Another fix would be to make isActive()
return false if
UrlbarPrefs.get("quickSuggestEnabled")
is false. That's what the quick suggest
provider does, and that's why it doesn't have this problem.
quickSuggestEnabled
will remain false until QuickSuggest.init()
is called. I
think it's nicer to only rely on QuickSuggest.weather
though.
Comment 2•2 years ago
|
||
Set release status flags based on info from the regressing bug 1814732
Assignee | ||
Updated•2 years ago
|
Comment 4•2 years ago
|
||
bugherder |
Description
•