Closed Bug 1280876 Opened 8 years ago Closed 8 years ago

Find toolbar influences New Tab page

Categories

(Toolkit :: Find Toolbar, defect)

50 Branch
defect
Not set
normal
Points:
1

Tracking

()

VERIFIED FIXED
mozilla51
Iteration:
50.4 - Aug 1
Tracking Status
firefox49 --- unaffected
firefox50 --- disabled
firefox51 --- disabled
firefox52 --- verified

People

(Reporter: annevk, Assigned: mikedeboer)

References

(Blocks 1 open bug)

Details

(Keywords: regression)

Attachments

(2 files)

Attached image new tab screen shot.png
It seems if you did an inline search, that can influence the thumbnails for the New Tab page.
Summary: Find toolbar influence New Tab page → Find toolbar influences New Tab page
Blocks: 384458
[Tracking Requested - why for this release]: Regression
Keywords: regression
Version: unspecified → 50 Branch
Feature has been backed out so not tracking these bugs for 50.
Assignee: nobody → mdeboer
Status: NEW → ASSIGNED
Iteration: --- → 50.4 - Aug 1
Points: --- → 1
Comment on attachment 8775609 [details]
Bug 1280876 - don't take screenshots of pages that have the findbar open.

https://reviewboard.mozilla.org/r/67776/#review65108

::: toolkit/components/thumbnails/PageThumbUtils.jsm:284
(Diff revision 1)
> +    // Don't take screenshots when the findbar is active.
> +    if (aDocument.mozFinderHighlightVisible) {
> +      return false;
> +    }

Can you just query if the findbar is open? 

Something not as ugly as `gBrowser.getBrowserForDocument(aDocument)._remoteFinder` and something that works for e10s and non-e10s, but similar?

::: toolkit/modules/FinderHighlighter.jsm:234
(Diff revision 1)
>  
>      window = window || this.finder._getWindow();
>      let anonNode = this._maybeCreateModalHighlightNodes(window);
>      this._addModalHighlightListeners(window);
>  
> +    window.document.mozFinderHighlightVisible = true;

I don't particularly like us adding properties to the document. Will they be visible to content? I'm assuming so, since the overlay needed to be added to anonymous content.

::: toolkit/modules/FinderHighlighter.jsm:265
(Diff revision 1)
>            this._unhookListenersAtIndex(x);
>          }
>        }
>      }
>  
> +    delete window.document.mozFinderHighlightVisible;

window.document.mozFinderHighlightVisible = false;
Attachment #8775609 - Flags: review?(jaws) → review-
Thanks for the review!

(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #4)
> Can you just query if the findbar is open? 

Aah, yes... why didn't I think of that?
(In reply to Mike de Boer [:mikedeboer] from comment #5)
> Aah, yes... why didn't I think of that?

Apparently I did, but is complicated due to the fact that the findbar is in the chrome process and the highlighter in the content process. I need to think of something else here.
Comment on attachment 8775609 [details]
Bug 1280876 - don't take screenshots of pages that have the findbar open.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67776/diff/1-2/
Attachment #8775609 - Attachment description: Bug 1280876 - prevent the background page thumbnail capturer to take shots whilst the finder highlighter is active. → Bug 1280876 - don't take screenshots of pages that have the findbar open.
Attachment #8775609 - Flags: review?(jaws)
Attachment #8775609 - Flags: review?(bzbarsky)
Attachment #8775609 - Flags: review-
https://reviewboard.mozilla.org/r/67776/#review65340

::: docshell/base/nsDocShell.cpp:819
(Diff revision 2)
>    , mFrameType(FRAME_TYPE_REGULAR)
>    , mPrivateBrowsingId(0)
>    , mParentCharsetSource(0)
>    , mJSRunToCompletionDepth(0)
>    , mTouchEventsOverride(nsIDocShell::TOUCHEVENTS_OVERRIDE_NONE)
> +  , mFindbarOpen(false)

Compiler gives a warning here about the order of initialization, but I don't think that matters much in this case...
> Compiler gives a warning here about the order of initialization, but I don't think that matters much in this case...

It matters, both in terms of efficiency and compiler warning spew, and you should fix the warning by ordering your initializers the same as you order your members.
Comment on attachment 8775609 [details]
Bug 1280876 - don't take screenshots of pages that have the findbar open.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67776/diff/2-3/
(In reply to Boris Zbarsky [:bz] from comment #9)
> It matters, both in terms of efficiency and compiler warning spew, and you
> should fix the warning by ordering your initializers the same as you order
> your members.

Aha! OK, thanks for the explanation. It's part of the basics, I know, but I learn everyday...
Comment on attachment 8775609 [details]
Bug 1280876 - don't take screenshots of pages that have the findbar open.

https://reviewboard.mozilla.org/r/67776/#review65378
Attachment #8775609 - Flags: review?(jaws) → review+
Blocks: 1291278
Comment on attachment 8775609 [details]
Bug 1280876 - don't take screenshots of pages that have the findbar open.

https://reviewboard.mozilla.org/r/67776/#review67506
Attachment #8775609 - Flags: review?(bzbarsky)
Comment on attachment 8775609 [details]
Bug 1280876 - don't take screenshots of pages that have the findbar open.

https://reviewboard.mozilla.org/r/67776/#review67508

Oh, looks like mozreview UI now disappears headers if you don't explicitly save them...

What I just _tried_ to say, and what I said a week ago when mozreview _also_ disappeared my comments, is that it's not clear to me why this state needs to live on docshell as opposed to the browser or tabbrowser or some other part of the frontend that the findbar is coordinating with anyway.  Is this state going to be relevant to subframes, for example?  I don't think so....
I filed bug 1293565 on the mozreview UI bustage....
(In reply to Boris Zbarsky [:bz] from comment #15)
> What I just _tried_ to say, and what I said a week ago when mozreview _also_
> disappeared my comments, is that it's not clear to me why this state needs
> to live on docshell as opposed to the browser or tabbrowser or some other
> part of the frontend that the findbar is coordinating with anyway.  Is this
> state going to be relevant to subframes, for example?  I don't think so....

Everything but the findbar XUL (and the RemoteFinder.jsm message proxy) live in the content process(es) and there's no `gFindBar` global that can be referenced there to extract state from it.
Since the background thumbnailer (the change in PageThumbUtils.jsm is what makes this all work) runs in the content process too, and checks if it should store a content thumbnail synchronously, so adding an async message passing flow there would be a bit problematic.
At first I thought about using a JS expando prop on the document object - `mozFindbarOpen = true` whilst the findbar is open - but that'd be visible to the web.
Do you see another option? Thanks for checking the bug again!
Flags: needinfo?(bzbarsky)
> but that'd be visible to the web

Er... no, it wouldn't.  The expando would be defined on the Xray; chrome would see it, but web content would not.

A bigger problem for the expando-on-the-document approach is that it would not persist across navigations, but the "findbar is open" state does.

Is there really no chrome object that corresponds to the tab but lives content-side??
Flags: needinfo?(bzbarsky)
(In reply to Boris Zbarsky [:bz] from comment #18)
> Is there really no chrome object that corresponds to the tab but lives
> content-side??

No, but I can make a new content global... That's probably the best option, thanks for asking.
Comment on attachment 8775609 [details]
Bug 1280876 - don't take screenshots of pages that have the findbar open.

https://reviewboard.mozilla.org/r/67776/#review67792

r=me with my nits fixed. Thanks mikedeboer!

::: toolkit/modules/BrowserUtils.jsm:315
(Diff revision 4)
> +   * @param  {nsIDocShell} docShell The docShell instance that a toolbar should
> +   *                                be interacting with
> +   * @param  {String}      [which]  Identifier of a specific toolbar
> +   * @return {Boolean}
> +   */
> +  isToolbarVisible(docShell, which = null) {

Out of curiosity, why are we defaulting this to null?

It looks like the null case means "there are no toolbars visible", but is that useful, especially given that we return false if we've never seen the window before?

It might be safer to just return toolbars.has(which), unless there's a good reason to care about the "we saw it once, but nothing is currently visible" case.

::: toolkit/modules/BrowserUtils.jsm:334
(Diff revision 4)
> +   * @param  {Boolean}     [visible] Whether the toolbar is visible. Optional,
> +   *                                 defaults to `true`.
> +   */
> +  trackToolbarVisibility(docShell, which, visible = true) {
> +    if (!this._visibleToolbarsMap)
> +      this._visibleToolbarsMap = new WeakMap();

I think we can probably just define \_visibleToolbarsMap directly on the BrowserUtils object safely, and be reasonably sure it exists.
Attachment #8775609 - Flags: review?(mconley) → review+
(In reply to Mike Conley (:mconley) - (Needinfo me!) from comment #21)
> Out of curiosity, why are we defaulting this to null?
> 
> It looks like the null case means "there are no toolbars visible", but is
> that useful, especially given that we return false if we've never seen the
> window before?
> 
> It might be safer to just return toolbars.has(which), unless there's a good
> reason to care about the "we saw it once, but nothing is currently visible"
> case.

Agreed.
Pushed by mdeboer@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0ec1ef348547
don't take screenshots of pages that have the findbar open. r=jaws,mconley
https://hg.mozilla.org/mozilla-central/rev/0ec1ef348547
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
I couldn't reproduce the initial reported issue and can't reproduce it either on the latest Nightly 52.0a1 (Build ID: 20160928030201) - Win10, Mac OS X 10.11 and Ubuntu 16.04, therefore I can't verify it as fixed. 

Anne, can you please confirm that this issue is indeed fixed?
Flags: needinfo?(annevk)
I haven't seen this recently. The only thing I notice is that search is still super slow and janky (and has some weird painting issues).
Flags: needinfo?(annevk)
Based on Comment 27, setting the status of this issue to Verified Fixed. Please note that the new Find Toolbar feature is disabled by default on Firefox 51.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: