Closed Bug 875509 Opened 11 years ago Closed 11 years ago

Defer loading the newly created docShell after a preloaded newtab page has been swapped in

Categories

(Firefox :: Tabbed Browser, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 24

People

(Reporter: ttaubert, Assigned: ttaubert)

References

Details

Attachments

(1 file, 1 obsolete file)

When a new tab is opened (and preloading enabled) we swap docShells of the newly opened tab and a preloaded one in the background. There is no need to actually start loading the newly created docShell until the tabopen animation has been finished. The animation is a lot smoother on my quite fast machine with this fixed.
Comment on attachment 753495 [details] [diff] [review] defer loading the newly created docShell after a preloaded newtab page has been swapped in > if (!uriIsAboutBlank) { > // pretend the user typed this so it'll be available till > // the document successfully loads > if (aURI && gInitialPages.indexOf(aURI) == -1) > b.userTypedValue = aURI; > >- let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE; >- if (aAllowThirdPartyFixup) >- flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP; >- if (aFromExternal) >- flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL; >- if (aIsUTF8) >- flags |= Ci.nsIWebNavigation.LOAD_FLAGS_URI_IS_UTF8; >- try { >- b.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset, aPostData); >- } catch (ex) { >- Cu.reportError(ex); >+ // If we didn't swap docShells with a preloaded browser >+ // then let's just continue loading the page normally. >+ if (!docShellsSwapped) { >+ let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE; >+ if (aAllowThirdPartyFixup) >+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP; >+ if (aFromExternal) >+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL; >+ if (aIsUTF8) >+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_URI_IS_UTF8; >+ try { >+ b.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset, aPostData); >+ } catch (ex) { >+ Cu.reportError(ex); >+ } > } > } Why not just check docShellsSwapped along with uriIsAboutBlank? "pretend the user typed this so it'll be available till the document successfully loads" doesn't seem to make sense for swapped docshells where nothing gets loaded. (How) Does the timer code handle new tabs being opened in fast succession?
(In reply to Dão Gottwald [:dao] from comment #2) > Why not just check docShellsSwapped along with uriIsAboutBlank? "pretend the > user typed this so it'll be available till the document successfully loads" > doesn't seem to make sense for swapped docshells where nothing gets loaded. Right, good point. Great, that makes the code a little less 'complex'. > (How) Does the timer code handle new tabs being opened in fast succession? If there's no preloaded page that is readyState=complete and has the right URL we will not swap docShells and therefore just continue loading as normal. The new tab will load as it currently does.
Attachment #753707 - Flags: review?(dao) → review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 24
Blocks: 842607
Depends on: 886376
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: