Closed Bug 1232651 Opened 9 years ago Closed 8 years ago

Search suggestions are enabled in private browsing

Categories

(Firefox for Android Graveyard :: General, defect, P3)

46 Branch
ARM
Android
defect

Tracking

(firefox45 affected, firefox46+ verified, firefox47+ verified, fennec45+)

RESOLVED FIXED
Firefox 47
Tracking Status
firefox45 --- affected
firefox46 + verified
firefox47 + verified
fennec 45+ ---

People

(Reporter: TeoVermesan, Assigned: ahunt)

References

Details

Attachments

(2 files)

Steps to reproduce:
1. With a clean profile open Firefox
2. Write "t" in the URL Bar
3. Turn on search suggestions
4. Go to Settings -> Search and set Twitter as a default search engines
5. Type something in the URL Bar (Search suggestions are displayed)
6. Go to private browsing and type "t" in URL Bar

Expected results:
- Search suggestions are not displayed in private browsing

Actual results:
- Search suggestions are displayed in private browsing

Note:
- reproducible on 45.0a2 Aurora and 46.0a1 Nightly
- on 43 Beta 10 search suggestions are not displayed in normal and private browsing after turning on search suggestions
Keywords: crash
Keywords: crash
This sounds like it could have the same cause as Bug 1223983.
Assignee: nobody → ahunt
Depends on: 1223983
(In reply to Andrzej Hunt :ahunt from comment #1)
> This sounds like it could have the same cause as Bug 1223983.

Tracking for 44+ to match this. If this issue doesn't affect beta, feel free to re-nom.
tracking-fennec: ? → 44+
FWIW, I also saw search suggestions in private browsing yesterday on Nightly.
Summary: Search suggestions are enabled in private browsing for Twitter → Search suggestions are enabled in private browsing
Blocks: 1235456
This turns out to be a separate bug (patch uploaded in the next comment hopefully), however I'm wondering whether we want to show

1) No suggestions at all (this is what my patch does)
or
2) Show just history suggestions

I think it would make more sense to go for no suggestions - we don't save search history in private mode, so it's potentially confusing if search history is still shown (i.e. the user may be confused as to whether searches in private browsing might be saved). (Doing this is also simpler to implement.) On the other hand we do show browsing history suggestions below the search suggestions, so showing search history would be more consistent?
Flags: needinfo?(alam)
We also remove the special case for updating mSuggestClient when
search engines are modified during private browsing - this causes
a weird edge case where we potentially show history suggestions
after switching search engines (this seems to be because having
mSuggestClient == null avoids us even reaching the stage where
we usually recycle unneeded suggestions).

Review commit: https://reviewboard.mozilla.org/r/29775/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/29775/
(In reply to Andrzej Hunt :ahunt from comment #4)
> This turns out to be a separate bug (patch uploaded in the next comment
> hopefully), however I'm wondering whether we want to show
> 
> 1) No suggestions at all (this is what my patch does)
> or
> 2) Show just history suggestions
> 
> I think it would make more sense to go for no suggestions - we don't save
> search history in private mode, so it's potentially confusing if search
> history is still shown (i.e. the user may be confused as to whether searches
> in private browsing might be saved). (Doing this is also simpler to
> implement.) On the other hand we do show browsing history suggestions below
> the search suggestions, so showing search history would be more consistent?

You make some good points, :ahunt. 

I think we should lump these two together and NOT show history or suggestions. 

In a mobile context, its hard for us to safely assume this is even the same person. Phones get passed around and Private Browsing should let you feel safe when you do this.
Flags: needinfo?(alam)
Attachment #8704858 - Attachment description: MozReview Request: Bug 1232651 - don't show search suggestions in private browsing → MozReview Request: Bug 1232651 - don't show search suggestions in private browsing r=mcomella
Attachment #8704858 - Flags: review?(michael.l.comella)
Comment on attachment 8704858 [details]
MozReview Request: Bug 1232651 - don't show search suggestions in private browsing r=mcomella

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/29775/diff/1-2/
Priority: -- → P3
This missed 44... let's try to land this for 45.
tracking-fennec: 44+ → ?
tracking-fennec: ? → 45+
Comment on attachment 8704858 [details]
MozReview Request: Bug 1232651 - don't show search suggestions in private browsing r=mcomella

https://reviewboard.mozilla.org/r/29775/#review29629

If it works for you, works for me. Sorry for the delay!

::: mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java:600
(Diff revision 2)
> -        if (mSuggestClient == null || (!mSuggestionsEnabled && !mSavedSearchesEnabled)) {
> +        Tab tab = Tabs.getInstance().getSelectedTab();

nit: `final`

::: mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java:603
(Diff revision 2)
> +        if (isPrivate || mSuggestClient == null || (!mSuggestionsEnabled && !mSavedSearchesEnabled)) {

I believe `mSuggestClient == null` was used to determine if we were in private mode or not so it seems better to be explicit here.

Since this was already supposed to have worked, I assume it automatically clears the active suggestions when switching from normal browsing to private browsing, right? I can't seem to find that code...

::: mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java:680
(Diff revision 2)
>                      // Only create a new instance of SuggestClient if it hasn't been
>                      // set yet.
> -                    maybeSetSuggestClient(suggestTemplate, isPrivate);
> +                    maybeSetSuggestClient(suggestTemplate);

nit: I feel like this comment describes what happens in the method, which seems unnecessary if the method was named better.

Can we remove the comment and update the name? e.g. `initSuggestClientIfNotAlreadyInit` (I'm sure there's a better name)
Attachment #8704858 - Flags: review?(michael.l.comella) → review+
https://hg.mozilla.org/integration/fx-team/rev/87c4fbaccbf5b794144f8f56d5b74d1f44769c20
Bug 1232651 - don't show search suggestions in private browsing r=mcomella
Comment on attachment 8704858 [details]
MozReview Request: Bug 1232651 - don't show search suggestions in private browsing r=mcomella

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/29775/diff/2-3/
> 
> I believe `mSuggestClient == null` was used to determine if we were in
> private mode or not so it seems better to be explicit here.
> 
> Since this was already supposed to have worked, I assume it automatically
> clears the active suggestions when switching from normal browsing to private
> browsing, right? I can't seem to find that code...
> 

It turns out we probably do need this - mSuggestClient isn't set until we receive the search engines in setSearchEngines - if you start typing before we receive those, then mSuggestClient will be null - so we still need to do the null-check (in addition to tracking private mode separately).
Flags: needinfo?(ahunt)
(In reply to Wes Kocher (:KWierso) from comment #11)
> Backed out in https://hg.mozilla.org/integration/fx-team/rev/75c6a6c1fec2
> for robocop bustage:
> 
> https://treeherder.mozilla.org/logviewer.html#?job_id=6916943&repo=fx-team

Try build succeeded after fixing the patch (comment #12), therefore pushing back to fx-team!

https://treeherder.mozilla.org/#/jobs?repo=try&revision=f30acc7351bf
https://hg.mozilla.org/integration/fx-team/rev/557fb171e6562816f16a317c0d45f688609361c7
Bug 1232651 - don't show search suggestions in private browsing r=mcomella
https://hg.mozilla.org/mozilla-central/rev/557fb171e656
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 47
Reproduced the issue also on 45 Beta 2 using ZTE Grand x86 (Android 4.0.4)
Should we uplift this? It's too late for 45, but not 46.
Flags: needinfo?(ahunt)
Verified as fixed on Aurora 47.0a2 (2016-03-09)
[Tracking Requested - why for this release]: Verified fix and we are early in the beta cycle.
Tracking; uplift sounds good to me too. This could make it into beta 4 early next week.
Comment on attachment 8704858 [details]
MozReview Request: Bug 1232651 - don't show search suggestions in private browsing r=mcomella

Approval Request Comment
[Feature/regressing bug #]: n/a
[User impact if declined]: Search suggestions are shown in private browsing, which is potentially confusing since we aren't retrieving suggestions then, and we also don't store searches in private browsing.
[Describe test coverage new/current, TreeHerder]: manual testing.
[Risks and why]: Low risk: we now check an additional condition when deciding whether to show suggestions. This change is already in aurora without any issues.
[String/UUID change made/needed]: none.
Flags: needinfo?(ahunt)
Attachment #8704858 - Flags: approval-mozilla-beta?
Comment on attachment 8704858 [details]
MozReview Request: Bug 1232651 - don't show search suggestions in private browsing r=mcomella

Verified on aurora. Shipping this faster sounds good!
This should make it into 46 for the beta 4 build early next week.
Attachment #8704858 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Search suggestions are not enabled in private browsing, so:
Verified as fixed using:
Device: Grand X in (Android 4.0.4)
Build: Firefox for Android 46 Beta 6
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: