Difference in number of resources between WebPageTest and DevTools

Hello,

I saw something strange in this site https://zinquo.com, in a WebPageTest test we can see 29 resources loaded, and in the DevTools we can see 167 resources

I found a DOMContentLoaded listener as a trigger to load tons of scripts:

The trigger

The method

My question is, why WPT don’t execute the DCL trigger?

This is a fun one! :slight_smile:

So the requests are indeed triggered during DOMContentLoaded

_triggerListener() {
   this._removeUserInteractionListener(this),
   "loading" === document.readyState ? document.addEventListener("DOMContentLoaded", this._loadEverythingNow.bind(this)) : this._loadEverythingNow()
}

That method, _triggerListener, is only called from userEventHandler:

this.userEventHandler = this._triggerListener.bind(this),

Which is called when any of these events fire:

this.triggerEvents = ["keydown", "mousedown", "mousemove", "touchmove", "touchstart", "touchend", "wheel"],

So WebPageTest never gets those requests, because none of those user interactions fire.

You can trigger them with custom scripting though!

This script navigates to the page, then fires a mousedown event:

navigate	https://zinquo.com/
execAndWait	window.dispatchEvent(new Event('mousedown'));

The result, is you can see two steps in the test. The first is the initial load, the second is what happens after user interaction.

Full test results here: zinquo.com : Chrome...irginia USA - EC2 - WebPageTest Result

2 Likes

Thank you @tkadlec :blush:

Is true, after a simple hover, the trigger fetch the requests :see_no_evil:

zinquo.com