Skip to content

Add support for / use TrustedTypes (CSP) #850

Description

@tomastrajan

Describe the solution you'd like
The @googlemaps/js-api-loader should support CSP TrustedTypes

Describe alternatives you've considered
Disabling CSP

Additional context
When CSP is enabled on the server, there will be a runtime error

TypeError: Failed to set the 'src' property on 'HTMLScriptElement': This document requires 'TrustedScriptURL' assignment.

In the library index.mjs file, line #369

a.src = this.url + ? + e; this assignment is the main problem

Tt should have been something like script.src = getPolicy()?.createScriptURL(url) ?? url; instead
and the library should register its TrustedType policy out of the box

Activity

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

    next major: breaking changethis is a change that we should wait to bundle into the next major versiontype: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions