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

[Storage Access API] Fix anomalous behavior with tests that use iframes #30320

Merged
merged 3 commits into from Sep 28, 2021

Conversation

andreubotella
Copy link
Member

@andreubotella andreubotella commented Sep 3, 2021

The tests for hasStorageAccess and requestStorageAccess need to test in different browsing contexts, with different relationships to the top-level browsing context, and both same-origin and cross-origin. They do this by declaring tests in the test file, and then loading that same test file in iframes using fetch_tests_from_window.

However, a requirement of fetch_tests_from_window is that the window whose tests to fetch must not include testharnessreport.js – which isn't true for these Storage Access API tests. While this doesn't seem to make a difference when running wpt serve or otherwise when using the default testharnessreport.js file, tests run with wpt run might timeout, and the subtests coming from the iframes might not be reported.

This change creates versions of hasStorageAccess.sub.window.html and requestStorageAccess.sub.window.html that don't import testharnessreport.js, specifically to be loaded as iframes.

The tests for `hasStorageAccess` and `requestStorageAccess` need to test
in different browsing contexts, with different relationships to the
top-level browsing context, and both same-origin and cross-origin. They
do this by declaring tests in the test file, and then loading that same
test file in iframes using `fetch_tests_from_window`.

However, a requirement of `fetch_tests_from_window` is that the window
whose tests to fetch must not include `testharnessreport.js` – which
isn't true for these Storage Access API tests. While this doesn't seem
to make a difference when running `wpt serve` or otherwise when using
the default `testharnessreport.js` file, tests run with `wpt run` might
timeout, and the subtests coming from the iframes might not be reported.

This change creates versions of `hasStorageAccess.sub.window.html` and
`requestStorageAccess.sub.window.html` that don't import
`testharnessreport.js`, specifically to be loaded as iframes.
@andreubotella andreubotella force-pushed the andreubotella/storage-access-iframe-fix branch from ff35315 to e5acd77 Compare September 3, 2021 14:39
@andreubotella
Copy link
Member Author

When running on my machine with wpt run, the tests are consistently not timing out, and no subtest from any iframe is missing – but in the various CI runs so far, some runs will result in a timeout and iframe tests being missing, and some won't, apparently at random. I'm not sure what to make of this.

Copy link
Member

@Brandr0id Brandr0id left a comment

Choose a reason for hiding this comment

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

Thanks for the update, LGTM.

@Brandr0id
Copy link
Member

@andreubotella is this change ready to be merged?

@andreubotella
Copy link
Member Author

@andreubotella is this change ready to be merged?

As I mentioned above, I was getting different results on CI than with ./wpt run on my machine, and I couldn't figure out why that happened. Let's see if it happens again this time.

@andreubotella
Copy link
Member Author

The results do match this time, so I guess this can be merged now.

@andreubotella andreubotella marked this pull request as ready for review September 28, 2021 02:15
@Brandr0id
Copy link
Member

Great! Let's merge, and I also have a Chromium bug tracking flakiness with these tests. Once this change hits the repo I'll confirm/investigate any remaining issues.

Thanks again for the patch.

@andreubotella andreubotella merged commit 09bf381 into master Sep 28, 2021
@andreubotella andreubotella deleted the andreubotella/storage-access-iframe-fix branch September 28, 2021 03:00
Gabisampaio pushed a commit to Gabisampaio/wpt that referenced this pull request Nov 18, 2021
…es (web-platform-tests#30320)

The tests for `hasStorageAccess` and `requestStorageAccess` need to test
in different browsing contexts, with different relationships to the
top-level browsing context, and both same-origin and cross-origin. They
do this by declaring tests in the test file, and then loading that same
test file in iframes using `fetch_tests_from_window`.

However, a requirement of `fetch_tests_from_window` is that the window
whose tests to fetch must not include `testharnessreport.js` – which
isn't true for these Storage Access API tests. While this doesn't seem
to make a difference when running `wpt serve` or otherwise when using
the default `testharnessreport.js` file, tests run with `wpt run` might
timeout, and the subtests coming from the iframes might not be reported.

This change creates versions of `hasStorageAccess.sub.window.html` and
`requestStorageAccess.sub.window.html` that don't import
`testharnessreport.js`, specifically to be loaded as iframes.
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.

None yet

4 participants