[New Tab Page] Use the hiddenWindow to preload a single newtab page that then serves multiple windows

RESOLVED FIXED in Firefox 18

Status

()

Firefox
Tabbed Browser
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: ttaubert, Assigned: ttaubert)

Tracking

Trunk
Firefox 18
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

6 years ago
Created attachment 648673 [details] [diff] [review]
patch v1

From bug 753448 comment #45:

"It would be nice to have a single pre-loaded new tab page browser shared across all windows, but that seems more complicated (maybe we could investigate using the hidden window in a followup?)."
To deal with the non-privilegedness of the hidden window on Win/Linux in bug 762569, we switched to using an xhtml iframe (with bug 769771 fixed). We might be able to do something like that and just call swapFrameLoaders on it directly (not via browser.swapDocShells).

We'd also need to make sure the browser is destroyed when it's no longer needed (e.g. when there are no more open browser windows).
(Assignee)

Comment 2

6 years ago
(In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment #1)
> To deal with the non-privilegedness of the hidden window on Win/Linux in bug
> 762569, we switched to using an xhtml iframe (with bug 769771 fixed).

I tried doing the same but "about:newtab" wouldn't load because of security reasons. chrome://browser/content/newtab/newTab.xul loads just fine.

> We
> might be able to do something like that and just call swapFrameLoaders on it
> directly (not via browser.swapDocShells).

That's unfortunately not implemented for iframes :(

http://dxr.lanedo.com/mozilla-central/content/html/content/src/nsGenericHTMLFrameElement.cpp.html#l137

> We'd also need to make sure the browser is destroyed when it's no longer
> needed (e.g. when there are no more open browser windows).

We shouldn't do this because there wouldn't be any preloaded tab for newly opened tabs on Mac.
(Assignee)

Comment 3

6 years ago
Created attachment 660815 [details] [diff] [review]
patch v2
Attachment #648673 - Attachment is obsolete: true
Attachment #660815 - Flags: review?(jaws)
(Assignee)

Comment 4

6 years ago
Comment on attachment 660815 [details] [diff] [review]
patch v2

Try says no.
Attachment #660815 - Flags: review?(jaws)
(Assignee)

Comment 5

6 years ago
Created attachment 661210 [details] [diff] [review]
patch v3
Attachment #660815 - Attachment is obsolete: true
Attachment #661210 - Flags: review?(jaws)
(Assignee)

Comment 6

6 years ago
Green on try (with browser.newtab.preload=true):

https://tbpl.mozilla.org/?tree=Try&rev=fa242a61c876
(Assignee)

Updated

6 years ago
Blocks: 791669
(Assignee)

Updated

6 years ago
Blocks: 791670
(Assignee)

Comment 7

6 years ago
This will work around the issue reported in bug 786484. With paint flashing enabled you can see that the excessive invalidation is gone.
Comment on attachment 661210 [details] [diff] [review]
patch v3

Review of attachment 661210 [details] [diff] [review]:
-----------------------------------------------------------------

I tested this out on Mac and confirmed that this fixes the invalidation issues.

::: browser/modules/BrowserNewTabPreloader.jsm
@@ +167,5 @@
>  
> +  _createPrivilegedFrame: function HostFrame_createPrivilegedFrame() {
> +    let doc = this._frame.document;
> +    let iframe = doc.createElement("iframe");
> +    iframe.setAttribute("src", "chrome://global/content/mozilla.xhtml");

Discussed on IRC and Tim said that we can add a chrome page specifically for new tab preloading.
Attachment #661210 - Flags: review?(jaws) → review+
r+ with the special-purpose chrome page for tab preloading.
(Assignee)

Comment 10

6 years ago
Thank you!

https://hg.mozilla.org/integration/fx-team/rev/90cc14017766
Whiteboard: [fixed-in-fx-team]
(Assignee)

Comment 11

6 years ago
Pushed a tiny bustage fix for xpcshell tests:

https://hg.mozilla.org/integration/fx-team/rev/47e7a44f9c91
(Assignee)

Comment 12

6 years ago
https://hg.mozilla.org/mozilla-central/rev/90cc14017766
https://hg.mozilla.org/mozilla-central/rev/47e7a44f9c91
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 18
You need to log in before you can comment on or make changes to this bug.