Skip to content

Allow doubles for ProgressEvent's loaded and total#394

Merged
domenic merged 1 commit into
mainfrom
double-progressevent
Mar 11, 2025
Merged

Allow doubles for ProgressEvent's loaded and total#394
domenic merged 1 commit into
mainfrom
double-progressevent

Conversation

@domenic

@domenic domenic commented Jan 21, 2025

Copy link
Copy Markdown
Member

This allows specifications to use ProgressEvents while not necessarily giving away the exact number of bytes, for example by using numbers between 0 and 1. See discussion in webmachinelearning/writing-assistance-apis#15 for the concrete use case.

(See WHATWG Working Mode: Changes for more details.)


I wanted to get this PR up to judge implementer interest. It would be a decent bit cleaner if we all agreed this was reasonable and merged the change now, instead of having to float a patch in the relevant specs and thus causing all the databases to have two definitions of ProgressEvent.


Preview | Diff

@annevk

annevk commented Jan 21, 2025

Copy link
Copy Markdown
Member

I'll double check, in principle it seems fine. @smaug----?

domenic added a commit to webmachinelearning/writing-assistance-apis that referenced this pull request Jan 22, 2025
This allows specifications to use ProgressEvents while not necessarily giving away the exact number of bytes, while maintaining a granularity greater than just 1 part in 100. See discussion in webmachinelearning/writing-assistance-apis#15 for the concrete use case.
@domenic domenic force-pushed the double-progressevent branch from 48e8e0d to 5b4e883 Compare January 22, 2025 05:03
@smaug----

smaug---- commented Jan 22, 2025

Copy link
Copy Markdown

Should be fine.
Technically not backwards compatible, but I'd be a bit surprised if someone relied on the number -> long long conversion when calling the constructor.

@annevk annevk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you could ping me once Chromium has successfully shipped this I'd appreciate this and I'll be sure to align WebKit at that point.

@domenic

domenic commented Jan 23, 2025

Copy link
Copy Markdown
Member Author

Awesome. I'm hoping to delegate the implementation and tests to someone else so it might be a week or so, but once we have tests up I'll update this thread with a link to them and open other-browser bugs. And I'll ping again once we have it shipped.

domenic added a commit to webmachinelearning/writing-assistance-apis that referenced this pull request Jan 24, 2025
domenic added a commit to webmachinelearning/writing-assistance-apis that referenced this pull request Jan 24, 2025
domenic added a commit to webmachinelearning/writing-assistance-apis that referenced this pull request Jan 24, 2025
@smaug----

Copy link
Copy Markdown

Bug with a patch https://bugzilla.mozilla.org/show_bug.cgi?id=1943649 (webidl codegen for events is nice in this case)
Waiting for the tests before landing ;)

@domenic

domenic commented Mar 4, 2025

Copy link
Copy Markdown
Member Author

Should we merge this now, since all the boxes are checked? Or would we prefer to wait to see this land in Chromium to prove web-compatibility?

(I think that this one is so low-risk that there's no need to wait, personally. Unlike whatwg/webidl#1465 where waiting would be more prudent.)

@annevk

annevk commented Mar 4, 2025

Copy link
Copy Markdown
Member

I think it's okay to merge this around the same time the tests are merged.

@smaug----

Copy link
Copy Markdown

FWIW, I landed the patch to Nightly, waiting for the tests now ;)

@domenic

domenic commented Mar 7, 2025

Copy link
Copy Markdown
Member Author

We got approval to ship in Chromium now, so the tests should land very soon!

@domenic domenic merged commit 4a6401c into main Mar 11, 2025
@domenic domenic deleted the double-progressevent branch March 11, 2025 01:01
@domenic

domenic commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

The tests have now merged, so I went ahead and merged this spec PR. Thanks all!

@annevk

annevk commented Mar 19, 2025

Copy link
Copy Markdown
Member

@smaug---- I think your IDL-only change might be insufficient, unless bindings work rather differently in Gecko. At least I had to change some C++ to get tests to pass, which also made me realize that there's a couple more throwing cases now, but hopefully none that people run into in practice.

@smaug----

Copy link
Copy Markdown

As I explained on Matrix, in Gecko one can create the full C++ implementation out of a "normal" kind of Event interface..

sebsebmc added a commit to sebsebmc/servo that referenced this pull request Apr 13, 2025
See: whatwg/xhr#394

Signed-off-by: Sebastian C <sebsebmc@gmail.com>
github-merge-queue Bot pushed a commit to servo/servo that referenced this pull request Apr 13, 2025
See: whatwg/xhr#394

Testing: WPT tests exist for this

Signed-off-by: Sebastian C <sebsebmc@gmail.com>
ddbeck added a commit to ddbeck/web-features that referenced this pull request Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants