Skip to content

Commit a532c95

Browse files
authored
Browser popup block is obtrusive when refreshing the page with the process explorer open (fix microsoft#250469) (microsoft#250618)
* Browser popup block is obtrusive when refreshing the page with the process explorer open (fix microsoft#250469) * fix ci * fix ci
1 parent 9188649 commit a532c95

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

src/vs/workbench/browser/window.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { CodeWindow, isAuxiliaryWindow, mainWindow } from '../../base/browser/wi
3131
import { createSingleCallFunction } from '../../base/common/functional.js';
3232
import { IConfigurationService } from '../../platform/configuration/common/configuration.js';
3333
import { IWorkbenchEnvironmentService } from '../services/environment/common/environmentService.js';
34+
import { MarkdownString } from '../../base/common/htmlContent.js';
3435

3536
export abstract class BaseWindow extends Disposable {
3637

@@ -339,16 +340,14 @@ export class BrowserWindow extends BaseWindow {
339340
if (!opened) {
340341
await this.dialogService.prompt({
341342
type: Severity.Warning,
342-
message: localize('unableToOpenExternal', "The browser interrupted the opening of a new tab or window. Press 'Open' to open it anyway."),
343-
detail: href,
343+
message: localize('unableToOpenExternal', "The browser blocked opening a new tab or window. Press 'Retry' to try again."),
344+
custom: {
345+
markdownDetails: [{ markdown: new MarkdownString(localize('unableToOpenWindowDetail', "Please allow pop-ups for this website in your [browser settings]({0}).", 'https://aka.ms/allow-vscode-popup'), true) }]
346+
},
344347
buttons: [
345348
{
346-
label: localize({ key: 'open', comment: ['&& denotes a mnemonic'] }, "&&Open"),
349+
label: localize({ key: 'retry', comment: ['&& denotes a mnemonic'] }, "&&Retry"),
347350
run: () => isAllowedOpener ? windowOpenPopup(href) : windowOpenNoOpener(href)
348-
},
349-
{
350-
label: localize({ key: 'learnMore', comment: ['&& denotes a mnemonic'] }, "&&Learn More"),
351-
run: () => this.openerService.open(URI.parse('https://aka.ms/allow-vscode-popup'))
352351
}
353352
],
354353
cancelButton: true

src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { coalesce } from '../../../../base/common/arrays.js';
1111
import { Barrier } from '../../../../base/common/async.js';
1212
import { onUnexpectedError } from '../../../../base/common/errors.js';
1313
import { Emitter, Event } from '../../../../base/common/event.js';
14+
import { MarkdownString } from '../../../../base/common/htmlContent.js';
1415
import { Disposable, DisposableStore, IDisposable, toDisposable } from '../../../../base/common/lifecycle.js';
1516
import { mark } from '../../../../base/common/performance.js';
1617
import { isFirefox, isWeb } from '../../../../base/common/platform.js';
@@ -360,8 +361,10 @@ export class BrowserAuxiliaryWindowService extends Disposable implements IAuxili
360361
if (!auxiliaryWindow && isWeb) {
361362
return (await this.dialogService.prompt({
362363
type: Severity.Warning,
363-
message: localize('unableToOpenWindow', "The browser interrupted the opening of a new window. Press 'Retry' to try again."),
364-
detail: localize('unableToOpenWindowDetail', "To avoid this problem in the future, please ensure to allow popups for this website."),
364+
message: localize('unableToOpenWindow', "The browser blocked opening a new window. Press 'Retry' to try again."),
365+
custom: {
366+
markdownDetails: [{ markdown: new MarkdownString(localize('unableToOpenWindowDetail', "Please allow pop-ups for this website in your [browser settings]({0}).", 'https://aka.ms/allow-vscode-popup'), true) }]
367+
},
365368
buttons: [
366369
{
367370
label: localize({ key: 'retry', comment: ['&& denotes a mnemonic'] }, "&&Retry"),

src/vs/workbench/services/host/browser/browserHostService.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { isIOS, isMacintosh } from '../../../../base/common/platform.js';
4242
import { IUserDataProfilesService } from '../../../../platform/userDataProfile/common/userDataProfile.js';
4343
import { URI } from '../../../../base/common/uri.js';
4444
import { VSBuffer } from '../../../../base/common/buffer.js';
45+
import { MarkdownString } from '../../../../base/common/htmlContent.js';
4546

4647
enum HostShutdownReason {
4748

@@ -80,7 +81,7 @@ export class BrowserHostService extends Disposable implements IHostService {
8081
@ILogService private readonly logService: ILogService,
8182
@IDialogService private readonly dialogService: IDialogService,
8283
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
83-
@IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService,
84+
@IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService
8485
) {
8586
super();
8687

@@ -497,14 +498,22 @@ export class BrowserHostService extends Disposable implements IHostService {
497498

498499
const opened = await this.workspaceProvider.open(workspace, options);
499500
if (!opened) {
500-
const { confirmed } = await this.dialogService.confirm({
501+
await this.dialogService.prompt({
501502
type: Severity.Warning,
502-
message: localize('unableToOpenExternal', "The browser interrupted the opening of a new tab or window. Press 'Open' to open it anyway."),
503-
primaryButton: localize({ key: 'open', comment: ['&& denotes a mnemonic'] }, "&&Open")
503+
message: workspace ?
504+
localize('unableToOpenExternalWorkspace', "The browser blocked opening a new tab or window for '{0}'. Press 'Retry' to try again.", this.getRecentLabel(workspace)) :
505+
localize('unableToOpenExternal', "The browser blocked opening a new tab or window. Press 'Retry' to try again."),
506+
custom: {
507+
markdownDetails: [{ markdown: new MarkdownString(localize('unableToOpenWindowDetail', "Please allow pop-ups for this website in your [browser settings]({0}).", 'https://aka.ms/allow-vscode-popup'), true) }]
508+
},
509+
buttons: [
510+
{
511+
label: localize({ key: 'retry', comment: ['&& denotes a mnemonic'] }, "&&Retry"),
512+
run: () => this.workspaceProvider.open(workspace, options)
513+
}
514+
],
515+
cancelButton: true
504516
});
505-
if (confirmed) {
506-
await this.workspaceProvider.open(workspace, options);
507-
}
508517
}
509518
}
510519

0 commit comments

Comments
 (0)