Closed Bug 1635622 Opened 5 years ago Closed 4 years ago

can't access property "heuristic", firstResult is undefined

Categories

(Firefox :: Address Bar, defect, P3)

defect
Points:
2

Tracking

()

RESOLVED FIXED
Firefox 78
Iteration:
78.2 - May 18 - May 31
Tracking Status
firefox78 --- fixed

People

(Reporter: kernp25, Assigned: adw)

Details

Attachments

(3 files, 1 obsolete file)

Attached image firefox_QMY37cpMSE.png (obsolete) —

I have seen this error in console: can't access property "heuristic", firstResult is undefined

My browser version: 77.0a1 (2020-05-04) (64-Bit)

Flags: needinfo?(adw)
Attached image firefox_leOm2Jf23e.png
Attachment #9146018 - Attachment is obsolete: true

I will try to reproduce the error.

Thanks for flagging me. According to the stack, _chunkTimer has fired after user input, notifying the view of results, but there are no results. That means the providers are really slow, or maybe the query was canceled before any of them returned results. notifyResults should bail if the query is canceled, and somewhere along the way, we should also bail if there are no results. That should probably happen in notifyResults since consumers shouldn't be notified when there are actually no results. In fact that's what one of my patches in bug 1398416 does, so I'll mark it as a dependency and hopefully we can fix this there.

If you do manage to figure out how to reliably reproduce it, I'd be interested.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Component: Disability Access APIs → Address Bar
Depends on: 1398416
Ever confirmed: true
Flags: needinfo?(adw)
Priority: -- → P3
Product: Core → Firefox

This seems to happen at startup (if the browser is loading/busy).

Bug 1398416 ended up not making the change I mentioned in comment 3, so this is likely still a problem. It should be easy enough to fix, but first it would be nice to investigate exactly why this is happening. I still do think it's probably just that the chunk timer fires before results are ready because the results are slow to be fetched. That's consistent with this happening at startup when the browser is busy doing many things.

Points: --- → 2
No longer depends on: 1398416
Attached video rHnUeoRvam.mp4

It seems to happen, if you type "w" at the address bar (maybe "www"?).

Can you look at the video?

Flags: needinfo?(adw)

If i type "W" in the address bar, it also makes the error.

"w" must be the first letter, you type in the address bar.

Thanks for investigating this some more. The stack in your video, like the stack in your screenshot, shows that we're notifying due to the chunk timer timing out. So the chunk timer is timing out before any results have been fetched. All we need to do is bail from _notifyResults if there are no results, or alternatively don't call _notifyResults from the chunk timer callback.

Assignee: nobody → adw
Status: NEW → ASSIGNED
Iteration: --- → 78.2 - May 18 - May 31
Flags: needinfo?(adw)

No wait, that doesn't make sense. We only start the chunk timer when a non-heuristic provider adds results. So there should always be at least one result when the chunk timer fires.

So I'll have to think more about why this is happening. It's not a problem with canceling the query since we also cancel the chunk timer.

Could you please enable some logging and post the log here? First, run this in the browser console. It enables a bunch of urlbar logging:

(function() {
let log = Log.repository.getLogger("Urlbar");
log.addAppender(new Log.DumpAppender());
log.addAppender(new Log.ConsoleAppender());
})();

Then please reproduce the error. You should see a lot of "Urlbar" log lines in both the browser console and your Windows terminal/console, if you started Firefox that way. They are the same logs, so you can look at whichever one is easier. Thanks.

Flags: needinfo?(kernp25)

