Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I reload a page and force the parsing, reflow and paint to be re-exercised?

10 views
Skip to first unread message

Yuhao

unread,
Mar 19, 2012, 11:07:12 PM3/19/12
to
Hi All,

I wanted to study the basic performance of firefox loading a page. I
want to exclude network noise and disk access overhead. So what I
basically did was to load a page in online mode, so that all the
resources will be in the browser cache (I enabled memory cache and
disabled disk cache), and switched to offline mode, and issued a
reload. But seems like reload didn't really go through the processing
stack from parsing, construction DOM tree, reflow and paint. I made
all changes in browser.js. The code I added is as follows:

function instrumentPageLoad(event) {
if (event.originalTarget instanceof HTMLDocument)
{
var doc = event.originalTarget; // doc is document that triggered
the event
var win = doc.defaultView; // win is the window for the doc

if (win != win.top) return; //only top window

var ioService = Services.io;
if (!ioService.offline)
{
BrowserOffline.toggleOfflineStatus();

const reloadFlags = nsIWebNavigation.LOAD_FLAGS_NONE;
var webNav = getWebNavigation();
webNav.reload(reloadFlags);
}
else
{
BrowserOffline.toggleOfflineStatus();

// close command
self.close();
}

}
}

window.addEventListener("load", function () {
gBrowser.addEventListener("load", instrumentPageLoad, true);
}, false);

Any suggestions on this? I guess I have to play with the reload
flags? I also tried the following to do reload:

gBrowser.loadURIWithFlags(doc.location.href,

nsIWebNavigation.LOAD_FLAGS_FIRST_LOAD,
null, null, null);
But still didn't work.

Any suggestions will be appreciated!

Thanks,
Yuhao
0 new messages