Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(canonical): remove cross-origin check #13412

Merged
merged 2 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions lighthouse-core/audits/seo/canonical.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ const UIStrings = {
* @example {https://example.com/} url
*/
explanationPointsElsewhere: 'Points to another `hreflang` location ({url})',
/**
* @description Explanatory message stating that there was a failure in an audit caused by a URL pointing to a different domain.
* @example {https://example.com/} url
* */
explanationDifferentDomain: 'Points to a different domain ({url})',
/** Explanatory message stating that the page's canonical URL was pointing to the domain's root URL, which is a common mistake. "points" refers to the action of the 'rel=canonical' referencing another link. "root" refers to the starting/home page of the website. "domain" refers to the registered domain name of the website. */
explanationRoot: 'Points to the domain\'s root URL (the homepage), ' +
'instead of an equivalent page of content',
Expand Down Expand Up @@ -174,15 +169,6 @@ class Canonical extends Audit {
};
}

// bing and yahoo don't allow canonical URLs pointing to different domains, it's also
// a common mistake to publish a page with canonical pointing to e.g. a test domain or localhost
if (!URL.rootDomainsMatch(canonicalURL, baseURL)) {
return {
score: 0,
explanation: str_(UIStrings.explanationDifferentDomain, {url: canonicalURL.href}),
};
}

// another common mistake is to have canonical pointing from all pages of the website to its root
if (
canonicalURL.origin === baseURL.origin &&
Expand Down
20 changes: 0 additions & 20 deletions lighthouse-core/test/audits/seo/canonical-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,26 +127,6 @@ describe('SEO: Document has valid canonical link', () => {
});
});

it('fails when canonical points to a different domain', () => {
const finalUrl = 'http://localhost.test';
const mainResource = {url: finalUrl};
const devtoolsLog = networkRecordsToDevtoolsLog([mainResource]);
const artifacts = {
devtoolsLogs: {[CanonicalAudit.DEFAULT_PASS]: devtoolsLog},
URL: {finalUrl},
LinkElements: [
link({rel: 'canonical', source: 'head', href: 'https://example.com'}),
],
};

const context = {computedCache: new Map()};
return CanonicalAudit.audit(artifacts, context).then(auditResult => {
assert.equal(auditResult.score, 0);
expect(auditResult.explanation)
.toBeDisplayString('Points to a different domain (https://example.com/)');
});
});

it('passes when canonical points to the root while current URL is also the root', async () => {
const finalUrl = 'https://example.com/';
const mainResource = {
Expand Down
3 changes: 0 additions & 3 deletions shared/localization/locales/ar-XB.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/ar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/bg.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/ca.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/cs.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/da.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/de.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/el.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/en-GB.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/en-US.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/en-XA.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/en-XL.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/es-419.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/es.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/fi.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/fil.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/fr.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/he.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/hi.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/hr.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/hu.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/id.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/it.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/ja.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/ko.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/lt.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/lv.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/nl.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/no.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/pl.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/pt-PT.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/pt.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/ro.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/ru.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading