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

feat(runtime-dom): trusted types compatibility #10844

Merged
merged 16 commits into from
Aug 2, 2024

Commits on May 30, 2024

  1. fix: ensure no trusted types violations on fresh mount

    This isn't a complete fix because `innerHTML` assignment also occurs
    in `insertStaticContent`. But at least this makes the hello-world app
    work with trusted types enabled.
    
    I'm still figuring out how to add test cases for trusted types.
    
    Remaining todos:
    - [ ] Add test cases for trusted types.
    - [ ] Fix `insertStaticContent` to be compatible with trusted types,
    we may need a `vue` policy for that case.
    - [ ] Add a note in the docs about trusted types compatibility.
    - [ ] Allow trusted values to be passed to `v-html` and other props,
    this ultimately fixes vuejs/rfcs#614
    haoqunjiang authored and yyx990803 committed May 30, 2024
    Configuration menu
    Copy the full SHA
    286be04 View commit details
    Browse the repository at this point in the history
  2. fix(runtime-dom): use a trusted policy for innerHTML assignment in ap…

    …p mounting
    
    Because `replaceChildren` isn't supported in all browsers, we still need
    to use `innerHTML` to clear the container before mounting the app.
    
    I left the compat mode implementation in `runtime-core` as is because it
    doesn't feel right to use a DOM-only API in `runtime-core`.
    haoqunjiang authored and yyx990803 committed May 30, 2024
    Configuration menu
    Copy the full SHA
    455861f View commit details
    Browse the repository at this point in the history
  3. fix: trusted types compat for insertStaticContent

    It seems that the only source of the `content` is the output of
    `stringifyStatic` in `compiler-dom`. I guess no additional check is
    needed here.
    haoqunjiang authored and yyx990803 committed May 30, 2024
    Configuration menu
    Copy the full SHA
    3ef9b8c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f853479 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e4b0b42 View commit details
    Browse the repository at this point in the history
  6. fix: use textContent instead of innerHTML for clearing container

    Setting `textContent` to empty string is the equivalent of setting
    `innerHTML` to empty string, but it doesn't trigger trusted types policy
    violation.
    
    Though maybe not as clear and performant as `trustedTypes.emptyHTML`,
    the code is more succint considering that we don't need to check for the
    existence of `trustedTypes` before using it.
    haoqunjiang authored and yyx990803 committed May 30, 2024
    Configuration menu
    Copy the full SHA
    0dc028e View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    cc5cd3c View commit details
    Browse the repository at this point in the history
  8. feat: add a feature flag to turn on trusted types policy creation, an…

    …d default to false
    haoqunjiang authored and yyx990803 committed May 30, 2024
    Configuration menu
    Copy the full SHA
    e9f8419 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    a608074 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    60e5471 View commit details
    Browse the repository at this point in the history

Commits on May 31, 2024

  1. chore: fix lint error

    haoqunjiang committed May 31, 2024
    Configuration menu
    Copy the full SHA
    bef7c83 View commit details
    Browse the repository at this point in the history

Commits on Aug 2, 2024

  1. Configuration menu
    Copy the full SHA
    1c64a31 View commit details
    Browse the repository at this point in the history
  2. chore: fix broken lockfile

    yyx990803 committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    d97b541 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6950fb5 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    da0c8eb View commit details
    Browse the repository at this point in the history
  5. chore: fix window access

    yyx990803 committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    1dbec32 View commit details
    Browse the repository at this point in the history