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
diff options
context:
space:
mode:
-rw-r--r--.yarnrc2
-rw-r--r--cgmanifest.json12
-rw-r--r--remote/.yarnrc2
-rw-r--r--resources/linux/code-url-handler.desktop2
-rw-r--r--resources/linux/code.desktop4
-rwxr-xr-xscripts/test-integration.sh2
-rwxr-xr-xscripts/test.sh2
-rw-r--r--src/bootstrap.js18
-rw-r--r--src/main.js7
-rw-r--r--src/typings/electron.d.ts1739
-rw-r--r--src/vs/base/parts/contextmenu/electron-main/contextmenu.ts2
-rw-r--r--src/vs/code/electron-main/app.ts2
-rw-r--r--src/vs/code/electron-main/window.ts2
-rw-r--r--src/vs/code/node/cli.ts6
-rw-r--r--src/vs/platform/dialogs/electron-main/dialogs.ts52
-rw-r--r--src/vs/platform/dialogs/node/dialogs.ts13
-rw-r--r--src/vs/platform/electron/electron-main/electronMainService.ts4
-rw-r--r--src/vs/platform/electron/node/electron.ts4
-rw-r--r--src/vs/platform/issue/electron-main/issueMainService.ts2
-rw-r--r--src/vs/platform/launch/electron-main/launchMainService.ts2
-rw-r--r--src/vs/platform/menubar/electron-main/menubar.ts4
-rw-r--r--src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts2
-rw-r--r--src/vs/workbench/contrib/webview/electron-browser/pre/electron-index.js9
-rw-r--r--src/vs/workbench/services/dialogs/electron-browser/fileDialogService.ts4
-rw-r--r--src/vs/workbench/test/workbenchTestServices.ts14
-rw-r--r--test/electron/index.js15
26 files changed, 550 insertions, 1377 deletions
diff --git a/.yarnrc b/.yarnrc
index e49da7f447d..ff946c7a250 100644
--- a/.yarnrc
+++ b/.yarnrc
@@ -1,3 +1,3 @@
disturl "https://atom.io/download/electron"
-target "6.0.9"
+target "4.2.10"
runtime "electron"
diff --git a/cgmanifest.json b/cgmanifest.json
index 8e8fc3484ff..d26f37b6204 100644
--- a/cgmanifest.json
+++ b/cgmanifest.json
@@ -6,7 +6,7 @@
"git": {
"name": "chromium",
"repositoryUrl": "https://chromium.googlesource.com/chromium/src",
- "commitHash": "91f08db83c2ce8c722ddf0911ead8f7c473bedfa"
+ "commitHash": "c6a08e5368de4352903e702cde750b33239a50ab"
}
},
"licenseDetail": [
@@ -40,7 +40,7 @@
"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
],
"isOnlyProductionDependency": true,
- "version": "76.0.3809.146"
+ "version": "69.0.3497.128"
},
{
"component": {
@@ -48,11 +48,11 @@
"git": {
"name": "nodejs",
"repositoryUrl": "https://github.com/nodejs/node",
- "commitHash": "64219741218aa87e259cf8257596073b8e747f0a"
+ "commitHash": "8c70b2084ce5f76ea1e3b3c4ccdeee4483fe338b"
}
},
"isOnlyProductionDependency": true,
- "version": "12.4.0"
+ "version": "10.11.0"
},
{
"component": {
@@ -60,12 +60,12 @@
"git": {
"name": "electron",
"repositoryUrl": "https://github.com/electron/electron",
- "commitHash": "407747b48c47cdeed156a73dde1c47609470c95a"
+ "commitHash": "4e4c7527c63fcf27dffaeb58bde996b8d859c0ed"
}
},
"isOnlyProductionDependency": true,
"license": "MIT",
- "version": "6.0.9"
+ "version": "4.2.10"
},
{
"component": {
diff --git a/remote/.yarnrc b/remote/.yarnrc
index 1e16cde724c..b28191e6bae 100644
--- a/remote/.yarnrc
+++ b/remote/.yarnrc
@@ -1,3 +1,3 @@
disturl "http://nodejs.org/dist"
-target "12.4.0"
+target "10.11.0"
runtime "node"
diff --git a/resources/linux/code-url-handler.desktop b/resources/linux/code-url-handler.desktop
index b85525fbd04..7106e0e0969 100644
--- a/resources/linux/code-url-handler.desktop
+++ b/resources/linux/code-url-handler.desktop
@@ -2,7 +2,7 @@
Name=@@NAME_LONG@@ - URL Handler
Comment=Code Editing. Redefined.
GenericName=Text Editor
-Exec=@@EXEC@@ --no-sandbox --open-url %U
+Exec=@@EXEC@@ --open-url %U
Icon=@@ICON@@
Type=Application
NoDisplay=true
diff --git a/resources/linux/code.desktop b/resources/linux/code.desktop
index b975e1094a2..1273bb2db7c 100644
--- a/resources/linux/code.desktop
+++ b/resources/linux/code.desktop
@@ -2,7 +2,7 @@
Name=@@NAME_LONG@@
Comment=Code Editing. Redefined.
GenericName=Text Editor
-Exec=@@EXEC@@ --no-sandbox --unity-launch %F
+Exec=@@EXEC@@ --unity-launch %F
Icon=@@ICON@@
Type=Application
StartupNotify=false
@@ -14,5 +14,5 @@ Keywords=vscode;
[Desktop Action new-empty-window]
Name=New Empty Window
-Exec=@@EXEC@@ --no-sandbox --new-window %F
+Exec=@@EXEC@@ --new-window %F
Icon=@@ICON@@
diff --git a/scripts/test-integration.sh b/scripts/test-integration.sh
index 2c3a571ffc7..df6219221b7 100755
--- a/scripts/test-integration.sh
+++ b/scripts/test-integration.sh
@@ -8,7 +8,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else
ROOT=$(dirname $(dirname $(readlink -f $0)))
VSCODEUSERDATADIR=`mktemp -d 2>/dev/null`
- LINUX_NO_SANDBOX="--no-sandbox" # Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox.
+ LINUX_NO_SANDBOX=""
fi
cd $ROOT
diff --git a/scripts/test.sh b/scripts/test.sh
index 630af4e53e5..e1ed5aa65c7 100755
--- a/scripts/test.sh
+++ b/scripts/test.sh
@@ -34,5 +34,5 @@ else
cd $ROOT ; \
ELECTRON_ENABLE_LOGGING=1 \
"$CODE" \
- test/electron/index.js --no-sandbox "$@" # Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox.
+ test/electron/index.js "$@"
fi
diff --git a/src/bootstrap.js b/src/bootstrap.js
index bd1aa29cebe..3aeaa72e3b1 100644
--- a/src/bootstrap.js
+++ b/src/bootstrap.js
@@ -21,7 +21,6 @@ process.on('SIGPIPE', () => {
//#endregion
//#region Add support for redirecting the loading of node modules
-
exports.injectNodeModuleLookupPath = function (injectPath) {
if (!injectPath) {
throw new Error('Missing injectPath');
@@ -37,8 +36,10 @@ exports.injectNodeModuleLookupPath = function (injectPath) {
const originalResolveLookupPaths = Module._resolveLookupPaths;
// @ts-ignore
- Module._resolveLookupPaths = function (moduleName, parent) {
- const paths = originalResolveLookupPaths(moduleName, parent);
+ Module._resolveLookupPaths = function (moduleName, parent, newReturn) {
+ const result = originalResolveLookupPaths(moduleName, parent, newReturn);
+
+ const paths = newReturn ? result : result[1];
for (let i = 0, len = paths.length; i < len; i++) {
if (paths[i] === nodeModulesPath) {
paths.splice(i, 0, injectPath);
@@ -46,7 +47,7 @@ exports.injectNodeModuleLookupPath = function (injectPath) {
}
}
- return paths;
+ return result;
};
};
//#endregion
@@ -70,10 +71,11 @@ exports.enableASARSupport = function (nodeModulesPath) {
// @ts-ignore
const originalResolveLookupPaths = Module._resolveLookupPaths;
-
// @ts-ignore
- Module._resolveLookupPaths = function (request, parent) {
- const paths = originalResolveLookupPaths(request, parent);
+ Module._resolveLookupPaths = function (request, parent, newReturn) {
+ const result = originalResolveLookupPaths(request, parent, newReturn);
+
+ const paths = newReturn ? result : result[1];
for (let i = 0, len = paths.length; i < len; i++) {
if (paths[i] === NODE_MODULES_PATH) {
paths.splice(i, 0, NODE_MODULES_ASAR_PATH);
@@ -81,7 +83,7 @@ exports.enableASARSupport = function (nodeModulesPath) {
}
}
- return paths;
+ return result;
};
};
//#endregion
diff --git a/src/main.js b/src/main.js
index ea852b1a406..4b0be14bf99 100644
--- a/src/main.js
+++ b/src/main.js
@@ -17,7 +17,7 @@ const paths = require('./paths');
// @ts-ignore
const product = require('../product.json');
// @ts-ignore
-const { app, protocol } = require('electron');
+const app = require('electron').app;
// Enable portable support
const portable = bootstrap.configurePortable();
@@ -33,11 +33,6 @@ app.setPath('userData', userDataPath);
// Update cwd based on environment and platform
setCurrentWorkingDirectory();
-// Register custom schemes with privileges
-protocol.registerSchemesAsPrivileged([
- { scheme: 'vscode-resource', privileges: { secure: true, supportFetchAPI: true, corsEnabled: true } }
-]);
-
// Global app listeners
registerListeners();
diff --git a/src/typings/electron.d.ts b/src/typings/electron.d.ts
index 3e55cdc4bf1..6f44785756c 100644
--- a/src/typings/electron.d.ts
+++ b/src/typings/electron.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for Electron 6.0.9
+// Type definitions for Electron 4.2.10
// Project: http://electronjs.org/
// Definitions by: The Electron Team <https://github.com/electron/electron>
// Definitions: https://github.com/electron/electron-typescript-definitions
@@ -8,7 +8,6 @@
type GlobalEvent = Event;
declare namespace Electron {
- // TODO: Replace this declaration with NodeJS.EventEmitter
class EventEmitter {
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
@@ -22,17 +21,28 @@ declare namespace Electron {
listenerCount(type: string): number;
prependListener(event: string, listener: Function): this;
prependOnceListener(event: string, listener: Function): this;
- eventNames(): Array<(string | symbol)>;
+ eventNames(): string[];
}
class Accelerator extends String {
}
+ interface Event extends GlobalEvent {
+ preventDefault: () => void;
+ sender: WebContents;
+ returnValue: any;
+ ctrlKey?: boolean;
+ metaKey?: boolean;
+ shiftKey?: boolean;
+ altKey?: boolean;
+ }
+
interface CommonInterface {
clipboard: Clipboard;
crashReporter: CrashReporter;
nativeImage: typeof NativeImage;
+ screen: Screen;
shell: Shell;
}
@@ -59,7 +69,6 @@ declare namespace Electron {
powerMonitor: PowerMonitor;
powerSaveBlocker: PowerSaveBlocker;
protocol: Protocol;
- screen: Screen;
session: typeof Session;
systemPreferences: SystemPreferences;
TouchBar: typeof TouchBar;
@@ -194,9 +203,9 @@ declare namespace Electron {
userInfo: any) => void): this;
/**
* Emitted before the application starts closing its windows. Calling
- * event.preventDefault() will prevent the default behavior, which is terminating
+ * event.preventDefault() will prevent the default behaviour, which is terminating
* the application. Note: If application quit was initiated by
- * autoUpdater.quitAndInstall(), then before-quit is emitted after emitting close
+ * autoUpdater.quitAndInstall() then before-quit is emitted after emitting close
* event on all windows and closing them. Note: On Windows, this event will not be
* emitted if the app is closed due to a shutdown/restart of the system or a user
* logout.
@@ -364,18 +373,6 @@ declare namespace Electron {
*/
error: string) => void): this;
/**
- * Emitted when desktopCapturer.getSources() is called in the renderer process of
- * webContents. Calling event.preventDefault() will make it return empty sources.
- */
- on(event: 'desktop-capturer-get-sources', listener: (event: Event,
- webContents: WebContents) => void): this;
- once(event: 'desktop-capturer-get-sources', listener: (event: Event,
- webContents: WebContents) => void): this;
- addListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
- webContents: WebContents) => void): this;
- removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
- webContents: WebContents) => void): this;
- /**
* Emitted when the gpu process crashes or is killed.
*/
on(event: 'gpu-process-crashed', listener: (event: Event,
@@ -388,7 +385,7 @@ declare namespace Electron {
killed: boolean) => void): this;
/**
* Emitted when webContents wants to do basic auth. The default behavior is to
- * cancel all authentications. To override this you should prevent the default
+ * cancel all authentications, to override this you should prevent the default
* behavior with event.preventDefault() and call callback(username, password) with
* the credentials.
*/
@@ -570,29 +567,12 @@ declare namespace Electron {
webContents: WebContents,
moduleName: string) => void): this;
/**
- * Emitted when the renderer process of webContents crashes or is killed.
- */
- on(event: 'renderer-process-crashed', listener: (event: Event,
- webContents: WebContents,
- killed: boolean) => void): this;
- once(event: 'renderer-process-crashed', listener: (event: Event,
- webContents: WebContents,
- killed: boolean) => void): this;
- addListener(event: 'renderer-process-crashed', listener: (event: Event,
- webContents: WebContents,
- killed: boolean) => void): this;
- removeListener(event: 'renderer-process-crashed', listener: (event: Event,
- webContents: WebContents,
- killed: boolean) => void): this;
- /**
* This event will be emitted inside the primary instance of your application when
- * a second instance has been executed and calls app.requestSingleInstanceLock().
- * argv is an Array of the second instance's command line arguments, and
- * workingDirectory is its current working directory. Usually applications respond
- * to this by making their primary window focused and non-minimized. This event is
- * guaranteed to be emitted after the ready event of app gets emitted. Note: Extra
- * command line arguments might be added by Chromium, such as
- * --original-process-start-time.
+ * a second instance has been executed. argv is an Array of the second instance's
+ * command line arguments, and workingDirectory is its current working directory.
+ * Usually applications respond to this by making their primary window focused and
+ * non-minimized. This event is guaranteed to be emitted after the ready event of
+ * app gets emitted.
*/
on(event: 'second-instance', listener: (event: Event,
/**
@@ -667,8 +647,8 @@ declare namespace Electron {
* Emitted when Handoff is about to be resumed on another device. If you need to
* update the state to be transferred, you should call event.preventDefault()
* immediately, construct a new userInfo dictionary and call
- * app.updateCurrentActiviy() in a timely manner. Otherwise, the operation will
- * fail and continue-activity-error will be called.
+ * app.updateCurrentActiviy() in a timely manner. Otherwise the operation will fail
+ * and continue-activity-error will be called.
*/
on(event: 'update-activity-state', listener: (event: Event,
/**
@@ -780,8 +760,8 @@ declare namespace Electron {
removeListener(event: 'window-all-closed', listener: Function): this;
/**
* Adds path to the recent documents list. This list is managed by the OS. On
- * Windows, you can visit the list from the task bar, and on macOS, you can visit
- * it from dock menu.
+ * Windows you can visit the list from the task bar, and on macOS you can visit it
+ * from dock menu.
*/
addRecentDocument(path: string): void;
/**
@@ -800,14 +780,19 @@ declare namespace Electron {
*/
disableHardwareAcceleration(): void;
/**
+ * Enables mixed sandbox mode on the app. This method can only be called before app
+ * is ready.
+ */
+ enableMixedSandbox(): void;
+ /**
* Enables full sandbox mode on the app. This method can only be called before app
* is ready.
*/
enableSandbox(): void;
/**
* Exits immediately with exitCode. exitCode defaults to 0. All windows will be
- * closed immediately without asking the user, and the before-quit and will-quit
- * events will not be emitted.
+ * closed immediately without asking user and the before-quit and will-quit events
+ * will not be emitted.
*/
exit(exitCode?: number): void;
/**
@@ -823,19 +808,12 @@ declare namespace Electron {
* Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux
* and macOS, icons depend on the application associated with file mime type.
*/
- getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
+ getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void;
/**
- * Fetches a path's associated icon. On Windows, there are 2 kinds of icons: On
- * Linux and macOS, icons depend on the application associated with file mime type.
- * Deprecated Soon
+ * Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux
+ * and macOS, icons depend on the application associated with file mime type.
*/
getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void;
- /**
- * Fetches a path's associated icon. On Windows, there are 2 kinds of icons: On
- * Linux and macOS, icons depend on the application associated with file mime type.
- * Deprecated Soon
- */
- getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void;
getGPUFeatureStatus(): GPUFeatureStatus;
/**
* For infoType equal to complete: Promise is fulfilled with Object containing all
@@ -850,16 +828,12 @@ declare namespace Electron {
/**
* To set the locale, you'll want to use a command line switch at app startup,
* which may be found here. Note: When distributing your packaged app, you have to
- * also ship the locales folder. Note: On Windows, you have to call it after the
+ * also ship the locales folder. Note: On Windows you have to call it after the
* ready events gets emitted.
*/
getLocale(): string;
/**
- * Note: When unable to detect locale country code, it returns empty string.
- */
- getLocaleCountryCode(): string;
- /**
- * If you provided path and args options to app.setLoginItemSettings, then you need
+ * If you provided path and args options to app.setLoginItemSettings then you need
* to pass the same arguments here for openAtLogin to be set correctly.
*/
getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
@@ -896,9 +870,6 @@ declare namespace Electron {
* Invalidates the current Handoff user activity.
*/
invalidateCurrentActivity(type: string): void;
- /**
- * Deprecated Soon
- */
isAccessibilitySupportEnabled(): boolean;
/**
* This method checks if the current executable is the default handler for a
@@ -910,16 +881,15 @@ declare namespace Electron {
* the Windows Registry and LSCopyDefaultHandlerForURLScheme internally.
*/
isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
- isEmojiPanelSupported(): boolean;
isInApplicationsFolder(): boolean;
isReady(): boolean;
isUnityRunning(): boolean;
/**
- * No confirmation dialog will be presented by default. If you wish to allow the
- * user to confirm the operation, you may do so using the dialog API. NOTE: This
+ * No confirmation dialog will be presented by default, if you wish to allow the
+ * user to confirm the operation you may do so using the dialog API. NOTE: This
* method throws errors if anything other than the user causes the move to fail.
- * For instance if the user cancels the authorization dialog, this method returns
- * false. If we fail to perform the copy, then this method will throw an error. The
+ * For instance if the user cancels the authorization dialog this method returns
+ * false. If we fail to perform the copy then this method will throw an error. The
* message in the error should be informative and tell you exactly what went wrong
*/
moveToApplicationsFolder(): boolean;
@@ -933,14 +903,14 @@ declare namespace Electron {
*/
quit(): void;
/**
- * Relaunches the app when current instance exits. By default, the new instance
- * will use the same working directory and command line arguments with current
- * instance. When args is specified, the args will be passed as command line
- * arguments instead. When execPath is specified, the execPath will be executed for
- * relaunch instead of current app. Note that this method does not quit the app
- * when executed, you have to call app.quit or app.exit after calling app.relaunch
- * to make the app restart. When app.relaunch is called for multiple times,
- * multiple instances will be started after current instance exited. An example of
+ * Relaunches the app when current instance exits. By default the new instance will
+ * use the same working directory and command line arguments with current instance.
+ * When args is specified, the args will be passed as command line arguments
+ * instead. When execPath is specified, the execPath will be executed for relaunch
+ * instead of current app. Note that this method does not quit the app when
+ * executed, you have to call app.quit or app.exit after calling app.relaunch to
+ * make the app restart. When app.relaunch is called for multiple times, multiple
+ * instances will be started after current instance exited. An example of
* restarting current instance immediately and adding a new command line argument
* to the new instance:
*/
@@ -956,25 +926,27 @@ declare namespace Electron {
*/
removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
/**
- * The return value of this method indicates whether or not this instance of your
- * application successfully obtained the lock. If it failed to obtain the lock,
- * you can assume that another instance of your application is already running with
- * the lock and exit immediately. I.e. This method returns true if your process is
- * the primary instance of your application and your app should continue loading.
- * It returns false if your process should immediately quit as it has sent its
- * parameters to another instance that has already acquired the lock. On macOS, the
- * system enforces single instance automatically when users try to open a second
- * instance of your app in Finder, and the open-file and open-url events will be
- * emitted for that. However when users start your app in command line, the
- * system's single instance mechanism will be bypassed, and you have to use this
+ * This method makes your application a Single Instance Application - instead of
+ * allowing multiple instances of your app to run, this will ensure that only a
+ * single instance of your app is running, and other instances signal this instance
+ * and exit. The return value of this method indicates whether or not this instance
+ * of your application successfully obtained the lock. If it failed to obtain the
+ * lock you can assume that another instance of your application is already running
+ * with the lock and exit immediately. I.e. This method returns true if your
+ * process is the primary instance of your application and your app should continue
+ * loading. It returns false if your process should immediately quit as it has
+ * sent its parameters to another instance that has already acquired the lock. On
+ * macOS the system enforces single instance automatically when users try to open a
+ * second instance of your app in Finder, and the open-file and open-url events
+ * will be emitted for that. However when users start your app in command line the
+ * system's single instance mechanism will be bypassed and you have to use this
* method to ensure single instance. An example of activating the window of primary
* instance when a second instance starts:
*/
requestSingleInstanceLock(): boolean;
/**
* Set the about panel options. This will override the values defined in the app's
- * .plist file on MacOS. See the Apple docs for more details. On Linux, values must
- * be set in order to be shown; there are no defaults.
+ * .plist file. See the Apple docs for more details.
*/
setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
/**
@@ -983,18 +955,10 @@ declare namespace Electron {
* accessibility docs for more details. Disabled by default. This API must be
* called after the ready event is emitted. Note: Rendering accessibility tree can
* significantly affect the performance of your app. It should not be enabled by
- * default. Deprecated Soon
+ * default.
*/
setAccessibilitySupportEnabled(enabled: boolean): void;
/**
- * Sets or creates a directory your app's logs which can then be manipulated with
- * app.getPath() or app.setPath(pathName, newPath). Calling app.setAppLogsPath()
- * without a path parameter will result in this directory being set to
- * /Library/Logs/YourAppName on macOS, and inside the userData directory on Linux
- * and Windows.
- */
- setAppLogsPath(path?: string): void;
- /**
* Changes the Application User Model ID to id.
*/
setAppUserModelId(id: string): void;
@@ -1003,23 +967,20 @@ declare namespace Electron {
* (aka URI scheme). It allows you to integrate your app deeper into the operating
* system. Once registered, all links with your-protocol:// will be opened with the
* current executable. The whole link, including protocol, will be passed to your
- * application as a parameter. On Windows, you can provide optional parameters
- * path, the path to your executable, and args, an array of arguments to be passed
- * to your executable when it launches. Note: On macOS, you can only register
+ * application as a parameter. On Windows you can provide optional parameters path,
+ * the path to your executable, and args, an array of arguments to be passed to
+ * your executable when it launches. Note: On macOS, you can only register
* protocols that have been added to your app's info.plist, which can not be
* modified at runtime. You can however change the file with a simple text editor
* or script during build time. Please refer to Apple's documentation for details.
- * Note: In a Windows Store environment (when packaged as an appx) this API will
- * return true for all calls but the registry key it sets won't be accessible by
- * other applications. In order to register your Windows Store application as a
- * default protocol handler you must declare the protocol in your manifest. The API
- * uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally.
+ * The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme
+ * internally.
*/
setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
/**
* Sets the counter badge for current app. Setting the count to 0 will hide the
- * badge. On macOS, it shows on the dock icon. On Linux, it only works for Unity
- * launcher. Note: Unity launcher requires the existence of a .desktop file to
+ * badge. On macOS it shows on the dock icon. On Linux it only works for Unity
+ * launcher, Note: Unity launcher requires the existence of a .desktop file to
* work, for more information please read Desktop Environment Integration.
*/
setBadgeCount(count: number): boolean;
@@ -1051,12 +1012,12 @@ declare namespace Electron {
setName(name: string): void;
/**
* Overrides the path to a special directory or file associated with name. If the
- * path specifies a directory that does not exist, an Error is thrown. In that
- * case, the directory should be created with fs.mkdirSync or similar. You can only
- * override paths of a name defined in app.getPath. By default, web pages' cookies
- * and caches will be stored under the userData directory. If you want to change
- * this location, you have to override the userData path before the ready event of
- * the app module is emitted.
+ * path specifies a directory that does not exist, the directory will be created by
+ * this method. On failure an Error is thrown. You can only override paths of a
+ * name defined in app.getPath. By default, web pages' cookies and caches will be
+ * stored under the userData directory. If you want to change this location, you
+ * have to override the userData path before the ready event of the app module is
+ * emitted.
*/
setPath(name: string, path: string): void;
/**
@@ -1076,15 +1037,11 @@ declare namespace Electron {
*/
show(): void;
/**
- * Show the app's about panel options. These options can be overridden with
- * app.setAboutPanelOptions(options).
+ * Show the about panel with the values defined in the app's .plist file or with
+ * the options set via app.setAboutPanelOptions(options).
*/
showAboutPanel(): void;
/**
- * Show the platform's native emoji picker.
- */
- showEmojiPanel(): void;
- /**
* Start accessing a security scoped resource. With this method Electron
* applications that are packaged for the Mac App Store may reach outside their
* sandbox to access files chosen by the user. See Apple's documentation for a
@@ -1097,34 +1054,6 @@ declare namespace Electron {
*/
updateCurrentActivity(type: string, userInfo: any): void;
whenReady(): Promise<void>;
- /**
- * A Boolean property that's true if Chrome's accessibility support is enabled,
- * false otherwise. This property will be true if the use of assistive
- * technologies, such as screen readers, has been detected. Setting this property
- * to true manually enables Chrome's accessibility support, allowing developers to
- * expose accessibility switch to users in application settings. See Chromium's
- * accessibility docs for more details. Disabled by default. This API must be
- * called after the ready event is emitted. Note: Rendering accessibility tree can
- * significantly affect the performance of your app. It should not be enabled by
- * default.
- */
- accessibilitySupportEnabled?: boolean;
- /**
- * A Boolean which when true disables the overrides that Electron has in place to
- * ensure renderer processes are restarted on every navigation. The current
- * default value for this property is false. The intention is for these overrides
- * to become disabled by default and then at some point in the future this property
- * will be removed. This property impacts which native modules you can use in the
- * renderer process. For more information on the direction Electron is going with
- * renderer process restarts and usage of native modules in the renderer process
- * please check out this Tracking Issue.
- */
- allowRendererProcessReuse?: boolean;
- /**
- * A Menu property that return Menu if one has been set and null otherwise. Users
- * can pass a Menu to set this property.
- */
- applicationMenu?: Menu;
commandLine: CommandLine;
dock: Dock;
/**
@@ -1288,8 +1217,7 @@ declare namespace Electron {
* media keys or browser commands, as well as the "Back" button built into some
* mice on Windows. Commands are lowercased, underscores are replaced with hyphens,
* and the APPCOMMAND_ prefix is stripped off. e.g. APPCOMMAND_BROWSER_BACKWARD is
- * emitted as browser-backward. The following app commands are explictly supported
- * on Linux:
+ * emitted as browser-backward.
*/
on(event: 'app-command', listener: (event: Event,
command: string) => void): this;
@@ -1624,10 +1552,6 @@ declare namespace Electron {
*/
static removeExtension(name: string): void;
/**
- * Replacement API for setBrowserView supporting work with multi browser views.
- */
- addBrowserView(browserView: BrowserView): void;
- /**
* Adds a window as a tab on this window, after the tab for the window instance.
*/
addTabbedWindow(browserWindow: BrowserWindow): void;
@@ -1637,22 +1561,11 @@ declare namespace Electron {
blur(): void;
blurWebView(): void;
/**
- * Captures a snapshot of the page within rect. Upon completion callback will be
- * called with callback(image). The image is an instance of NativeImage that stores
- * data of the snapshot. Omitting rect will capture the whole visible page.
- * Deprecated Soon
+ * Same as webContents.capturePage([rect, ]callback).
*/
capturePage(callback: (image: NativeImage) => void): void;
/**
- * Captures a snapshot of the page within rect. Omitting rect will capture the
- * whole visible page.
- */
- capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
- /**
- * Captures a snapshot of the page within rect. Upon completion callback will be
- * called with callback(image). The image is an instance of NativeImage that stores
- * data of the snapshot. Omitting rect will capture the whole visible page.
- * Deprecated Soon
+ * Same as webContents.capturePage([rect, ]callback).
*/
capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void;
/**
@@ -1685,13 +1598,11 @@ declare namespace Electron {
focus(): void;
focusOnWebView(): void;
getBounds(): Rectangle;
- getBrowserView(): (BrowserView) | (null);
/**
- * Returns array of BrowserView what was an attached with addBrowserView or
- * setBrowserView. Note: The BrowserView API is currently experimental and may
- * change or be removed in future Electron releases.
+ * Note: The BrowserView API is currently experimental and may change or be removed
+ * in future Electron releases.
*/
- getBrowserViews(): void;
+ getBrowserView(): (BrowserView) | (null);
getChildWindows(): BrowserWindow[];
getContentBounds(): Rectangle;
getContentSize(): number[];
@@ -1715,10 +1626,13 @@ declare namespace Electron {
getRepresentedFilename(): string;
getSize(): number[];
/**
- * Note: The title of the web page can be different from the title of the native
+ * Note: The title of web page can be different from the title of the native
* window.
*/
getTitle(): string;
+ /**
+ * On Windows and Linux always returns true.
+ */
hasShadow(): boolean;
/**
* Hides the window.
@@ -1770,7 +1684,7 @@ declare namespace Electron {
* Same as webContents.loadFile, filePath should be a path to an HTML file relative
* to the root of your application. See the webContents docs for more information.
*/
- loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
+ loadFile(filePath: string, options?: LoadFileOptions): void;
/**
* Same as webContents.loadURL(url[, options]). The url can be a remote address
* (e.g. http://) or a path to a local HTML file using the file:// protocol. To
@@ -1778,7 +1692,7 @@ declare namespace Electron {
* url.format method: You can load a URL using a POST request with URL-encoded data
* by doing the following:
*/
- loadURL(url: string, options?: LoadURLOptions): Promise<void>;
+ loadURL(url: string, options?: LoadURLOptions): void;
/**
* Maximizes the window. This will also show (but not focus) the window if it isn't
* being displayed already.
@@ -1811,11 +1725,6 @@ declare namespace Electron {
* Same as webContents.reload.
*/
reload(): void;
- removeBrowserView(browserView: BrowserView): void;
- /**
- * Remove the window's menu bar.
- */
- removeMenu(): void;
/**
* Restores the window from minimized state to its previous state.
*/
@@ -1920,7 +1829,7 @@ declare namespace Electron {
*/
setFullScreenable(fullscreenable: boolean): void;
/**
- * Sets whether the window should have a shadow.
+ * Sets whether the window should have a shadow. On Windows and Linux does nothing.
*/
setHasShadow(hasShadow: boolean): void;
/**
@@ -1947,7 +1856,8 @@ declare namespace Electron {
*/
setMaximumSize(width: number, height: number): void;
/**
- * Sets the menu as the window's menu bar.
+ * Sets the menu as the window's menu bar, setting it to null will remove the menu
+ * bar.
*/
setMenu(menu: (Menu) | (null)): void;
/**
@@ -2386,12 +2296,12 @@ declare namespace Electron {
// Docs: http://electronjs.org/docs/api/clipboard
- availableFormats(type?: 'selection' | 'clipboard'): string[];
+ availableFormats(type?: string): string[];
/**
* Clears the clipboard content.
*/
- clear(type?: 'selection' | 'clipboard'): void;
- has(format: string, type?: 'selection' | 'clipboard'): boolean;
+ clear(type?: string): void;
+ has(format: string, type?: string): boolean;
read(format: string): string;
/**
* Returns an Object containing title and url keys representing the bookmark in the
@@ -2401,24 +2311,24 @@ declare namespace Electron {
readBookmark(): ReadBookmark;
readBuffer(format: string): Buffer;
readFindText(): string;
- readHTML(type?: 'selection' | 'clipboard'): string;
- readImage(type?: 'selection' | 'clipboard'): NativeImage;
- readRTF(type?: 'selection' | 'clipboard'): string;
- readText(type?: 'selection' | 'clipboard'): string;
+ readHTML(type?: string): string;
+ readImage(type?: string): NativeImage;
+ readRTF(type?: string): string;
+ readText(type?: string): string;
/**
* Writes data to the clipboard.
*/
- write(data: Data, type?: 'selection' | 'clipboard'): void;
+ write(data: Data, type?: string): void;
/**
* Writes the title and url into the clipboard as a bookmark. Note: Most apps on
* Windows don't support pasting bookmarks into them so you can use clipboard.write
* to write both a bookmark and fallback text to the clipboard.
*/
- writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
+ writeBookmark(title: string, url: string, type?: string): void;
/**
* Writes the buffer into the clipboard as format.
*/
- writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
+ writeBuffer(format: string, buffer: Buffer, type?: string): void;
/**
* Writes the text into the find pasteboard as plain text. This method uses
* synchronous IPC when called from the renderer process.
@@ -2427,19 +2337,19 @@ declare namespace Electron {
/**
* Writes markup to the clipboard.
*/
- writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
+ writeHTML(markup: string, type?: string): void;
/**
* Writes image to the clipboard.
*/
- writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
+ writeImage(image: NativeImage, type?: string): void;
/**
* Writes the text into the clipboard in RTF.
*/
- writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
+ writeRTF(text: string, type?: string): void;
/**
* Writes the text into the clipboard as plain text.
*/
- writeText(text: string, type?: 'selection' | 'clipboard'): void;
+ writeText(text: string, type?: string): void;
}
interface ContentTracing extends EventEmitter {
@@ -2447,41 +2357,46 @@ declare namespace Electron {
// Docs: http://electronjs.org/docs/api/content-tracing
/**
- * Get a set of category groups. The category groups can change as new code paths
- * are reached. Once all child processes have acknowledged the getCategories
- * request the callback is invoked with an array of category groups. Deprecated
- * Soon
+ * Get the current monitoring traced data. Child processes typically cache trace
+ * data and only rarely flush and send trace data back to the main process. This is
+ * because it may be an expensive operation to send the trace data over IPC and we
+ * would like to avoid unneeded runtime overhead from tracing. So, to end tracing,
+ * we must asynchronously ask all child processes to flush any pending trace data.
+ * Once all child processes have acknowledged the captureMonitoringSnapshot request
+ * the callback will be called with a file that contains the traced data.
*/
- getCategories(callback: (categories: string[]) => void): void;
+ captureMonitoringSnapshot(resultFilePath: string, callback: (resultFilePath: string) => void): void;
/**
* Get a set of category groups. The category groups can change as new code paths
- * are reached.
+ * are reached. Once all child processes have acknowledged the getCategories
+ * request the callback is invoked with an array of category groups.
*/
- getCategories(): Promise<string[]>;
+ getCategories(callback: (categories: string[]) => void): void;
/**
* Get the maximum usage across processes of trace buffer as a percentage of the
* full state. When the TraceBufferUsage value is determined the callback is
- * called. Deprecated Soon
+ * called.
*/
- getTraceBufferUsage(callback: (value: number) => void): void;
+ getTraceBufferUsage(callback: (value: number, percentage: number) => void): void;
/**
- * Get the maximum usage across processes of trace buffer as a percentage of the
- * full state.
+ * Start monitoring on all processes. Monitoring begins immediately locally and
+ * asynchronously on child processes as soon as they receive the startMonitoring
+ * request. Once all child processes have acknowledged the startMonitoring request
+ * the callback will be called.
*/
- getTraceBufferUsage(): Promise<any>;
+ startMonitoring(options: StartMonitoringOptions, callback: Function): void;
/**
* Start recording on all processes. Recording begins immediately locally and
* asynchronously on child processes as soon as they receive the EnableRecording
* request. The callback will be called once all child processes have acknowledged
- * the startRecording request. Deprecated Soon
+ * the startRecording request.
*/
startRecording(options: (TraceCategoriesAndOptions) | (TraceConfig), callback: Function): void;
/**
- * Start recording on all processes. Recording begins immediately locally and
- * asynchronously on child processes as soon as they receive the EnableRecording
- * request.
+ * Stop monitoring on all processes. Once all child processes have acknowledged the
+ * stopMonitoring request the callback is called.
*/
- startRecording(options: (TraceCategoriesAndOptions) | (TraceConfig)): Promise<void>;
+ stopMonitoring(callback: Function): void;
/**
* Stop recording on all processes. Child processes typically cache trace data and
* only rarely flush and send trace data back to the main process. This helps to
@@ -2491,18 +2406,9 @@ declare namespace Electron {
* acknowledged the stopRecording request, callback will be called with a file that
* contains the traced data. Trace data will be written into resultFilePath if it
* is not empty or into a temporary file. The actual file path will be passed to
- * callback if it's not null. Deprecated Soon
+ * callback if it's not null.
*/
stopRecording(resultFilePath: string, callback: (resultFilePath: string) => void): void;
- /**
- * Stop recording on all processes. Child processes typically cache trace data and
- * only rarely flush and send trace data back to the main process. This helps to
- * minimize the runtime overhead of tracing since sending trace data over IPC can
- * be an expensive operation. So, to end tracing, we must asynchronously ask all
- * child processes to flush any pending trace data. Trace data will be written into
- * resultFilePath if it is not empty or into a temporary file.
- */
- stopRecording(resultFilePath: string): Promise<string>;
}
interface Cookie {
@@ -2614,37 +2520,20 @@ declare namespace Electron {
/**
* Writes any unwritten cookies data to disk.
*/
- flushStore(): Promise<void>;
- /**
- * Writes any unwritten cookies data to disk. Deprecated Soon
- */
flushStore(callback: Function): void;
/**
- * Sends a request to get all cookies matching filter, and resolves a promise with
- * the response.
- */
- get(filter: Filter): Promise<Electron.Cookie[]>;
- /**
* Sends a request to get all cookies matching filter, callback will be called with
- * callback(error, cookies) on complete. Deprecated Soon
+ * callback(error, cookies) on complete.
*/
get(filter: Filter, callback: (error: Error, cookies: Cookie[]) => void): void;
/**
- * Removes the cookies matching url and name
- */
- remove(url: string, name: string): Promise<void>;
- /**
* Removes the cookies matching url and name, callback will called with callback()
- * on complete. Deprecated Soon
+ * on complete.
*/
remove(url: string, name: string, callback: Function): void;
/**
- * Sets a cookie with details.
- */
- set(details: Details): Promise<void>;
- /**
* Sets a cookie with details, callback will be called with callback(error) on
- * complete. Deprecated Soon
+ * complete.
*/
set(details: Details, callback: (error: Error) => void): void;
}
@@ -2672,15 +2561,15 @@ declare namespace Electron {
id: string;
}
- interface CrashReporter {
+ interface CrashReporter extends EventEmitter {
// Docs: http://electronjs.org/docs/api/crash-reporter
/**
* Set an extra parameter to be sent with the crash report. The values specified
* here will be sent in addition to any values set via the extra option when start
- * was called. This API is only available on macOS and windows, if you need to
- * add/update extra parameters on Linux after your first call to start you can call
+ * was called. This API is only available on macOS, if you need to add/update extra
+ * parameters on Linux and Windows after your first call to start you can call
* start again with the updated extra options.
*/
addExtraParameter(key: string, value: string): void;
@@ -2724,10 +2613,13 @@ declare namespace Electron {
* reports from them, use process.crashReporter.start instead. Pass the same
* options as above along with an additional one called crashesDirectory that
* should point to a directory to store the crash reports temporarily. You can test
- * this out by calling process.crash() to crash the child process. Note: If you
- * need send additional/updated extra parameters after your first call start you
- * can call addExtraParameter on macOS or call start again with the new/updated
- * extra parameters on Linux and Windows. Note: On macOS and windows, Electron uses
+ * this out by calling process.crash() to crash the child process. Note: To collect
+ * crash reports from child process in Windows, you need to add this extra code as
+ * well. This will start the process that will monitor and send the crash reports.
+ * Replace submitURL, productName and crashesDirectory with appropriate values.
+ * Note: If you need send additional/updated extra parameters after your first call
+ * start you can call addExtraParameter on macOS or call start again with the
+ * new/updated extra parameters on Linux and Windows. Note: On macOS, Electron uses
* a new crashpad client for crash collection and reporting. If you want to enable
* crash reporting, initializing crashpad from the main process using
* crashReporter.start is required regardless of which process you want to collect
@@ -2739,17 +2631,6 @@ declare namespace Electron {
start(options: CrashReporterStartOptions): void;
}
- interface CustomScheme {
-
- // Docs: http://electronjs.org/docs/api/structures/custom-scheme
-
- privileges?: Privileges;
- /**
- * Custom schemes to be registered with options.
- */
- scheme: string;
- }
-
class Debugger extends EventEmitter {
// Docs: http://electronjs.org/docs/api/debugger
@@ -2831,13 +2712,9 @@ declare namespace Electron {
detach(): void;
isAttached(): boolean;
/**
- * Send given command to the debugging target. Deprecated Soon
- */
- sendCommand(method: string, commandParams?: any, callback?: (error: any, result: any) => void): void;
- /**
* Send given command to the debugging target.
*/
- sendCommand(method: string, commandParams?: any): Promise<any>;
+ sendCommand(method: string, commandParams?: any, callback?: (error: any, result: any) => void): void;
}
interface DesktopCapturer extends EventEmitter {
@@ -2848,10 +2725,9 @@ declare namespace Electron {
* Starts gathering information about all available desktop media sources, and
* calls callback(error, sources) when finished. sources is an array of
* DesktopCapturerSource objects, each DesktopCapturerSource represents a screen or
- * an individual window that can be captured. Deprecated Soon
+ * an individual window that can be captured.
*/
getSources(options: SourcesOptions, callback: (error: Error, sources: DesktopCapturerSource[]) => void): void;
- getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
}
interface DesktopCapturerSource {
@@ -2859,12 +2735,6 @@ declare namespace Electron {
// Docs: http://electronjs.org/docs/api/structures/desktop-capturer-source
/**
- * An icon image of the application that owns the window or null if the source has
- * a type screen. The size of the icon is not known in advance and depends on what
- * the the application provides.
- */
- appIcon: NativeImage;
- /**
* A unique identifier that will correspond to the id of the matching returned by
* the . On some platforms, this is equivalent to the XX portion of the id field
* above and on others it will differ. It will be an empty string if not available.
@@ -2900,7 +2770,7 @@ declare namespace Electron {
* information, and gives the user the option of trusting/importing the
* certificate. If you provide a browserWindow argument the dialog will be attached
* to the parent window, making it modal. On Windows the options are more limited,
- * due to the Win32 APIs used: Deprecated Soon
+ * due to the Win32 APIs used:
*/
showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions, callback: Function): void;
/**
@@ -2910,14 +2780,6 @@ declare namespace Electron {
* to the parent window, making it modal. On Windows the options are more limited,
* due to the Win32 APIs used:
*/
- showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
- /**
- * On macOS, this displays a modal dialog that shows a message and certificate
- * information, and gives the user the option of trusting/importing the
- * certificate. If you provide a browserWindow argument the dialog will be attached
- * to the parent window, making it modal. On Windows the options are more limited,
- * due to the Win32 APIs used: Deprecated Soon
- */
showCertificateTrustDialog(options: CertificateTrustDialogOptions, callback: Function): void;
/**
* On macOS, this displays a modal dialog that shows a message and certificate
@@ -2926,14 +2788,6 @@ declare namespace Electron {
* to the parent window, making it modal. On Windows the options are more limited,
* due to the Win32 APIs used:
*/
- showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
- /**
- * On macOS, this displays a modal dialog that shows a message and certificate
- * information, and gives the user the option of trusting/importing the
- * certificate. If you provide a browserWindow argument the dialog will be attached
- * to the parent window, making it modal. On Windows the options are more limited,
- * due to the Win32 APIs used: Deprecated Soon
- */
showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions, callback: Function): void;
/**
* Displays a modal dialog that shows an error message. This API can be called
@@ -2944,141 +2798,74 @@ declare namespace Electron {
showErrorBox(title: string, content: string): void;
/**
* Shows a message box, it will block the process until the message box is closed.
- * The browserWindow argument allows the dialog to attach itself to a parent
- * window, making it modal.
- */
- showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
- /**
- * Shows a message box, it will block the process until the message box is closed.
- * The browserWindow argument allows the dialog to attach itself to a parent
- * window, making it modal.
- */
- showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
- /**
- * Shows a message box, it will block the process until the message box is closed.
* It returns the index of the clicked button. The browserWindow argument allows
- * the dialog to attach itself to a parent window, making it modal.
+ * the dialog to attach itself to a parent window, making it modal. If a callback
+ * is passed, the dialog will not block the process. The API call will be
+ * asynchronous and the result will be passed via callback(response).
*/
- showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
+ showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number;
/**
* Shows a message box, it will block the process until the message box is closed.
* It returns the index of the clicked button. The browserWindow argument allows
- * the dialog to attach itself to a parent window, making it modal.
+ * the dialog to attach itself to a parent window, making it modal. If a callback
+ * is passed, the dialog will not block the process. The API call will be
+ * asynchronous and the result will be passed via callback(response).
*/
- showMessageBoxSync(options: MessageBoxSyncOptions): number;
+ showMessageBox(options: MessageBoxOptions, callback?: (response: number, checkboxChecked: boolean) => void): number;
/**
* The browserWindow argument allows the dialog to attach itself to a parent
* window, making it modal. The filters specifies an array of file types that can
* be displayed or selected when you want to limit the user to a specific type. For
* example: The extensions array should contain extensions without wildcards or
* dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use
- * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an
- * open dialog can not be both a file selector and a directory selector, so if you
- * set properties to ['openFile', 'openDirectory'] on these platforms, a directory
- * selector will be shown.
+ * the '*' wildcard (no other wildcard is supported). If a callback is passed, the
+ * API call will be asynchronous and the result will be passed via
+ * callback(filenames). Note: On Windows and Linux an open dialog can not be both a
+ * file selector and a directory selector, so if you set properties to ['openFile',
+ * 'openDirectory'] on these platforms, a directory selector will be shown.
*/
- showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: Function): Promise<Electron.OpenDialogReturnValue>;
+ showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: (filePaths: string[], bookmarks: string[]) => void): (string[]) | (undefined);
/**
* The browserWindow argument allows the dialog to attach itself to a parent
* window, making it modal. The filters specifies an array of file types that can
* be displayed or selected when you want to limit the user to a specific type. For
* example: The extensions array should contain extensions without wildcards or
* dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use
- * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an
- * open dialog can not be both a file selector and a directory selector, so if you
- * set properties to ['openFile', 'openDirectory'] on these platforms, a directory
- * selector will be shown.
- */
- showOpenDialog(options: OpenDialogOptions, callback?: Function): Promise<Electron.OpenDialogReturnValue>;
- /**
- * The browserWindow argument allows the dialog to attach itself to a parent
- * window, making it modal. The filters specifies an array of file types that can
- * be displayed or selected when you want to limit the user to a specific type. For
- * example: The extensions array should contain extensions without wildcards or
- * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use
- * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an
- * open dialog can not be both a file selector and a directory selector, so if you
- * set properties to ['openFile', 'openDirectory'] on these platforms, a directory
- * selector will be shown.
- */
- showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
- /**
- * The browserWindow argument allows the dialog to attach itself to a parent
- * window, making it modal. The filters specifies an array of file types that can
- * be displayed or selected when you want to limit the user to a specific type. For
- * example: The extensions array should contain extensions without wildcards or
- * dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use
- * the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an
- * open dialog can not be both a file selector and a directory selector, so if you
- * set properties to ['openFile', 'openDirectory'] on these platforms, a directory
- * selector will be shown.
- */
- showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
- /**
- * The browserWindow argument allows the dialog to attach itself to a parent
- * window, making it modal. The filters specifies an array of file types that can
- * be displayed, see dialog.showOpenDialog for an example. Note: On macOS, using
- * the asynchronous version is recommended to avoid issues when expanding and
- * collapsing the dialog.
+ * the '*' wildcard (no other wildcard is supported). If a callback is passed, the
+ * API call will be asynchronous and the result will be passed via
+ * callback(filenames). Note: On Windows and Linux an open dialog can not be both a
+ * file selector and a directory selector, so if you set properties to ['openFile',
+ * 'openDirectory'] on these platforms, a directory selector will be shown.
*/
- showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
+ showOpenDialog(options: OpenDialogOptions, callback?: (filePaths: string[], bookmarks: string[]) => void): (string[]) | (undefined);
/**
* The browserWindow argument allows the dialog to attach itself to a parent
* window, making it modal. The filters specifies an array of file types that can
- * be displayed, see dialog.showOpenDialog for an example. Note: On macOS, using
- * the asynchronous version is recommended to avoid issues when expanding and
- * collapsing the dialog.
+ * be displayed, see dialog.showOpenDialog for an example. If a callback is passed,
+ * the API call will be asynchronous and the result will be passed via
+ * callback(filename).
*/
- showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
+ showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback?: (filename: string, bookmark: string) => void): (string) | (undefined);
/**
* The browserWindow argument allows the dialog to attach itself to a parent
* window, making it modal. The filters specifies an array of file types that can
- * be displayed, see dialog.showOpenDialog for an example.
+ * be displayed, see dialog.showOpenDialog for an example. If a callback is passed,
+ * the API call will be asynchronous and the result will be passed via
+ * callback(filename).
*/
- showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined);
- /**
- * The browserWindow argument allows the dialog to attach itself to a parent
- * window, making it modal. The filters specifies an array of file types that can
- * be displayed, see dialog.showOpenDialog for an example.
- */
- showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined);
+ showSaveDialog(options: SaveDialogOptions, callback?: (filename: string, bookmark: string) => void): (string) | (undefined);
}
interface Display {
// Docs: http://electronjs.org/docs/api/structures/display
- /**
- * Can be available, unavailable, unknown.
- */
- accelerometerSupport: ('available' | 'unavailable' | 'unknown');
bounds: Rectangle;
/**
- * The number of bits per pixel.
- */
- colorDepth: number;
- /**
- * represent a color space (three-dimensional object which contains all realizable
- * color combinations) for the purpose of color conversions
- */
- colorSpace: string;
- /**
- * The number of bits per color component.
- */
- depthPerComponent: number;
- /**
* Unique identifier associated with the display.
*/
id: number;
/**
- * true for an internal display and false for an external display
- */
- internal: boolean;
- /**
- * Whether or not the display is a monochrome display.
- */
- monochrome: boolean;
- /**
* Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
*/
rotation: number;
@@ -3164,7 +2951,6 @@ declare namespace Electron {
getLastModifiedTime(): string;
getMimeType(): string;
getReceivedBytes(): number;
- getSaveDialogOptions(): SaveDialogOptions;
getSavePath(): string;
getStartTime(): number;
/**
@@ -3192,12 +2978,6 @@ declare namespace Electron {
*/
resume(): void;
/**
- * This API allows the user to set custom options for the save dialog that opens
- * for the download item by default. The API is only available in session's
- * will-download callback function.
- */
- setSaveDialogOptions(options: SaveDialogOptions): void;
- /**
* The API is only available in session's will-download callback function. If user
* doesn't set the save path via the API, Electron will use the original routine to
* determine the save path(Usually prompts a save dialog).
@@ -3205,13 +2985,6 @@ declare namespace Electron {
setSavePath(path: string): void;
}
- interface Event extends GlobalEvent {
-
- // Docs: http://electronjs.org/docs/api/structures/event
-
- preventDefault: (() => void);
- }
-
interface FileFilter {
// Docs: http://electronjs.org/docs/api/structures/file-filter
@@ -3239,17 +3012,7 @@ declare namespace Electron {
* on macOS 10.14 Mojave unless the app has been authorized as a trusted
* accessibility client:
*/
- register(accelerator: Accelerator, callback: Function): boolean;
- /**
- * Registers a global shortcut of all accelerator items in accelerators. The
- * callback is called when any of the registered shortcuts are pressed by the user.
- * When a given accelerator is already taken by other applications, this call will
- * silently fail. This behavior is intended by operating systems, since they don't
- * want applications to fight for global shortcuts. The following accelerators will
- * not be registered successfully on macOS 10.14 Mojave unless the app has been
- * authorized as a trusted accessibility client:
- */
- registerAll(accelerators: string[], callback: Function): void;
+ register(accelerator: Accelerator, callback: Function): void;
/**
* Unregisters the global shortcut of accelerator.
*/
@@ -3355,24 +3118,15 @@ declare namespace Electron {
*/
finishTransactionByDate(date: string): void;
/**
- * Retrieves the product descriptions. Deprecated Soon
- */
- getProducts(productIDs: string[], callback: (products: Product[]) => void): void;
- /**
* Retrieves the product descriptions.
*/
- getProducts(productIDs: string[]): Promise<Electron.Product[]>;
+ getProducts(productIDs: string[], callback: (products: Product[]) => void): void;
getReceiptURL(): string;
/**
* You should listen for the transactions-updated event as soon as possible and
- * certainly before you call purchaseProduct. Deprecated Soon
- */
- purchaseProduct(productID: string, quantity?: number, callback?: (isProductValid: boolean) => void): void;
- /**
- * You should listen for the transactions-updated event as soon as possible and
* certainly before you call purchaseProduct.
*/
- purchaseProduct(productID: string, quantity?: number): Promise<boolean>;
+ purchaseProduct(productID: string, quantity?: number, callback?: (isProductValid: boolean) => void): void;
}
class IncomingMessage extends EventEmitter {
@@ -3474,12 +3228,12 @@ declare namespace Electron {
* Listens to channel, when a new message arrives listener would be called with
* listener(event, args...).
*/
- on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
+ on(channel: string, listener: Function): this;
/**
* Adds a one time listener function for the event. This listener is invoked only
* the next time a message is sent to channel, after which it is removed.
*/
- once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
+ once(channel: string, listener: Function): this;
/**
* Removes listeners of the specified channel.
*/
@@ -3491,31 +3245,6 @@ declare namespace Electron {
removeListener(channel: string, listener: Function): this;
}
- interface IpcMainEvent extends Event {
-
- // Docs: http://electronjs.org/docs/api/structures/ipc-main-event
-
- /**
- * The ID of the renderer frame that sent this message
- */
- frameId: number;
- /**
- * A function that will send an IPC message to the renderer frame that sent the
- * original message that you are currently handling. You should use this method to
- * "reply" to the sent message in order to guaruntee the reply will go to the
- * correct process and frame.
- */
- reply: Function;
- /**
- * Set this to the value to be returned in a syncronous message
- */
- returnValue: any;
- /**
- * Returns the webContents that sent the message
- */
- sender: WebContents;
- }
-
interface IpcRenderer extends EventEmitter {
// Docs: http://electronjs.org/docs/api/ipc-renderer
@@ -3524,12 +3253,12 @@ declare namespace Electron {
* Listens to channel, when a new message arrives listener would be called with
* listener(event, args...).
*/
- on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
+ on(channel: string, listener: Function): this;
/**
* Adds a one time listener function for the event. This listener is invoked only
* the next time a message is sent to channel, after which it is removed.
*/
- once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
+ once(channel: string, listener: Function): this;
/**
* Removes all listeners, or those of the specified channel.
*/
@@ -3566,23 +3295,6 @@ declare namespace Electron {
sendToHost(channel: string, ...args: any[]): void;
}
- interface IpcRendererEvent extends Event {
-
- // Docs: http://electronjs.org/docs/api/structures/ipc-renderer-event
-
- /**
- * The IpcRenderer instance that emitted the event originally
- */
- sender: IpcRenderer;
- /**
- * The webContents.id that sent the message, you can call
- * event.sender.sendTo(event.senderId, ...) to reply to the message, see for more
- * information. This only applies to messages sent from a different renderer.
- * Messages sent directly from the main process set event.senderId to 0.
- */
- senderId: number;
- }
-
interface JumpListCategory {
// Docs: http://electronjs.org/docs/api/structures/jump-list-category
@@ -3646,37 +3358,6 @@ declare namespace Electron {
* One of the following:
*/
type?: ('task' | 'separator' | 'file');
- /**
- * The working directory. Default is empty.
- */
- workingDirectory?: string;
- }
-
- interface KeyboardEvent extends Event {
-
- // Docs: http://electronjs.org/docs/api/structures/keyboard-event
-
- /**
- * whether an Alt key was used in an accelerator to trigger the Event
- */
- altKey?: boolean;
- /**
- * whether the Control key was used in an accelerator to trigger the Event
- */
- ctrlKey?: boolean;
- /**
- * whether a meta key was used in an accelerator to trigger the Event
- */
- metaKey?: boolean;
- /**
- * whether a Shift key was used in an accelerator to trigger the Event
- */
- shiftKey?: boolean;
- /**
- * whether an accelerator was used to trigger the event as opposed to another user
- * gesture like mouse click
- */
- triggeredByAccelerator?: boolean;
}
interface MemoryUsageDetails {
@@ -3712,7 +3393,7 @@ declare namespace Electron {
* usage can be referenced above. You can also attach other fields to the element
* of the template and they will become properties of the constructed menu items.
*/
- static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
+ static buildFromTemplate(template: MenuItemConstructorOptions[]): Menu;
/**
* Note: The returned Menu instance doesn't support dynamic addition or removal of
* menu items. Instance properties can still be dynamically modified.
@@ -3727,16 +3408,9 @@ declare namespace Electron {
static sendActionToFirstResponder(action: string): void;
/**
* Sets menu as the application menu on macOS. On Windows and Linux, the menu will
- * be set as each window's top menu. Also on Windows and Linux, you can use a & in
- * the top-level item name to indicate which letter should get a generated
- * accelerator. For example, using &File for the file menu would result in a
- * generated Alt-F accelerator that opens the associated menu. The indicated
- * character in the button label gets an underline. The & character is not
- * displayed on the button label. Passing null will suppress the default menu. On
- * Windows and Linux, this has the additional effect of removing the menu bar from
- * the window. Note: The default menu will be created automatically if the app does
- * not set one. It contains standard items such as File, Edit, View, Window and
- * Help.
+ * be set as each window's top menu. Passing null will remove the menu bar on
+ * Windows and Linux but has no effect on macOS. Note: This API has to be called
+ * after the ready event of app module.
*/
static setApplicationMenu(menu: (Menu) | (null)): void;
/**
@@ -3764,20 +3438,10 @@ declare namespace Electron {
// Docs: http://electronjs.org/docs/api/menu-item
constructor(options: MenuItemConstructorOptions);
- accelerator: string;
checked: boolean;
click: Function;
- commandId: number;
enabled: boolean;
- icon: NativeImage;
- id: string;
label: string;
- menu: Menu;
- registerAccelerator: boolean;
- role: string;
- sublabel: string;
- submenu: Menu;
- type: string;
visible: boolean;
}
@@ -3804,13 +3468,7 @@ declare namespace Electron {
*/
static createEmpty(): NativeImage;
/**
- * Creates a new NativeImage instance from buffer that contains the raw bitmap
- * pixel data returned by toBitmap(). The specific format is platform-dependent.
- */
- static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
- /**
- * Creates a new NativeImage instance from buffer. Tries to decode as PNG or JPEG
- * first.
+ * Creates a new NativeImage instance from buffer.
*/
static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
/**
@@ -3898,14 +3556,9 @@ declare namespace Electron {
startLogging(path: string): void;
/**
* Stops recording network events. If not called, net logging will automatically
- * end when app quits. Deprecated Soon
- */
- stopLogging(callback?: (path: string) => void): void;
- /**
- * Stops recording network events. If not called, net logging will automatically
* end when app quits.
*/
- stopLogging(): Promise<string>;
+ stopLogging(callback?: (path: string) => void): void;
/**
* A Boolean property that indicates whether network logs are recorded.
*/
@@ -4086,15 +3739,6 @@ declare namespace Electron {
removeListener(event: 'unlock-screen', listener: Function): this;
/**
* Calculate the system idle state. idleThreshold is the amount of time (in
- * seconds) before considered idle. locked is available on supported systems only.
- */
- getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
- /**
- * Calculate system idle time in seconds.
- */
- getSystemIdleTime(): number;
- /**
- * Calculate the system idle state. idleThreshold is the amount of time (in
* seconds) before considered idle. callback will be called synchronously on some
* systems and with an idleState argument that describes the system's state. locked
* is available on supported systems only.
@@ -4138,26 +3782,6 @@ declare namespace Electron {
status: number;
}
- interface ProcessMemoryInfo {
-
- // Docs: http://electronjs.org/docs/api/structures/process-memory-info
-
- /**
- * The amount of memory not shared by other processes, such as JS heap or HTML
- * content in Kilobytes.
- */
- private: number;
- /**
- * and The amount of memory currently pinned to actual physical RAM in Kilobytes.
- */
- residentSet: number;
- /**
- * The amount of memory shared between processes, typically memory consumed by the
- * Electron code itself in Kilobytes.
- */
- shared: number;
- }
-
interface ProcessMetric {
// Docs: http://electronjs.org/docs/api/structures/process-metric
@@ -4171,9 +3795,9 @@ declare namespace Electron {
*/
pid: number;
/**
- * Process type. One of the following values:
+ * Process type (Browser or Tab or GPU etc).
*/
- type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'GPU' | 'Unknown');
+ type: string;
}
interface Product {
@@ -4189,15 +3813,14 @@ declare namespace Electron {
*/
contentVersion: string;
/**
- * The locale formatted price of the product.
+ * A Boolean value that indicates whether the App Store has downloadable content
+ * for this product.
*/
- formattedPrice: string;
+ downloadable: boolean;
/**
- * A Boolean value that indicates whether the App Store has downloadable content
- * for this product. true if at least one file has been associated with the
- * product.
+ * The locale formatted price of the product.
*/
- isDownloadable: boolean;
+ formattedPrice: string;
/**
* A description of the product.
*/
@@ -4247,10 +3870,9 @@ declare namespace Electron {
interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void;
/**
* The callback will be called with a boolean that indicates whether there is
- * already a handler for scheme. Deprecated Soon
+ * already a handler for scheme.
*/
- isProtocolHandled(scheme: string, callback: (handled: boolean) => void): void;
- isProtocolHandled(scheme: string): Promise<boolean>;
+ isProtocolHandled(scheme: string, callback: (error: Error) => void): void;
/**
* Registers a protocol of scheme that will send a Buffer as a response. The usage
* is the same with registerFileProtocol, except that the callback should be called
@@ -4265,14 +3887,13 @@ declare namespace Electron {
* scheme is successfully registered or completion(error) when failed. To handle
* the request, the callback should be called with either the file's path or an
* object that has a path property, e.g. callback(filePath) or callback({ path:
- * filePath }). The object may also have a headers property which gives a map of
- * headers to values for the response headers, e.g. callback({ path: filePath,
- * headers: {"Content-Security-Policy": "default-src 'none'"]}). When callback is
- * called with nothing, a number, or an object that has an error property, the
- * request will fail with the error number you specified. For the available error
- * numbers you can use, please see the net error list. By default the scheme is
- * treated like http:, which is parsed differently than protocols that follow the
- * "generic URI syntax" like file:.
+ * filePath }). When callback is called with nothing, a number, or an object that
+ * has an error property, the request will fail with the error number you
+ * specified. For the available error numbers you can use, please see the net error
+ * list. By default the scheme is treated like http:, which is parsed differently
+ * than protocols that follow the "generic URI syntax" like file:, so you probably
+ * want to call protocol.registerStandardSchemes to have your scheme treated as a
+ * standard scheme.
*/
registerFileProtocol(scheme: string, handler: (request: RegisterFileProtocolRequest, callback: (filePath?: string) => void) => void, completion?: (error: Error) => void): void;
/**
@@ -4284,31 +3905,24 @@ declare namespace Electron {
* set session to null. For POST requests the uploadData object must be provided.
*/
registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void;
- /**
- * Note: This method can only be used before the ready event of the app module gets
- * emitted and can be called only once. Registers the scheme as standard, secure,
- * bypasses content security policy for resources, allows registering ServiceWorker
- * and supports fetch API. Specify a privilege with the value of true to enable the
- * capability. An example of registering a privileged scheme, with bypassing
- * Content Security Policy: A standard scheme adheres to what RFC 3986 calls
- * generic URI syntax. For example http and https are standard schemes, while file
- * is not. Registering a scheme as standard, will allow relative and absolute
- * resources to be resolved correctly when served. Otherwise the scheme will behave
- * like the file protocol, but without the ability to resolve relative URLs. For
- * example when you load following page with custom protocol without registering it
- * as standard scheme, the image will not be loaded because non-standard schemes
- * can not recognize relative URLs: Registering a scheme as standard will allow
- * access to files through the FileSystem API. Otherwise the renderer will throw a
- * security error for the scheme. By default web storage apis (localStorage,
- * sessionStorage, webSQL, indexedDB, cookies) are disabled for non standard
- * schemes. So in general if you want to register a custom protocol to replace the
- * http protocol, you have to register it as a standard scheme.
- * protocol.registerSchemesAsPrivileged can be used to replicate the functionality
- * of the previous protocol.registerStandardSchemes, webFrame.registerURLSchemeAs*
- * and protocol.registerServiceWorkerSchemes functions that existed prior to
- * Electron 5.0.0, for example: before (<= v4.x) after (>= v5.x)
- */
- registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
+ registerServiceWorkerSchemes(schemes: string[]): void;
+ /**
+ * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
+ * http and https are standard schemes, while file is not. Registering a scheme as
+ * standard, will allow relative and absolute resources to be resolved correctly
+ * when served. Otherwise the scheme will behave like the file protocol, but
+ * without the ability to resolve relative URLs. For example when you load
+ * following page with custom protocol without registering it as standard scheme,
+ * the image will not be loaded because non-standard schemes can not recognize
+ * relative URLs: Registering a scheme as standard will allow access to files
+ * through the FileSystem API. Otherwise the renderer will throw a security error
+ * for the scheme. By default web storage apis (localStorage, sessionStorage,
+ * webSQL, indexedDB, cookies) are disabled for non standard schemes. So in general
+ * if you want to register a custom protocol to replace the http protocol, you have
+ * to register it as a standard scheme: Note: This method can only be used before
+ * the ready event of the app module gets emitted.
+ */
+ registerStandardSchemes(schemes: string[], options?: RegisterStandardSchemesOptions): void;
/**
* Registers a protocol of scheme that will send a Readable as a response. The
* usage is similar to the other register{Any}Protocol, except that the callback
@@ -4589,33 +4203,22 @@ declare namespace Electron {
* authentication.
*/
allowNTLMCredentialsForDomains(domains: string): void;
- clearAuthCache(): Promise<void>;
- clearAuthCache(options: (RemovePassword) | (RemoveClientCertificate)): Promise<void>;
/**
- * Clears the session’s HTTP authentication cache. Deprecated Soon
+ * Clears the session’s HTTP authentication cache.
*/
- clearAuthCache(options: (RemovePassword) | (RemoveClientCertificate), callback: Function): void;
+ clearAuthCache(options: (RemovePassword) | (RemoveClientCertificate), callback?: Function): void;
/**
* Clears the session’s HTTP cache.
*/
- clearCache(): Promise<void>;
- /**
- * Clears the session’s HTTP cache. Deprecated Soon
- */
- clearCache(callback: (error: number) => void): void;
+ clearCache(callback: Function): void;
/**
* Clears the host resolver cache.
*/
- clearHostResolverCache(): Promise<void>;
- /**
- * Clears the host resolver cache. Deprecated Soon
- */
clearHostResolverCache(callback?: Function): void;
/**
- * Clears the storage data for the current session. Deprecated Soon
+ * Clears the data of web storages.
*/
clearStorageData(options?: ClearStorageDataOptions, callback?: Function): void;
- clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
/**
* Allows resuming cancelled or interrupted downloads from previous Session. The
* API will generate a DownloadItem that can be accessed with the will-download
@@ -4637,22 +4240,16 @@ declare namespace Electron {
* Writes any unwritten DOMStorage data to disk.
*/
flushStorageData(): void;
- /**
- * Deprecated Soon
- */
getBlobData(identifier: string, callback: (result: Buffer) => void): void;
- getBlobData(identifier: string): Promise<Buffer>;
- getCacheSize(): Promise<number>;
/**
- * Callback is invoked with the session's current cache size. Deprecated Soon
+ * Callback is invoked with the session's current cache size.
*/
- getCacheSize(callback: (size: number, error: number) => void): void;
+ getCacheSize(callback: (size: number) => void): void;
getPreloads(): string[];
getUserAgent(): string;
- resolveProxy(url: string): Promise<string>;
/**
* Resolves the proxy information for url. The callback will be called with
- * callback(proxy) when the request is performed. Deprecated Soon
+ * callback(proxy) when the request is performed.
*/
resolveProxy(url: string, callback: (proxy: string) => void): void;
/**
@@ -4691,13 +4288,6 @@ declare namespace Electron {
* proxyRules has to follow the rules below: For example: The proxyBypassRules is a
* comma separated list of rules described below:
*/
- setProxy(config: Config): Promise<void>;
- /**
- * Sets the proxy settings. When pacScript and proxyRules are provided together,
- * the proxyRules option is ignored and pacScript configuration is applied. The
- * proxyRules has to follow the rules below: For example: The proxyBypassRules is a
- * comma separated list of rules described below: Deprecated Soon
- */
setProxy(config: Config, callback: Function): void;
/**
* Overrides the userAgent and acceptLanguages for this session. The
@@ -4729,12 +4319,7 @@ declare namespace Electron {
* Open the given external protocol URL in the desktop's default manner. (For
* example, mailto: URLs in the user's default mail agent).
*/
- openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
- /**
- * Open the given external protocol URL in the desktop's default manner. (For
- * example, mailto: URLs in the user's default mail agent). Deprecated
- */
- openExternalSync(url: string, options?: OpenExternalSyncOptions): boolean;
+ openExternal(url: string, options?: OpenExternalOptions, callback?: (error: Error) => void): boolean;
/**
* Open the given file in the desktop's default manner.
*/
@@ -4747,7 +4332,7 @@ declare namespace Electron {
/**
* Show the given file in a file manager. If possible, select the file.
*/
- showItemInFolder(fullPath: string): void;
+ showItemInFolder(fullPath: string): boolean;
/**
* Creates or updates a shortcut link at shortcutPath.
*/
@@ -4848,48 +4433,28 @@ declare namespace Electron {
once(event: 'color-changed', listener: (event: Event) => void): this;
addListener(event: 'color-changed', listener: (event: Event) => void): this;
removeListener(event: 'color-changed', listener: (event: Event) => void): this;
- on(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
- /**
- * `true` if a high contrast theme is being used, `false` otherwise.
- */
- highContrastColorScheme: boolean) => void): this;
- once(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
- /**
- * `true` if a high contrast theme is being used, `false` otherwise.
- */
- highContrastColorScheme: boolean) => void): this;
- addListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
- /**
- * `true` if a high contrast theme is being used, `false` otherwise.
- */
- highContrastColorScheme: boolean) => void): this;
- removeListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
- /**
- * `true` if a high contrast theme is being used, `false` otherwise.
- */
- highContrastColorScheme: boolean) => void): this;
on(event: 'inverted-color-scheme-changed', listener: (event: Event,
/**
- * `true` if an inverted color scheme (a high contrast color scheme with light text
- * and dark backgrounds) is being used, `false` otherwise.
+ * `true` if an inverted color scheme, such as a high contrast theme, is being
+ * used, `false` otherwise.
*/
invertedColorScheme: boolean) => void): this;
once(event: 'inverted-color-scheme-changed', listener: (event: Event,
/**
- * `true` if an inverted color scheme (a high contrast color scheme with light text
- * and dark backgrounds) is being used, `false` otherwise.
+ * `true` if an inverted color scheme, such as a high contrast theme, is being
+ * used, `false` otherwise.
*/
invertedColorScheme: boolean) => void): this;
addListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
/**
- * `true` if an inverted color scheme (a high contrast color scheme with light text
- * and dark backgrounds) is being used, `false` otherwise.
+ * `true` if an inverted color scheme, such as a high contrast theme, is being
+ * used, `false` otherwise.
*/
invertedColorScheme: boolean) => void): this;
removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
/**
- * `true` if an inverted color scheme (a high contrast color scheme with light text
- * and dark backgrounds) is being used, `false` otherwise.
+ * `true` if an inverted color scheme, such as a high contrast theme, is being
+ * used, `false` otherwise.
*/
invertedColorScheme: boolean) => void): this;
/**
@@ -4902,26 +4467,15 @@ declare namespace Electron {
* was not required until macOS 10.14 Mojave, so this method will always return
* true if your system is running 10.13 High Sierra or lower.
*/
- askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
- /**
- * NOTE: This API will return false on macOS systems older than Sierra 10.12.2.
- */
- canPromptTouchID(): boolean;
- /**
- * This API is only available on macOS 10.14 Mojave or newer.
- */
+ askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<Boolean>;
getAccentColor(): string;
/**
- * Returns an object with system animation settings.
- */
- getAnimationSettings(): AnimationSettings;
- /**
* Gets the macOS appearance setting that you have declared you want for your
* application, maps to NSApplication.appearance. You can use the
* setAppLevelAppearance API to set this value.
*/
getAppLevelAppearance(): ('dark' | 'light' | 'unknown');
- getColor(color: '3d-dark-shadow' | '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text' | 'alternate-selected-control-text' | 'alternate-selected-control-text' | 'control-background' | 'control' | 'control-text' | 'disabled-control-text' | 'find-highlight' | 'grid' | 'header-text' | 'highlight' | 'keyboard-focus-indicator' | 'label' | 'link' | 'placeholder-text' | 'quaternary-label' | 'scrubber-textured-background' | 'secondary-label' | 'selected-content-background' | 'selected-control' | 'selected-control-text' | 'selected-menu-item' | 'selected-text-background' | 'selected-text' | 'separator' | 'shadow' | 'tertiary-label' | 'text-background' | 'text' | 'under-page-background' | 'unemphasized-selected-content-background' | 'unemphasized-selected-text-background' | 'unemphasized-selected-text' | 'window-background' | 'window-frame-text'): string;
+ getColor(color: '3d-dark-shadow' | '3d-face' | '3d-highlight' | '3d-light' | '3d-shadow' | 'active-border' | 'active-caption' | 'active-caption-gradient' | 'app-workspace' | 'button-text' | 'caption-text' | 'desktop' | 'disabled-text' | 'highlight' | 'highlight-text' | 'hotlight' | 'inactive-border' | 'inactive-caption' | 'inactive-caption-gradient' | 'inactive-caption-text' | 'info-background' | 'info-text' | 'menu' | 'menu-highlight' | 'menubar' | 'menu-text' | 'scrollbar' | 'window' | 'window-frame' | 'window-text'): string;
/**
* Gets the macOS appearance setting that is currently applied to your application,
* maps to NSApplication.effectiveAppearance Please note that until Electron is
@@ -4939,12 +4493,6 @@ declare namespace Electron {
*/
getMediaAccessStatus(mediaType: string): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
/**
- * Returns one of several standard system colors that automatically adapt to
- * vibrancy and changes in accessibility settings like 'Increase contrast' and
- * 'Reduce transparency'. See Apple Documentation for more details.
- */
- getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): void;
- /**
* Some popular key and types are:
*/
getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any;
@@ -4954,7 +4502,6 @@ declare namespace Electron {
*/
isAeroGlassEnabled(): boolean;
isDarkMode(): boolean;
- isHighContrastColorScheme(): boolean;
isInvertedColorScheme(): boolean;
isSwipeTrackingFromScrollEventsEnabled(): boolean;
isTrustedAccessibilityClient(prompt: boolean): boolean;
@@ -4967,23 +4514,13 @@ declare namespace Electron {
* Posts event as native notifications of macOS. The userInfo is an Object that
* contains the user information dictionary sent along with the notification.
*/
- postNotification(event: string, userInfo: any, deliverImmediately?: boolean): void;
+ postNotification(event: string, userInfo: any): void;
/**
* Posts event as native notifications of macOS. The userInfo is an Object that
* contains the user information dictionary sent along with the notification.
*/
postWorkspaceNotification(event: string, userInfo: any): void;
/**
- * This API itself will not protect your user data; rather, it is a mechanism to
- * allow you to do so. Native apps will need to set Access Control Constants like
- * kSecAccessControlUserPresence on the their keychain entry so that reading it
- * would auto-prompt for Touch ID biometric consent. This could be done with
- * node-keytar, such that one would store an encryption key with node-keytar and
- * only fetch it if promptTouchID() resolves. NOTE: This API will return a rejected
- * Promise on macOS systems older than Sierra 10.12.2.
- */
- promptTouchID(reason: string): Promise<void>;
- /**
* Add the specified defaults to your application's NSUserDefaults.
*/
registerDefaults(defaults: any): void;
@@ -5071,10 +4608,6 @@ declare namespace Electron {
* The string to be displayed in a JumpList.
*/
title: string;
- /**
- * The working directory. Default is empty.
- */
- workingDirectory?: string;
}
interface ThumbarButton {
@@ -5296,7 +4829,7 @@ declare namespace Electron {
/**
* Emitted when the tray icon is clicked.
*/
- on(event: 'click', listener: (event: KeyboardEvent,
+ on(event: 'click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
@@ -5305,7 +4838,7 @@ declare namespace Electron {
* The position of the event.
*/
position: Point) => void): this;
- once(event: 'click', listener: (event: KeyboardEvent,
+ once(event: 'click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
@@ -5314,7 +4847,7 @@ declare namespace Electron {
* The position of the event.
*/
position: Point) => void): this;
- addListener(event: 'click', listener: (event: KeyboardEvent,
+ addListener(event: 'click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
@@ -5323,7 +4856,7 @@ declare namespace Electron {
* The position of the event.
*/
position: Point) => void): this;
- removeListener(event: 'click', listener: (event: KeyboardEvent,
+ removeListener(event: 'click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
@@ -5335,22 +4868,22 @@ declare namespace Electron {
/**
* Emitted when the tray icon is double clicked.
*/
- on(event: 'double-click', listener: (event: KeyboardEvent,
+ on(event: 'double-click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
bounds: Rectangle) => void): this;
- once(event: 'double-click', listener: (event: KeyboardEvent,
+ once(event: 'double-click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
bounds: Rectangle) => void): this;
- addListener(event: 'double-click', listener: (event: KeyboardEvent,
+ addListener(event: 'double-click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
bounds: Rectangle) => void): this;
- removeListener(event: 'double-click', listener: (event: KeyboardEvent,
+ removeListener(event: 'double-click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
@@ -5432,22 +4965,22 @@ declare namespace Electron {
/**
* Emitted when the mouse enters the tray icon.
*/
- on(event: 'mouse-enter', listener: (event: KeyboardEvent,
+ on(event: 'mouse-enter', listener: (event: Event,
/**
* The position of the event.
*/
position: Point) => void): this;
- once(event: 'mouse-enter', listener: (event: KeyboardEvent,
+ once(event: 'mouse-enter', listener: (event: Event,
/**
* The position of the event.
*/
position: Point) => void): this;
- addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
+ addListener(event: 'mouse-enter', listener: (event: Event,
/**
* The position of the event.
*/
position: Point) => void): this;
- removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
+ removeListener(event: 'mouse-enter', listener: (event: Event,
/**
* The position of the event.
*/
@@ -5455,22 +4988,22 @@ declare namespace Electron {
/**
* Emitted when the mouse exits the tray icon.
*/
- on(event: 'mouse-leave', listener: (event: KeyboardEvent,
+ on(event: 'mouse-leave', listener: (event: Event,
/**
* The position of the event.
*/
position: Point) => void): this;
- once(event: 'mouse-leave', listener: (event: KeyboardEvent,
+ once(event: 'mouse-leave', listener: (event: Event,
/**
* The position of the event.
*/
position: Point) => void): this;
- addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
+ addListener(event: 'mouse-leave', listener: (event: Event,
/**
* The position of the event.
*/
position: Point) => void): this;
- removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
+ removeListener(event: 'mouse-leave', listener: (event: Event,
/**
* The position of the event.
*/
@@ -5478,22 +5011,22 @@ declare namespace Electron {
/**
* Emitted when the mouse moves in the tray icon.
*/
- on(event: 'mouse-move', listener: (event: KeyboardEvent,
+ on(event: 'mouse-move', listener: (event: Event,
/**
* The position of the event.
*/
position: Point) => void): this;
- once(event: 'mouse-move', listener: (event: KeyboardEvent,
+ once(event: 'mouse-move', listener: (event: Event,
/**
* The position of the event.
*/
position: Point) => void): this;
- addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
+ addListener(event: 'mouse-move', listener: (event: Event,
/**
* The position of the event.
*/
position: Point) => void): this;
- removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
+ removeListener(event: 'mouse-move', listener: (event: Event,
/**
* The position of the event.
*/
@@ -5501,22 +5034,22 @@ declare namespace Electron {
/**
* Emitted when the tray icon is right clicked.
*/
- on(event: 'right-click', listener: (event: KeyboardEvent,
+ on(event: 'right-click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
bounds: Rectangle) => void): this;
- once(event: 'right-click', listener: (event: KeyboardEvent,
+ once(event: 'right-click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
bounds: Rectangle) => void): this;
- addListener(event: 'right-click', listener: (event: KeyboardEvent,
+ addListener(event: 'right-click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
bounds: Rectangle) => void): this;
- removeListener(event: 'right-click', listener: (event: KeyboardEvent,
+ removeListener(event: 'right-click', listener: (event: Event,
/**
* The bounds of tray icon.
*/
@@ -5535,7 +5068,6 @@ declare namespace Electron {
*/
getBounds(): Rectangle;
getIgnoreDoubleClickEvents(): boolean;
- getTitle(title: string): string;
isDestroyed(): boolean;
/**
* Pops up the context menu of the tray icon. When menu is passed, the menu will be
@@ -5548,9 +5080,9 @@ declare namespace Electron {
*/
setContextMenu(menu: (Menu) | (null)): void;
/**
- * Sets when the tray's icon background becomes highlighted (in blue). Deprecated
- * Note: You can use highlightMode with a BrowserWindow by toggling between 'never'
- * and 'always' modes when the window visibility changes.
+ * Sets when the tray's icon background becomes highlighted (in blue). Note: You
+ * can use highlightMode with a BrowserWindow by toggling between 'never' and
+ * 'always' modes when the window visibility changes.
*/
setHighlightMode(mode: 'selection' | 'always' | 'never'): void;
/**
@@ -5568,7 +5100,7 @@ declare namespace Electron {
*/
setPressedImage(image: (NativeImage) | (string)): void;
/**
- * Sets the title displayed next to the tray icon in the status bar (Support ANSI
+ * Sets the title displayed aside of the tray icon in the status bar (Support ANSI
* colors).
*/
setTitle(title: string): void;
@@ -5837,14 +5369,6 @@ declare namespace Electron {
*/
hotspot?: Point) => void): this;
/**
- * Emitted when desktopCapturer.getSources() is called in the renderer process.
- * Calling event.preventDefault() will make it return empty sources.
- */
- on(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
- once(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
- addListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
- removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
- /**
* Emitted when webContents is destroyed.
*/
on(event: 'destroyed', listener: Function): this;
@@ -6193,13 +5717,6 @@ declare namespace Electron {
addListener(event: 'dom-ready', listener: (event: Event) => void): this;
removeListener(event: 'dom-ready', listener: (event: Event) => void): this;
/**
- * Emitted when the window enters a full-screen state triggered by HTML API.
- */
- on(event: 'enter-html-full-screen', listener: Function): this;
- once(event: 'enter-html-full-screen', listener: Function): this;
- addListener(event: 'enter-html-full-screen', listener: Function): this;
- removeListener(event: 'enter-html-full-screen', listener: Function): this;
- /**
* Emitted when a result is available for [webContents.findInPage] request.
*/
on(event: 'found-in-page', listener: (event: Event,
@@ -6211,45 +5728,6 @@ declare namespace Electron {
removeListener(event: 'found-in-page', listener: (event: Event,
result: Result) => void): this;
/**
- * Emitted when the renderer process sends an asynchronous message via
- * ipcRenderer.send().
- */
- on(event: 'ipc-message', listener: (event: Event,
- channel: string,
- ...args: any[]) => void): this;
- once(event: 'ipc-message', listener: (event: Event,
- channel: string,
- ...args: any[]) => void): this;
- addListener(event: 'ipc-message', listener: (event: Event,
- channel: string,
- ...args: any[]) => void): this;
- removeListener(event: 'ipc-message', listener: (event: Event,
- channel: string,
- ...args: any[]) => void): this;
- /**
- * Emitted when the renderer process sends a synchronous message via
- * ipcRenderer.sendSync().
- */
- on(event: 'ipc-message-sync', listener: (event: Event,
- channel: string,
- ...args: any[]) => void): this;
- once(event: 'ipc-message-sync', listener: (event: Event,
- channel: string,
- ...args: any[]) => void): this;
- addListener(event: 'ipc-message-sync', listener: (event: Event,
- channel: string,
- ...args: any[]) => void): this;
- removeListener(event: 'ipc-message-sync', listener: (event: Event,
- channel: string,
- ...args: any[]) => void): this;
- /**
- * Emitted when the window leaves a full-screen state triggered by HTML API.
- */
- on(event: 'leave-html-full-screen', listener: Function): this;
- once(event: 'leave-html-full-screen', listener: Function): this;
- addListener(event: 'leave-html-full-screen', listener: Function): this;
- removeListener(event: 'leave-html-full-screen', listener: Function): this;
- /**
* Emitted when webContents wants to do basic auth. The usage is the same with the
* login event of app.
*/
@@ -6464,21 +5942,6 @@ declare namespace Electron {
name: string,
version: string) => void): this;
/**
- * Emitted when the preload script preloadPath throws an unhandled exception error.
- */
- on(event: 'preload-error', listener: (event: Event,
- preloadPath: string,
- error: Error) => void): this;
- once(event: 'preload-error', listener: (event: Event,
- preloadPath: string,
- error: Error) => void): this;
- addListener(event: 'preload-error', listener: (event: Event,
- preloadPath: string,
- error: Error) => void): this;
- removeListener(event: 'preload-error', listener: (event: Event,
- preloadPath: string,
- error: Error) => void): this;
- /**
* Emitted when remote.getBuiltin() is called in the renderer process. Calling
* event.preventDefault() will prevent the module from being returned. Custom value
* can be returned by setting event.returnValue.
@@ -6743,22 +6206,15 @@ declare namespace Electron {
canGoForward(): boolean;
canGoToOffset(offset: number): boolean;
/**
- * Captures a snapshot of the page within rect. Omitting rect will capture the
- * whole visible page.
- */
- capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
- /**
* Captures a snapshot of the page within rect. Upon completion callback will be
* called with callback(image). The image is an instance of NativeImage that stores
* data of the snapshot. Omitting rect will capture the whole visible page.
- * Deprecated Soon
*/
capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void;
/**
* Captures a snapshot of the page within rect. Upon completion callback will be
* called with callback(image). The image is an instance of NativeImage that stores
* data of the snapshot. Omitting rect will capture the whole visible page.
- * Deprecated Soon
*/
capturePage(callback: (image: NativeImage) => void): void;
/**
@@ -6805,16 +6261,13 @@ declare namespace Electron {
/**
* Evaluates code in page. In the browser window some HTML APIs like
* requestFullScreen can only be invoked by a gesture from the user. Setting
- * userGesture to true will remove this limitation. Deprecated Soon
+ * userGesture to true will remove this limitation. If the result of the executed
+ * code is a promise the callback result will be the resolved value of the promise.
+ * We recommend that you use the returned Promise to handle code that results in a
+ * Promise.
*/
executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise<any>;
/**
- * Evaluates code in page. In the browser window some HTML APIs like
- * requestFullScreen can only be invoked by a gesture from the user. Setting
- * userGesture to true will remove this limitation.
- */
- executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
- /**
* Starts a request to find all matches for the text in the web page. The result of
* the request can be obtained by subscribing to found-in-page event.
*/
@@ -6835,8 +6288,16 @@ declare namespace Electron {
getURL(): string;
getUserAgent(): string;
getWebRTCIPHandlingPolicy(): string;
- getZoomFactor(): number;
- getZoomLevel(): number;
+ /**
+ * Sends a request to get current zoom factor, the callback will be called with
+ * callback(zoomFactor).
+ */
+ getZoomFactor(callback: (zoomFactor: number) => void): void;
+ /**
+ * Sends a request to get current zoom level, the callback will be called with
+ * callback(zoomLevel).
+ */
+ getZoomLevel(callback: (zoomLevel: number) => void): void;
/**
* Makes the browser go back a web page.
*/
@@ -6854,6 +6315,11 @@ declare namespace Electron {
*/
goToOffset(offset: number): void;
/**
+ * Checks if any ServiceWorker is registered and returns a boolean as response to
+ * callback.
+ */
+ hasServiceWorker(callback: (hasWorker: boolean) => void): void;
+ /**
* Injects CSS into the current web page.
*/
insertCSS(css: string): void;
@@ -6870,10 +6336,6 @@ declare namespace Electron {
*/
inspectServiceWorker(): void;
/**
- * Opens the developer tools for the shared worker context.
- */
- inspectSharedWorker(): void;
- /**
* Schedules a full repaint of the window this web contents is in. If offscreen
* rendering is enabled invalidates the frame and generates a new one through the
* 'paint' event.
@@ -6896,13 +6358,13 @@ declare namespace Electron {
* relative to the root of your application. For instance an app structure like
* this: Would require code like this
*/
- loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
+ loadFile(filePath: string, options?: LoadFileOptions): void;
/**
* Loads the url in the window. The url must contain the protocol prefix, e.g. the
* http:// or file://. If the load should bypass http cache then use the pragma
* header to achieve it.
*/
- loadURL(url: string, options?: LoadURLOptions): Promise<void>;
+ loadURL(url: string, options?: LoadURLOptions): void;
/**
* Opens the devtools. When contents is a <webview> tag, the mode would be detach
* by default, explicitly passing an empty mode can force using last used dock
@@ -6927,16 +6389,11 @@ declare namespace Electron {
print(options?: PrintOptions, callback?: (success: boolean) => void): void;
/**
* Prints window's web page as PDF with Chromium's preview printing custom
- * settings. The landscape will be ignored if @page CSS at-rule is used in the web
- * page. By default, an empty options will be regarded as: Use page-break-before:
- * always; CSS style to force to print to a new page. An example of
- * webContents.printToPDF:
- */
- printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
- /**
- * Prints window's web page as PDF with Chromium's preview printing custom
* settings. The callback will be called with callback(error, data) on completion.
- * The data is a Buffer that contains the generated PDF data. Deprecated Soon
+ * The data is a Buffer that contains the generated PDF data. The landscape will be
+ * ignored if @page CSS at-rule is used in the web page. By default, an empty
+ * options will be regarded as: Use page-break-before: always; CSS style to force
+ * to print to a new page. An example of webContents.printToPDF:
*/
printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void;
/**
@@ -6963,7 +6420,7 @@ declare namespace Electron {
* Executes the editing command replaceMisspelling in web page.
*/
replaceMisspelling(text: string): void;
- savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
+ savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML', callback: (error: Error) => void): boolean;
/**
* Executes the editing command selectAll in web page.
*/
@@ -6985,16 +6442,6 @@ declare namespace Electron {
*/
sendInputEvent(event: Event): void;
/**
- * Send an asynchronous message to a specific frame in a renderer process via
- * channel. Arguments will be serialized as JSON internally and as such no
- * functions or prototype chains will be included. The renderer process can handle
- * the message by listening to channel with the ipcRenderer module. If you want to
- * get the frameId of a given renderer context you should use the
- * webFrame.routingId value. E.g. You can also read frameId from all incoming IPC
- * messages in the main process.
- */
- sendToFrame(frameId: number, channel: string, ...args: any[]): void;
- /**
* Mute the audio on the current web page.
*/
setAudioMuted(muted: boolean): void;
@@ -7093,6 +6540,12 @@ declare namespace Electron {
*/
undo(): void;
/**
+ * Unregisters any ServiceWorker if present and returns a boolean as response to
+ * callback when the JS promise is fulfilled or false when the JS promise is
+ * rejected.
+ */
+ unregisterServiceWorker(callback: (success: boolean) => void): void;
+ /**
* Executes the editing command unselect in web page.
*/
unselect(): void;
@@ -7121,22 +6574,11 @@ declare namespace Electron {
* requestFullScreen can only be invoked by a gesture from the user. Setting
* userGesture to true will remove this limitation.
*/
- executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
- /**
- * Evaluates code in page. In the browser window some HTML APIs like
- * requestFullScreen can only be invoked by a gesture from the user. Setting
- * userGesture to true will remove this limitation. Deprecated Soon
- */
executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise<any>;
/**
- * Works like executeJavaScript but evaluates scripts in an isolated context.
- * Deprecated Soon
- */
- executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any) => void): Promise<any>;
- /**
- * Works like executeJavaScript but evaluates scripts in an isolated context.
+ * Work like executeJavaScript but evaluates scripts in an isolated context.
*/
- executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
+ executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any) => void): void;
findFrameByName(name: string): WebFrame;
findFrameByRoutingId(routingId: number): WebFrame;
getFrameForSelector(selector: string): WebFrame;
@@ -7148,14 +6590,22 @@ declare namespace Electron {
getZoomFactor(): number;
getZoomLevel(): number;
/**
- * Inserts css as a style sheet in the document.
- */
- insertCSS(css: string): void;
- /**
* Inserts text to the focused element.
*/
insertText(text: string): void;
/**
+ * Resources will be loaded from this scheme regardless of the current page's
+ * Content Security Policy.
+ */
+ registerURLSchemeAsBypassingCSP(scheme: string): void;
+ /**
+ * Registers the scheme as secure, bypasses content security policy for resources,
+ * allows registering ServiceWorker and supports fetch API. Specify an option with
+ * the value of false to omit it from the registration. An example of registering a
+ * privileged scheme, without bypassing Content Security Policy:
+ */
+ registerURLSchemeAsPrivileged(scheme: string, options?: RegisterURLSchemeAsPrivilegedOptions): void;
+ /**
* Set the content security policy of the isolated world.
*/
setIsolatedWorldContentSecurityPolicy(worldId: number, csp: string): void;
@@ -7164,11 +6614,6 @@ declare namespace Electron {
*/
setIsolatedWorldHumanReadableName(worldId: number, name: string): void;
/**
- * Set the security origin, content security policy and name of the isolated world.
- * Note: If the csp is specified, then the securityOrigin also has to be specified.
- */
- setIsolatedWorldInfo(worldId: number, info: Info): void;
- /**
* Set the security origin of the isolated world.
*/
setIsolatedWorldSecurityOrigin(worldId: number, securityOrigin: string): void;
@@ -7178,12 +6623,10 @@ declare namespace Electron {
setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
/**
* Sets a provider for spell checking in input fields and text areas. The provider
- * must be an object that has a spellCheck method that accepts an array of
- * individual words for spellchecking. The spellCheck function runs asynchronously
- * and calls the callback function with an array of misspelt words when complete.
- * An example of using node-spellchecker as provider:
+ * must be an object that has a spellCheck method that returns whether the word
+ * passed is correctly spelled. An example of using node-spellchecker as provider:
*/
- setSpellCheckProvider(language: string, provider: Provider): void;
+ setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: Provider): void;
/**
* Sets the maximum and minimum pinch-to-zoom level.
*/
@@ -7242,90 +6685,90 @@ declare namespace Electron {
* The listener will be called with listener(details) when a server initiated
* redirect is about to occur.
*/
- onBeforeRedirect(listener: ((details: OnBeforeRedirectDetails) => void) | (null)): void;
+ onBeforeRedirect(listener: (details: OnBeforeRedirectDetails) => void): void;
/**
* The listener will be called with listener(details) when a server initiated
* redirect is about to occur.
*/
- onBeforeRedirect(filter: OnBeforeRedirectFilter, listener: ((details: OnBeforeRedirectDetails) => void) | (null)): void;
+ onBeforeRedirect(filter: OnBeforeRedirectFilter, listener: (details: OnBeforeRedirectDetails) => void): void;
/**
* The listener will be called with listener(details, callback) when a request is
* about to occur. The uploadData is an array of UploadData objects. The callback
- * has to be called with an response object. Some examples of valid urls:
+ * has to be called with an response object.
*/
- onBeforeRequest(listener: ((details: OnBeforeRequestDetails, callback: (response: Response) => void) => void) | (null)): void;
+ onBeforeRequest(listener: (details: OnBeforeRequestDetails, callback: (response: Response) => void) => void): void;
/**
* The listener will be called with listener(details, callback) when a request is
* about to occur. The uploadData is an array of UploadData objects. The callback
- * has to be called with an response object. Some examples of valid urls:
+ * has to be called with an response object.
*/
- onBeforeRequest(filter: OnBeforeRequestFilter, listener: ((details: OnBeforeRequestDetails, callback: (response: Response) => void) => void) | (null)): void;
+ onBeforeRequest(filter: OnBeforeRequestFilter, listener: (details: OnBeforeRequestDetails, callback: (response: Response) => void) => void): void;
/**
* The listener will be called with listener(details, callback) before sending an
* HTTP request, once the request headers are available. This may occur after a TCP
* connection is made to the server, but before any http data is sent. The callback
* has to be called with an response object.
*/
- onBeforeSendHeaders(filter: OnBeforeSendHeadersFilter, listener: ((details: OnBeforeSendHeadersDetails, callback: (response: OnBeforeSendHeadersResponse) => void) => void) | (null)): void;
+ onBeforeSendHeaders(filter: OnBeforeSendHeadersFilter, listener: (details: OnBeforeSendHeadersDetails, callback: (response: OnBeforeSendHeadersResponse) => void) => void): void;
/**
* The listener will be called with listener(details, callback) before sending an
* HTTP request, once the request headers are available. This may occur after a TCP
* connection is made to the server, but before any http data is sent. The callback
* has to be called with an response object.
*/
- onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersDetails, callback: (response: OnBeforeSendHeadersResponse) => void) => void) | (null)): void;
+ onBeforeSendHeaders(listener: (details: OnBeforeSendHeadersDetails, callback: (response: OnBeforeSendHeadersResponse) => void) => void): void;
/**
* The listener will be called with listener(details) when a request is completed.
*/
- onCompleted(filter: OnCompletedFilter, listener: ((details: OnCompletedDetails) => void) | (null)): void;
+ onCompleted(filter: OnCompletedFilter, listener: (details: OnCompletedDetails) => void): void;
/**
* The listener will be called with listener(details) when a request is completed.
*/
- onCompleted(listener: ((details: OnCompletedDetails) => void) | (null)): void;
+ onCompleted(listener: (details: OnCompletedDetails) => void): void;
/**
* The listener will be called with listener(details) when an error occurs.
*/
- onErrorOccurred(listener: ((details: OnErrorOccurredDetails) => void) | (null)): void;
+ onErrorOccurred(listener: (details: OnErrorOccurredDetails) => void): void;
/**
* The listener will be called with listener(details) when an error occurs.
*/
- onErrorOccurred(filter: OnErrorOccurredFilter, listener: ((details: OnErrorOccurredDetails) => void) | (null)): void;
+ onErrorOccurred(filter: OnErrorOccurredFilter, listener: (details: OnErrorOccurredDetails) => void): void;
/**
* The listener will be called with listener(details, callback) when HTTP response
* headers of a request have been received. The callback has to be called with an
* response object.
*/
- onHeadersReceived(filter: OnHeadersReceivedFilter, listener: ((details: OnHeadersReceivedDetails, callback: (response: OnHeadersReceivedResponse) => void) => void) | (null)): void;
+ onHeadersReceived(filter: OnHeadersReceivedFilter, listener: (details: OnHeadersReceivedDetails, callback: (response: OnHeadersReceivedResponse) => void) => void): void;
/**
* The listener will be called with listener(details, callback) when HTTP response
* headers of a request have been received. The callback has to be called with an
* response object.
*/
- onHeadersReceived(listener: ((details: OnHeadersReceivedDetails, callback: (response: OnHeadersReceivedResponse) => void) => void) | (null)): void;
+ onHeadersReceived(listener: (details: OnHeadersReceivedDetails, callback: (response: OnHeadersReceivedResponse) => void) => void): void;
/**
* The listener will be called with listener(details) when first byte of the
* response body is received. For HTTP requests, this means that the status line
* and response headers are available.
*/
- onResponseStarted(listener: ((details: OnResponseStartedDetails) => void) | (null)): void;
+ onResponseStarted(listener: (details: OnResponseStartedDetails) => void): void;
/**
* The listener will be called with listener(details) when first byte of the
* response body is received. For HTTP requests, this means that the status line
* and response headers are available.
*/
- onResponseStarted(filter: OnResponseStartedFilter, listener: ((details: OnResponseStartedDetails) => void) | (null)): void;
+ onResponseStarted(filter: OnResponseStartedFilter, listener: (details: OnResponseStartedDetails) => void): void;
/**
* The listener will be called with listener(details) just before a request is
* going to be sent to the server, modifications of previous onBeforeSendHeaders
* response are visible by the time this listener is fired.
*/
- onSendHeaders(filter: OnSendHeadersFilter, listener: ((details: OnSendHeadersDetails) => void) | (null)): void;
+ onSendHeaders(filter: OnSendHeadersFilter, listener: (details: OnSendHeadersDetails) => void): void;
/**
* The listener will be called with listener(details) just before a request is
* going to be sent to the server, modifications of previous onBeforeSendHeaders
* response are visible by the time this listener is fired.
*/
- onSendHeaders(listener: ((details: OnSendHeadersDetails) => void) | (null)): void;
+ onSendHeaders(listener: (details: OnSendHeadersDetails) => void): void;
}
interface WebSource {
@@ -7520,25 +6963,16 @@ declare namespace Electron {
canGoForward(): boolean;
canGoToOffset(offset: number): boolean;
/**
- * Captures a snapshot of the page within rect. Upon completion callback will be
- * called with callback(image). The image is an instance of NativeImage that stores
- * data of the snapshot. Omitting rect will capture the whole visible page.
- * Deprecated Soon
+ * Captures a snapshot of the webview's page. Same as
+ * webContents.capturePage([rect, ]callback).
*/
capturePage(callback: (image: NativeImage) => void): void;
/**
- * Captures a snapshot of the page within rect. Upon completion callback will be
- * called with callback(image). The image is an instance of NativeImage that stores
- * data of the snapshot. Omitting rect will capture the whole visible page.
- * Deprecated Soon
+ * Captures a snapshot of the webview's page. Same as
+ * webContents.capturePage([rect, ]callback).
*/
capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void;
/**
- * Captures a snapshot of the page within rect. Omitting rect will capture the
- * whole visible page.
- */
- capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
- /**
* Clears the navigation history.
*/
clearHistory(): void;
@@ -7565,15 +6999,9 @@ declare namespace Electron {
/**
* Evaluates code in page. If userGesture is set, it will create the user gesture
* context in the page. HTML APIs like requestFullScreen, which require user
- * action, can take advantage of this option for automation. Deprecated Soon
- */
- executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise<any>;
- /**
- * Evaluates code in page. If userGesture is set, it will create the user gesture
- * context in the page. HTML APIs like requestFullScreen, which require user
* action, can take advantage of this option for automation.
*/
- executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
+ executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void;
/**
* Starts a request to find all matches for the text in the web page. The result of
* the request can be obtained by subscribing to found-in-page event.
@@ -7587,9 +7015,16 @@ declare namespace Electron {
* is disabled.
*/
getWebContents(): WebContents;
- getWebContentsId(): number;
- getZoomFactor(): number;
- getZoomLevel(): number;
+ /**
+ * Sends a request to get current zoom factor, the callback will be called with
+ * callback(zoomFactor).
+ */
+ getZoomFactor(callback: (zoomFactor: number) => void): void;
+ /**
+ * Sends a request to get current zoom level, the callback will be called with
+ * callback(zoomLevel).
+ */
+ getZoomLevel(callback: (zoomLevel: number) => void): void;
/**
* Makes the guest page go back.
*/
@@ -7622,10 +7057,6 @@ declare namespace Electron {
* Opens the DevTools for the service worker context present in the guest page.
*/
inspectServiceWorker(): void;
- /**
- * Opens the DevTools for the shared worker context present in the guest page.
- */
- inspectSharedWorker(): void;
isAudioMuted(): boolean;
isCrashed(): boolean;
isCurrentlyAudible(): boolean;
@@ -7638,7 +7069,7 @@ declare namespace Electron {
* Loads the url in the webview, the url must contain the protocol prefix, e.g. the
* http:// or file://.
*/
- loadURL(url: string, options?: LoadURLOptions): Promise<void>;
+ loadURL(url: string, options?: LoadURLOptions): void;
/**
* Opens a DevTools window for guest page.
*/
@@ -7657,14 +7088,10 @@ declare namespace Electron {
print(options?: PrintOptions): void;
/**
* Prints webview's web page as PDF, Same as webContents.printToPDF(options,
- * callback). Deprecated Soon
+ * callback).
*/
printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void;
/**
- * Prints webview's web page as PDF, Same as webContents.printToPDF(options).
- */
- printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
- /**
* Executes editing command redo in page.
*/
redo(): void;
@@ -7754,6 +7181,14 @@ declare namespace Electron {
*/
// allowpopups?: string; ### VSCODE CHANGE (https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ###
/**
+ * When this attribute is present the webview container will automatically resize
+ * within the bounds specified by the attributes minwidth, minheight, maxwidth, and
+ * maxheight. These constraints do not impact the webview unless autosize is
+ * enabled. When autosize is enabled, the webview container size cannot be less
+ * than the minimum values or greater than the maximum.
+ */
+ autosize?: string;
+ /**
* A list of strings which specifies the blink features to be disabled separated by
* ,. The full list of supported feature strings can be found in the
* RuntimeEnabledFeatures.json5 file.
@@ -7772,7 +7207,7 @@ declare namespace Electron {
enableblinkfeatures?: string;
/**
* When this attribute is false the guest page in webview will not have access to
- * the remote module. The remote module is available by default.
+ * the remote module. The remote module is avaiable by default.
*/
enableremotemodule?: string;
/**
@@ -7786,13 +7221,6 @@ declare namespace Electron {
*/
nodeintegration?: string;
/**
- * Experimental option for enabling NodeJS support in sub-frames such as iframes
- * inside the webview. All your preloads will load for every iframe, you can use
- * process.isMainFrame to determine if you are in the main frame or not. This
- * option is disabled by default in the guest page.
- */
- nodeintegrationinsubframes?: string;
- /**
* Sets the session used by the page. If partition starts with persist:, the page
* will use a persistent session available to all pages in the app with the same
* partition. if there is no persist: prefix, the page will use an in-memory
@@ -7854,22 +7282,13 @@ declare namespace Electron {
*/
copyright?: string;
/**
- * The app's build version number.
- */
- version?: string;
- /**
* Credit information.
*/
credits?: string;
/**
- * The app's website.
- */
- website?: string;
- /**
- * Path to the app's icon. Will be shown as 64x64 pixels while retaining aspect
- * ratio.
+ * The app's build version number.
*/
- iconPath?: string;
+ version?: string;
}
interface AddRepresentationOptions {
@@ -7895,24 +7314,6 @@ declare namespace Electron {
dataURL?: string;
}
- interface AnimationSettings {
- /**
- * Returns true if rich animations should be rendered. Looks at session type (e.g.
- * remote desktop) and accessibility settings to give guidance for heavy
- * animations.
- */
- shouldRenderRichAnimation: boolean;
- /**
- * Determines on a per-platform basis whether scroll animations (e.g. produced by
- * home/end key) should be enabled.
- */
- scrollAnimationsEnabledBySystem: boolean;
- /**
- * Determines whether the user desires reduced motion based on platform APIs.
- */
- prefersReducedMotion: boolean;
- }
-
interface AppDetailsOptions {
/**
* Window's . It has to be set, otherwise the other options will have no effect.
@@ -7956,16 +7357,6 @@ declare namespace Electron {
* by default.
*/
height: boolean;
- /**
- * If true, the view's x position and width will grow and shrink proportionly with
- * the window. false by default.
- */
- horizontal: boolean;
- /**
- * If true, the view's y position and height will grow and shrink proportinaly with
- * the window. false by default.
- */
- vertical: boolean;
}
interface BitmapOptions {
@@ -8084,9 +7475,7 @@ declare namespace Electron {
*/
kiosk?: boolean;
/**
- * Default window title. Default is "Electron". If the HTML tag </code> is defined
- * in the HTML file loaded by <code>loadURL()</code>, this property will be
- * ignored.</foo>
+ * Default window title. Default is "Electron".
*/
title?: string;
/**
@@ -8131,8 +7520,8 @@ declare namespace Electron {
enableLargerThanScreen?: boolean;
/**
* Window's background color as a hexadecimal value, like #66CD00 or #FFF or
- * #80FFFFFF (alpha in #AARRGGBB format is supported if transparent is set to
- * true). Default is #FFF (white).
+ * #80FFFFFF (alpha is supported if transparent is set to true). Default is #FFF
+ * (white).
*/
backgroundColor?: string;
/**
@@ -8244,24 +7633,15 @@ declare namespace Electron {
interface CommandLine {
/**
* Append a switch (with optional value) to Chromium's command line. Note: This
- * will not affect process.argv. The intended usage of this function is to control
- * Chromium's behavior.
+ * will not affect process.argv, and is mainly used by developers to control some
+ * low-level Chromium behaviors.
*/
appendSwitch: (the_switch: string, value?: string) => void;
/**
* Append an argument to Chromium's command line. The argument will be quoted
- * correctly. Switches will precede arguments regardless of appending order. If
- * you're appending an argument like --switch=value, consider using
- * appendSwitch('switch', 'value') instead. Note: This will not affect
- * process.argv. The intended usage of this function is to control Chromium's
- * behavior.
+ * correctly. Note: This will not affect process.argv.
*/
appendArgument: (value: string) => void;
- hasSwitch: (the_switch: string) => boolean;
- /**
- * Note: When the switch is not present or has no value, it returns empty string.
- */
- getSwitchValue: (the_switch: string) => string;
}
interface Config {
@@ -8398,15 +7778,6 @@ declare namespace Electron {
crashesDirectory?: string;
}
- interface CreateFromBitmapOptions {
- width: number;
- height: number;
- /**
- * Defaults to 1.0.
- */
- scaleFactor?: number;
- }
-
interface CreateFromBufferOptions {
/**
* Required for bitmap buffers.
@@ -8479,7 +7850,8 @@ declare namespace Electron {
*/
value?: string;
/**
- * The domain of the cookie. Empty by default if omitted.
+ * The domain of the cookie; this will be normalized with a preceding dot so that
+ * it's also valid for subdomains. Empty by default if omitted.
*/
domain?: string;
/**
@@ -8563,13 +7935,15 @@ declare namespace Electron {
* Hides the dock icon.
*/
hide: () => void;
- show: () => Promise<void>;
+ /**
+ * Shows the dock icon.
+ */
+ show: () => void;
isVisible: () => boolean;
/**
* Sets the application's dock menu.
*/
setMenu: (menu: Menu) => void;
- getMenu: () => (Menu) | (null);
/**
* Sets the image associated with this dock icon.
*/
@@ -8720,21 +8094,6 @@ declare namespace Electron {
password: string;
}
- interface Info {
- /**
- * Security origin for the isolated world.
- */
- securityOrigin?: string;
- /**
- * Content Security Policy for the isolated world.
- */
- csp?: string;
- /**
- * Name for isolated world. Useful in devtools.
- */
- name?: string;
- }
-
interface Input {
/**
* Either keyUp or keyDown.
@@ -8929,18 +8288,12 @@ declare namespace Electron {
* Will be called with click(menuItem, browserWindow, event) when the menu item is
* clicked.
*/
- click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: KeyboardEvent) => void;
+ click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void;
/**
- * Can be undo, redo, cut, copy, paste, pasteAndMatchStyle, delete, selectAll,
- * reload, forceReload, toggleDevTools, resetZoom, zoomIn, zoomOut,
- * togglefullscreen, window, minimize, close, help, about, services, hide,
- * hideOthers, unhide, quit, startSpeaking, stopSpeaking, close, minimize, zoom,
- * front, appMenu, fileMenu, editMenu, viewMenu, recentDocuments, toggleTabBar,
- * selectNextTab, selectPreviousTab, mergeAllWindows, clearRecentDocuments,
- * moveTabToNewWindow or windowMenu Define the action of the menu item, when
- * specified the click property will be ignored. See .
+ * Define the action of the menu item, when specified the click property will be
+ * ignored. See .
*/
- role?: ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'close' | 'minimize' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu');
+ role?: string;
/**
* Can be normal, separator, submenu, checkbox or radio.
*/
@@ -8954,11 +8307,6 @@ declare namespace Electron {
*/
enabled?: boolean;
/**
- * default is true, and when false will prevent the accelerator from triggering the
- * item if the item is not visible`.
- */
- acceleratorWorksWhenHidden?: boolean;
- /**
* If false, the menu item will be entirely hidden.
*/
visible?: boolean;
@@ -9073,82 +8421,6 @@ declare namespace Electron {
normalizeAccessKeys?: boolean;
}
- interface MessageBoxReturnValue {
- /**
- * The index of the clicked button.
- */
- response: number;
- /**
- * The checked state of the checkbox if checkboxLabel was set. Otherwise false.
- */
- checkboxChecked: boolean;
- }
-
- interface MessageBoxSyncOptions {
- /**
- * Can be "none", "info", "error", "question" or "warning". On Windows, "question"
- * displays the same icon as "info", unless you set an icon using the "icon"
- * option. On macOS, both "warning" and "error" display the same warning icon.
- */
- type?: string;
- /**
- * Array of texts for buttons. On Windows, an empty array will result in one button
- * labeled "OK".
- */
- buttons?: string[];
- /**
- * Index of the button in the buttons array which will be selected by default when
- * the message box opens.
- */
- defaultId?: number;
- /**
- * Title of the message box, some platforms will not show it.
- */
- title?: string;
- /**
- * Content of the message box.
- */
- message: string;
- /**
- * Extra information of the message.
- */
- detail?: string;
- /**
- * If provided, the message box will include a checkbox with the given label. The
- * checkbox state can be inspected only when using callback.
- */
- checkboxLabel?: string;
- /**
- * Initial checked state of the checkbox. false by default.
- */
- checkboxChecked?: boolean;
- icon?: (NativeImage) | (string);
- /**
- * The index of the button to be used to cancel the dialog, via the Esc key. By
- * default this is assigned to the first button with "cancel" or "no" as the label.
- * If no such labeled buttons exist and this option is not set, 0 will be used as
- * the return value or callback response.
- */
- cancelId?: number;
- /**
- * On Windows Electron will try to figure out which one of the buttons are common
- * buttons (like "Cancel" or "Yes"), and show the others as command links in the
- * dialog. This can make the dialog appear in the style of modern Windows apps. If
- * you don't like this behavior, you can set noLink to true.
- */
- noLink?: boolean;
- /**
- * Normalize the keyboard access keys across platforms. Default is false. Enabling
- * this assumes & is used in the button labels for the placement of the keyboard
- * shortcut access key and labels will be converted so they work correctly on each
- * platform, & characters are removed on macOS, converted to _ on Linux, and left
- * untouched on Windows. For example, a button label of Vie&w will be converted to
- * Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and
- * Linux.
- */
- normalizeAccessKeys?: boolean;
- }
-
interface NewWindowEvent extends Event {
url: string;
frameName: string;
@@ -9216,7 +8488,6 @@ declare namespace Electron {
method: string;
webContentsId?: number;
resourceType: string;
- referrer: string;
timestamp: number;
redirectURL: string;
statusCode: number;
@@ -9242,7 +8513,6 @@ declare namespace Electron {
method: string;
webContentsId?: number;
resourceType: string;
- referrer: string;
timestamp: number;
uploadData: UploadData[];
}
@@ -9261,7 +8531,6 @@ declare namespace Electron {
method: string;
webContentsId?: number;
resourceType: string;
- referrer: string;
timestamp: number;
requestHeaders: RequestHeaders;
}
@@ -9310,7 +8579,6 @@ declare namespace Electron {
method: string;
webContentsId?: number;
resourceType: string;
- referrer: string;
timestamp: number;
fromCache: boolean;
/**
@@ -9333,7 +8601,6 @@ declare namespace Electron {
method: string;
webContentsId?: number;
resourceType: string;
- referrer: string;
timestamp: number;
statusLine: string;
statusCode: number;
@@ -9367,7 +8634,6 @@ declare namespace Electron {
method: string;
webContentsId?: number;
resourceType: string;
- referrer: string;
timestamp: number;
responseHeaders: ResponseHeaders;
/**
@@ -9392,7 +8658,6 @@ declare namespace Electron {
method: string;
webContentsId?: number;
resourceType: string;
- referrer: string;
timestamp: number;
requestHeaders: RequestHeaders;
}
@@ -9412,11 +8677,6 @@ declare namespace Electron {
* back. In detach mode it's not.
*/
mode: ('right' | 'bottom' | 'undocked' | 'detach');
- /**
- * Whether to bring the opened devtools window to the foreground. The default is
- * true.
- */
- activate?: boolean;
}
interface OpenDialogOptions {
@@ -9443,44 +8703,6 @@ declare namespace Electron {
securityScopedBookmarks?: boolean;
}
- interface OpenDialogReturnValue {
- /**
- * An array of file paths chosen by the user. If the dialog is cancelled this will
- * be an empty array.
- */
- filePaths?: string[];
- /**
- * An array matching the filePaths array of base64 encoded strings which contains
- * security scoped bookmark data. securityScopedBookmarks must be enabled for this
- * to be populated.
- */
- bookmarks?: string[];
- }
-
- interface OpenDialogSyncOptions {
- title?: string;
- defaultPath?: string;
- /**
- * Custom label for the confirmation button, when left empty the default label will
- * be used.
- */
- buttonLabel?: string;
- filters?: FileFilter[];
- /**
- * Contains which features the dialog should use. The following values are
- * supported:
- */
- properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'>;
- /**
- * Message to display above input boxes.
- */
- message?: string;
- /**
- * Create when packaged for the Mac App Store.
- */
- securityScopedBookmarks?: boolean;
- }
-
interface OpenExternalOptions {
/**
* true to bring the opened application to the foreground. The default is true.
@@ -9492,17 +8714,6 @@ declare namespace Electron {
workingDirectory?: string;
}
- interface OpenExternalSyncOptions {
- /**
- * true to bring the opened application to the foreground. The default is true.
- */
- activate?: boolean;
- /**
- * The working directory.
- */
- workingDirectory?: string;
- }
-
interface PageFaviconUpdatedEvent extends Event {
/**
* Array of URLs.
@@ -9663,31 +8874,21 @@ declare namespace Electron {
landscape?: boolean;
}
- interface Privileges {
- /**
- * Default false.
- */
- standard?: boolean;
- /**
- * Default false.
- */
- secure?: boolean;
- /**
- * Default false.
- */
- bypassCSP?: boolean;
+ interface ProcessMemoryInfo {
/**
- * Default false.
+ * and The amount of memory currently pinned to actual physical RAM in Kilobytes.
*/
- allowServiceWorkers?: boolean;
+ residentSet: number;
/**
- * Default false.
+ * The amount of memory not shared by other processes, such as JS heap or HTML
+ * content in Kilobytes.
*/
- supportFetchAPI?: boolean;
+ private: number;
/**
- * Default false.
+ * The amount of memory shared between processes, typically memory consumed by the
+ * Electron code itself in Kilobytes.
*/
- corsEnabled?: boolean;
+ shared: number;
}
interface ProgressBarOptions {
@@ -9699,9 +8900,9 @@ declare namespace Electron {
interface Provider {
/**
- * .
+ * Returns Boolean.
*/
- spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
+ spellCheck: (text: string) => void;
}
interface ReadBookmark {
@@ -9738,6 +8939,13 @@ declare namespace Electron {
uploadData: UploadData[];
}
+ interface RegisterStandardSchemesOptions {
+ /**
+ * true to register the scheme as secure. Default false.
+ */
+ secure?: boolean;
+ }
+
interface RegisterStreamProtocolRequest {
url: string;
headers: Headers;
@@ -9753,6 +8961,29 @@ declare namespace Electron {
uploadData: UploadData[];
}
+ interface RegisterURLSchemeAsPrivilegedOptions {
+ /**
+ * Default true.
+ */
+ secure?: boolean;
+ /**
+ * Default true.
+ */
+ bypassCSP?: boolean;
+ /**
+ * Default true.
+ */
+ allowServiceWorkers?: boolean;
+ /**
+ * Default true.
+ */
+ supportFetchAPI?: boolean;
+ /**
+ * Default true.
+ */
+ corsEnabled?: boolean;
+ }
+
interface RelaunchOptions {
args?: string[];
execPath?: string;
@@ -9849,53 +9080,6 @@ declare namespace Electron {
securityScopedBookmarks?: boolean;
}
- interface SaveDialogReturnValue {
- /**
- * whether or not the dialog was canceled.
- */
- canceled: boolean;
- /**
- * If the dialog is canceled this will be undefined.
- */
- filePath?: string;
- /**
- * Base64 encoded string which contains the security scoped bookmark data for the
- * saved file. securityScopedBookmarks must be enabled for this to be present.
- */
- bookmark?: string;
- }
-
- interface SaveDialogSyncOptions {
- title?: string;
- /**
- * Absolute directory path, absolute file path, or file name to use by default.
- */
- defaultPath?: string;
- /**
- * Custom label for the confirmation button, when left empty the default label will
- * be used.
- */
- buttonLabel?: string;
- filters?: FileFilter[];
- /**
- * Message to display above text fields.
- */
- message?: string;
- /**
- * Custom label for the text displayed in front of the filename text field.
- */
- nameFieldLabel?: string;
- /**
- * Show the tags input box, defaults to true.
- */
- showsTagField?: boolean;
- /**
- * Create a when packaged for the Mac App Store. If this option is enabled and the
- * file doesn't already exist a blank file will be created at the chosen path.
- */
- securityScopedBookmarks?: boolean;
- }
-
interface Settings {
/**
* true to open the app at login, false to remove the app as a login item. Defaults
@@ -9928,17 +9112,14 @@ declare namespace Electron {
types: string[];
/**
* The size that the media source thumbnail should be scaled to. Default is 150 x
- * 150. Set width or height to 0 when you do not need the thumbnails. This will
- * save the processing time required for capturing the content of each window and
- * screen.
+ * 150.
*/
thumbnailSize?: Size;
- /**
- * Set to true to enable fetching window icons. The default value is false. When
- * false the appIcon property of the sources return null. Same if a source has the
- * type screen.
- */
- fetchWindowIcons?: boolean;
+ }
+
+ interface StartMonitoringOptions {
+ categoryFilter: string;
+ traceOptions: string;
}
interface SystemMemoryInfo {
@@ -10306,7 +9487,7 @@ declare namespace Electron {
*/
devTools?: boolean;
/**
- * Whether node integration is enabled. Default is false.
+ * Whether node integration is enabled. Default is true.
*/
nodeIntegration?: boolean;
/**
@@ -10315,12 +9496,6 @@ declare namespace Electron {
*/
nodeIntegrationInWorker?: boolean;
/**
- * Experimental option for enabling Node.js support in sub-frames such as iframes
- * and child windows. All your preloads will load for every iframe, you can use
- * process.isMainFrame to determine if you are in the main frame or not.
- */
- nodeIntegrationInSubFrames?: boolean;
- /**
* Specifies a script that will be loaded before other scripts run in the page.
* This script will always have access to node APIs no matter whether node
* integration is turned on or off. The value should be the absolute file path to
@@ -10397,6 +9572,10 @@ declare namespace Electron {
*/
webgl?: boolean;
/**
+ * Enables WebAudio support. Default is true.
+ */
+ webaudio?: boolean;
+ /**
* Whether plugins should be enabled. Default is false.
*/
plugins?: boolean;
@@ -10463,17 +9642,19 @@ declare namespace Electron {
*/
contextIsolation?: boolean;
/**
- * Whether to use native window.open(). Defaults to false. Child windows will
- * always have node integration disabled unless nodeIntegrationInSubFrames is true.
- * This option is currently experimental.
+ * Whether to use native window.open(). If set to true, the webPreferences of child
+ * window will always be the same with parent window, regardless of the parameters
+ * passed to window.open(). Defaults to false. This option is currently
+ * experimental.
*/
nativeWindowOpen?: boolean;
/**
- * Whether to enable the . Defaults to false. The preload script configured for the
- * will have node integration enabled when it is executed so you should ensure
- * remote/untrusted content is not able to create a tag with a possibly malicious
- * preload script. You can use the will-attach-webview event on to strip away the
- * preload script and to validate or alter the 's initial settings.
+ * Whether to enable the . Defaults to the value of the nodeIntegration option. The
+ * preload script configured for the will have node integration enabled when it is
+ * executed so you should ensure remote/untrusted content is not able to create a
+ * tag with a possibly malicious preload script. You can use the
+ * will-attach-webview event on to strip away the preload script and to validate or
+ * alter the 's initial settings.
*/
webviewTag?: boolean;
/**
@@ -10497,17 +9678,6 @@ declare namespace Electron {
* Default is false.
*/
navigateOnDragDrop?: boolean;
- /**
- * Autoplay policy to apply to content in the window, can be
- * no-user-gesture-required, user-gesture-required,
- * document-user-activation-required. Defaults to no-user-gesture-required.
- */
- autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
- /**
- * Whether to prevent the window from resizing when entering HTML Fullscreen.
- * Default is false.
- */
- disableHtmlFullscreenWindowResize?: boolean;
}
interface DefaultFontFamily {
@@ -10580,6 +9750,7 @@ declare namespace NodeJS {
// addListener(event: 'loaded', listener: Function): this;
// removeListener(event: 'loaded', listener: Function): this;
// ### END VSCODE MODIFICATION ###
+
/**
* Causes the main thread of the current process crash.
*/
@@ -10606,18 +9777,13 @@ declare namespace NodeJS {
* private memory is more representative of the actual pre-compression memory usage
* of the process on macOS.
*/
- getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
+ getProcessMemoryInfo(): Electron.ProcessMemoryInfo;
/**
* Returns an object giving memory usage statistics about the entire system. Note
* that all statistics are reported in Kilobytes.
*/
getSystemMemoryInfo(): Electron.SystemMemoryInfo;
/**
- * Examples: Note: It returns the actual operating system version instead of kernel
- * version on macOS unlike os.release().
- */
- getSystemVersion(): string;
- /**
* Causes the main thread of the current process hang.
*/
hang(): void;
@@ -10636,17 +9802,6 @@ declare namespace NodeJS {
*/
defaultApp?: boolean;
/**
- * A Boolean that controls whether or not deprecation warnings are printed to
- * stderr when formerly callback-based APIs converted to Promises are invoked using
- * callbacks. Setting this to true will enable deprecation warnings.
- */
- enablePromiseAPIs?: boolean;
- /**
- * A Boolean, true when the current renderer context is the "main" renderer frame.
- * If you want the ID of the current frame you should use webFrame.routingId.
- */
- isMainFrame?: boolean;
- /**
* A Boolean. For Mac App Store build, this property is true, for other builds it
* is undefined.
*/
@@ -10693,7 +9848,7 @@ declare namespace NodeJS {
traceProcessWarnings?: boolean;
/**
* A String representing the current process's type, can be "browser" (i.e. main
- * process), "renderer", or "worker" (i.e. web worker).
+ * process) or "renderer".
*/
type?: string;
/**
diff --git a/src/vs/base/parts/contextmenu/electron-main/contextmenu.ts b/src/vs/base/parts/contextmenu/electron-main/contextmenu.ts
index 6222be78028..4ec758b086b 100644
--- a/src/vs/base/parts/contextmenu/electron-main/contextmenu.ts
+++ b/src/vs/base/parts/contextmenu/electron-main/contextmenu.ts
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
-import { Menu, MenuItem, BrowserWindow, ipcMain, IpcMainEvent } from 'electron';
+import { Menu, MenuItem, BrowserWindow, ipcMain, Event as IpcMainEvent } from 'electron';
import { ISerializableContextMenuItem, CONTEXT_MENU_CLOSE_CHANNEL, CONTEXT_MENU_CHANNEL, IPopupOptions } from 'vs/base/parts/contextmenu/common/contextmenu';
export function registerContextMenuListener(): void {
diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts
index cfa48b71053..dd200cde511 100644
--- a/src/vs/code/electron-main/app.ts
+++ b/src/vs/code/electron-main/app.ts
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
-import { app, ipcMain as ipc, systemPreferences, shell, Event, contentTracing, protocol, powerMonitor, IpcMainEvent, BrowserWindow } from 'electron';
+import { app, ipcMain as ipc, systemPreferences, shell, Event, contentTracing, protocol, powerMonitor, Event as IpcMainEvent, BrowserWindow } from 'electron';
import { IProcessEnvironment, isWindows, isMacintosh } from 'vs/base/common/platform';
import { WindowsManager } from 'vs/code/electron-main/windows';
import { OpenContext, IWindowOpenable } from 'vs/platform/windows/common/windows';
diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts
index 6a2f8b994c5..f136d7c7232 100644
--- a/src/vs/code/electron-main/window.ts
+++ b/src/vs/code/electron-main/window.ts
@@ -561,7 +561,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
autoDetectHighContrast = false;
}
windowConfiguration.highContrast = isWindows && autoDetectHighContrast && systemPreferences.isInvertedColorScheme();
- windowConfiguration.accessibilitySupport = app.accessibilitySupportEnabled;
+ windowConfiguration.accessibilitySupport = app.isAccessibilitySupportEnabled();
// Title style related
windowConfiguration.maximized = this._win.isMaximized();
diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts
index 9e814c1b58b..ef61a9e41b2 100644
--- a/src/vs/code/node/cli.ts
+++ b/src/vs/code/node/cli.ts
@@ -14,7 +14,7 @@ import * as paths from 'vs/base/common/path';
import { whenDeleted, writeFileSync } from 'vs/base/node/pfs';
import { findFreePort, randomPort } from 'vs/base/node/ports';
import { resolveTerminalEncoding } from 'vs/base/node/encoding';
-import { isWindows, isLinux } from 'vs/base/common/platform';
+import { isWindows } from 'vs/base/common/platform';
import { ProfilingSession, Target } from 'v8-inspect-profiler';
import { isString } from 'vs/base/common/types';
@@ -360,10 +360,6 @@ export async function main(argv: string[]): Promise<any> {
options['stdio'] = 'ignore';
}
- if (isLinux) {
- addArg(argv, '--no-sandbox'); // Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox
- }
-
const child = spawn(process.execPath, argv.slice(2), options);
if (args.wait && waitMarkerFilePath) {
diff --git a/src/vs/platform/dialogs/electron-main/dialogs.ts b/src/vs/platform/dialogs/electron-main/dialogs.ts
index 7b49ca50c2e..7a38932aede 100644
--- a/src/vs/platform/dialogs/electron-main/dialogs.ts
+++ b/src/vs/platform/dialogs/electron-main/dialogs.ts
@@ -4,14 +4,14 @@
*--------------------------------------------------------------------------------------------*/
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
-import { MessageBoxOptions, MessageBoxReturnValue, SaveDialogOptions, SaveDialogReturnValue, OpenDialogOptions, OpenDialogReturnValue, dialog, FileFilter, BrowserWindow } from 'electron';
+import { MessageBoxOptions, SaveDialogOptions, OpenDialogOptions, dialog, FileFilter, BrowserWindow } from 'electron';
import { Queue } from 'vs/base/common/async';
import { IStateService } from 'vs/platform/state/node/state';
import { isMacintosh } from 'vs/base/common/platform';
import { dirname } from 'vs/base/common/path';
import { normalizeNFC } from 'vs/base/common/normalization';
import { exists } from 'vs/base/node/pfs';
-import { INativeOpenDialogOptions } from 'vs/platform/dialogs/node/dialogs';
+import { INativeOpenDialogOptions, MessageBoxReturnValue, SaveDialogReturnValue, OpenDialogReturnValue } from 'vs/platform/dialogs/node/dialogs';
import { withNullAsUndefined } from 'vs/base/common/types';
import { localize } from 'vs/nls';
import { WORKSPACE_FILTER } from 'vs/platform/workspaces/common/workspaces';
@@ -139,11 +139,13 @@ export class DialogMainService implements IDialogMainService {
showMessageBox(options: MessageBoxOptions, window?: BrowserWindow): Promise<MessageBoxReturnValue> {
return this.getDialogQueue(window).queue(async () => {
- if (window) {
- return dialog.showMessageBox(window, options);
- }
+ return new Promise(resolve => {
+ if (window) {
+ return dialog.showMessageBox(window, options, (response, checkboxChecked) => resolve({ response, checkboxChecked }));
+ }
- return dialog.showMessageBox(options);
+ return dialog.showMessageBox(options);
+ });
});
}
@@ -158,16 +160,17 @@ export class DialogMainService implements IDialogMainService {
}
return this.getDialogQueue(window).queue(async () => {
- let result: SaveDialogReturnValue;
- if (window) {
- result = await dialog.showSaveDialog(window, options);
- } else {
- result = await dialog.showSaveDialog(options);
- }
-
- result.filePath = normalizePath(result.filePath);
+ return new Promise<SaveDialogReturnValue>(resolve => {
+ if (window) {
+ dialog.showSaveDialog(window, options, filePath => resolve({ filePath }));
+ } else {
+ dialog.showSaveDialog(options, filePath => resolve({ filePath }));
+ }
+ }).then(result => {
+ result.filePath = normalizePath(result.filePath);
- return result;
+ return result;
+ });
});
}
@@ -192,16 +195,17 @@ export class DialogMainService implements IDialogMainService {
}
// Show dialog
- let result: OpenDialogReturnValue;
- if (window) {
- result = await dialog.showOpenDialog(window, options);
- } else {
- result = await dialog.showOpenDialog(options);
- }
-
- result.filePaths = normalizePaths(result.filePaths);
+ return new Promise<OpenDialogReturnValue>(resolve => {
+ if (window) {
+ dialog.showOpenDialog(window, options, filePaths => resolve({ filePaths }));
+ } else {
+ dialog.showOpenDialog(options, filePaths => resolve({ filePaths }));
+ }
+ }).then(result => {
+ result.filePaths = normalizePaths(result.filePaths);
- return result;
+ return result;
+ });
});
}
}
diff --git a/src/vs/platform/dialogs/node/dialogs.ts b/src/vs/platform/dialogs/node/dialogs.ts
index 754693da712..aa9df3c6d94 100644
--- a/src/vs/platform/dialogs/node/dialogs.ts
+++ b/src/vs/platform/dialogs/node/dialogs.ts
@@ -13,3 +13,16 @@ export interface INativeOpenDialogOptions {
telemetryEventName?: string;
telemetryExtraData?: ITelemetryData;
}
+
+export interface MessageBoxReturnValue {
+ response: number;
+ checkboxChecked: boolean;
+}
+
+export interface SaveDialogReturnValue {
+ filePath?: string;
+}
+
+export interface OpenDialogReturnValue {
+ filePaths?: string[];
+}
diff --git a/src/vs/platform/electron/electron-main/electronMainService.ts b/src/vs/platform/electron/electron-main/electronMainService.ts
index 89f5763e30f..71581fd6bbd 100644
--- a/src/vs/platform/electron/electron-main/electronMainService.ts
+++ b/src/vs/platform/electron/electron-main/electronMainService.ts
@@ -5,11 +5,11 @@
import { Event } from 'vs/base/common/event';
import { IWindowsMainService } from 'vs/platform/windows/electron-main/windows';
-import { MessageBoxOptions, MessageBoxReturnValue, shell, OpenDevToolsOptions, SaveDialogOptions, SaveDialogReturnValue, OpenDialogOptions, OpenDialogReturnValue, CrashReporterStartOptions, crashReporter, Menu, BrowserWindow, app } from 'electron';
+import { MessageBoxOptions, shell, OpenDevToolsOptions, SaveDialogOptions, OpenDialogOptions, CrashReporterStartOptions, crashReporter, Menu, BrowserWindow, app } from 'electron';
import { INativeOpenWindowOptions } from 'vs/platform/windows/node/window';
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
import { IOpenedWindow, OpenContext, IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
-import { INativeOpenDialogOptions } from 'vs/platform/dialogs/node/dialogs';
+import { INativeOpenDialogOptions, MessageBoxReturnValue, SaveDialogReturnValue, OpenDialogReturnValue } from 'vs/platform/dialogs/node/dialogs';
import { isMacintosh, IProcessEnvironment } from 'vs/base/common/platform';
import { IElectronService } from 'vs/platform/electron/node/electron';
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
diff --git a/src/vs/platform/electron/node/electron.ts b/src/vs/platform/electron/node/electron.ts
index e097c7a1eba..1454542c92b 100644
--- a/src/vs/platform/electron/node/electron.ts
+++ b/src/vs/platform/electron/node/electron.ts
@@ -4,10 +4,10 @@
*--------------------------------------------------------------------------------------------*/
import { Event } from 'vs/base/common/event';
-import { MessageBoxOptions, MessageBoxReturnValue, OpenDevToolsOptions, SaveDialogOptions, OpenDialogOptions, OpenDialogReturnValue, SaveDialogReturnValue, CrashReporterStartOptions } from 'electron';
+import { MessageBoxOptions, OpenDevToolsOptions, SaveDialogOptions, OpenDialogOptions, CrashReporterStartOptions } from 'electron';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IWindowOpenable, IOpenEmptyWindowOptions, IOpenedWindow } from 'vs/platform/windows/common/windows';
-import { INativeOpenDialogOptions } from 'vs/platform/dialogs/node/dialogs';
+import { INativeOpenDialogOptions, MessageBoxReturnValue, SaveDialogReturnValue, OpenDialogReturnValue } from 'vs/platform/dialogs/node/dialogs';
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
import { ParsedArgs } from 'vscode-minimist';
import { IProcessEnvironment } from 'vs/base/common/platform';
diff --git a/src/vs/platform/issue/electron-main/issueMainService.ts b/src/vs/platform/issue/electron-main/issueMainService.ts
index 975cb234e2e..e41d966ea84 100644
--- a/src/vs/platform/issue/electron-main/issueMainService.ts
+++ b/src/vs/platform/issue/electron-main/issueMainService.ts
@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
import * as objects from 'vs/base/common/objects';
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
import { IIssueService, IssueReporterData, IssueReporterFeatures, ProcessExplorerData } from 'vs/platform/issue/node/issue';
-import { BrowserWindow, ipcMain, screen, IpcMainEvent, Display, shell } from 'electron';
+import { BrowserWindow, ipcMain, screen, Event as IpcMainEvent, Display, shell } from 'electron';
import { ILaunchMainService } from 'vs/platform/launch/electron-main/launchMainService';
import { PerformanceInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService';
diff --git a/src/vs/platform/launch/electron-main/launchMainService.ts b/src/vs/platform/launch/electron-main/launchMainService.ts
index dc60e0a59f1..9c94d83e152 100644
--- a/src/vs/platform/launch/electron-main/launchMainService.ts
+++ b/src/vs/platform/launch/electron-main/launchMainService.ts
@@ -219,7 +219,7 @@ export class LaunchMainService implements ILaunchMainService {
mainPID: process.pid,
mainArguments: process.argv.slice(1),
windows,
- screenReader: !!app.accessibilitySupportEnabled,
+ screenReader: !!app.isAccessibilitySupportEnabled(),
gpuFeatureStatus: app.getGPUFeatureStatus()
});
}
diff --git a/src/vs/platform/menubar/electron-main/menubar.ts b/src/vs/platform/menubar/electron-main/menubar.ts
index 1dc526cd658..0f00ac45280 100644
--- a/src/vs/platform/menubar/electron-main/menubar.ts
+++ b/src/vs/platform/menubar/electron-main/menubar.ts
@@ -6,7 +6,7 @@
import * as nls from 'vs/nls';
import { isMacintosh, language } from 'vs/base/common/platform';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
-import { app, shell, Menu, MenuItem, BrowserWindow, MenuItemConstructorOptions, WebContents, Event, KeyboardEvent } from 'electron';
+import { app, shell, Menu, MenuItem, BrowserWindow, MenuItemConstructorOptions, WebContents, Event, Event as KeyboardEvent } from 'electron';
import { OpenContext, IRunActionInWindowRequest, getTitleBarStyle, IRunKeybindingInWindowRequest, IWindowOpenable } from 'vs/platform/windows/common/windows';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -359,7 +359,7 @@ export class Menubar {
const servicesMenu = new Menu();
const services = new MenuItem({ label: nls.localize('mServices', "Services"), role: 'services', submenu: servicesMenu });
const hide = new MenuItem({ label: nls.localize('mHide', "Hide {0}", product.nameLong), role: 'hide', accelerator: 'Command+H' });
- const hideOthers = new MenuItem({ label: nls.localize('mHideOthers', "Hide Others"), role: 'hideOthers', accelerator: 'Command+Alt+H' });
+ const hideOthers = new MenuItem({ label: nls.localize('mHideOthers', "Hide Others"), role: 'hideothers', accelerator: 'Command+Alt+H' });
const showAll = new MenuItem({ label: nls.localize('mShowAll', "Show All"), role: 'unhide' });
const quit = new MenuItem(this.likeAction('workbench.action.quit', {
label: nls.localize('miQuit', "Quit {0}", product.nameLong), click: () => {
diff --git a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts
index 7039bdfa6db..ffe0daa5e1c 100644
--- a/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts
+++ b/src/vs/workbench/contrib/extensions/electron-browser/runtimeExtensionsEditor.ts
@@ -636,7 +636,7 @@ export class SaveExtensionHostProfileAction extends Action {
}]
});
- if (!picked || !picked.filePath || picked.canceled) {
+ if (!picked || !picked.filePath) {
return;
}
diff --git a/src/vs/workbench/contrib/webview/electron-browser/pre/electron-index.js b/src/vs/workbench/contrib/webview/electron-browser/pre/electron-index.js
index 8be7c9520a6..6992535ea97 100644
--- a/src/vs/workbench/contrib/webview/electron-browser/pre/electron-index.js
+++ b/src/vs/workbench/contrib/webview/electron-browser/pre/electron-index.js
@@ -13,6 +13,15 @@
return;
}
hasRegistered = true;
+
+ // @ts-ignore
+ require('electron').webFrame.registerURLSchemeAsPrivileged('vscode-resource', {
+ secure: true,
+ bypassCSP: false,
+ allowServiceWorkers: false,
+ supportFetchAPI: true,
+ corsEnabled: true
+ });
};
}());
diff --git a/src/vs/workbench/services/dialogs/electron-browser/fileDialogService.ts b/src/vs/workbench/services/dialogs/electron-browser/fileDialogService.ts
index 5d9942691f3..44790f68ce5 100644
--- a/src/vs/workbench/services/dialogs/electron-browser/fileDialogService.ts
+++ b/src/vs/workbench/services/dialogs/electron-browser/fileDialogService.ts
@@ -110,7 +110,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil
return this.pickFileToSaveSimplified(schema, options);
} else {
const result = await this.electronService.showSaveDialog(this.toNativeSaveDialogOptions(options));
- if (result && !result.canceled && result.filePath) {
+ if (result && result.filePath) {
return URI.file(result.filePath);
}
}
@@ -134,7 +134,7 @@ export class FileDialogService extends AbstractFileDialogService implements IFil
}
const result = await this.electronService.showSaveDialog(this.toNativeSaveDialogOptions(options));
- if (result && !result.canceled && result.filePath) {
+ if (result && result.filePath) {
return URI.file(result.filePath);
}
diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts
index 35dcbd85dde..0a726a52ff9 100644
--- a/src/vs/workbench/test/workbenchTestServices.ts
+++ b/src/vs/workbench/test/workbenchTestServices.ts
@@ -87,7 +87,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
import product from 'vs/platform/product/common/product';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IElectronService } from 'vs/platform/electron/node/electron';
-import { INativeOpenDialogOptions } from 'vs/platform/dialogs/node/dialogs';
+import { INativeOpenDialogOptions, MessageBoxReturnValue, SaveDialogReturnValue, OpenDialogReturnValue } from 'vs/platform/dialogs/node/dialogs';
import { IBackupMainService, IWorkspaceBackupInfo } from 'vs/platform/backup/electron-main/backup';
import { IEmptyWindowBackupInfo } from 'vs/platform/backup/node/backup';
import { IDialogMainService } from 'vs/platform/dialogs/electron-main/dialogs';
@@ -1355,9 +1355,9 @@ export class TestElectronService implements IElectronService {
async minimizeWindow(): Promise<void> { }
async isWindowFocused(): Promise<boolean> { return true; }
async focusWindow(options?: { windowId?: number | undefined; } | undefined): Promise<void> { }
- async showMessageBox(options: Electron.MessageBoxOptions): Promise<Electron.MessageBoxReturnValue> { throw new Error('Method not implemented.'); }
- async showSaveDialog(options: Electron.SaveDialogOptions): Promise<Electron.SaveDialogReturnValue> { throw new Error('Method not implemented.'); }
- async showOpenDialog(options: Electron.OpenDialogOptions): Promise<Electron.OpenDialogReturnValue> { throw new Error('Method not implemented.'); }
+ async showMessageBox(options: Electron.MessageBoxOptions): Promise<MessageBoxReturnValue> { throw new Error('Method not implemented.'); }
+ async showSaveDialog(options: Electron.SaveDialogOptions): Promise<SaveDialogReturnValue> { throw new Error('Method not implemented.'); }
+ async showOpenDialog(options: Electron.OpenDialogOptions): Promise<OpenDialogReturnValue> { throw new Error('Method not implemented.'); }
async pickFileFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> { }
async pickFileAndOpen(options: INativeOpenDialogOptions): Promise<void> { }
async pickFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> { }
@@ -1448,15 +1448,15 @@ export class TestDialogMainService implements IDialogMainService {
throw new Error('Method not implemented.');
}
- showMessageBox(options: Electron.MessageBoxOptions, window?: Electron.BrowserWindow | undefined): Promise<Electron.MessageBoxReturnValue> {
+ showMessageBox(options: Electron.MessageBoxOptions, window?: Electron.BrowserWindow | undefined): Promise<MessageBoxReturnValue> {
throw new Error('Method not implemented.');
}
- showSaveDialog(options: Electron.SaveDialogOptions, window?: Electron.BrowserWindow | undefined): Promise<Electron.SaveDialogReturnValue> {
+ showSaveDialog(options: Electron.SaveDialogOptions, window?: Electron.BrowserWindow | undefined): Promise<SaveDialogReturnValue> {
throw new Error('Method not implemented.');
}
- showOpenDialog(options: Electron.OpenDialogOptions, window?: Electron.BrowserWindow | undefined): Promise<Electron.OpenDialogReturnValue> {
+ showOpenDialog(options: Electron.OpenDialogOptions, window?: Electron.BrowserWindow | undefined): Promise<OpenDialogReturnValue> {
throw new Error('Method not implemented.');
}
}
diff --git a/test/electron/index.js b/test/electron/index.js
index 386515dc414..f21b3615c0e 100644
--- a/test/electron/index.js
+++ b/test/electron/index.js
@@ -9,7 +9,7 @@ const { join } = require('path');
const path = require('path');
const mocha = require('mocha');
const events = require('events');
-// const MochaJUnitReporter = require('mocha-junit-reporter');
+const MochaJUnitReporter = require('mocha-junit-reporter');
const url = require('url');
const defaultReporterName = process.platform === 'win32' ? 'list' : 'spec';
@@ -133,13 +133,12 @@ app.on('ready', () => {
if (argv.tfs) {
new mocha.reporters.Spec(runner);
- // TODO@deepak the mocha Junit reporter seems to cause a hang when running with Electron 6 inside docker container
- // new MochaJUnitReporter(runner, {
- // reporterOptions: {
- // testsuitesTitle: `${argv.tfs} ${process.platform}`,
- // mochaFile: process.env.BUILD_ARTIFACTSTAGINGDIRECTORY ? path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${argv.tfs.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) : undefined
- // }
- // });
+ new MochaJUnitReporter(runner, {
+ reporterOptions: {
+ testsuitesTitle: `${argv.tfs} ${process.platform}`,
+ mochaFile: process.env.BUILD_ARTIFACTSTAGINGDIRECTORY ? path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${argv.tfs.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) : undefined
+ }
+ });
} else {
const reporterPath = path.join(path.dirname(require.resolve('mocha')), 'lib', 'reporters', argv.reporter);
let Reporter;