Re: [html-tests] Add a couple of tests that img delays the load event (#5509)

I don't think any of this is an issue.  The last thing on the page is `</script>`, and the script isn't executed until that read, so even if a packet is dropped, it cannot intervene between the script's execution and DOMContentLoaded, because the script won't execute until the whole page has been received.  If you want to be extra sure, make the `img.src =` be on the last line.  I don't think even the most underpowered device in the world will take more than 1 s between executing the last line of script and DOMContentLoaded.

If somehow I'm wrong, then whoever runs the test suite on these devices will figure out that it's flaky and up the timeout a bit, no harm done.

If you aren't happy with that: why don't you make the image take forever to load, test that DOMContentLoaded fires anyway, and then in DOMContentLoaded change the src to an image that takes 1 s to load and test that it's loaded at onload?  That way you're only assuming that from DOMContentLoaded to load is less than one second if nothing is blocking it, which should be even safer.  And for free, you test that an image load blocks the load event even if the src was only set in DOMContentLoaded.  (I assume that this is actually what's supposed to happen.)

View on GitHub: https://github.com/w3c/web-platform-tests/pull/5509#issuecomment-297660367

Received on Thursday, 27 April 2017 09:18:17 UTC