Skip to content

Commit e46bf56

Browse files
amarjotgillDevtools-frontend LUCI CQ
authored andcommitted
[DevTools] Support base::feature for port and scheme OBC in DevTools UI
This feature will only be shown when kEnableSchemeBoundCookies or kEnablePortBoundCookies are enabled Corresponding Chromium CL: https://crrev.com/c/5980600 Bug: 375571828 Change-Id: I3ce60a22bfcb88ccc2c4b6b2b79df86ab5fb5bf0 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5979651 Reviewed-by: Jack Franklin <[email protected]> Commit-Queue: Amarjot Gill <[email protected]> Reviewed-by: Wolfgang Beyer <[email protected]>
1 parent bd344de commit e46bf56

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

front_end/core/host/InspectorFrontendHost.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,10 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
429429
devToolsPrivacyUI: {
430430
enabled: false,
431431
},
432+
devToolsEnableOriginBoundCookies: {
433+
portBindingEnabled: false,
434+
schemeBindingEnabled: false,
435+
},
432436
isOffTheRecord: false,
433437
};
434438
if ('hostConfigForTesting' in globalThis) {

front_end/core/root/Runtime.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,11 @@ export interface HostConfigPrivacyUI {
365365
enabled: boolean;
366366
}
367367

368+
export interface HostConfigEnableOriginBoundCookies {
369+
portBindingEnabled: boolean;
370+
schemeBindingEnabled: boolean;
371+
}
372+
368373
// We use `RecursivePartial` here to enforce that DevTools code is able to
369374
// handle `HostConfig` objects of an unexpected shape. This can happen if
370375
// the implementation in the Chromium backend is changed without correctly
@@ -386,6 +391,7 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
386391
* or guest mode, rather than a "normal" profile.
387392
*/
388393
isOffTheRecord: boolean,
394+
devToolsEnableOriginBoundCookies: HostConfigEnableOriginBoundCookies,
389395
}>;
390396

391397
/**

front_end/testing/EnvironmentHelpers.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,11 @@ export function getGetHostConfigStub(config: Root.Runtime.HostConfig): sinon.Sin
546546
enabled: false,
547547
...config.devToolsPrivacyUI,
548548
} as Root.Runtime.HostConfigPrivacyUI,
549+
devToolsEnableOriginBoundCookies: {
550+
portBindingEnabled: false,
551+
schemeBindingEnabled: false,
552+
...config.devToolsEnableOriginBoundCookies,
553+
} as Root.Runtime.HostConfigEnableOriginBoundCookies,
549554
isOffTheRecord: false,
550555
});
551556
}

front_end/ui/legacy/components/cookie_table/CookiesTable.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import * as Common from '../../../../core/common/common.js';
3636
import * as i18n from '../../../../core/i18n/i18n.js';
3737
import * as Platform from '../../../../core/platform/platform.js';
38-
import * as Root from '../../../../core/root/root.js';
3938
import * as SDK from '../../../../core/sdk/sdk.js';
4039
import * as Protocol from '../../../../generated/protocol.js';
4140
import * as IssuesManager from '../../../../models/issues_manager/issues_manager.js';
@@ -237,7 +236,8 @@ export class CookiesTable extends UI.Widget.VBox {
237236
},
238237
] as DataGrid.DataGrid.ColumnDescriptor[];
239238

240-
if (Root.Runtime.experiments.isEnabled('experimental-cookie-features')) {
239+
const config = Common.Settings.Settings.instance().getHostConfig();
240+
if (config.devToolsEnableOriginBoundCookies?.schemeBindingEnabled) {
241241
const additionalColumns = [
242242
{
243243
id: SDK.Cookie.Attribute.SOURCE_SCHEME,
@@ -247,6 +247,11 @@ export class CookiesTable extends UI.Widget.VBox {
247247
weight: 7,
248248
editable,
249249
},
250+
] as DataGrid.DataGrid.ColumnDescriptor[];
251+
columns.push(...additionalColumns);
252+
}
253+
if (config.devToolsEnableOriginBoundCookies?.portBindingEnabled) {
254+
const additionalColumns = [
250255
{
251256
id: SDK.Cookie.Attribute.SOURCE_PORT,
252257
title: 'SourcePort',

0 commit comments

Comments
 (0)