Closed Bug 780123 Opened 12 years ago Closed 12 years ago

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

Categories

(Firefox :: Tabbed Browser, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 18

People

(Reporter: ttaubert, Assigned: ttaubert)

References

Details

Attachments

(1 file, 2 obsolete files)

Attached 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.
Attached 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)
Attached 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
Closed: 12 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.

Attachment

General

Created:
Updated:
Size: