Closed Bug 1500483 Opened 6 years ago Closed 6 years ago

Reduce/clarify UrlbarController's dependency on the browser window

Categories

(Firefox :: Address Bar, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
Firefox 65
Tracking Status
firefox65 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(1 file)

When I landed bug 1498181, I introduced UrlbarController depending on the browser window.

Marco commented (post landing):

"""
Having the controller directly communicating with the window makes a few assumptions, that should likely be matter of the view. In a pure MVC system this would be wrong, the controller only communicates with the view, that is the only one knowing its UI context. I'm not saying we should make this the perfect abstraction, but it may be worth documenting the kind of window we are expecting here. We seem to make the assumption that window is a browser window, for example, but that's not documented anywhere.
"""

I agree with this and I wasn't quite right to land it in the way I did. Part of the issue is that there's various functions, e.g. addToUrlbarHistory that could be .jsm functions but are implementing in the window scope.

My current thoughts are along the lines of:

- Move appropriate functions (addToUrlbarHistory, getShortcutOrURIAndPostData) from browser window scope to .jsm scope.
- Implement a switchTab on UrlbarInput for handling the TAB_SWITCH result type.
- Potentially move _loadURI from the UrlbarController to UrlbarInput. There may still be one or two items for the controller to do, but it seems more logical that focus and selection changes are done by the input.
- Maybe move _whereToOpen to UrlbarInput - and see if we're able to rearrange the resultSelected/handleEnteredText functions to not need to call it straight away, but leave it to _loadURI.

I may separate some of these out, but I'll need to play around with the whole set first to figure out what makes most sense.
Blocks: 1500486
Depends on: 1502039
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/529c6742a1e1
Clarify the type of window that should be passed to UrlbarController, and tidy usages of the window in the controller. r=mak
https://hg.mozilla.org/mozilla-central/rev/529c6742a1e1
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
Summary: Reduce/remove UrlbarController's dependency on the browser window → Reduce/clarify UrlbarController's dependency on the browser window
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: