-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One resource entry per resource #2919
Conversation
Critic review: https://critic.hoppipolla.co.uk/r/6450 This is an external review system which you may optionally use for the code review of your pull request. In order to help critic track your changes, please do not make in-place history rewrites (e.g. via |
@igrigorik do you know where we stand on this front? Is the test appropriate and is the case covered by the spec? |
It's still not clear to me if this is correct. If you follow the RT processing model verbatim, then there should be multiple records, since the second image should (at least in theory) initiate a fetch, which should then hit the appropriate caches and pull out the right data. However, in practice, in Chrome you only see one request because the request is fulfilled via the ~"renderer memory cache", which is not specified anywhere... I think we should solve that first (probably within Fetch), and then we'll be in a position to answer this. |
Said another way.. if there was a ServiceWorker behind the fetches, you'd see 2 entries. If there isn't, you may only see 1 today. This is probably not correct and we should consider updating the spec. (We will also need to keep in mind that web devs are used to this behavior today and changing this could break some telemetry processing.) |
HTML defines an image cache. Forgot the name atm but I think that is defined to some extent. Not well, since not subject to CSP atm, but… |
|
var img_location = document.location.origin + path(document.location.pathname) | ||
+ "resources/square.png"; | ||
var observer = new PerformanceObserver( | ||
t.step_func(function (entryList, obs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not testing here a scenario where there will be a second entry added, only in some slight delay that will cause it to be added to the next PerfObs event.
@annevk - I think you're referring to the list of available images. In any case, I disagree that this case should show two separate entries, as there's no actual fetch triggered for MemoryCache reused images. I'd argue that if we want 2 separate entries here, we should also have 2 entries for every resource the preloader is triggering a preload of. There's no conceptual difference between the two.
@toddreifsteck - Why is that? Can you point to the relevant parts of the SW/fetch specs that result in resource reuse triggering new fetch events? |
When are you planning on getting this defined in detail? |
Discussed this at TPAC yesterday with Todd & Yoav...
Ignore the above. Step 6 of the RT processing model covers this case:
So, the behavior that is being tested here is correct -- lgtm for that. For the test structure: it's not clear to me that this is the best way to test the actual behavior, as there is no guarantee that UA must dispatch a single PO event. Ideally, we should check that only one event was delivered some time after the onload event of the second test fired. |
@plehegar Is updating this test per @igrigorik feedback something you can take or should we move it to Xiaoqian? |
@siusin is this something you'd be able to update (see #2919 (comment)) while you're working on #402? |
Sorry, I missed that earlier :( |
Yep! For (1), make sure we register it at the top of the page, well ahead of the images.. |
c88c766
to
62be562
Compare
(the pull request needs to be rebased) |
cc43589
to
f2d931c
Compare
At this point, I'm thinking to wait for w3c/resource-timing#83 ... |
@plehegar wait for...? As in, tests to cover w3c/resource-timing#87? |
No. I did mean w3c/resource-timing#83 . For the purpose of this test, I need to be able to better predict when the entry will be reported and that's not the case with Firefox at the moment. |
Err, still confused. What does responseStart have to do with when entry is reported (I assume you mean queued to PerfObserver)? |
@siusin any chance we can stage this test? |
Resubmitted at #6567 |
Thanks Yoav. Closing this, let's continue in the new PR. |
This comes from #2884 and this test scenario needs to be addressed by the specification first.