1590570334343 Urlbar.ProvidersManager INFO Query start w
1590570334343 Urlbar.ProvidersManager INFO Using muxer UnifiedComplete
1590570334343 Urlbar.Tokenizer INFO Tokenizing: {"allowAutofill":true,"isPrivate":false,"maxResults":10,"searchString":"w","allowSearchSuggestions":true,"currentPage":"about:home","formHistoryName":"searchbar-history","lastResultCount":0,"userContextId":0}
1590570334344 Urlbar.Tokenizer DEBUG Restriction chars: ^+%?#$
1590570334344 Urlbar.Tokenizer INFO Found tokens: ["w"]
1590570334344 Urlbar.Tokenizer DEBUG userinfo:
1590570334345 Urlbar.Tokenizer DEBUG hostPort: w
1590570334345 Urlbar.Tokenizer INFO Filtered Tokens: ["w"]
1590570334345 Urlbar.ProvidersManager DEBUG Context sources 1,2,3,4,5,6
1590570334347 Urlbar.Provider.UnifiedComplete INFO Starting query for w
1590570334347 Urlbar.Tokenizer INFO Tokenizing: {"searchString":"w"}
1590570334348 Urlbar.Tokenizer DEBUG Restriction chars: ^
+%?#$
1590570334348 Urlbar.Tokenizer INFO Found tokens: ["w"]
1590570334348 Urlbar.Tokenizer DEBUG userinfo:
1590570334348 Urlbar.Tokenizer DEBUG hostPort: w
1590570334349 Urlbar.Tokenizer INFO Filtered Tokens: ["w"]
1590570334350 Urlbar.ProvidersManager DEBUG SkippableTimer :: Query provider timer :: Started
1590570334350 Urlbar.ProvidersManager INFO Queried 3 providers
1590570334352 Urlbar.Tokenizer DEBUG userinfo:
1590570334352 Urlbar.Tokenizer DEBUG hostPort: w
1590570334401 Urlbar.ProvidersManager DEBUG SkippableTimer :: Query provider timer :: Timed out!
1590570334401 Urlbar.Provider.PrivateSearch INFO Starting query for w
1590570334401 Urlbar.Provider.SearchSuggestions INFO Starting query for w
1590570334401 Urlbar.Provider.PrivateSearch INFO isPrivateEngine: false
1590570334401 Urlbar.Provider.PrivateSearch DEBUG SkippableTimer :: ProviderPrivateSearch :: Started
1590570334405 Urlbar.Provider.SearchSuggestions DEBUG SkippableTimer :: ProviderSearchSuggestions :: Started
1590570334502 Urlbar.Provider.PrivateSearch DEBUG SkippableTimer :: ProviderPrivateSearch :: Timed out!
1590570334503 Urlbar.ProvidersManager DEBUG SkippableTimer :: Query chunk timer :: Started
1590570334506 Urlbar.Provider.SearchSuggestions DEBUG SkippableTimer :: ProviderSearchSuggestions :: Timed out!
1590570334520 Urlbar.ProvidersManager DEBUG SkippableTimer :: Query chunk timer :: Timed out!
1590570334520 Urlbar.Muxer.UnifiedComplete DEBUG Buckets: heuristic,1,extension,5,suggestion,4,general,Infinity,suggestion,Infinity,general,Infinity
1590570334520 Urlbar.ProvidersManager DEBUG SkippableTimer :: Query chunk timer :: Canceling
1590570334520 Urlbar.ProvidersManager DEBUG SkippableTimer :: Query chunk timer :: Skipped
1590570334520 Urlbar.ProvidersManager DEBUG Cropping 0 results to 10
1590570334660 Urlbar.Muxer.UnifiedComplete DEBUG Buckets: heuristic,1,extension,5,suggestion,4,general,Infinity,suggestion,Infinity,general,Infinity
1590570334660 Urlbar.ProvidersManager DEBUG Cropping 1 results to 10
1590570334719 Urlbar.Muxer.UnifiedComplete DEBUG Buckets: heuristic,1,extension,5,suggestion,4,general,Infinity,suggestion,Infinity,general,Infinity
1590570334719 Urlbar.ProvidersManager DEBUG Cropping 2 results to 10
1590570334720 Urlbar.Muxer.UnifiedComplete DEBUG Buckets: heuristic,1,extension,5,suggestion,4,general,Infinity,suggestion,Infinity,general,Infinity
1590570334720 Urlbar.ProvidersManager DEBUG Cropping 3 results to 10
1590570334721 Urlbar.Muxer.UnifiedComplete DEBUG Buckets: heuristic,1,extension,5,suggestion,4,general,Infinity,suggestion,Infinity,general,Infinity
1590570334721 Urlbar.ProvidersManager DEBUG Cropping 4 results to 10
1590570334723 Urlbar.Muxer.UnifiedComplete DEBUG Buckets: heuristic,1,extension,5,suggestion,4,general,Infinity,suggestion,Infinity,general,Infinity
1590570334723 Urlbar.ProvidersManager DEBUG Cropping 5 results to 10
1590570334724 Urlbar.Muxer.UnifiedComplete DEBUG Buckets: heuristic,1,extension,5,suggestion,4,general,Infinity,suggestion,Infinity,general,Infinity
1590570334724 Urlbar.ProvidersManager DEBUG Cropping 6 results to 10
1590570334731 Urlbar.Muxer.UnifiedComplete DEBUG Buckets: heuristic,1,extension,5,suggestion,4,general,Infinity,suggestion,Infinity,general,Infinity
1590570334731 Urlbar.ProvidersManager DEBUG Cropping 7 results to 10
1590570334733 Urlbar.Muxer.UnifiedComplete DEBUG Buckets: heuristic,1,extension,5,suggestion,4,general,Infinity,suggestion,Infinity,general,Infinity
1590570334733 Urlbar.ProvidersManager DEBUG Cropping 8 results to 10
1590570334734 Urlbar.Muxer.UnifiedComplete DEBUG Buckets: heuristic,1,extension,5,suggestion,4,general,Infinity,suggestion,Infinity,general,Infinity
1590570334734 Urlbar.ProvidersManager DEBUG Cropping 9 results to 10
1590570334735 Urlbar.Muxer.UnifiedComplete DEBUG Buckets: heuristic,1,extension,5,suggestion,4,general,Infinity,suggestion,Infinity,general,Infinity
1590570334736 Urlbar.ProvidersManager DEBUG Cropping 10 results to 10
1590570334737 Urlbar.ProvidersManager INFO Query cancel w
1590570334737 Urlbar.Provider.UnifiedComplete INFO Canceling query for w
1590570334737 Urlbar.Provider.Interventions INFO Canceling query for w
1590570334737 Urlbar.Provider.PrivateSearch INFO Canceling query for w
1590570334737 Urlbar.Provider.SearchTips INFO Canceling query for w
1590570334737 Urlbar.Provider.SearchSuggestions INFO Canceling query for w
1590570334737 Urlbar.Provider.TokenAliasEngines INFO Canceling query for w
1590570334737 Urlbar.Provider.TopSites INFO Canceling query for w
1590570334737 Urlbar.ProvidersManager DEBUG SkippableTimer :: Query provider timer :: Skipped
1590570336422 Urlbar.EventBufferer DEBUG Clearing queue on blur

Flags: needinfo?(kernp25)
Flags: needinfo?(adw)

Thank you. We can see that the chunk timer is starting and timing out. We can also see that the muxer is called for each of the 10 results being added. And right around where the chunk timer starts and times out, we have logs from the private search provider. It looks like the private search provider is the first provider to add results: its internal timer times out and the next line logged is "Query chunk timer :: Started", i.e., the chunk timer is started (due to adding results).

That's helpful. It makes me remember that the muxer doesn't always include each result in the final list of results -- of course. It can exclude results. So I think I was basically right. What's likely happening is that the private search provider adds the private search result (and I see you're on Nightly, which is required for it) but the muxer excludes it (because the search also returns history for example), so the final context.results on return from the first call to the muxer is empty.

The right fix is bailing when context.results is empty after all.

Flags: needinfo?(adw)

Actually in this case the condition that causes the muxer to exclude the private search result is probably context.results.length > 1, not the presence of history. The private search provider is the first provider to add results, and it only adds the one.

Pushed by dwillcoxon@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d7d503d53382 Don't notify urlbar consumers when there aren't any results in a search. r=mak
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 78
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: