Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
96d6adac
Commit
96d6adac
authored
Jul 05, 2024
by
Sung Ye In
Committed by
Zack Tanner
Aug 26, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(next): add cross origin in react dom preload (#67423)
Co-authored-by:
Jiwon Choi
<
devjiwonchoi@gmail.com
>
parent
c572030a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
4 deletions
+55
-4
script.tsx
packages/next/src/client/script.tsx
+14
-4
layout.tsx
test/e2e/app-dir/next-script/app/layout.tsx
+8
-0
page.tsx
test/e2e/app-dir/next-script/app/page.tsx
+10
-0
next-script.test.ts
test/e2e/app-dir/next-script/next-script.test.ts
+17
-0
next.config.js
test/e2e/app-dir/next-script/next.config.js
+6
-0
No files found.
packages/next/src/client/script.tsx
View file @
96d6adac
...
@@ -349,8 +349,13 @@ function Script(props: ScriptProps): JSX.Element | null {
...
@@ -349,8 +349,13 @@ function Script(props: ScriptProps): JSX.Element | null {
ReactDOM
.
preload
(
ReactDOM
.
preload
(
src
,
src
,
restProps
.
integrity
restProps
.
integrity
?
{
as
:
'script'
,
integrity
:
restProps
.
integrity
,
nonce
}
?
{
:
{
as
:
'script'
,
nonce
}
as
:
'script'
,
integrity
:
restProps
.
integrity
,
nonce
,
crossOrigin
:
restProps
.
crossOrigin
,
}
:
{
as
:
'script'
,
nonce
,
crossOrigin
:
restProps
.
crossOrigin
}
)
)
return
(
return
(
<
script
<
script
...
@@ -370,8 +375,13 @@ function Script(props: ScriptProps): JSX.Element | null {
...
@@ -370,8 +375,13 @@ function Script(props: ScriptProps): JSX.Element | null {
ReactDOM
.
preload
(
ReactDOM
.
preload
(
src
,
src
,
restProps
.
integrity
restProps
.
integrity
?
{
as
:
'script'
,
integrity
:
restProps
.
integrity
,
nonce
}
?
{
:
{
as
:
'script'
,
nonce
}
as
:
'script'
,
integrity
:
restProps
.
integrity
,
nonce
,
crossOrigin
:
restProps
.
crossOrigin
,
}
:
{
as
:
'script'
,
nonce
,
crossOrigin
:
restProps
.
crossOrigin
}
)
)
}
}
}
}
...
...
test/e2e/app-dir/next-script/app/layout.tsx
0 → 100644
View file @
96d6adac
import
{
ReactNode
}
from
'react'
export
default
function
Root
({
children
}:
{
children
:
ReactNode
})
{
return
(
<
html
>
<
body
>
{
children
}
</
body
>
</
html
>
)
}
test/e2e/app-dir/next-script/app/page.tsx
0 → 100644
View file @
96d6adac
import
Script
from
'next/script'
export
default
function
Page
()
{
return
(
<
Script
src=
"https://code.jquery.com/jquery-3.7.1.min.js"
crossOrigin=
"use-credentials"
/>
)
}
test/e2e/app-dir/next-script/next-script.test.ts
0 → 100644
View file @
96d6adac
import
{
nextTestSetup
}
from
'e2e-utils'
describe
(
'Script component with crossOrigin props'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
})
it
(
'should be set crossOrigin also in preload link tag'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/'
)
const
crossorigin
=
await
browser
.
elementByCss
(
'link[href="https://code.jquery.com/jquery-3.7.1.min.js"]'
)
.
getAttribute
(
'crossorigin'
)
expect
(
crossorigin
).
toBe
(
'use-credentials'
)
})
})
test/e2e/app-dir/next-script/next.config.js
0 → 100644
View file @
96d6adac
/**
* @type {import('next').NextConfig}
*/
const
nextConfig
=
{}
module
.
exports
=
nextConfig
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment