Comment 44 for bug 306017

Revision history for this message
In , Adam Dane (unusualtears) wrote :

Created attachment 620559
WIP v3: Flag loads as "browsed to" for better control/coverage of persisting/resetting search

The goal for this version was to approximate the behavior described in Bug 565740, Comment 4.

This patch has the various URI loaders that should persist the search use |nsIWebNavigation::LOAD_FLAGS_BROWSED_TO|. The flag indicates the load is organic to the current user activity.

That flag gets transformed in |nsDocShell| to an instance variable |mBrowsedTo|. That's checked by callers to |nsIWebProgressListener::OnLocationChange|, so they can include the |LOCATION_CHANGE_BROWSED_TO| flag. In turn, tabbrowser's listener will persist the search data (engine/value) if it hears that flag.

Load types accounted for:
1. Persists search:
  1. New (blank) tabs
  2. Search bar
  3. Content Link loads (current, tab, tabshifted, window)
  4. Replacing current page with a frame
  5. JS loads (eg, Google Search results when JavaScript is enabled)
  6. Session restore loads
  7. Undo close tab loads

2. Resets search to default:
  1. Chrome (about:) Link loads (eg, new tab page thumbnail click)
  2. External load (eg, from command line when browser is already open)
  3. Chrome loads (other than [1.1] and [1.2]) including location bar and places