Skip to content

Commit 18ddea3

Browse files
authored
fix(youtube-player): use safevalues (#30773)
1 parent b1a5c61 commit 18ddea3

File tree

8 files changed

+2029
-2007
lines changed

8 files changed

+2029
-2007
lines changed

Diff for: .aspect/rules/external_repository_action_cache/npm_translate_lock_MzA5NzUwNzMx

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# This file should be checked into version control along with the pnpm-lock.yaml file.
44
.npmrc=-1406867100
55
integration/package.json=-620011313
6-
package.json=-2075832703
7-
pnpm-lock.yaml=-986459546
6+
package.json=1797122117
7+
pnpm-lock.yaml=1639985799
88
pnpm-workspace.yaml=334858811
99
src/cdk-experimental/package.json=237487315
1010
src/cdk/package.json=-908433069
@@ -18,5 +18,5 @@ src/material-luxon-adapter/package.json=-199007660
1818
src/material-moment-adapter/package.json=-1407689629
1919
src/material/package.json=-1237533685
2020
src/universal-app/package.json=346715231
21-
src/youtube-player/package.json=68300461
22-
yarn.lock=-710001387
21+
src/youtube-player/package.json=1069986537
22+
yarn.lock=1826047937

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
"rxjs": "^6.6.7",
6969
"rxjs-tslint-rules": "^4.34.8",
7070
"tslib": "^2.3.1",
71-
"zone.js": "~0.15.0"
71+
"zone.js": "~0.15.0",
72+
"safevalues": "^1.2.0"
7273
},
7374
"devDependencies": {
7475
"@angular-devkit/build-angular": "^20.0.0-next.4",

Diff for: pkg-externals.bzl

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ PKG_EXTERNALS = [
4949
"rxjs",
5050
"rxjs/operators",
5151
"selenium-webdriver",
52+
"safevalues",
53+
"safevalues/dom",
5254
]
5355

5456
# Creates externals for a given package and its entry-points.

Diff for: pnpm-lock.yaml

+2,009-1,999
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/youtube-player/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ ng_project(
3838
"//:node_modules/@angular/core",
3939
"//:node_modules/@types/youtube",
4040
"//:node_modules/rxjs",
41+
"//:node_modules/safevalues",
4142
"//src:dev_mode_types",
4243
],
4344
)

Diff for: src/youtube-player/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"homepage": "https://github.com/angular/components/tree/main/src/youtube-player#readme",
1919
"dependencies": {
2020
"@types/youtube": "^0.1.0",
21-
"tslib": "^2.3.0"
21+
"tslib": "^2.3.0",
22+
"safevalues": "^1.2.0"
2223
},
2324
"peerDependencies": {
2425
"@angular/core": "0.0.0-NG",

Diff for: src/youtube-player/youtube-player.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import {
3232
EventEmitter,
3333
} from '@angular/core';
3434
import {isPlatformBrowser} from '@angular/common';
35+
import {trustedResourceUrl} from 'safevalues';
36+
import {setScriptSrc} from 'safevalues/dom';
3537
import {Observable, of as observableOf, Subject, BehaviorSubject, fromEventPattern} from 'rxjs';
3638
import {takeUntil, switchMap} from 'rxjs/operators';
3739
import {PlaceholderImageQuality, YouTubePlayerPlaceholder} from './youtube-player-placeholder';
@@ -743,7 +745,7 @@ function loadApi(nonce: string | null): void {
743745
}
744746

745747
// We can use `document` directly here, because this logic doesn't run outside the browser.
746-
const url = 'https://www.youtube.com/iframe_api';
748+
const url = trustedResourceUrl`https://www.youtube.com/iframe_api`;
747749
const script = document.createElement('script');
748750
const callback = (event: Event) => {
749751
script.removeEventListener('load', callback);
@@ -759,7 +761,7 @@ function loadApi(nonce: string | null): void {
759761
};
760762
script.addEventListener('load', callback);
761763
script.addEventListener('error', callback);
762-
(script as any).src = url;
764+
setScriptSrc(script, url);
763765
script.async = true;
764766

765767
if (nonce) {

Diff for: yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -12152,6 +12152,11 @@ safe-stable-stringify@^2.3.1:
1215212152
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
1215312153
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
1215412154

12155+
safevalues@^1.2.0:
12156+
version "1.2.0"
12157+
resolved "https://registry.yarnpkg.com/safevalues/-/safevalues-1.2.0.tgz#f9e646d6ebf31788004ef192d2a7d646c9896bb2"
12158+
integrity sha512-zIsuhjYvJCjfsfjoim2ab6gLKFYAnTiDSJGh0cC3T44L/4kNLL90hBG2BzrXPrHA3f8Ms8FSJ1mljKH5dVR1cw==
12159+
1215512160
1215612161
version "16.0.5"
1215712162
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-16.0.5.tgz#257bc90119ade066851cafe7f2c3f3504c7cda98"

0 commit comments

Comments
 (0)