From 226d2bf4d76afa47ed3085ba37e35c8d51d6e902 Mon Sep 17 00:00:00 2001 From: Filipa Senra Date: Thu, 26 Jan 2023 16:51:26 +0000 Subject: [PATCH] [Privacy Sandbox] Add PSExtensionsAPI message for deprecation issue This CL ads the deprecation message and milestone to be shown when the PrivacyExtensionsAPI shows up on the Issues DevTools Panel. See http://go/cl-c/4166933 and http://go/cl-c/4171292 for context. Bug: 1378703, b/254414152 Change-Id: Ifd4502a895a7fbfff04a1025054922b08b9295ab Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4171293 Commit-Queue: Filipa Senra Reviewed-by: Danil Somsikov --- .../models/issues_manager/DeprecationIssue.ts | 16 ++++++ .../markdown_view/MarkdownLinksMap.ts | 4 ++ test/e2e/issues/BUILD.gn | 1 + .../privacy-sandbox-extensions-api_test.ts | 52 +++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 test/e2e/issues/privacy-sandbox-extensions-api_test.ts diff --git a/front_end/models/issues_manager/DeprecationIssue.ts b/front_end/models/issues_manager/DeprecationIssue.ts index 7c694d42d9..02fa1dab01 100644 --- a/front_end/models/issues_manager/DeprecationIssue.ts +++ b/front_end/models/issues_manager/DeprecationIssue.ts @@ -396,6 +396,18 @@ const UIStrings = { */ overflowVisibleOnReplacedElement: 'Specifying `overflow: visible` on img, video and canvas tags may cause them to produce visual content outside of the element bounds. See https://github.com/WICG/shared-element-transitions/blob/main/debugging_overflow_on_images.md.', + /** + * @description Warning displayed to developers that the API + * `chrome.privacy.websites.privacySandboxEnabled` is being deprecated in + * favour of three new more granular APIs: topicsEnabled, FledgeEnabled and + * adMeasurementEnabled. The `privacySandboxEnabled` API allowed extensions to + * control the homologous Chrome Setting. The existing Chrome Setting for + * Privacy Sandbox is also going away in favor of more granular settings that + * are matched by the new extensions APIs- topicsEnabled, FledgeEnabled and + * adMeasurementEnabled. + */ + privacySandboxExtensionsAPI: + 'We’re deprecating the API `chrome.privacy.websites.privacySandboxEnabled`, though it will remain active for backward compatibility until release M113. Instead, please use `chrome.privacy.websites.topicsEnabled`, `chrome.privacy.websites.fledgeEnabled` and `chrome.privacy.websites.adMeasurementEnabled`. See https://developer.chrome.com/docs/extensions/reference/privacy/#property-websites-privacySandboxEnabled.', }; // clang-format on const str_ = i18n.i18n.registerUIStrings('models/issues_manager/DeprecationIssue.ts', UIStrings); @@ -599,6 +611,10 @@ export class DeprecationIssue extends Issue { UIStrings.deprecatedWithReplacement, {PH1: 'HTMLVideoElement.webkitSupportsFullscreen', PH2: 'Document.fullscreenEnabled'}); break; + case Protocol.Audits.DeprecationIssueType.PrivacySandboxExtensionsAPI: + messageFunction = i18nLazyString(UIStrings.privacySandboxExtensionsAPI); + milestone = 113; + break; case Protocol.Audits.DeprecationIssueType.RangeExpand: messageFunction = i18nLazyString(UIStrings.deprecatedWithReplacement, {PH1: 'Range.expand()', PH2: 'Selection.modify()'}); diff --git a/front_end/ui/components/markdown_view/MarkdownLinksMap.ts b/front_end/ui/components/markdown_view/MarkdownLinksMap.ts index 00dd4454ec..2e172c09f5 100644 --- a/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +++ b/front_end/ui/components/markdown_view/MarkdownLinksMap.ts @@ -45,6 +45,10 @@ export const markdownLinks = new Map([ 'https://github.com/WICG/shared-element-transitions/blob/main/debugging_overflow_on_images.md', 'https://github.com/WICG/shared-element-transitions/blob/main/debugging_overflow_on_images.md', ], + [ + 'https://developer.chrome.com/docs/extensions/reference/privacy/#property-websites-privacySandboxEnabled', + 'https://developer.chrome.com/docs/extensions/reference/privacy/#property-websites-privacySandboxEnabled', + ], ]); export const getMarkdownLink = (key: string): string => { diff --git a/test/e2e/issues/BUILD.gn b/test/e2e/issues/BUILD.gn index 1b6ce2f0a1..bf908016cd 100644 --- a/test/e2e/issues/BUILD.gn +++ b/test/e2e/issues/BUILD.gn @@ -25,6 +25,7 @@ node_ts_library("issues") { "issue-view-reparent_test.ts", "low-text-contrast-issues_test.ts", "navigator-user-agent-issues_test.ts", + "privacy-sandbox-extensions-api_test.ts", "quirks-mode-issues_test.ts", "quota-issues_test.ts", "report-only_test.ts", diff --git a/test/e2e/issues/privacy-sandbox-extensions-api_test.ts b/test/e2e/issues/privacy-sandbox-extensions-api_test.ts new file mode 100644 index 0000000000..ff2b3d1b14 --- /dev/null +++ b/test/e2e/issues/privacy-sandbox-extensions-api_test.ts @@ -0,0 +1,52 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {assertNotNullOrUndefined, getBrowserAndPages, goToResource} from '../../shared/helper.js'; +import {describe, it} from '../../shared/mocha-extensions.js'; +import { + ensureResourceSectionIsExpanded, + expandIssue, + getIssueByTitle, + getResourcesElement, + navigateToIssuesTab, + waitForTableFromResourceSectionContents, +} from '../helpers/issues-helpers.js'; + +describe('Privacy Sandbox Extensions API', async () => { + beforeEach(async () => { + await goToResource('empty.html'); + }); + + it('should report privacy sandbox extensions api deprecation issues', async () => { + await navigateToIssuesTab(); + const {frontend} = getBrowserAndPages(); + frontend.evaluate(() => { + const issue = { + code: 'DeprecationIssue', + details: { + deprecationIssueDetails: { + sourceCodeLocation: { + url: 'empty.html', + lineNumber: 1, + columnNumber: 1, + }, + type: 'PrivacySandboxExtensionsAPI', + }, + }, + }; + // @ts-ignore + window.addIssueForTest(issue); + }); + + await expandIssue(); + const issueElement = await getIssueByTitle('Deprecated Feature Used'); + assertNotNullOrUndefined(issueElement); + const section = await getResourcesElement('1 source', issueElement, '.affected-resource-label'); + await ensureResourceSectionIsExpanded(section); + const expectedTableRows = [ + ['empty.html:2'], + ]; + await waitForTableFromResourceSectionContents(section.content, expectedTableRows); + }); +});