豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit e0d71e8

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
Use UIHelper to open link
Let the helper handle all the logic as it's tested, so if anything changes we can handle it in one place. Bug: none Change-Id: I10f300c620105acb95966da9338e9632cc27ee18 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7648889 Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org> Commit-Queue: Natallia Harshunova <nharshunova@chromium.org> Reviewed-by: Natallia Harshunova <nharshunova@chromium.org>
1 parent 9d16987 commit e0d71e8

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

front_end/panels/settings/components/SyncSection.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import * as Common from '../../../core/common/common.js';
1010
import * as Host from '../../../core/host/host.js';
1111
import * as i18n from '../../../core/i18n/i18n.js';
1212
import type * as Platform from '../../../core/platform/platform.js';
13-
import * as SDK from '../../../core/sdk/sdk.js';
1413
import * as Badges from '../../../models/badges/badges.js';
1514
import * as Buttons from '../../../ui/components/buttons/buttons.js';
1615
import type * as SettingsComponents from '../../../ui/components/settings/settings.js';
16+
import * as UIHelpers from '../../../ui/helpers/helpers.js';
1717
import * as UI from '../../../ui/legacy/legacy.js';
1818
import * as Lit from '../../../ui/lit/lit.js';
1919
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
@@ -343,19 +343,10 @@ export class SyncSection extends UI.Widget.Widget {
343343
}
344344

345345
#onWarningClick(event: Event): void {
346-
const rootTarget = SDK.TargetManager.TargetManager.instance().rootTarget();
347-
if (rootTarget === null) {
348-
return;
349-
}
350346
// TODO: investigate if /advance link is alive
351-
const warningLink = !this.#syncInfo.isSyncActive ?
352-
('chrome://settings/syncSetup' as Platform.DevToolsPath.UrlString) :
353-
('chrome://settings/syncSetup/advanced' as Platform.DevToolsPath.UrlString);
354-
void rootTarget.targetAgent().invoke_createTarget({url: warningLink}).then(result => {
355-
if (result.getError()) {
356-
Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(warningLink);
357-
}
358-
});
347+
const warningLink =
348+
this.#syncInfo.isSyncActive ? 'chrome://settings/syncSetup/advanced' : 'chrome://settings/syncSetup';
349+
UIHelpers.openInNewTab(warningLink);
359350
event.consume();
360351
}
361352

0 commit comments

Comments
 (0)