-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
fix(audit): iframe with redirect shouldn't be marked as critical #6704
Conversation
6323062
to
9537538
Compare
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.
I'm having a hard time evaluating this PR... This comment describes this original impl, which has changed a lot.
And unfortunately our test page doesn't have an iframe behind a redirect any more. I created a test page (in #7352) but it never gets an entry in the preload audit. (only preconnect)
Going back to the original bug report #6675, the concern is that we suggest to preload an iframe the user is deliberately lazyloading. We could see that an iframe's request was script-initiated and skip those if we want, but I don't think that's neccessary.
At this point I don't know what redirects have to do with this, but maybe there's more context I'm missing.
@paulirish I might guess that 302 status on our current iframe (which described in #6675) is pure coincidental, point of issue was that iframe was loaded not with the document but later, JS-initiated, thus not blocking initial parsing and render. Fixing 302 as non-critical request would help in our sole case, but I might guess that won't help where programmaticaly enabled iframe would not give 302 but 200. |
i'll check it out if it's still a problem ,if not we can just close this one. |
#7352 fixed initiators and redirects. It makes a lot more sense now. We specifically say that iframes aren't critical. And we only want critical requests for the user to preload. So if we ever flag a redirect (that eventually is an iframe) in those audits, we have something to fix. I couldn't get a redirect to show up in preload details. But maybe i wasn't constructing the right situation. If they'll never show up in preload, then we're done here. :) |
@paulirish it's not showing up anymore in preload so that's good but the redirect is still marked as a critical request because the resourceType is marked as undefined for a redirect. I made a repro on glitch I'm rebasing this branch |
9537538
to
13c7c17
Compare
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.
oh sorry ward forgot to flush this like weeks ago
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.
LGTM!
Fixed comments 😄 |
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.
tested this out. lgtm.
redirects to iframes (noncritical) are no longer included as critical. ✅
redirects to scripts (critical) are included as critical requests. ✅
Here's a test run where i added a redirect to a script. you can see it enters into the chain as expected. (this already worked fine in master and continues to work):
And test with redirects before an iframe (master on left, this PR on right):
let's do this.
thanks @paulirish ! |
Summary
Fixes 302 iframes inside a page marked as critical requests
Related Issues/PRs
#6675