UNPKG

@firebase/app

Version:

The primary entrypoint to the Firebase JS SDK

53 lines (52 loc) • 1.86 kB
/** * @license * Copyright 2026 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Name of the Trusted Types policy that Firebase SDKs use to load external * scripts. Apps that restrict policy names with the `trusted-types` CSP * directive must allow this name. * * @internal */ export declare const _TRUSTED_TYPES_POLICY_NAME = "firebase-js-sdk-policy"; /** * Returns `url` if it is one of the allowed external scripts, and throws * otherwise. Used as the `createScriptURL` implementation of the Trusted Types * policy. * * @internal */ export declare function _createTrustedScriptURL(url: string): string; /** * Sets the `src` of a script element through the Firebase Trusted Types policy * when Trusted Types are supported, so that Firebase SDKs can load external * scripts on pages that enforce Trusted Types. * * Throws if `url` is not an allowed Firebase script URL, or if the browser * rejects the assignment. * * @param script - The script element to update. * @param url - The script URL. Must be an allowed Firebase script URL. * * @internal */ export declare function _setTrustedScriptSrc(script: HTMLScriptElement, url: string): void; /** * Resets the cached Trusted Types policy. Only for use in tests. * * @internal */ export declare function _resetTrustedTypesPolicyForTesting(): void;