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

RESOLVED FIXED in Firefox 18

Status

()

defect
RESOLVED FIXED
7 years ago
6 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)

Posted patch patch v1 (obsolete) — Splinter Review
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).
(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.
Posted patch patch v2 (obsolete) — Splinter Review
Attachment #648673 - Attachment is obsolete: true
Attachment #660815 - Flags: review?(jaws)
Comment on attachment 660815 [details] [diff] [review]
patch v2

Try says no.
Attachment #660815 - Flags: review?(jaws)
Posted patch patch v3Splinter Review
Attachment #660815 - Attachment is obsolete: true
Attachment #661210 - Flags: review?(jaws)
Green on try (with browser.newtab.preload=true):

https://tbpl.mozilla.org/?tree=Try&rev=fa242a61c876
Blocks: 791669
Blocks: 791670
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.
Pushed a tiny bustage fix for xpcshell tests:

https://hg.mozilla.org/integration/fx-team/rev/47e7a44f9c91
https://hg.mozilla.org/mozilla-central/rev/90cc14017766
https://hg.mozilla.org/mozilla-central/rev/47e7a44f9c91
Status: ASSIGNED → RESOLVED
Last Resolved: 7 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.