Skip to content

Commit

Permalink
Speed up NetInternalsTest.netInternalsPrerenderViewFail by
Browse files Browse the repository at this point in the history
creating one less process.  Same method cannot be used for
NetInternalsTest.netInternalsPrerenderViewSucceed, unfortunately.

R=eroman@chromium.org
BUG=119731

Review URL: http://codereview.chromium.org/9836046

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128658 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
mmenke@chromium.org committed Mar 24, 2012
1 parent 130073f commit c87efed
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion chrome/test/data/webui/net_internals/prerender_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,21 @@ PrerenderTask.prototype = {
startPrerendering_: function(prerenderInfo) {
expectEquals(0, prerenderInfo.active.length);
expectEquals(0, prerenderInfo.history.length);
chrome.send('prerenderPage', [this.url_]);
if (this.shouldSucceed_) {
chrome.send('prerenderPage', [this.url_]);

this.state_ = STATE.NEED_NAVIGATE;
} else {
// If the prerender is going to fail, we can add the prerender link to the
// current document, so we will create one less process. Unfortunately,
// if the prerender is going to succeed, we have to create a new process
// with the prerender link, to avoid the prerender being cancelled due to
// a session storage namespace mismatch.
var link = document.createElement('link');
link.rel = 'prerender';
link.href = this.url_;
document.head.appendChild(link);

this.state_ = STATE.HISTORY_WAIT;
}
},
Expand Down

0 comments on commit c87efed

Please sign in to comment.