fs: Remove nullable markers from WriteParams members#182
fs: Remove nullable markers from WriteParams members#182usamanadeemdeveloper wants to merge 2 commits intowhatwg:mainfrom
Conversation
|
The commit message doesn't seem accurate. You're making them non-nullable, which means that passing null will throw. That is probably what we want, but it will require test changes and such so you need to restore the PR template as well and fill it out. |
`size`, `position`, and `data` in the `WriteParams` dictionary were marked as nullable (?), but the write() algorithm only checks for their existence and never handles null values. Making them non-nullable means that passing null will now throw a TypeError at the WebIDL boundary, which is the correct behavior. Fixes whatwg#181.
98be590 to
1122ace
Compare
Thank you for the feedback! I've addressed all three points:
|
its been a while and no reply from your side would you consider the PR? |
|
I think it should be considered, yes. Your test PR is a 404 however (once you fix that I recommend linking it from the original post at the top, so all the relevant information is collected there). I also want @a-sully or @mkruisselbrink to look at this as this would require changes to all implementations. Which also means you can't say N/A for implementation bugs. Maybe @jesup too. |
AAh I think I did pretty much everything what you asked now! Thanks for guidance |
f9b48c8 to
098f00d
Compare
|
Hi @annevk — wanted to give you a full status update and flag a couple of things that need attention. What's been completed since your last review (Mar 6):
Why I pushed an empty commit today: CI was failing because Request: Could you please approve the CI workflow run so it can execute? And if possible, could you nudge @a-sully and @mkruisselbrink? They were assigned as reviewers on March 2 — it's been 3 weeks with no response. A quick ping from you would go a long way. Happy to provide any additional context they need. Thanks for your time and guidance throughout this process! |
|
@annevk — one small follow-up on the Participation check. I've already signed the individual agreement at https://participate.whatwg.org, so my entry should be in the participant-data repository with Thanks again for approving the CI run! |
Hi @annevk, thanks for the thumbs up! Any idea when @a-sully or @mkruisselbrink might get a chance to review this? |
|
@fergald can someone from your team take a look please? |
|
This seems like a reasonable change, and is certainly what the spec should have said from the beginning, my mistake. |
|
If we are all agreed on then I'm fine with it too. Maybe would be nice to check known usages like in emscripten. cc @jjjalkanen |
|
@fergald isn't that throwing conditional upon the value of type? Because otherwise we might as well make these fields required. |
|
If you always get an exception it's fine, but just from a brief scan of the Chromium code @fergald pointed to I don't think you get an exception when type is "truncate" and position or data is null. Now perhaps that is unlikely enough to not matter in practice, but that would be a new case where we start throwing assuming I'm understanding that correctly from the limited context. |
Thank you for the precise pushback. I've retested with isolated writables (fresh stream per test) to avoid state contamination from earlier failures. { type: "truncate", position: null } → SyntaxError: truncate requires a size argument So Chromium does throw in both cases, but the error is driven by the missing/null size, not by position or data being null those fields appear to be ignored under truncate. The exception fires regardless of what else is in the dict. |
|
@annevk based on the test results, the one genuine behavior change this PR introduces is { type: "write", position: null } which currently passes silently in Chromium. Should I update the PR description to explicitly call this out rather than saying "consistent with implementations"? Happy to clarify the wording if that helps move things forward. |
|
It's not that simple as |
|
So this would force people to supply a This would also cause the examples on MDN to start throwing. Unless I'm misunderstanding things, these have to be optional. |
|
They remain optional. But if you pass them instead of omitting them and use null as value you would get an exception. That means that (Unfortunately |
|
@annevk thanks. Off-topic but what do you mean by lenient? Looking at Chromium, it seems that both I'm a little nervous about this change. I would like have some data on whether/how often people are making calls with The practical benefits of this are minimal, so don't see a great argument for taking a risk. |
Yes, that's no longer the case in WebKit. In WebKit you are now required to use WebKit has this dictionary as well, but we don't have telemetry. |



size,position, anddatain theWriteParamsdictionary weremarked as nullable (?), but the write() algorithm only checks for their
existence and never handles null values. Making them non-nullable means
that passing null will now throw a TypeError at the WebIDL boundary,
which is the correct behavior.
Fixes #181.
This is a spec alignment fix. The algorithm has never handled null for
these members, so making them non-nullable correctly reflects actual
intended behavior (also consistent with Chromium, Gecko, and WebKit
implementations).
be reviewed and commented upon at:
message to use. ✓