Skip to content

Conversation

@iandunn
Copy link
Member

@iandunn iandunn commented Oct 7, 2020

Add QUnit options to disable CORS.

Trac ticket: https://core.trac.wordpress.org/ticket/51446

@iandunn
Copy link
Member Author

iandunn commented Oct 7, 2020

  • The CORS error is fixed, but now there's still the FILE_NOT_FOUND one.
Running "qunit:files" (qunit) task
Testing tests/qunit/compiled.html .................................................................................................................................................................................................................................................................................................................OK
Testing tests/qunit/index.html Failed to load resource: net::ERR_FILE_NOT_FOUND
.................................................................................................................................................................................................................................................................................................................OK
  • I'm not sure if all 3 options are needed, or if just --disable-web-security would be enough

@iandunn iandunn force-pushed the 51466-qunit-cors branch 2 times, most recently from f853781 to ddc9e73 Compare October 8, 2020 00:17
In some environments, QUnit fails with this error:

> Access to XMLHttpRequest at 'file:///wp-admin/admin-ajax.php' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, https.

Requesting that endpoing via HTTP would require hardcoding a hostname, which would remove the ability of devs to use whatever hostname they want.

We don't need to worry about CORS in this context, so it's safe to disable it.

Fixes #51446
See gruntjs/grunt-contrib-qunit#158
Props garrett-eclipse
@iandunn
Copy link
Member Author

iandunn commented Oct 8, 2020

I removed allow-file-access-from-files per https://core.trac.wordpress.org/ticket/51446#comment:11. I kept --headless, though, because I got a Chromium popup after removing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant