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

Tracking issue: issues with testing and reporting workerd results #76

Open
jasnell opened this issue Mar 15, 2024 · 5 comments
Open

Tracking issue: issues with testing and reporting workerd results #76

jasnell opened this issue Mar 15, 2024 · 5 comments

Comments

@jasnell
Copy link
Collaborator

jasnell commented Mar 15, 2024

I'm going to use this issue to track a number of issues with the reporting of results for workerd. Will add issues as the cause is determined...

  1. URL conformance... The results currently show workerd as not implemented URL. This is incorrect, workerd provides a fully WHATWG compliant URL implementation. It appears the issue causing workerd to fail these tests is that the tests themselves use location.href, which workerd does not implement. Specifically, tests.json includes a number of tests using the pattern:
  "api.URL.host": {
    "code": "(function () {\n  var instance;\n  try {\n    instance = new URL(location.href);\n  } catch (e) {\n    instance = new webkitURL(location.href);\n  }\n  return !!instance && \"host\" in instance;\n})();\n",

Either a different input URL should be used for the test harness in generator/runtimes/workerd/handler.ts should be updated to polyfill location.href

  1. The test results check for AbortSignal.prototype.onabort. Workerd definitely does not define the onabort property on the AbortSignal prototype but it does, in fact support use of signal.onabort = .... This is a discrepancy with how workerd supports the spec but given that the method does work, the result table is inaccurate. Implement AbortSignal.protototype.onabort cloudflare/workerd#1848 PR fix for workerd has landed. It is not yet in production. Should be relatively soon tho.

  2. The test results indicate that workerd does not support the ByteLengthQueuingStrategy. This might be a discrepancy in how the class is exposed on our global scope vs. how the test looks for it. self.ByteLengthQueuingStrategy works just fine and the constructor is supported. I suspect that the same applies to the CompressionStream constructor, CountQueuingStrategy constructor, CustomEvent constructor, etc. This is actually an issue with the test harness. Currently it tests for the presence of a class constructor by trying to call the constructor with no arguments. If it works, cool. If it throws, it determines support vs non-support by checking the error message. Unfortunately the harness currently does not account for the error messages provided by workerd so it flags those as failures. Update constructor harness to support workerd #119

  3. The test results indicate that workerd does not support the CloseEvent. It actually does but we have a bug. The test tries to create the CloseEvent using only a single string argument in the constructor, eliding the optional second options argument. Looks like workerd is incorrectly set to require that second argument right now so the test fails trying to construct the instance. I will open an issue to fix that, in the meantime tho, the rest of it is supported. The second argument to CloseEvent is supposed to be optional cloudflare/workerd#1849

  4. The test results indicate that the new Headers getSetCookie() API is not supported. This is false. Unfortunately for backwards compatibility reasons we require a compatibility flag to be set (https://developers.cloudflare.com/workers/configuration/compatibility-dates/#headers-supports-getsetcookie) to enable the feature but it is on by default as of a year ago. Update the workerd compatibility date #79

  5. For the PromiseRejectionEvent, we definitely do not support the constructor but we do support the promise and reason properties.

  6. For the ReadableByteStreamController desiredSize property. This is a discrepancy with how workers exposes the property. The test looks for it on the prototype, while the runtime exposes it as an instance property. This is probably a bug in workerd that I need to look at but the property itself is supported. Likewise with the view property on ReadableStreamByobRequest Convert the standard properties on streams objects to prototype cloudflare/workerd#1850 PR fix for workerd has landed. It is not yet in production. Should be relatively soon tho.

  7. TransformStreamDefaultController is fully supported in workerd.

  8. We have a PR to improve TextEncodingStream and TextDecoderStream conformance by adding the missing properties - Add standard properties to TextDecoderStream/TextEncoderStream cloudflare/workerd#1981 PR landed.

  9. We have a PR to add reportError(...) and add the missing ErrorEvent constructor - Implements the web platform standard reportError API cloudflare/workerd#1979 PR landed.

I imagine that it will likely take a few pull requests (as well as a couple of modifications in workerd) to update the compat table for these cases.

@ascorbic
Copy link
Collaborator

For 5, is this an option that can be set in our workerd runner?

@ascorbic
Copy link
Collaborator

I don't think polyfilling location.href will be enough, because the Request tests all try to instantiate it with an empty string, which also doesn't work. We'll need to see if we can fix the tests.

@jasnell
Copy link
Collaborator Author

jasnell commented Mar 15, 2024

@ascorbic ... for #5, yes, it would be set as a compat flag in the worker config. Honestly I think it should be the default already tho, I need to look into it a bit more....

Update: ah, yes, your compatibilityDate is set to 2023-02-28 which means the getSetCookie() flag won't be on by default. If you bump that up to some time in 2024 then you should pick up that change.

@ascorbic
Copy link
Collaborator

Ah ok. If you'd like to do a PR to update it to the best settings to represent what users would get then that would be great.

@jasnell
Copy link
Collaborator Author

jasnell commented May 7, 2024

Ok, most of the issues here have been addressed in the runtime or the test harness (or in pending PRs). There are still a couple of remaining minor items (like the PromiseRejectionEvent constructor) that will be addressed over time. For now, I'd like to get #119 landed then take a look at the regenerated matrix using an up to date workerd, then continue on from there.

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

No branches or pull requests

2 participants