Skip to content

Synchronous validation in getMappedRange #64

Closed

Description

@kainino0x

How should synchronous validation errors be exposed in getMappedRange? It can return null, but that doesn't tell the caller what went wrong. This would probably be fine, except e.g. Chromium needs to know what string to attach to the DOMException it generates. To do that now it needs to duplicate all of the validation that's already in getMappedRange.

Activity

  1. kainino0x commented on Jul 16, 2020

    @kainino0x
    CollaboratorAuthor

    (Which is especially problematic for the overlapping-range validation.)

  2. Kangz commented on Jul 16, 2020

    @Kangz
    Collaborator

    IMHO the overlapping range validation should be on the Blink side only, because it stems from limitations of ArrayBuffer. Same thing for the alignment restrictions.

  3. kainino0x commented on Jul 16, 2020

    @kainino0x
    CollaboratorAuthor

    Good point. Perhaps no issue here then.

  4. kainino0x commented on Jun 28, 2023

    @kainino0x
    CollaboratorAuthor

    from last week's meeting: At least the safe Rust API will keep this validation because it's required for Rust safety guarantees. wgpu-core and the C API don't necessarily have to, still.

  5. Kangz commented on Jun 29, 2023

    @Kangz
    Collaborator

    Do we have an explanation of why this is needed for the Rust safety guarantees? It seems it would only be to get mutable ranges?

  6. kainino0x commented on Jun 29, 2023

    @kainino0x
    CollaboratorAuthor

    We didn't specifically talk about const ranges, maybe for const ranges overlaps are fine? @cwfitzgerald

  7. cwfitzgerald commented on Jun 29, 2023

    @cwfitzgerald
    Collaborator

    Correct, const overlaps are fine, mutable overlaps are not.

  8. kainino0x commented on Sep 7, 2023

    @kainino0x
    CollaboratorAuthor

    In June we had concluded:

    make this Result-like, error is either an enum or a string (who owns the string?)

    However we discussed this more today in the broader context of reporting synchronous errors and came to a simpler conclusion:

    • CF: Can’t do an enum because in WASM we can’t convert the JS Error to an enum.
    • Could return a struct that you have to FreeMembers. Very annoying because you have to do this for every single GetMappedRange call.
    • Out param for the error, and if you pass it then you have to FreeMembers?
    • CF: Worried about inconsistencies across the API
    • KN: Just return a two-state enum so we don’t have to convert JS error to enum? (Actually that’s the same as returning nullptr)
      • CF: Implementation-defined logging
    • KN: There’s two error cases: overlapping (mutable) ranges, and asking for a mutable pointer to immutable mapping.
    • conclusion: Return nullptr on error, with implementation-defined logging
  9. added 3 commits that reference this issue on Oct 19, 2024
    7d37df5
    4bd547a
    77e4660
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buffer mappingMapAsync and friendserrorsError reportinghas resolutionIssue is resolved, just needs to be done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions