Skip to content
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

Iframes with missing redirect location should fire load event and queue RT entry #33317

Merged
merged 2 commits into from
Mar 23, 2022

Conversation

noamr
Copy link
Contributor

@noamr noamr commented Mar 23, 2022

Iframes with missing redirect location (e.g. 302 response code and no location header) should fire load event and queue RT entry

@noamr noamr changed the title iframe rt bad redirect Iframes with missing redirect location should fire load event and queue RT entry Mar 23, 2022
t.add_cleanup(() => frame.remove());
await new Promise(resolve => {
frame.addEventListener('load', resolve);
frame.src = 'resources/bad-redirect.py';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Maybe rename to redirect-without-location.py or add a comment as to why this redirect is bad?

document.body.appendChild(frame);
});

const entries = performance.getEntriesByName(frame.src);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? I thought getEntriesByName needs the absolute URL..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! The src attribute returns the full URL

<script src="/resources/testharnessreport.js"></script>
<body>
<script>
promise_test(async t => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High level note - would be nice to use the resource-loaders.js infra for this. Would also be nice to test (if not tested already elsewhere) that it's only the initial src that's exposed and not the redirected one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter is tested elsewhere.

Copy link
Contributor

@yoavweiss yoavweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@noamr noamr enabled auto-merge (squash) March 23, 2022 08:29
@noamr noamr merged commit 7eb2cb2 into master Mar 23, 2022
@noamr noamr deleted the iframe-rt-bad-redirect branch March 23, 2022 08:35
DanielRyanSmith pushed a commit to DanielRyanSmith/wpt that referenced this pull request Mar 25, 2022
…ue RT entry (web-platform-tests#33317)

* Iframes with missing redirect location should fire load event and queue RT entry

See whatwg/html#7531

* Rename and use loader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants