-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Worker support] test for no cors headers #1374
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
Conversation
for more information, see https://pre-commit.ci
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.
The code in the PR is good, apart some naming/style minor issue which I highlighted in the comments.
But the big problem is the
8000
code which is NOT in the PR: what we want is that pyscript detects the "no cors" headers and display a nice error message, with a link to the documentation which explains what is the problem.
This is just the machinery to make it possible to write a test for that, but the machinery alone is useless.
I don't think this does resolve #1312. The feature request is:
When the headers are missing. As far as I can tell this patch only adjusts test code, it doesn't currently add any new error messages. Also we should consider further improvements to synclink so that in same thread mode shared array buffer isn't needed. |
This is a useful step towards resolving #1312 though, it gets the test support code ready. |
Aah sorry, seems like I missed the part about introducing error messages in #1312 |
c31d835
to
d21da0c
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@madhur-tandon I think there is a bit of confusion w.r.t the final goal. In theory, the current situation is the following:
HOWEVER I realized that we cannot write such a test currently, because situation (4) never arises: i.e., currently pyscript works perfectly fine even if we don't have CORS headers set. I think we will need it as soon as we merge PR #1333 , but not today. @hoodmane I am very confused about what's happening on But then my question is: why did you have to modify pyscript/pyscriptjs/tests/integration/conftest.py Lines 144 to 156 in c05195c
If I comment out |
@antocuni Although I have added the error message, it is not in the form of a Tagging @hoodmane too for a re-review as well. The right entry point to check for these headers is the |
Sounds like. |
@madhur-tandon see my previous message: The source of the confusion is a big misunderstanding: the synclink PR added the CORS headers to our dev server, so I assumed they were necessary for running pyscript: and in that case, the point of #1312 was to make sure that we display a nice error message to the user. But it turns out that it's not the case: as of now, the CORS headers are not needed and pyscript works perfectly fine without them. So the "proper" fix would be to revert the change and delete the extra code from the repo, not to add a test for an unneeded feature. However, the situation is going to change soon: CORS headers are needed for web workers, so as soon as #1333 is merged, this PR becomes relevant again. Let's put it on hold until then. |
The tests that fail are kinda unrelated 😅 |
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.
Looks good to me 😄
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.
Looks good to me.
After we merge let's open an issue to add a place in the docs somewhere with more info and put a link to it in the error message. |
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
Closes #1312 and #1364
CC: @hoodmane and @antocuni