Unverified Commit ced7339a authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Fix: missing crossorigin property on manifest link (#62873)

We didn't set the property of manifest before, this PR fixes the missing
prop

> If the manifest requires credentials to fetch, the crossorigin
attribute must be set to use-credentials, even if the manifest file is
in the same origin as the current page.
x-ref: https://developer.mozilla.org/en-US/docs/Web/Manifest


Fixes NEXT-2706
parent bdfe247b
......@@ -61,7 +61,11 @@ export function BasicMeta({ metadata }: { metadata: ResolvedMetadata }) {
])
: []),
metadata.manifest ? (
<link rel="manifest" href={metadata.manifest.toString()} />
<link
rel="manifest"
href={metadata.manifest.toString()}
crossOrigin="use-credentials"
/>
) : null,
Meta({ name: 'generator', content: metadata.generator }),
Meta({ name: 'keywords', content: metadata.keywords?.join(',') }),
......
......@@ -228,6 +228,12 @@ createNextDescribe(
'dns-prefetch': '/dns-prefetch-url',
})
// Manifest link should have crossOrigin attribute
await matchDom('link', 'rel="manifest"', {
href: '/api/manifest',
crossOrigin: 'use-credentials',
})
await matchDom('meta', 'name="theme-color"', {
media: '(prefers-color-scheme: dark)',
content: 'cyan',
......@@ -237,6 +243,7 @@ createNextDescribe(
it('should support other basic tags (edge)', async () => {
const browser = await next.browser('/basic-edge')
const matchMultiDom = createMultiDomMatcher(browser)
const matchDom = createDomMatcher(browser)
await matchMultiDom('meta', 'name', 'content', {
generator: 'next.js',
......@@ -255,6 +262,12 @@ createNextDescribe(
preload: '/api/preload',
'dns-prefetch': '/dns-prefetch-url',
})
// Manifest link should have crossOrigin attribute
await matchDom('link', 'rel="manifest"', {
href: '/api/manifest',
crossOrigin: 'use-credentials',
})
})
it('should support apple related tags `itunes` and `appWebApp`', async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment