Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/vs
diff options
context:
space:
mode:
authorBenjamin Pasero <benjamin.pasero@microsoft.com>2022-07-13 12:56:15 +0300
committerGitHub <noreply@github.com>2022-07-13 12:56:15 +0300
commit4404dc63561a286e13f9ba5a669e5403a367425a (patch)
treee6fb6436cbf94d4f26271f84281e0292e98e6cfb /src/vs
parent5737c7eea15e195edde1e9228238cddbf3e93c1d (diff)
Explorer: cannot copy paste anymore to duplicate file with sandbox enabled (fix #154820) (#155044)
* Explorer: cannot copy paste anymore to duplicate file with sandbox enabled (fix #154820) * skip smudge!
Diffstat (limited to 'src/vs')
-rw-r--r--src/vs/base/parts/sandbox/electron-browser/preload.js8
-rw-r--r--src/vs/platform/native/common/native.ts5
-rw-r--r--src/vs/platform/native/electron-main/nativeHostMainService.ts9
-rw-r--r--src/vs/workbench/services/clipboard/electron-sandbox/clipboardService.ts6
-rw-r--r--src/vs/workbench/test/electron-browser/workbenchTestServices.ts5
5 files changed, 18 insertions, 15 deletions
diff --git a/src/vs/base/parts/sandbox/electron-browser/preload.js b/src/vs/base/parts/sandbox/electron-browser/preload.js
index 3e25c4097f1..53e38ce14c2 100644
--- a/src/vs/base/parts/sandbox/electron-browser/preload.js
+++ b/src/vs/base/parts/sandbox/electron-browser/preload.js
@@ -145,7 +145,7 @@
/**
* @param {string} channel
* @param {any[]} args
- * @returns {Promise<any> | undefined}
+ * @returns {Promise<any> | never}
*/
invoke(channel, ...args) {
if (validateIPC(channel)) {
@@ -156,7 +156,7 @@
/**
* @param {string} channel
* @param {(event: IpcRendererEvent, ...args: any[]) => void} listener
- * @returns {IpcRenderer}
+ * @returns {IpcRenderer | never}
*/
on(channel, listener) {
if (validateIPC(channel)) {
@@ -169,7 +169,7 @@
/**
* @param {string} channel
* @param {(event: IpcRendererEvent, ...args: any[]) => void} listener
- * @returns {IpcRenderer}
+ * @returns {IpcRenderer | never}
*/
once(channel, listener) {
if (validateIPC(channel)) {
@@ -182,7 +182,7 @@
/**
* @param {string} channel
* @param {(event: IpcRendererEvent, ...args: any[]) => void} listener
- * @returns {IpcRenderer}
+ * @returns {IpcRenderer | never}
*/
removeListener(channel, listener) {
if (validateIPC(channel)) {
diff --git a/src/vs/platform/native/common/native.ts b/src/vs/platform/native/common/native.ts
index 5f6937e8655..5698299eb3c 100644
--- a/src/vs/platform/native/common/native.ts
+++ b/src/vs/platform/native/common/native.ts
@@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
+import { VSBuffer } from 'vs/base/common/buffer';
import { Event } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
import { MessageBoxOptions, MessageBoxReturnValue, MouseInputEvent, OpenDevToolsOptions, OpenDialogOptions, OpenDialogReturnValue, SaveDialogOptions, SaveDialogReturnValue } from 'vs/base/parts/sandbox/common/electronTypes';
@@ -121,8 +122,8 @@ export interface ICommonNativeHostService {
writeClipboardText(text: string, type?: 'selection' | 'clipboard'): Promise<void>;
readClipboardFindText(): Promise<string>;
writeClipboardFindText(text: string): Promise<void>;
- writeClipboardBuffer(format: string, buffer: Uint8Array, type?: 'selection' | 'clipboard'): Promise<void>;
- readClipboardBuffer(format: string): Promise<Uint8Array>;
+ writeClipboardBuffer(format: string, buffer: VSBuffer, type?: 'selection' | 'clipboard'): Promise<void>;
+ readClipboardBuffer(format: string): Promise<VSBuffer>;
hasClipboard(format: string, type?: 'selection' | 'clipboard'): Promise<boolean>;
// macOS Touchbar
diff --git a/src/vs/platform/native/electron-main/nativeHostMainService.ts b/src/vs/platform/native/electron-main/nativeHostMainService.ts
index 639c6cfa063..3cfca907766 100644
--- a/src/vs/platform/native/electron-main/nativeHostMainService.ts
+++ b/src/vs/platform/native/electron-main/nativeHostMainService.ts
@@ -39,6 +39,7 @@ import { IColorScheme, IOpenedWindow, IOpenEmptyWindowOptions, IOpenWindowOption
import { IWindowsMainService, OpenContext } from 'vs/platform/windows/electron-main/windows';
import { isWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
import { IWorkspacesManagementMainService } from 'vs/platform/workspaces/electron-main/workspacesManagementMainService';
+import { VSBuffer } from 'vs/base/common/buffer';
export interface INativeHostMainService extends AddFirstParameterToFunctions<ICommonNativeHostService, Promise<unknown> /* only methods, not events */, number | undefined /* window ID */> { }
@@ -603,12 +604,12 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
return clipboard.writeFindText(text);
}
- async writeClipboardBuffer(windowId: number | undefined, format: string, buffer: Uint8Array, type?: 'selection' | 'clipboard'): Promise<void> {
- return clipboard.writeBuffer(format, Buffer.from(buffer), type);
+ async writeClipboardBuffer(windowId: number | undefined, format: string, buffer: VSBuffer, type?: 'selection' | 'clipboard'): Promise<void> {
+ return clipboard.writeBuffer(format, Buffer.from(buffer.buffer), type);
}
- async readClipboardBuffer(windowId: number | undefined, format: string): Promise<Uint8Array> {
- return clipboard.readBuffer(format);
+ async readClipboardBuffer(windowId: number | undefined, format: string): Promise<VSBuffer> {
+ return VSBuffer.wrap(clipboard.readBuffer(format));
}
async hasClipboard(windowId: number | undefined, format: string, type?: 'selection' | 'clipboard'): Promise<boolean> {
diff --git a/src/vs/workbench/services/clipboard/electron-sandbox/clipboardService.ts b/src/vs/workbench/services/clipboard/electron-sandbox/clipboardService.ts
index 8e3f25df564..326d09c3a37 100644
--- a/src/vs/workbench/services/clipboard/electron-sandbox/clipboardService.ts
+++ b/src/vs/workbench/services/clipboard/electron-sandbox/clipboardService.ts
@@ -56,11 +56,11 @@ export class NativeClipboardService implements IClipboardService {
return this.nativeHostService.hasClipboard(NativeClipboardService.FILE_FORMAT);
}
- private resourcesToBuffer(resources: URI[]): Uint8Array {
- return VSBuffer.fromString(resources.map(r => r.toString()).join('\n')).buffer;
+ private resourcesToBuffer(resources: URI[]): VSBuffer {
+ return VSBuffer.fromString(resources.map(r => r.toString()).join('\n'));
}
- private bufferToResources(buffer: Uint8Array): URI[] {
+ private bufferToResources(buffer: VSBuffer): URI[] {
if (!buffer) {
return [];
}
diff --git a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts
index 3a35d0f4018..f4fce1346e2 100644
--- a/src/vs/workbench/test/electron-browser/workbenchTestServices.ts
+++ b/src/vs/workbench/test/electron-browser/workbenchTestServices.ts
@@ -54,6 +54,7 @@ import { joinPath } from 'vs/base/common/resources';
import { UserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfileService';
import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { UriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentityService';
+import { VSBuffer } from 'vs/base/common/buffer';
const args = parseArgs(process.argv, OPTIONS);
@@ -272,8 +273,8 @@ export class TestNativeHostService implements INativeHostService {
async writeClipboardText(text: string, type?: 'selection' | 'clipboard' | undefined): Promise<void> { }
async readClipboardFindText(): Promise<string> { return ''; }
async writeClipboardFindText(text: string): Promise<void> { }
- async writeClipboardBuffer(format: string, buffer: Uint8Array, type?: 'selection' | 'clipboard' | undefined): Promise<void> { }
- async readClipboardBuffer(format: string): Promise<Uint8Array> { return Uint8Array.from([]); }
+ async writeClipboardBuffer(format: string, buffer: VSBuffer, type?: 'selection' | 'clipboard' | undefined): Promise<void> { }
+ async readClipboardBuffer(format: string): Promise<VSBuffer> { return VSBuffer.wrap(Uint8Array.from([])); }
async hasClipboard(format: string, type?: 'selection' | 'clipboard' | undefined): Promise<boolean> { return false; }
async sendInputEvent(event: MouseInputEvent): Promise<void> { }
async windowsGetStringRegKey(hive: 'HKEY_CURRENT_USER' | 'HKEY_LOCAL_MACHINE' | 'HKEY_CLASSES_ROOT' | 'HKEY_USERS' | 'HKEY_CURRENT_CONFIG', path: string, name: string): Promise<string | undefined> { return undefined; }