Skip to content

Commit 2a299bb

Browse files
author
Benjamin Pasero
committed
tweak d.ts to avoid security and deprecation pitfalls
1 parent 1845bc3 commit 2a299bb

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/typings/electron.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6374,7 +6374,7 @@ declare namespace Electron {
63746374
* When this attribute is present the guest page will be allowed to open new
63756375
* windows. Popups are disabled by default.
63766376
*/
6377-
allowpopups?: string;
6377+
// allowpopups?: string; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ###
63786378
/**
63796379
* When this attribute is present the webview container will automatically resize
63806380
* within the bounds specified by the attributes minwidth, minheight, maxwidth, and
@@ -6407,7 +6407,7 @@ declare namespace Electron {
64076407
* When this attribute is present the guest page will have web security disabled.
64086408
* Web security is enabled by default.
64096409
*/
6410-
disablewebsecurity?: string;
6410+
// disablewebsecurity?: string; ### VSCODE CHANGE(https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ###
64116411
/**
64126412
* A value that links the webview to a specific webContents. When a webview first
64136413
* loads a new webContents is created and this attribute is set to its instance
@@ -8633,12 +8633,12 @@ declare namespace Electron {
86338633
* websites by people), and set allowRunningInsecureContent to true if this options
86348634
* has not been set by user. Default is true.
86358635
*/
8636-
webSecurity?: boolean;
8636+
// webSecurity?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ###
86378637
/**
86388638
* Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
86398639
* false.
86408640
*/
8641-
allowRunningInsecureContent?: boolean;
8641+
// allowRunningInsecureContent?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ###
86428642
/**
86438643
* Enables image support. Default is true.
86448644
*/
@@ -8662,7 +8662,7 @@ declare namespace Electron {
86628662
/**
86638663
* Enables Chromium's experimental features. Default is false.
86648664
*/
8665-
experimentalFeatures?: boolean;
8665+
// experimentalFeatures?: boolean; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ###
86668666
/**
86678667
* Enables Chromium's experimental canvas features. Default is false.
86688668
*/

src/typings/node.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,39 +192,39 @@ declare var Buffer: {
192192
* @param str String to store in buffer.
193193
* @param encoding encoding to use, optional. Default is 'utf8'
194194
*/
195-
new(str: string, encoding?: string): Buffer;
195+
// new(str: string, encoding?: string): Buffer; ### VSCODE CHANGE (new Buffer() is deprecated)
196196
/**
197197
* Allocates a new buffer of {size} octets.
198198
*
199199
* @param size count of octets to allocate.
200200
*/
201-
new(size: number): Buffer;
201+
// new(size: number): Buffer; ### VSCODE CHANGE (new Buffer() is deprecated)
202202
/**
203203
* Allocates a new buffer containing the given {array} of octets.
204204
*
205205
* @param array The octets to store.
206206
*/
207-
new(array: Uint8Array): Buffer;
207+
// new(array: Uint8Array): Buffer; ### VSCODE CHANGE (new Buffer() is deprecated)
208208
/**
209209
* Produces a Buffer backed by the same allocated memory as
210210
* the given {ArrayBuffer}.
211211
*
212212
*
213213
* @param arrayBuffer The ArrayBuffer with which to share memory.
214214
*/
215-
new(arrayBuffer: ArrayBuffer): Buffer;
215+
// new(arrayBuffer: ArrayBuffer): Buffer; ### VSCODE CHANGE (new Buffer() is deprecated)
216216
/**
217217
* Allocates a new buffer containing the given {array} of octets.
218218
*
219219
* @param array The octets to store.
220220
*/
221-
new(array: any[]): Buffer;
221+
// new(array: any[]): Buffer; ### VSCODE CHANGE (new Buffer() is deprecated)
222222
/**
223223
* Copies the passed {buffer} data onto a new {Buffer} instance.
224224
*
225225
* @param buffer The buffer to copy.
226226
*/
227-
new(buffer: Buffer): Buffer;
227+
// new(buffer: Buffer): Buffer; ### VSCODE CHANGE (new Buffer() is deprecated)
228228
prototype: Buffer;
229229
/**
230230
* When passed a reference to the .buffer property of a TypedArray instance,

src/vs/platform/download/node/downloadIpc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class DownloadServiceChannelClient implements IDownloadService {
6969
out.end();
7070
disposable.dispose();
7171
c(null);
72-
} else if (result instanceof Buffer) {
72+
} else if (Buffer.isBuffer(result)) {
7373
out.write(result);
7474
} else if (typeof result === 'string') {
7575
out.close();

0 commit comments

Comments
 (0)