From 0bcf5cff8a0b2298fc6d8dc69825e841d8e57295 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 10 Dec 2018 12:54:38 +0100 Subject: [PATCH] Update to Electron 3.0.10 (#56149) * update to 3.0.0-beta.3 * update d.ts files; rename NodeBuffer => Buffer * update to 3.0.0-beta.4 * undo invalid change * remove some Electron 2.0.x specific workarounds * pinch zoom is now disabled by default * update vscode-nsfw * change vscode-nsfw * update smoke test electron version * streams: use destroy() over close() * workaround broken tests * bump distro and OSS * try to bump node version for build * update macOS build to use node.js 10.8.0 * fix extension tests * use node.js 10.2.1 for all builds * remove nsfw from dev dependencies * back to node 8.x for build * Revert "back to node 8.x for build" This reverts commit 90ea2b7af2a1930e60f86fcef7ef9e2c49a79a8a. * update distro * disable test run on macOS prod build for now * bump distro * ensure proper nsfw dep * fix more native dependencies * temp disable failing test * fix packages * update deps * fix deps * update deps * enable macOS unit tests again * fix deprecated buffer use * Electron 3.0.0.beta.5 * bump deps * fix tree accidentally treating auxclick as click * improve overlay cleanup scheduler (fixes flicker seen with Electron 3.0.x) * update distro * remove obsolete disableBlinkFeatures: 'Auxclick' * update to Electron 3.0 beta 6 * fix compile * workaround #56994 * do not use backgroundColor to find shared process (causes flicker) * fix flicker on windows from shared process background color * webview - bubble up keyboard events (workaround for #56988) * bump electron to 3.0.0-beta.8 * webview - fix deprecation * webview - fix another deprecation * debt - handle SIGPIPE on more processes * workaround more webview focus issues (for #56988) * webview - use proper way to focus() * debt - avoid window-focus/blur and use native focus events instead * webview - restore previous focus method * webview - improve focus tracking (do not rely on DOM events) * bump to electron 3.0.0-beta.9 * update deps * update electron@3.0.0-beta.10 * webview - do not rely on DOM focus for certain commands (for #56988) * update to electron@3.0.0-beta.11 * electron@3.0.0-beta.12 * update to beta 13 * update to electron 3.0.0 * update to Electron 3.0.1 * electron@3.0.2 * revert build changes (node.js version) * try with: enable mojave dark mode support * fix types * electron 3.0.3 * electron@3.0.4 * fix deps * bump electron@3.0.6 * bump electron@3.0.9 * fix strict null issue * reset format * bump electron@3.0.10 * fix strict null issue * webview - print error when revive fails * electron 3.0.x - try to fix keybindings in webviews (#64417) * bump @types/node => ^10.12.12 * :lipstick: * update distro --- .yarnrc | 2 +- cgmanifest.json | 16 +- package.json | 4 +- src/bootstrap-window.js | 3 +- src/main.js | 4 +- src/typings/electron.d.ts | 990 ++++++++++++------ src/vs/base/node/extfs.ts | 6 +- src/vs/base/node/request.ts | 2 +- src/vs/code/electron-main/windows.ts | 11 + .../browser/services/codeEditorServiceImpl.ts | 2 +- .../editor/browser/widget/codeEditorWidget.ts | 2 +- .../issue/electron-main/issueService.ts | 2 +- .../common/abstractKeybindingService.ts | 4 + .../platform/keybinding/common/keybinding.ts | 5 + .../test/common/mockKeybindingService.ts | 4 +- src/vs/platform/node/zip.ts | 2 +- .../api/electron-browser/mainThreadWebview.ts | 5 +- .../parts/activitybar/activitybarPart.ts | 29 +- .../html/electron-browser/htmlPreviewPart.ts | 6 + .../webview/electron-browser/webview-pre.js | 14 + .../webview/electron-browser/webviewEditor.ts | 102 +- .../electron-browser/webviewElement.ts | 78 +- test/smoke/package.json | 2 +- test/smoke/yarn.lock | 147 +-- yarn.lock | 8 +- 25 files changed, 934 insertions(+), 516 deletions(-) diff --git a/.yarnrc b/.yarnrc index 8e1ac6b6cac..3ab151edb0b 100644 --- a/.yarnrc +++ b/.yarnrc @@ -1,3 +1,3 @@ disturl "https://atom.io/download/electron" -target "2.0.12" +target "3.0.10" runtime "electron" diff --git a/cgmanifest.json b/cgmanifest.json index 637c7d2f5ab..e4d0401e78c 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -6,7 +6,7 @@ "git": { "name": "chromium", "repositoryUrl": "https://chromium.googlesource.com/chromium/src", - "commitHash": "7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33" + "commitHash": "164c37e3f235134c88e80fac2a182cfba3f07f00" } }, "licenseDetail": [ @@ -40,7 +40,7 @@ "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ], "isOnlyProductionDependency": true, - "version": "61.0.3163.100" + "version": "66.0.3359.181" }, { "component": { @@ -48,12 +48,12 @@ "git": { "name": "libchromiumcontent", "repositoryUrl": "https://github.com/electron/libchromiumcontent", - "commitHash": "ccdb085454b0a387ee96e0f81a7ca9a8ce07a710" + "commitHash": "d9e39391cfae447a84e276a402342cf8b4b5bcba" } }, "isOnlyProductionDependency": true, "license": "MIT", - "version": "61.0.3163.100" + "version": "66.0.3359.181" }, { "component": { @@ -61,11 +61,11 @@ "git": { "name": "nodejs", "repositoryUrl": "https://github.com/nodejs/node", - "commitHash": "8a44289089a08b7b19fa3c4651b5f1f5d1edd71b" + "commitHash": "5cbb905c1af7cea2d709932d59827d7c6d03ef4a" } }, "isOnlyProductionDependency": true, - "version": "8.9.3" + "version": "10.2.0" }, { "component": { @@ -73,12 +73,12 @@ "git": { "name": "electron", "repositoryUrl": "https://github.com/electron/electron", - "commitHash": "d281859cf59f12c7107a540a9f4cba0ecf5eff41" + "commitHash": "4305657858592be2b44c95ae7af53c627dcdc5e7" } }, "isOnlyProductionDependency": true, "license": "MIT", - "version": "2.0.12" + "version": "3.0.10" }, { "component": { diff --git a/package.json b/package.json index 8fbbfd3e7b1..786d020e06e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.31.0", - "distro": "573bd4fedabe1c0bcebeb1e683109079ae560312", + "distro": "2fc810c2f29040b34dbeab2be175a22cca2624db", "author": { "name": "Microsoft Corporation" }, @@ -63,7 +63,7 @@ "@types/keytar": "^4.0.1", "@types/minimist": "^1.2.0", "@types/mocha": "2.2.39", - "@types/node": "^8.9.1", + "@types/node": "^10.12.12", "@types/semver": "^5.5.0", "@types/sinon": "^1.16.36", "@types/webpack": "^4.4.10", diff --git a/src/bootstrap-window.js b/src/bootstrap-window.js index 7775f02e9ab..18778b2a312 100644 --- a/src/bootstrap-window.js +++ b/src/bootstrap-window.js @@ -51,9 +51,8 @@ exports.load = function (modulePaths, resultCallback, options) { // Enable ASAR support bootstrap.enableASARSupport(path.join(configuration.appRoot, 'node_modules')); - // disable pinch zoom & apply zoom level early to avoid glitches + // Apply zoom level early to avoid glitches const zoomLevel = configuration.zoomLevel; - webFrame.setVisualZoomLevelLimits(1, 1); if (typeof zoomLevel === 'number' && zoomLevel !== 0) { webFrame.setZoomLevel(zoomLevel); } diff --git a/src/main.js b/src/main.js index 36f55c6f888..f35df3d89b1 100644 --- a/src/main.js +++ b/src/main.js @@ -147,10 +147,8 @@ function onReady() { */ function configureCommandlineSwitches(cliArgs, nodeCachedDataDir) { - // TODO@Ben Electron 2.0.x: prevent localStorage migration from SQLite to LevelDB due to issues - app.commandLine.appendSwitch('disable-mojo-local-storage'); - // Force pre-Chrome-60 color profile handling (for https://github.com/Microsoft/vscode/issues/51791) + // TODO@Ben check if future versions of Electron still support this flag app.commandLine.appendSwitch('disable-features', 'ColorCorrectRendering'); // Support JS Flags diff --git a/src/typings/electron.d.ts b/src/typings/electron.d.ts index 607eeb388c9..bde9ebe8f70 100644 --- a/src/typings/electron.d.ts +++ b/src/typings/electron.d.ts @@ -1,5 +1,5 @@ -// Type definitions for Electron 2.0.5 -// Project: http://electron.atom.io/ +// Type definitions for Electron 3.0.10 +// Project: http://electronjs.org/ // Definitions by: The Electron Team // Definitions: https://github.com/electron/electron-typescript-definitions @@ -64,6 +64,7 @@ declare namespace Electron { Menu: typeof Menu; MenuItem: typeof MenuItem; net: Net; + netLog: NetLog; Notification: typeof Notification; powerMonitor: PowerMonitor; powerSaveBlocker: PowerSaveBlocker; @@ -101,6 +102,7 @@ declare namespace Electron { type nativeImage = NativeImage; const nativeImage: typeof NativeImage; const net: Net; + const netLog: NetLog; const powerMonitor: PowerMonitor; const powerSaveBlocker: PowerSaveBlocker; const protocol: Protocol; @@ -470,6 +472,50 @@ declare namespace Electron { once(event: 'ready', listener: (launchInfo: any) => void): this; addListener(event: 'ready', listener: (launchInfo: any) => void): this; removeListener(event: 'ready', listener: (launchInfo: any) => void): this; + /** + * This event will be emitted inside the primary instance of your application when + * 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, + /** + * An array of the second instance's command line arguments + */ + argv: string[], + /** + * The second instance's working directory + */ + workingDirectory: string) => void): this; + once(event: 'second-instance', listener: (event: Event, + /** + * An array of the second instance's command line arguments + */ + argv: string[], + /** + * The second instance's working directory + */ + workingDirectory: string) => void): this; + addListener(event: 'second-instance', listener: (event: Event, + /** + * An array of the second instance's command line arguments + */ + argv: string[], + /** + * The second instance's working directory + */ + workingDirectory: string) => void): this; + removeListener(event: 'second-instance', listener: (event: Event, + /** + * An array of the second instance's command line arguments + */ + argv: string[], + /** + * The second instance's working directory + */ + workingDirectory: string) => void): this; /** * Emitted when a client certificate is requested. The url corresponds to the * navigation entry requesting the client certificate and callback can be called @@ -496,6 +542,13 @@ declare namespace Electron { url: string, certificateList: Certificate[], callback: (certificate?: Certificate) => void) => void): this; + /** + * Emitted when Electron has created a new session. + */ + on(event: 'session-created', listener: (session: Session) => void): this; + once(event: 'session-created', listener: (session: Session) => void): this; + addListener(event: 'session-created', listener: (session: Session) => void): this; + removeListener(event: 'session-created', listener: (session: Session) => void): this; /** * 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() @@ -581,7 +634,7 @@ declare namespace Electron { * event represents the applicationWillFinishLaunching notification of * NSApplication. You would usually set up listeners for the open-file and open-url * events here, and start the crash reporter and auto updater. In most cases, you - * should just do everything in the ready event handler. + * should do everything in the ready event handler. */ on(event: 'will-finish-launching', listener: Function): this; once(event: 'will-finish-launching', listener: Function): this; @@ -656,12 +709,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, callback: (error: Error, icon: NativeImage) => void): void; + getFileIcon(path: string, options: FileIconOptions, callback: (error: Error, icon: NativeImage) => void): void; /** * 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; + getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void; getGPUFeatureStatus(): GPUFeatureStatus; getJumpListSettings(): JumpListSettings; /** @@ -688,6 +741,12 @@ declare namespace Electron { */ getPath(name: string): string; getVersion(): string; + /** + * This method returns whether or not this instance of your app is currently + * holding the single instance lock. You can request the lock with + * app.requestSingleInstanceLock() and release with app.releaseSingleInstanceLock() + */ + hasSingleInstanceLock(): boolean; /** * Hides all application windows without minimizing them. */ @@ -717,27 +776,6 @@ declare namespace Electron { isInApplicationsFolder(): boolean; isReady(): boolean; isUnityRunning(): boolean; - /** - * 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. callback will be called by the first instance with callback(argv, - * workingDirectory) when 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. The callback is guaranteed to be - * executed after the ready event of app gets emitted. This method returns false if - * your process is the primary instance of the application and your app should - * continue loading. And returns true if your process has sent its parameters to - * another instance, and you should immediately quit. 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: - */ - makeSingleInstance(callback: (argv: string[], workingDirectory: string) => void): 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 @@ -770,15 +808,34 @@ declare namespace Electron { */ relaunch(options?: RelaunchOptions): void; /** - * Releases all locks that were created by makeSingleInstance. This will allow - * multiple instances of the application to once again run side by side. + * Releases all locks that were created by requestSingleInstanceLock. This will + * allow multiple instances of the application to once again run side by side. */ - releaseSingleInstance(): void; + releaseSingleInstanceLock(): void; /** * This method checks if the current executable as the default handler for a * protocol (aka URI scheme). If so, it will remove the app as the default handler. */ removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; + /** + * 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. See the Apple docs for more details. @@ -883,14 +940,32 @@ declare namespace Electron { * userInfo into its current userInfo dictionary. */ updateCurrentActivity(type: string, userInfo: any): void; + whenReady(): Promise; commandLine: CommandLine; dock: Dock; + /** + * A Boolean property that returns true if the app is packaged, false otherwise. + * For many apps, this property can be used to distinguish development and + * production environments. + */ + isPackaged?: boolean; } interface AutoUpdater extends EventEmitter { // Docs: http://electron.atom.io/docs/api/auto-updater + /** + * This event is emitted after a user calls quitAndInstall(). When this API is + * called, the before-quit event is not emitted before all windows are closed. As a + * result you should listen to this event if you wish to perform actions before the + * windows are closed while a process is quitting, as well as listening to + * before-quit. + */ + on(event: 'before-quit-for-update', listener: Function): this; + once(event: 'before-quit-for-update', listener: Function): this; + addListener(event: 'before-quit-for-update', listener: Function): this; + removeListener(event: 'before-quit-for-update', listener: Function): this; /** * Emitted when checking if an update has started. */ @@ -1034,7 +1109,7 @@ declare namespace Electron { * cancel the close. For example: Note: There is a subtle difference between the * behaviors of window.onbeforeunload = handler and * window.addEventListener('beforeunload', handler). It is recommended to always - * set the event.returnValue explicitly, instead of just returning a value, as the + * set the event.returnValue explicitly, instead of only returning a value, as the * former works more consistently within Electron. */ on(event: 'close', listener: (event: Event) => void): this; @@ -1107,7 +1182,7 @@ declare namespace Electron { removeListener(event: 'minimize', listener: Function): this; /** * Emitted when the window is being moved to a new position. Note: On macOS this - * event is just an alias of moved. + * event is an alias of moved. */ on(event: 'move', listener: Function): this; once(event: 'move', listener: Function): this; @@ -1274,7 +1349,7 @@ declare namespace Electron { * emitted. */ static getExtensions(): Extensions; - static getFocusedWindow(): BrowserWindow; + static getFocusedWindow(): BrowserWindow | null; /** * Remove a DevTools extension by name. Note: This API cannot be called before the * ready event of the app module is emitted. @@ -1439,6 +1514,10 @@ declare namespace Electron { * more than one tab in the current window. */ moveTabToNewWindow(): void; + /** + * Moves window to top(z-order) regardless of focus + */ + moveTop(): void; /** * Uses Quick Look to preview a file at a given path. */ @@ -1484,8 +1563,9 @@ declare namespace Electron { * ratio for HD @1920x1080) within the player itself we would call this function * with arguments of 16/9 and [ 40, 50 ]. The second argument doesn't care where * the extra width and height are within the content view--only that they exist. - * Just sum any extra width and height areas you have within the overall content - * view. + * Sum any extra width and height areas you have within the overall content view. + * Calling this function with a value of 0 will remove any previously set aspect + * ratios. */ setAspectRatio(aspectRatio: number, extraSize: Size): void; /** @@ -1602,7 +1682,7 @@ declare namespace Electron { * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to * convey some sort of application status or to passively notify the user. */ - setOverlayIcon(overlay: NativeImage, description: string): void; + setOverlayIcon(overlay: NativeImage | null, description: string): void; /** * Sets parent as current window's parent window, passing null will turn current * window into a top-level window. @@ -1632,6 +1712,14 @@ declare namespace Electron { * Sets whether the window can be manually resized by user. */ setResizable(resizable: boolean): void; + /** + * Setting a window shape determines the area within the window where the system + * permits drawing and user interaction. Outside of the given region, no pixels + * will be drawn and no mouse events will be registered. Mouse events outside of + * the region will not be received by that window, but will fall through to + * whatever is behind the window. + */ + setShape(rects: Rectangle[]): void; /** * Changes the attachment point for sheets on macOS. By default, sheets are * attached just below the window frame, but you may want to display them beneath a @@ -1644,7 +1732,8 @@ declare namespace Electron { */ setSimpleFullScreen(flag: boolean): void; /** - * Resizes the window to width and height. + * Resizes the window to width and height. If width or height are below any set + * minimum size constraints the window will snap to its minimum size. */ setSize(width: number, height: number, animate?: boolean): void; /** @@ -1962,6 +2051,11 @@ declare namespace Electron { */ followRedirect(): void; getHeader(name: string): Header; + /** + * You can use this method in conjunction with POST requests to get the progress of + * a file upload or other data transfer. + */ + getUploadProgress(): UploadProgress; /** * Removes a previously set extra header name. This method can be called only * before first write. Trying to call it after the first write will throw an error. @@ -2437,6 +2531,12 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/desktop-capturer-source + /** + * 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. + */ + display_id: string; /** * The identifier of a window or screen that can be used as a chromeMediaSourceId * constraint when calling [navigator.webkitGetUserMedia]. The format of the @@ -2785,26 +2885,42 @@ declare namespace Electron { */ on(event: 'transactions-updated', listener: (event: Event, /** - * Array of transactions. + * Array of objects. */ transactions: Transaction[]) => void): this; once(event: 'transactions-updated', listener: (event: Event, /** - * Array of transactions. + * Array of objects. */ transactions: Transaction[]) => void): this; addListener(event: 'transactions-updated', listener: (event: Event, /** - * Array of transactions. + * Array of objects. */ transactions: Transaction[]) => void): this; removeListener(event: 'transactions-updated', listener: (event: Event, /** - * Array of transactions. + * Array of objects. */ transactions: Transaction[]) => void): this; canMakePayments(): boolean; + /** + * Completes all pending transactions. + */ + finishAllTransactions(): void; + /** + * Completes the pending transactions corresponding to the date. + */ + finishTransactionByDate(date: string): void; + /** + * Retrieves the product descriptions. + */ + 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. + */ purchaseProduct(productID: string, quantity?: number, callback?: (isProductValid: boolean) => void): void; } @@ -2964,9 +3080,9 @@ declare namespace Electron { */ // sendSync(channel: string, ...args: any[]): any; ### VSCODE CHANGE (we do not want to use sendSync) /** - * Sends a message to a window with windowid via channel. + * Sends a message to a window with webContentsId via channel. */ - sendTo(windowId: number, channel: string, ...args: any[]): void; + sendTo(webContentsId: number, channel: string, ...args: any[]): void; /** * Like ipcRenderer.send but the event will be sent to the element in the * host page instead of the main process. @@ -3097,10 +3213,9 @@ declare namespace Electron { removeListener(event: 'menu-will-show', listener: (event: Event) => void): this; constructor(); /** - * Generally, the template is just an array of options for constructing a MenuItem. - * The 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. + * Generally, the template is an array of options for constructing a MenuItem. The + * 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: MenuItemConstructorOptions[]): Menu; /** @@ -3110,9 +3225,9 @@ declare namespace Electron { static getApplicationMenu(): Menu | null; /** * Sends the action to the first responder of application. This is used for - * emulating default macOS menu behaviors. Usually you would just use the role - * property of a MenuItem. See the macOS Cocoa Event Handling Guide for more - * information on macOS' native actions. + * emulating default macOS menu behaviors. Usually you would use the role property + * of a MenuItem. See the macOS Cocoa Event Handling Guide for more information on + * macOS' native actions. */ static sendActionToFirstResponder(action: string): void; /** @@ -3248,6 +3363,29 @@ declare namespace Electron { request(options: any | string): ClientRequest; } + interface NetLog extends EventEmitter { + + // Docs: http://electron.atom.io/docs/api/net-log + + /** + * Starts recording network events to path. + */ + startLogging(path: string): void; + /** + * Stops recording network events. If not called, net logging will automatically + * end when app quits. + */ + stopLogging(callback?: (path: string) => void): void; + /** + * A Boolean property that indicates whether network logs are recorded. + */ + currentlyLogging?: boolean; + /** + * A String property that returns the path to the current log file. + */ + currentlyLoggingPath?: string; + } + class Notification extends EventEmitter { // Docs: http://electron.atom.io/docs/api/notification @@ -3329,11 +3467,11 @@ declare namespace Electron { close(): void; /** * Immediately shows the notification to the user, please note this means unlike - * the HTML5 Notification implementation, simply instantiating a new Notification - * does not immediately show it to the user, you need to call this method before - * the OS will display it. If the notification has been shown before, this method - * will dismiss the previously shown notification and create a new one with - * identical properties. + * the HTML5 Notification implementation, instantiating a new Notification does not + * immediately show it to the user, you need to call this method before the OS will + * display it. If the notification has been shown before, this method will dismiss + * the previously shown notification and create a new one with identical + * properties. */ show(): void; } @@ -3364,6 +3502,13 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/power-monitor + /** + * Emitted when the system is about to lock the screen. + */ + on(event: 'lock-screen', listener: Function): this; + once(event: 'lock-screen', listener: Function): this; + addListener(event: 'lock-screen', listener: Function): this; + removeListener(event: 'lock-screen', listener: Function): this; /** * Emitted when the system changes to AC power. */ @@ -3402,6 +3547,13 @@ declare namespace Electron { once(event: 'suspend', listener: Function): this; addListener(event: 'suspend', listener: Function): this; removeListener(event: 'suspend', listener: Function): this; + /** + * Emitted as soon as the systems screen is unlocked. + */ + on(event: 'unlock-screen', listener: Function): this; + once(event: 'unlock-screen', listener: Function): this; + addListener(event: 'unlock-screen', listener: Function): this; + removeListener(event: 'unlock-screen', listener: Function): this; } interface PowerSaveBlocker extends EventEmitter { @@ -3458,6 +3610,45 @@ declare namespace Electron { type: string; } + interface Product { + + // Docs: http://electron.atom.io/docs/api/structures/product + + /** + * The total size of the content, in bytes. + */ + contentLengths: number[]; + /** + * A string that identifies the version of the content. + */ + contentVersion: string; + /** + * A Boolean value that indicates whether the App Store has downloadable content + * for this product. + */ + downloadable: boolean; + /** + * The locale formatted price of the product. + */ + formattedPrice: string; + /** + * A description of the product. + */ + localizedDescription: string; + /** + * The name of the product. + */ + localizedTitle: string; + /** + * The cost of the product in the local currency. + */ + price: number; + /** + * The string that identifies the product to the Apple App Store. + */ + productIdentifier: string; + } + interface Protocol extends EventEmitter { // Docs: http://electron.atom.io/docs/api/protocol @@ -3590,11 +3781,32 @@ declare namespace Electron { y: number; } + interface Referrer { + + // Docs: http://electron.atom.io/docs/api/structures/referrer + + /** + * Can be default, unsafe-url, no-referrer-when-downgrade, no-referrer, origin, + * strict-origin-when-cross-origin, same-origin or strict-origin. See the for more + * details on the meaning of these values. + */ + policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin'); + /** + * HTTP Referrer URL. + */ + url: string; + } + interface Remote extends MainInterface { // Docs: http://electron.atom.io/docs/api/remote getCurrentWebContents(): WebContents; + /** + * Note: Do not use removeAllListeners on BrowserWindow. Use of this can remove all + * blur listeners, disable click events on touch bar buttons, and other unintended + * consequences. + */ getCurrentWindow(): BrowserWindow; getGlobal(name: string): any; /** @@ -3698,6 +3910,17 @@ declare namespace Electron { oldDisplay: Display) => void): this; removeListener(event: 'display-removed', listener: (event: Event, oldDisplay: Display) => void): this; + /** + * Converts a screen DIP point to a screen physical point. The DPI scale is + * performed relative to the display containing the DIP point. + */ + dipToScreenPoint(point: Point): Point; + /** + * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed + * relative to the display nearest to window. If window is null, scaling will be + * performed to the display nearest to rect. + */ + dipToScreenRect(window: BrowserWindow | null, rect: Rectangle): Rectangle; getAllDisplays(): Display[]; /** * The current absolute position of the mouse pointer. @@ -3705,8 +3928,18 @@ declare namespace Electron { getCursorScreenPoint(): Point; getDisplayMatching(rect: Rectangle): Display; getDisplayNearestPoint(point: Point): Display; - getMenuBarHeight(): number; getPrimaryDisplay(): Display; + /** + * Converts a screen physical point to a screen DIP point. The DPI scale is + * performed relative to the display containing the physical point. + */ + screenToDipPoint(point: Point): Point; + /** + * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed + * relative to the display nearest to window. If window is null, scaling will be + * performed to the display nearest to rect. + */ + screenToDipRect(window: BrowserWindow | null, rect: Rectangle): Rectangle; } interface ScrubberItem { @@ -4051,6 +4284,11 @@ declare namespace Electron { * contains the user information dictionary sent along with the notification. */ 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; /** * Add the specified defaults to your application's NSUserDefaults. */ @@ -4069,7 +4307,7 @@ declare namespace Electron { * Same as subscribeNotification, but uses NSNotificationCenter for local defaults. * This is necessary for events such as NSUserDefaultsDidChangeNotification. */ - subscribeLocalNotification(event: string, callback: (event: string, userInfo: any) => void): void; + subscribeLocalNotification(event: string, callback: (event: string, userInfo: any) => void): number; /** * Subscribes to native notifications of macOS, callback will be called with * callback(event, userInfo) when the corresponding event happens. The userInfo is @@ -4078,7 +4316,13 @@ declare namespace Electron { * unsubscribe the event. Under the hood this API subscribes to * NSDistributedNotificationCenter, example values of event are: */ - subscribeNotification(event: string, callback: (event: string, userInfo: any) => void): void; + subscribeNotification(event: string, callback: (event: string, userInfo: any) => void): number; + /** + * Same as subscribeNotification, but uses + * NSWorkspace.sharedWorkspace.notificationCenter. This is necessary for events + * such as NSWorkspaceDidActivateApplicationNotification. + */ + subscribeWorkspaceNotification(event: string, callback: (event: string, userInfo: any) => void): void; /** * Same as unsubscribeNotification, but removes the subscriber from * NSNotificationCenter. @@ -4088,6 +4332,11 @@ declare namespace Electron { * Removes the subscriber with id. */ unsubscribeNotification(id: number): void; + /** + * Same as unsubscribeNotification, but removes the subscriber from + * NSWorkspace.sharedWorkspace.notificationCenter. + */ + unsubscribeWorkspaceNotification(id: number): void; } interface Task { @@ -4251,17 +4500,32 @@ declare namespace Electron { // Docs: http://electron.atom.io/docs/api/structures/transaction + /** + * The error code if an error occurred while processing the transaction. + */ errorCode: number; + /** + * The error message if an error occurred while processing the transaction. + */ errorMessage: string; + /** + * The identifier of the restored transaction by the App Store. + */ originalTransactionIdentifier: string; payment: Payment; + /** + * The date the transaction was added to the App Store’s payment queue. + */ transactionDate: string; + /** + * A string that uniquely identifies a successful payment transaction. + */ transactionIdentifier: string; /** - * The transaction sate ("purchasing", "purchased", "failed", "restored", or - * "deferred") + * The transaction state, can be purchasing, purchased, failed, restored or + * deferred. */ - transactionState: string; + transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred'); } class Tray extends EventEmitter { @@ -4531,6 +4795,7 @@ declare namespace Electron { * The bounds of this tray icon as Object. */ getBounds(): Rectangle; + getIgnoreDoubleClickEvents(): boolean; isDestroyed(): boolean; /** * Pops up the context menu of the tray icon. When menu is passed, the menu will be @@ -4541,13 +4806,19 @@ declare namespace Electron { /** * Sets the context menu for this icon. */ - setContextMenu(menu: Menu): void; + setContextMenu(menu: Menu | null): void; /** * 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; + /** + * Sets the option to ignore double click events. Ignoring these events allows you + * to detect every individual click of the tray icon. This value is set to false by + * default. + */ + setIgnoreDoubleClickEvents(ignore: boolean): void; /** * Sets the image associated with this tray icon. */ @@ -4555,7 +4826,7 @@ declare namespace Electron { /** * Sets the image associated with this tray icon when pressed on macOS. */ - setPressedImage(image: NativeImage): void; + setPressedImage(image: NativeImage | string): void; /** * Sets the title displayed aside of the tray icon in the status bar (Support ANSI * colors). @@ -4625,32 +4896,6 @@ declare namespace Electron { type: string; } - interface UploadFileSystem { - - // Docs: http://electron.atom.io/docs/api/structures/upload-file-system - - /** - * FileSystem url to read data for upload. - */ - filsSystemURL: string; - /** - * Number of bytes to read from offset. Defaults to 0. - */ - length: number; - /** - * Last Modification time in number of seconds since the UNIX epoch. - */ - modificationTime: number; - /** - * Defaults to 0. - */ - offset: number; - /** - * fileSystem. - */ - type: string; - } - interface UploadRawData { // Docs: http://electron.atom.io/docs/api/structures/upload-raw-data @@ -4737,19 +4982,23 @@ declare namespace Electron { * Emitted when the associated window logs a console message. Will not be emitted * for windows with offscreen rendering enabled. */ - on(event: 'console-message', listener: (level: number, + on(event: 'console-message', listener: (event: Event, + level: number, message: string, line: number, sourceId: string) => void): this; - once(event: 'console-message', listener: (level: number, + once(event: 'console-message', listener: (event: Event, + level: number, message: string, line: number, sourceId: string) => void): this; - addListener(event: 'console-message', listener: (level: number, + addListener(event: 'console-message', listener: (event: Event, + level: number, message: string, line: number, sourceId: string) => void): this; - removeListener(event: 'console-message', listener: (level: number, + removeListener(event: 'console-message', listener: (event: Event, + level: number, message: string, line: number, sourceId: string) => void): this; @@ -4938,22 +5187,30 @@ declare namespace Electron { errorCode: number, errorDescription: string, validatedURL: string, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; once(event: 'did-fail-load', listener: (event: Event, errorCode: number, errorDescription: string, validatedURL: string, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; addListener(event: 'did-fail-load', listener: (event: Event, errorCode: number, errorDescription: string, validatedURL: string, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; removeListener(event: 'did-fail-load', listener: (event: Event, errorCode: number, errorDescription: string, validatedURL: string, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; /** * Emitted when the navigation is done, i.e. the spinner of the tab has stopped * spinning, and the onload event was dispatched. @@ -4966,119 +5223,149 @@ declare namespace Electron { * Emitted when a frame has done navigation. */ on(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; once(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; addListener(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; removeListener(event: 'did-frame-finish-load', listener: (event: Event, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; /** - * Emitted when a redirect is received while requesting a resource. - */ - on(event: 'did-get-redirect-request', listener: (event: Event, - oldURL: string, - newURL: string, - isMainFrame: boolean, - httpResponseCode: number, - requestMethod: string, - referrer: string, - headers: any) => void): this; - once(event: 'did-get-redirect-request', listener: (event: Event, - oldURL: string, - newURL: string, - isMainFrame: boolean, - httpResponseCode: number, - requestMethod: string, - referrer: string, - headers: any) => void): this; - addListener(event: 'did-get-redirect-request', listener: (event: Event, - oldURL: string, - newURL: string, - isMainFrame: boolean, - httpResponseCode: number, - requestMethod: string, - referrer: string, - headers: any) => void): this; - removeListener(event: 'did-get-redirect-request', listener: (event: Event, - oldURL: string, - newURL: string, - isMainFrame: boolean, - httpResponseCode: number, - requestMethod: string, - referrer: string, - headers: any) => void): this; - /** - * Emitted when details regarding a requested resource are available. status - * indicates the socket connection to download the resource. - */ - on(event: 'did-get-response-details', listener: (event: Event, - status: boolean, - newURL: string, - originalURL: string, - httpResponseCode: number, - requestMethod: string, - referrer: string, - headers: any, - resourceType: string) => void): this; - once(event: 'did-get-response-details', listener: (event: Event, - status: boolean, - newURL: string, - originalURL: string, - httpResponseCode: number, - requestMethod: string, - referrer: string, - headers: any, - resourceType: string) => void): this; - addListener(event: 'did-get-response-details', listener: (event: Event, - status: boolean, - newURL: string, - originalURL: string, - httpResponseCode: number, - requestMethod: string, - referrer: string, - headers: any, - resourceType: string) => void): this; - removeListener(event: 'did-get-response-details', listener: (event: Event, - status: boolean, - newURL: string, - originalURL: string, - httpResponseCode: number, - requestMethod: string, - referrer: string, - headers: any, - resourceType: string) => void): this; - /** - * Emitted when a navigation is done. This event is not emitted for in-page + * Emitted when any frame navigation is done. This event is not emitted for in-page * navigations, such as clicking anchor links or updating the window.location.hash. * Use did-navigate-in-page event for this purpose. */ - on(event: 'did-navigate', listener: (event: Event, - url: string) => void): this; - once(event: 'did-navigate', listener: (event: Event, - url: string) => void): this; - addListener(event: 'did-navigate', listener: (event: Event, - url: string) => void): this; - removeListener(event: 'did-navigate', listener: (event: Event, - url: string) => void): this; + on(event: 'did-frame-navigate', listener: (event: Event, + url: string, + /** + * -1 for non HTTP navigations + */ + httpResponseCode: number, + /** + * empty for non HTTP navigations, + */ + httpStatusText: string, + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; + once(event: 'did-frame-navigate', listener: (event: Event, + url: string, + /** + * -1 for non HTTP navigations + */ + httpResponseCode: number, + /** + * empty for non HTTP navigations, + */ + httpStatusText: string, + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; + addListener(event: 'did-frame-navigate', listener: (event: Event, + url: string, + /** + * -1 for non HTTP navigations + */ + httpResponseCode: number, + /** + * empty for non HTTP navigations, + */ + httpStatusText: string, + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; + removeListener(event: 'did-frame-navigate', listener: (event: Event, + url: string, + /** + * -1 for non HTTP navigations + */ + httpResponseCode: number, + /** + * empty for non HTTP navigations, + */ + httpStatusText: string, + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; /** - * Emitted when an in-page navigation happened. When in-page navigation happens, - * the page URL changes but does not cause navigation outside of the page. Examples - * of this occurring are when anchor links are clicked or when the DOM hashchange - * event is triggered. + * Emitted when a main frame navigation is done. This event is not emitted for + * in-page navigations, such as clicking anchor links or updating the + * window.location.hash. Use did-navigate-in-page event for this purpose. + */ + on(event: 'did-navigate', listener: (event: Event, + url: string, + /** + * -1 for non HTTP navigations + */ + httpResponseCode: number, + /** + * empty for non HTTP navigations + */ + httpStatusText: string) => void): this; + once(event: 'did-navigate', listener: (event: Event, + url: string, + /** + * -1 for non HTTP navigations + */ + httpResponseCode: number, + /** + * empty for non HTTP navigations + */ + httpStatusText: string) => void): this; + addListener(event: 'did-navigate', listener: (event: Event, + url: string, + /** + * -1 for non HTTP navigations + */ + httpResponseCode: number, + /** + * empty for non HTTP navigations + */ + httpStatusText: string) => void): this; + removeListener(event: 'did-navigate', listener: (event: Event, + url: string, + /** + * -1 for non HTTP navigations + */ + httpResponseCode: number, + /** + * empty for non HTTP navigations + */ + httpStatusText: string) => void): this; + /** + * Emitted when an in-page navigation happened in any frame. When in-page + * navigation happens, the page URL changes but does not cause navigation outside + * of the page. Examples of this occurring are when anchor links are clicked or + * when the DOM hashchange event is triggered. */ on(event: 'did-navigate-in-page', listener: (event: Event, url: string, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; once(event: 'did-navigate-in-page', listener: (event: Event, url: string, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; addListener(event: 'did-navigate-in-page', listener: (event: Event, url: string, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; removeListener(event: 'did-navigate-in-page', listener: (event: Event, url: string, - isMainFrame: boolean) => void): this; + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; /** * Corresponds to the points in time when the spinner of the tab started spinning. */ @@ -5086,6 +5373,30 @@ declare namespace Electron { once(event: 'did-start-loading', listener: Function): this; addListener(event: 'did-start-loading', listener: Function): this; removeListener(event: 'did-start-loading', listener: Function): this; + /** + * Emitted when any frame (including main) starts navigating. isInplace will be + * true for in-page navigations. + */ + on(event: 'did-start-navigation', listener: (url: string, + isInPlace: boolean, + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; + once(event: 'did-start-navigation', listener: (url: string, + isInPlace: boolean, + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; + addListener(event: 'did-start-navigation', listener: (url: string, + isInPlace: boolean, + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; + removeListener(event: 'did-start-navigation', listener: (url: string, + isInPlace: boolean, + isMainFrame: boolean, + frameProcessId: number, + frameRoutingId: number) => void): this; /** * Corresponds to the points in time when the spinner of the tab stopped spinning. */ @@ -5171,7 +5482,12 @@ declare namespace Electron { * The non-standard features (features not handled by Chromium or Electron) given * to `window.open()`. */ - additionalFeatures: string[]) => void): this; + additionalFeatures: string[], + /** + * The referrer that will be passed to the new window. May or may not result in the + * `Referer` header being sent, depending on the referrer policy. + */ + referrer: Referrer) => void): this; once(event: 'new-window', listener: (event: Event, url: string, frameName: string, @@ -5188,7 +5504,12 @@ declare namespace Electron { * The non-standard features (features not handled by Chromium or Electron) given * to `window.open()`. */ - additionalFeatures: string[]) => void): this; + additionalFeatures: string[], + /** + * The referrer that will be passed to the new window. May or may not result in the + * `Referer` header being sent, depending on the referrer policy. + */ + referrer: Referrer) => void): this; addListener(event: 'new-window', listener: (event: Event, url: string, frameName: string, @@ -5205,7 +5526,12 @@ declare namespace Electron { * The non-standard features (features not handled by Chromium or Electron) given * to `window.open()`. */ - additionalFeatures: string[]) => void): this; + additionalFeatures: string[], + /** + * The referrer that will be passed to the new window. May or may not result in the + * `Referer` header being sent, depending on the referrer policy. + */ + referrer: Referrer) => void): this; removeListener(event: 'new-window', listener: (event: Event, url: string, frameName: string, @@ -5222,7 +5548,12 @@ declare namespace Electron { * The non-standard features (features not handled by Chromium or Electron) given * to `window.open()`. */ - additionalFeatures: string[]) => void): this; + additionalFeatures: string[], + /** + * The referrer that will be passed to the new window. May or may not result in the + * `Referer` header being sent, depending on the referrer policy. + */ + referrer: Referrer) => void): this; /** * Emitted when page receives favicon urls. */ @@ -5289,6 +5620,13 @@ declare namespace Electron { removeListener(event: 'plugin-crashed', listener: (event: Event, name: string, version: string) => void): this; + /** + * Emitted when the unresponsive web page becomes responsive again. + */ + on(event: 'responsive', listener: Function): this; + once(event: 'responsive', listener: Function): this; + addListener(event: 'responsive', listener: Function): this; + removeListener(event: 'responsive', listener: Function): this; /** * Emitted when bluetooth device needs to be selected on call to * navigator.bluetooth.requestDevice. To use navigator.bluetooth api webBluetooth @@ -5328,6 +5666,13 @@ declare namespace Electron { url: string, certificateList: Certificate[], callback: (certificate: Certificate) => void) => void): this; + /** + * Emitted when the web page becomes unresponsive. + */ + on(event: 'unresponsive', listener: Function): this; + once(event: 'unresponsive', listener: Function): this; + addListener(event: 'unresponsive', listener: Function): this; + removeListener(event: 'unresponsive', listener: Function): this; /** * Emitted when mouse moves over a link or the keyboard moves the focus to a link. */ @@ -5424,30 +5769,22 @@ declare namespace Electron { addWorkSpace(path: string): void; /** * Begin subscribing for presentation events and captured frames, the callback will - * be called with callback(frameBuffer, dirtyRect) when there is a presentation - * event. The frameBuffer is a Buffer that contains raw pixel data. On most - * machines, the pixel data is effectively stored in 32bit BGRA format, but the - * actual representation depends on the endianness of the processor (most modern - * processors are little-endian, on machines with big-endian processors the data is - * in 32bit ARGB format). The dirtyRect is an object with x, y, width, height - * properties that describes which part of the page was repainted. If onlyDirty is - * set to true, frameBuffer will only contain the repainted area. onlyDirty - * defaults to false. + * be called with callback(image, dirtyRect) when there is a presentation event. + * The image is an instance of NativeImage that stores the captured frame. The + * dirtyRect is an object with x, y, width, height properties that describes which + * part of the page was repainted. If onlyDirty is set to true, image will only + * contain the repainted area. onlyDirty defaults to false. */ - beginFrameSubscription(callback: (frameBuffer: Buffer, dirtyRect: Rectangle) => void): void; + beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void; /** * Begin subscribing for presentation events and captured frames, the callback will - * be called with callback(frameBuffer, dirtyRect) when there is a presentation - * event. The frameBuffer is a Buffer that contains raw pixel data. On most - * machines, the pixel data is effectively stored in 32bit BGRA format, but the - * actual representation depends on the endianness of the processor (most modern - * processors are little-endian, on machines with big-endian processors the data is - * in 32bit ARGB format). The dirtyRect is an object with x, y, width, height - * properties that describes which part of the page was repainted. If onlyDirty is - * set to true, frameBuffer will only contain the repainted area. onlyDirty - * defaults to false. + * be called with callback(image, dirtyRect) when there is a presentation event. + * The image is an instance of NativeImage that stores the captured frame. The + * dirtyRect is an object with x, y, width, height properties that describes which + * part of the page was repainted. If onlyDirty is set to true, image will only + * contain the repainted area. onlyDirty defaults to false. */ - beginFrameSubscription(onlyDirty: boolean, callback: (frameBuffer: Buffer, dirtyRect: Rectangle) => void): void; + beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void; canGoBack(): boolean; canGoForward(): boolean; canGoToOffset(offset: number): boolean; @@ -5456,13 +5793,13 @@ declare namespace Electron { * 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. */ - capturePage(callback: (image: NativeImage) => void): void; + 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. */ - capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + capturePage(callback: (image: NativeImage) => void): void; /** * Clears the navigation history. */ @@ -5528,6 +5865,7 @@ declare namespace Electron { * Get the system printer list. */ getPrinters(): PrinterInfo[]; + getProcessId(): number; getTitle(): string; getURL(): string; getUserAgent(): string; @@ -5714,10 +6052,6 @@ declare namespace Electron { * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. */ setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; - /** - * Set the size of the page. This is only supported for guest contents. - */ - setSize(options: SizeOptions): void; /** * Overrides the user agent for this web page. */ @@ -5817,6 +6151,9 @@ declare namespace Electron { * Work like executeJavaScript but evaluates scripts in isolated context. */ executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any) => void): void; + findFrameByName(name: string): WebFrame; + findFrameByRoutingId(routingId: number): WebFrame; + getFrameForSelector(selector: string): WebFrame; /** * Returns an object describing usage information of Blink's internal memory * caches. This will generate: @@ -5840,12 +6177,6 @@ declare namespace Electron { * privileged scheme, without bypassing Content Security Policy: */ registerURLSchemeAsPrivileged(scheme: string, options?: RegisterURLSchemeAsPrivilegedOptions): void; - /** - * Registers the scheme as secure scheme. Secure schemes do not trigger mixed - * content warnings. For example, https and data are secure schemes because they - * cannot be corrupted by active network attackers. - */ - registerURLSchemeAsSecure(scheme: string): void; /** * Set the content security policy of the isolated world. */ @@ -5883,6 +6214,39 @@ declare namespace Electron { * limits of 300% and 50% of original size, respectively. */ setZoomLevel(level: number): void; + /** + * A WebFrame representing the first child frame of webFrame, the property would be + * null if webFrame has no children or if first child is not in the current + * renderer process. + */ + firstChild?: WebFrame; + /** + * A WebFrame representing next sibling frame, the property would be null if + * webFrame is the last frame in its parent or if the next sibling is not in the + * current renderer process. + */ + nextSibling?: WebFrame; + /** + * A WebFrame representing the frame which opened webFrame, the property would be + * null if there's no opener or opener is not in the current renderer process. + */ + opener?: WebFrame; + /** + * A WebFrame representing parent frame of webFrame, the property would be null if + * webFrame is top or parent is not in the current renderer process. + */ + parent?: WebFrame; + /** + * An Integer representing the unique frame id in the current renderer process. + * Distinct WebFrame instances that refer to the same underlying frame will have + * the same routingId. + */ + routingId?: number; + /** + * A WebFrame representing top frame in frame hierarchy to which webFrame belongs, + * the property would be null if top frame is not in the current renderer process. + */ + top?: WebFrame; } class WebRequest extends EventEmitter { @@ -6029,17 +6393,6 @@ declare namespace Electron { */ addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this; removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this; - /** - * Fired when details regarding a requested resource is available. status indicates - * socket connection to download the resource. - */ - addEventListener(event: 'did-get-response-details', listener: (event: DidGetResponseDetailsEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-get-response-details', listener: (event: DidGetResponseDetailsEvent) => void): this; - /** - * Fired when a redirect was received while requesting a resource. - */ - addEventListener(event: 'did-get-redirect-request', listener: (event: DidGetRedirectRequestEvent) => void, useCapture?: boolean): this; - removeEventListener(event: 'did-get-redirect-request', listener: (event: DidGetRedirectRequestEvent) => void): this; /** * Fired when document in the given frame is loaded. */ @@ -6118,8 +6471,8 @@ declare namespace Electron { removeEventListener(event: 'close', listener: (event: Event) => void): this; /** * Fired when the guest page has sent an asynchronous message to embedder page. - * With sendToHost method and ipc-message event you can easily communicate between - * guest page and embedder page: + * With sendToHost method and ipc-message event you can communicate between guest + * page and embedder page: */ addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this; removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this; @@ -6383,40 +6736,23 @@ declare namespace Electron { * than the minimum values or greater than the maximum. */ autosize?: string; - /** - * A list of strings which specifies the blink features to be enabled separated by - * ,. The full list of supported feature strings can be found in the - * RuntimeEnabledFeatures.json5 file. - */ - blinkfeatures?: 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. */ disableblinkfeatures?: string; - /** - * When this attribute is present the webview contents will be prevented from - * resizing when the webview element itself is resized. This can be used in - * combination with webContents.setSize to manually resize the webview contents in - * reaction to a window size change. This can make resizing faster compared to - * relying on the webview element bounds to automatically resize the contents. - */ - disableguestresize?: string; /** * When this attribute is present the guest page will have web security disabled. * Web security is enabled by default. */ // disablewebsecurity?: string; ### VSCODE CHANGE(https://github.com/electron/electron/blob/master/docs/tutorial/security.md) ### /** - * A value that links the webview to a specific webContents. When a webview first - * loads a new webContents is created and this attribute is set to its instance - * identifier. Setting this attribute on a new or existing webview connects it to - * the existing webContents that currently renders in a different webview. The - * existing webview will see the destroy event and will then create a new - * webContents when a new url is loaded. + * A list of strings which specifies the blink features to be enabled separated by + * ,. The full list of supported feature strings can be found in the + * RuntimeEnabledFeatures.json5 file. */ - guestinstance?: string; + enableblinkfeatures?: string; /** * Sets the referrer URL for the guest page. */ @@ -6727,7 +7063,9 @@ declare namespace Electron { enableLargerThanScreen?: boolean; /** * Window's background color as a hexadecimal value, like #66CD00 or #FFF or - * #80FFFFFF (alpha is supported). Default is #FFF (white). + * #80FFFFFF (alpha is supported). Default is #FFF (white). If transparent is set + * to true, only values with transparent (#00-------) or opaque (#FF-----) alpha + * values are respected. */ backgroundColor?: string; /** @@ -6827,7 +7165,7 @@ declare namespace Electron { origin?: string; /** * The types of storages to clear, can contain: appcache, cookies, filesystem, - * indexdb, localstorage, shadercache, websql, serviceworkers. + * indexdb, localstorage, shadercache, websql, serviceworkers, cachestorage. */ storages?: string[]; /** @@ -7097,23 +7435,6 @@ declare namespace Electron { isMainFrame: boolean; } - interface DidGetRedirectRequestEvent extends Event { - oldURL: string; - newURL: string; - isMainFrame: boolean; - } - - interface DidGetResponseDetailsEvent extends Event { - status: boolean; - newURL: string; - originalURL: string; - httpResponseCode: number; - requestMethod: string; - referrer: string; - headers: Headers; - resourceType: string; - } - interface DidNavigateEvent extends Event { url: string; } @@ -7284,6 +7605,18 @@ declare namespace Electron { interface Headers { } + interface HeapStatistics { + totalHeapSize: number; + totalHeapSizeExecutable: number; + totalPhysicalSize: number; + totalAvailableSize: number; + usedHeapSize: number; + heapSizeLimit: number; + mallocedMemory: number; + peakMallocedMemory: number; + doesZapGarbage: boolean; + } + interface IgnoreMouseEventsOptions { /** * If true, forwards mouse move messages to Chromium, enabling mouse related events @@ -7413,9 +7746,9 @@ declare namespace Electron { interface LoadURLOptions { /** - * A HTTP Referrer url. + * An HTTP Referrer url. */ - httpReferrer?: string; + httpReferrer?: string | Referrer; /** * A user agent originating the request. */ @@ -7424,10 +7757,7 @@ declare namespace Electron { * Extra headers separated by "\n" */ extraHeaders?: string; - /** - * - - */ - postData?: UploadRawData[] | UploadFile[] | UploadFileSystem[] | UploadBlob[]; + postData?: UploadRawData[] | UploadFile[] | UploadBlob[]; /** * Base url (with trailing path separator) for files to be loaded by the data url. * This is needed only if the specified url is a data url and needs to load other @@ -7879,7 +8209,13 @@ declare namespace Electron { } interface Payment { + /** + * The identifier of the purchased product. + */ productIdentifier: string; + /** + * The quantity purchased. + */ quantity: number; } @@ -7944,7 +8280,7 @@ declare namespace Electron { * Specify page size of the generated PDF. Can be A3, A4, A5, Legal, Letter, * Tabloid or an Object containing height and width in microns. */ - pageSize?: string; + pageSize?: string | Size; /** * Whether to print CSS backgrounds. */ @@ -8104,6 +8440,7 @@ declare namespace Electron { interface ResourceUsage { images: MemoryUsageDetails; + scripts: MemoryUsageDetails; cssStyleSheets: MemoryUsageDetails; xslStyleSheets: MemoryUsageDetails; fonts: MemoryUsageDetails; @@ -8176,7 +8513,7 @@ declare namespace Electron { /** * true to open the app as hidden. Defaults to false. The user can edit this * setting from the System Preferences so - * app.getLoginItemStatus().wasOpenedAsHidden should be checked when the app is + * app.getLoginItemSettings().wasOpenedAsHidden should be checked when the app is * opened to know the current value. This setting is not available on . */ openAsHidden?: boolean; @@ -8191,29 +8528,6 @@ declare namespace Electron { args?: string[]; } - interface SizeOptions { - /** - * true to make the webview container automatically resize within the bounds - * specified by the attributes normal, min and max. - */ - enableAutoSize?: boolean; - /** - * Normal size of the page. This can be used in combination with the attribute to - * manually resize the webview guest contents. - */ - normal?: Size; - /** - * Minimum size of the page. This can be used in combination with the attribute to - * manually resize the webview guest contents. - */ - min?: Size; - /** - * Maximium size of the page. This can be used in combination with the attribute to - * manually resize the webview guest contents. - */ - max?: Size; - } - interface SourcesOptions { /** * An array of Strings that lists the types of desktop sources to be captured, @@ -8451,6 +8765,27 @@ declare namespace Electron { url: string; } + interface UploadProgress { + /** + * Whether the request is currently active. If this is false no other properties + * will be set + */ + active: boolean; + /** + * Whether the upload has started. If this is false both current and total will be + * set to 0. + */ + started: boolean; + /** + * The number of bytes that have been uploaded so far + */ + current: number; + /** + * The number of bytes that will be uploaded this request + */ + total: number; + } + interface Versions { /** * A String representing Chrome's version string. @@ -8675,7 +9010,7 @@ declare namespace Electron { * A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to * enable. The full list of supported feature strings can be found in the file. */ - blinkFeatures?: string; + enableBlinkFeatures?: string; /** * A list of feature strings separated by ,, like CSSVariables,KeyboardEventKey to * disable. The full list of supported feature strings can be found in the file. @@ -8727,7 +9062,9 @@ declare namespace Electron { */ contextIsolation?: boolean; /** - * Whether to use native window.open(). Defaults to false. This option is currently + * 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; @@ -8745,7 +9082,22 @@ declare namespace Electron { * of this app. Useful for passing small bits of data down to renderer process * preload scripts. */ - additionArguments?: string[]; + additionalArguments?: string[]; + /** + * Whether to enable browser style consecutive dialog protection. Default is false. + */ + safeDialogs?: boolean; + /** + * The message to display when consecutive dialog protection is triggered. If not + * defined the default message would be used, note that currently the default + * message is in English and not localized. + */ + safeDialogsMessage?: string; + /** + * Whether dragging and dropping a file or link onto the page causes a navigation. + * Default is false. + */ + navigateOnDragDrop?: boolean; } interface DefaultFontFamily { @@ -8774,6 +9126,7 @@ declare namespace Electron { */ fantasy?: string; } + } declare module 'electron' { @@ -8823,6 +9176,11 @@ declare namespace NodeJS { */ crash(): void; getCPUUsage(): Electron.CPUUsage; + /** + * Returns an object with V8 heap statistics. Note that all statistics are reported + * in Kilobytes. + */ + getHeapStatistics(): Electron.HeapStatistics; getIOCounters(): Electron.IOCounters; /** * Returns an object giving memory usage statistics about the current process. Note @@ -8903,4 +9261,4 @@ declare namespace NodeJS { electron: string; chrome: string; } -} \ No newline at end of file +} diff --git a/src/vs/base/node/extfs.ts b/src/vs/base/node/extfs.ts index e157c56c8a6..53384810fe5 100644 --- a/src/vs/base/node/extfs.ts +++ b/src/vs/base/node/extfs.ts @@ -390,7 +390,7 @@ function doWriteFileStreamAndFlush(path: string, reader: NodeJS.ReadableStream, if (error) { if (isOpen) { writer.once('close', () => callback(error)); - writer.close(); + writer.destroy(); } else { callback(error); } @@ -450,10 +450,10 @@ function doWriteFileStreamAndFlush(path: string, reader: NodeJS.ReadableStream, canFlush = false; } - writer.close(); + writer.destroy(); }); } else { - writer.close(); + writer.destroy(); } }); diff --git a/src/vs/base/node/request.ts b/src/vs/base/node/request.ts index 6a8b5ad0780..143778dd52b 100644 --- a/src/vs/base/node/request.ts +++ b/src/vs/base/node/request.ts @@ -81,7 +81,7 @@ export function request(options: IRequestOptions, token: CancellationToken): Pro opts.auth = options.user + ':' + options.password; } - req = rawRequest(opts, (res: http.ClientResponse) => { + req = rawRequest(opts, (res: http.IncomingMessage) => { const followRedirects: number = isNumber(options.followRedirects) ? options.followRedirects : 3; if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && followRedirects > 0 && res.headers['location']) { request(assign({}, options, { diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index 3670dbd59d8..24c4df7ebff 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -1658,6 +1658,17 @@ export class WindowsManager implements IWindowsMainService { // Unresponsive if (error === WindowError.UNRESPONSIVE) { + if (window.isExtensionDevelopmentHost || window.isExtensionTestHost || (window.win && window.win.webContents && window.win.webContents.isDevToolsOpened())) { + // TODO@Ben Workaround for https://github.com/Microsoft/vscode/issues/56994 + // In certain cases the window can report unresponsiveness because a breakpoint was hit + // and the process is stopped executing. The most typical cases are: + // - devtools are opened and debugging happens + // - window is an extensions development host that is being debugged + // - window is an extension test development host that is being debugged + return; + } + + // Show Dialog this.dialogs.showMessageBox({ title: product.nameLong, type: 'warning', diff --git a/src/vs/editor/browser/services/codeEditorServiceImpl.ts b/src/vs/editor/browser/services/codeEditorServiceImpl.ts index 7ddea523070..b490643881b 100644 --- a/src/vs/editor/browser/services/codeEditorServiceImpl.ts +++ b/src/vs/editor/browser/services/codeEditorServiceImpl.ts @@ -210,7 +210,7 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider { const _CSS_MAP: { [prop: string]: string; } = { color: 'color:{0} !important;', - opacity: 'opacity:{0}; will-change: opacity;', // TODO@Ben: 'will-change: opacity' is a workaround for https://github.com/Microsoft/vscode/issues/52196 + opacity: 'opacity:{0};', backgroundColor: 'background-color:{0};', outline: 'outline:{0};', diff --git a/src/vs/editor/browser/widget/codeEditorWidget.ts b/src/vs/editor/browser/widget/codeEditorWidget.ts index 31225b97db9..84763f32414 100644 --- a/src/vs/editor/browser/widget/codeEditorWidget.ts +++ b/src/vs/editor/browser/widget/codeEditorWidget.ts @@ -1832,7 +1832,7 @@ registerThemingParticipant((theme, collector) => { const unnecessaryForeground = theme.getColor(editorUnnecessaryCodeOpacity); if (unnecessaryForeground) { - collector.addRule(`.${SHOW_UNUSED_ENABLED_CLASS} .monaco-editor .${ClassName.EditorUnnecessaryInlineDecoration} { opacity: ${unnecessaryForeground.rgba.a}; will-change: opacity; }`); // TODO@Ben: 'will-change: opacity' is a workaround for https://github.com/Microsoft/vscode/issues/52196 + collector.addRule(`.${SHOW_UNUSED_ENABLED_CLASS} .monaco-editor .${ClassName.EditorUnnecessaryInlineDecoration} { opacity: ${unnecessaryForeground.rgba.a}; }`); } const unnecessaryBorder = theme.getColor(editorUnnecessaryCodeBorder); diff --git a/src/vs/platform/issue/electron-main/issueService.ts b/src/vs/platform/issue/electron-main/issueService.ts index 7cdbcf7a854..344346bed19 100644 --- a/src/vs/platform/issue/electron-main/issueService.ts +++ b/src/vs/platform/issue/electron-main/issueService.ts @@ -328,4 +328,4 @@ export class IssueService implements IIssueService { return `${require.toUrl('vs/code/electron-browser/issue/issueReporter.html')}?config=${encodeURIComponent(JSON.stringify(config))}`; } -} +} \ No newline at end of file diff --git a/src/vs/platform/keybinding/common/abstractKeybindingService.ts b/src/vs/platform/keybinding/common/abstractKeybindingService.ts index 78d71449bec..7e6f07aff23 100644 --- a/src/vs/platform/keybinding/common/abstractKeybindingService.ts +++ b/src/vs/platform/keybinding/common/abstractKeybindingService.ts @@ -101,6 +101,10 @@ export abstract class AbstractKeybindingService extends Disposable implements IK return result.resolvedKeybinding; } + public dispatchEvent(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean { + return this._dispatch(e, target); + } + public softDispatch(e: IKeyboardEvent, target: IContextKeyServiceTarget): IResolveResult | null { const keybinding = this.resolveKeyboardEvent(e); if (keybinding.isChord()) { diff --git a/src/vs/platform/keybinding/common/keybinding.ts b/src/vs/platform/keybinding/common/keybinding.ts index 078cea23ede..762362bd8cd 100644 --- a/src/vs/platform/keybinding/common/keybinding.ts +++ b/src/vs/platform/keybinding/common/keybinding.ts @@ -52,6 +52,11 @@ export interface IKeybindingService { resolveUserBinding(userBinding: string): ResolvedKeybinding[]; + /** + * Resolve and dispatch `keyboardEvent` and invoke the command. + */ + dispatchEvent(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean; + /** * Resolve and dispatch `keyboardEvent`, but do not invoke the command or change inner state. */ diff --git a/src/vs/platform/keybinding/test/common/mockKeybindingService.ts b/src/vs/platform/keybinding/test/common/mockKeybindingService.ts index 99893ecbff8..42213cc40a7 100644 --- a/src/vs/platform/keybinding/test/common/mockKeybindingService.ts +++ b/src/vs/platform/keybinding/test/common/mockKeybindingService.ts @@ -120,11 +120,11 @@ export class MockKeybindingService implements IKeybindingService { return null; } - dispatchEvent(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean { + public dispatchEvent(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean { return false; } - mightProducePrintableCharacter(e: IKeyboardEvent): boolean { + public mightProducePrintableCharacter(e: IKeyboardEvent): boolean { return false; } } diff --git a/src/vs/platform/node/zip.ts b/src/vs/platform/node/zip.ts index fc1a1a87af1..6e9670e9255 100644 --- a/src/vs/platform/node/zip.ts +++ b/src/vs/platform/node/zip.ts @@ -83,7 +83,7 @@ function extractEntry(stream: Readable, fileName: string, mode: number, targetPa once(token.onCancellationRequested)(() => { if (istream) { - istream.close(); + istream.destroy(); } }); diff --git a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts index a9f51628d7c..e8cad936198 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts @@ -19,6 +19,7 @@ import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorG import * as vscode from 'vscode'; import { extHostNamedCustomer } from './extHostCustomers'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { onUnexpectedError } from 'vs/base/common/errors'; @extHostNamedCustomer(MainContext.MainThreadWebviews) export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviver { @@ -169,7 +170,9 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv } return this._proxy.$deserializeWebviewPanel(handle, webview.state.viewType, webview.getTitle(), state, editorGroupToViewColumn(this._editorGroupService, webview.group), webview.options) - .then(undefined, () => { + .then(undefined, error => { + onUnexpectedError(error); + webview.html = MainThreadWebviews.getDeserializationFailedContents(viewType); }); })); diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index fc1c6e6c2d0..ad25d47377a 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -17,14 +17,11 @@ import { IPartService, Parts, Position as SideBarPosition } from 'vs/workbench/s import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IDisposable, toDisposable } from 'vs/base/common/lifecycle'; import { ToggleActivityBarVisibilityAction } from 'vs/workbench/browser/actions/toggleActivityBarVisibility'; -import { IThemeService, registerThemingParticipant, ITheme } from 'vs/platform/theme/common/themeService'; +import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService'; import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND, ACTIVITY_BAR_INACTIVE_FOREGROUND } from 'vs/workbench/common/theme'; import { contrastBorder } from 'vs/platform/theme/common/colorRegistry'; import { CompositeBar } from 'vs/workbench/browser/parts/compositeBar'; -import { isMacintosh } from 'vs/base/common/platform'; -import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; -import { scheduleAtNextAnimationFrame, Dimension, addClass } from 'vs/base/browser/dom'; -import { Color } from 'vs/base/common/color'; +import { Dimension, addClass } from 'vs/base/browser/dom'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { URI } from 'vs/base/common/uri'; @@ -63,7 +60,6 @@ export class ActivitybarPart extends Part { @IInstantiationService private instantiationService: IInstantiationService, @IPartService private partService: IPartService, @IThemeService themeService: IThemeService, - @ILifecycleService private lifecycleService: ILifecycleService, @IStorageService private storageService: IStorageService, @IExtensionService private extensionService: IExtensionService, @IViewsService private viewsService: IViewsService, @@ -189,27 +185,6 @@ export class ActivitybarPart extends Part { this.createGlobalActivityActionBar(globalActivities); - // TODO@Ben: workaround for https://github.com/Microsoft/vscode/issues/45700 - // It looks like there are rendering glitches on macOS with Chrome 61 when - // using --webkit-mask with a background color that is different from the image - // The workaround is to promote the element onto its own drawing layer. We do - // this only after the workbench has loaded because otherwise there is ugly flicker. - if (isMacintosh) { - this.lifecycleService.when(LifecyclePhase.Restored).then(() => { - scheduleAtNextAnimationFrame(() => { // another delay... - scheduleAtNextAnimationFrame(() => { // ...to prevent more flickering on startup - registerThemingParticipant((theme, collector) => { - const activityBarForeground = theme.getColor(ACTIVITY_BAR_FOREGROUND); - if (activityBarForeground && !activityBarForeground.equals(Color.white)) { - // only apply this workaround if the color is different from the image one (white) - collector.addRule('.monaco-workbench .activitybar > .content .monaco-action-bar .action-label { will-change: transform; }'); - } - }); - }); - }); - }); - } - return content; } diff --git a/src/vs/workbench/parts/html/electron-browser/htmlPreviewPart.ts b/src/vs/workbench/parts/html/electron-browser/htmlPreviewPart.ts index 96e890bad6a..beb5093cc3e 100644 --- a/src/vs/workbench/parts/html/electron-browser/htmlPreviewPart.ts +++ b/src/vs/workbench/parts/html/electron-browser/htmlPreviewPart.ts @@ -22,6 +22,7 @@ import { WebviewElement, WebviewOptions } from 'vs/workbench/parts/webview/elect import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsService'; import { CancellationToken } from 'vs/base/common/cancellation'; +import { Event, Emitter } from 'vs/base/common/event'; export interface HtmlPreviewEditorViewState { scrollYPercentage: number; @@ -47,6 +48,9 @@ export class HtmlPreviewPart extends BaseWebviewEditor { private editorMemento: IEditorMemento; + private readonly _onDidFocusWebview = this._register(new Emitter()); + public get onDidFocus(): Event { return this._onDidFocusWebview.event; } + constructor( @ITelemetryService telemetryService: ITelemetryService, @IThemeService themeService: IThemeService, @@ -113,6 +117,8 @@ export class HtmlPreviewPart extends BaseWebviewEditor { this._scrollYPercentage = data.scrollYPercentage; }), ]; + + this._register(this._webview.onDidFocus(() => this._onDidFocusWebview.fire())); } return this._webview; } diff --git a/src/vs/workbench/parts/webview/electron-browser/webview-pre.js b/src/vs/workbench/parts/webview/electron-browser/webview-pre.js index 7ca8427445e..223cae1bda2 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webview-pre.js +++ b/src/vs/workbench/parts/webview/electron-browser/webview-pre.js @@ -325,6 +325,20 @@ // write new content onto iframe newFrame.contentDocument.open('text/html', 'replace'); + newFrame.contentWindow.addEventListener('focus', function () { ipcRenderer.sendToHost('did-focus'); }); + newFrame.contentWindow.addEventListener('blur', function () { ipcRenderer.sendToHost('did-blur'); }); + newFrame.contentWindow.addEventListener('keydown', function (e) { + ipcRenderer.sendToHost('did-keydown', { + key: e.key, + keyCode: e.keyCode, + code: e.code, + shiftKey: e.shiftKey, + altKey: e.altKey, + ctrlKey: e.ctrlKey, + metaKey: e.metaKey, + repeat: e.repeat + }); + }); newFrame.contentWindow.onbeforeunload = () => { if (isInDevelopmentMode) { // Allow reloads while developing a webview ipcRenderer.sendToHost('do-reload'); diff --git a/src/vs/workbench/parts/webview/electron-browser/webviewEditor.ts b/src/vs/workbench/parts/webview/electron-browser/webviewEditor.ts index ee6dbdd92e3..7bdce44d889 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webviewEditor.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webviewEditor.ts @@ -6,7 +6,7 @@ import * as DOM from 'vs/base/browser/dom'; import { CancellationToken } from 'vs/base/common/cancellation'; import { Emitter, Event } from 'vs/base/common/event'; -import { IDisposable } from 'vs/base/common/lifecycle'; +import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; @@ -31,11 +31,11 @@ export class WebviewEditor extends BaseWebviewEditor { private _content: HTMLElement; private _webviewContent: HTMLElement | undefined; - private _webviewFocusTracker?: DOM.IFocusTracker; - private _webviewFocusListenerDisposable?: IDisposable; + private _webviewFocusTrackerDisposables: IDisposable[] = []; private _onFocusWindowHandler?: IDisposable; - private readonly _onDidFocusWebview = new Emitter(); + private readonly _onDidFocusWebview = this._register(new Emitter()); + public get onDidFocus(): Event { return this._onDidFocusWebview.event; } constructor( @ITelemetryService telemetryService: ITelemetryService, @@ -102,17 +102,7 @@ export class WebviewEditor extends BaseWebviewEditor { this._content = undefined; } - this._onDidFocusWebview.dispose(); - - if (this._webviewFocusTracker) { - this._webviewFocusTracker.dispose(); - this._webviewFocusTracker = undefined; - } - - if (this._webviewFocusListenerDisposable) { - this._webviewFocusListenerDisposable.dispose(); - this._webviewFocusListenerDisposable = undefined; - } + this._webviewFocusTrackerDisposables = dispose(this._webviewFocusTrackerDisposables); if (this._onFocusWindowHandler) { this._onFocusWindowHandler.dispose(); @@ -127,10 +117,6 @@ export class WebviewEditor extends BaseWebviewEditor { } } - public get onDidFocus(): Event { - return this._onDidFocusWebview.event; - } - protected setEditorVisible(visible: boolean, group: IEditorGroup): void { if (this.input && this.input instanceof WebviewEditorInput) { if (visible) { @@ -225,53 +211,49 @@ export class WebviewEditor extends BaseWebviewEditor { this._webviewContent = input.container; + if (input.webview) { + this._webview = input.webview; + } else { + if (input.options.enableFindWidget) { + this._contextKeyService = this._register(this._contextKeyService.createScoped(this._webviewContent)); + this.findWidgetVisible = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE.bindTo(this._contextKeyService); + } + + this._webview = this._instantiationService.createInstance(WebviewElement, + this._partService.getContainer(Parts.EDITOR_PART), + { + enableWrappedPostMessage: true, + useSameOriginForRoot: false, + extensionLocation: input.extensionLocation + }); + this._webview.mountTo(this._webviewContent); + input.webview = this._webview; + + if (input.options.tryRestoreScrollPosition) { + this._webview.initialScrollProgress = input.scrollYPercentage; + } + + this._webview.state = input.webviewState; + + this._content.setAttribute('aria-flowto', this._webviewContent.id); + + this.doUpdateContainer(); + } + this.trackFocus(); - const existing = input.webview; - if (existing) { - this._webview = existing; - return existing; - } - - if (input.options.enableFindWidget) { - this._contextKeyService = this._register(this._contextKeyService.createScoped(this._webviewContent)); - this.findWidgetVisible = KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE.bindTo(this._contextKeyService); - } - - this._webview = this._instantiationService.createInstance(WebviewElement, - this._partService.getContainer(Parts.EDITOR_PART), - { - enableWrappedPostMessage: true, - useSameOriginForRoot: false, - extensionLocation: input.extensionLocation - }); - this._webview.mountTo(this._webviewContent); - input.webview = this._webview; - - if (input.options.tryRestoreScrollPosition) { - this._webview.initialScrollProgress = input.scrollYPercentage; - } - - this._webview.state = input.webviewState; - - this._content.setAttribute('aria-flowto', this._webviewContent.id); - - this.doUpdateContainer(); return this._webview; } private trackFocus() { - if (this._webviewFocusTracker) { - this._webviewFocusTracker.dispose(); - } - if (this._webviewFocusListenerDisposable) { - this._webviewFocusListenerDisposable.dispose(); - } + this._webviewFocusTrackerDisposables = dispose(this._webviewFocusTrackerDisposables); - this._webviewFocusTracker = DOM.trackFocus(this._webviewContent); - this._webviewFocusListenerDisposable = this._webviewFocusTracker.onDidFocus(() => { - this._onDidFocusWebview.fire(); - }); + // Track focus in webview content + const webviewContentFocusTracker = DOM.trackFocus(this._webviewContent); + this._webviewFocusTrackerDisposables.push(webviewContentFocusTracker); + this._webviewFocusTrackerDisposables.push(webviewContentFocusTracker.onDidFocus(() => this._onDidFocusWebview.fire())); + + // Track focus in webview element + this._webviewFocusTrackerDisposables.push(this._webview.onDidFocus(() => this._onDidFocusWebview.fire())); } } - diff --git a/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts b/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts index f2201182ac8..43416a7ebfe 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { addClass, addDisposableListener } from 'vs/base/browser/dom'; -import { Emitter } from 'vs/base/common/event'; +import { Emitter, Event } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; @@ -15,6 +15,8 @@ import { DARK, ITheme, IThemeService, LIGHT } from 'vs/platform/theme/common/the import { registerFileProtocol, WebviewProtocol } from 'vs/workbench/parts/webview/electron-browser/webviewProtocols'; import { areWebviewInputOptionsEqual } from './webviewEditorService'; import { WebviewFindWidget } from './webviewFindWidget'; +import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; +import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; export interface WebviewOptions { readonly allowScripts?: boolean; @@ -26,6 +28,17 @@ export interface WebviewOptions { readonly extensionLocation?: URI; } +interface IKeydownEvent { + key: string; + keyCode: number; + code: string; + shiftKey: boolean; + altKey: boolean; + ctrlKey: boolean; + metaKey: boolean; + repeat: boolean; +} + export class WebviewElement extends Disposable { private _webview: Electron.WebviewTag; private _ready: Promise; @@ -35,6 +48,9 @@ export class WebviewElement extends Disposable { private _contents: string = ''; private _state: string | undefined = undefined; + private readonly _onDidFocus = this._register(new Emitter()); + public get onDidFocus(): Event { return this._onDidFocus.event; } + constructor( private readonly _styleElement: Element, private _options: WebviewOptions, @@ -42,12 +58,12 @@ export class WebviewElement extends Disposable { @IThemeService private readonly _themeService: IThemeService, @IEnvironmentService private readonly _environmentService: IEnvironmentService, @IFileService private readonly _fileService: IFileService, + @IKeybindingService private readonly _keybindingService: IKeybindingService ) { super(); this._webview = document.createElement('webview'); this._webview.setAttribute('partition', this._options.allowSvgs ? 'webview' : `webview${Date.now()}`); - this._webview.setAttribute('disableguestresize', ''); this._webview.setAttribute('webpreferences', 'contextIsolation=yes'); this._webview.style.flex = '0 1'; @@ -164,6 +180,21 @@ export class WebviewElement extends Disposable { this._state = event.args[0]; this._onDidUpdateState.fire(this._state); return; + + case 'did-focus': + this.handleFocusChange(true); + return; + + case 'did-blur': + this.handleFocusChange(false); + return; + + case 'did-keydown': + // Electron: workaround for https://github.com/electron/electron/issues/14258 + // We have to detect keyboard events in the and dispatch them to our + // keybinding service because these events do not bubble to the parent window anymore. + this.handleKeydown(event.args[0]); + return; } })); this._register(addDisposableListener(this._webview, 'devtools-opened', () => { @@ -183,8 +214,6 @@ export class WebviewElement extends Disposable { dispose(): void { if (this._webview) { - this._webview.guestinstance = 'none'; - if (this._webview.parentElement) { this._webview.parentElement.removeChild(this._webview); } @@ -263,6 +292,35 @@ export class WebviewElement extends Disposable { public focus(): void { this._webview.focus(); this._send('focus'); + + // Handle focus change programmatically (do not rely on event from ) + this.handleFocusChange(true); + } + + private handleFocusChange(isFocused: boolean): void { + if (isFocused) { + this._onDidFocus.fire(); + } + } + + private handleKeydown(event: IKeydownEvent): void { + + // Create a fake KeyboardEvent from the data provided + const emulatedKeyboardEvent = new KeyboardEvent('keydown', { + code: event.code, + key: event.key, + keyCode: event.keyCode, + shiftKey: event.shiftKey, + altKey: event.altKey, + ctrlKey: event.ctrlKey, + metaKey: event.metaKey, + repeat: event.repeat + } as KeyboardEvent); + + // Dispatch through our keybinding service + // Note: we set the as target of the event so that scoped context key + // services function properly to enable commands like select all and find. + this._keybindingService.dispatchEvent(new StandardKeyboardEvent(emulatedKeyboardEvent), this._webview); } public sendMessage(data: any): void { @@ -325,18 +383,6 @@ export class WebviewElement extends Disposable { } contents.setZoomFactor(factor); - if (!this._webview || !this._webview.parentElement) { - return; - } - - const width = this._webview.parentElement.clientWidth; - const height = this._webview.parentElement.clientHeight; - contents.setSize({ - normal: { - width: Math.floor(width * factor), - height: Math.floor(height * factor) - } - }); }); } diff --git a/test/smoke/package.json b/test/smoke/package.json index 044201ce0bd..20b8ed11bbb 100644 --- a/test/smoke/package.json +++ b/test/smoke/package.json @@ -22,7 +22,7 @@ "@types/webdriverio": "4.6.1", "concurrently": "^3.5.1", "cpx": "^1.5.0", - "electron": "^2.0.12", + "electron": "3.0.10", "htmlparser2": "^3.9.2", "mkdirp": "^0.5.1", "mocha": "^5.2.0", diff --git a/test/smoke/yarn.lock b/test/smoke/yarn.lock index 6fd6af733be..ba9193d0b91 100644 --- a/test/smoke/yarn.lock +++ b/test/smoke/yarn.lock @@ -494,11 +494,23 @@ debug@3.1.0, debug@^3.1.0: dependencies: ms "2.0.0" +debug@^3.0.0: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + deep-extend@~0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" @@ -569,28 +581,28 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" -electron-download@^3.0.1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/electron-download/-/electron-download-3.3.0.tgz#2cfd54d6966c019c4d49ad65fbe65cc9cdef68c8" - integrity sha1-LP1U1pZsAZxNSa1l++Zcyc3vaMg= +electron-download@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/electron-download/-/electron-download-4.1.1.tgz#02e69556705cc456e520f9e035556ed5a015ebe8" + integrity sha512-FjEWG9Jb/ppK/2zToP+U5dds114fM1ZOJqMAR4aXXL5CvyPE9fiqBK/9YcwC9poIFQTEJk/EM/zyRwziziRZrg== dependencies: - debug "^2.2.0" - fs-extra "^0.30.0" - home-path "^1.0.1" + debug "^3.0.0" + env-paths "^1.0.0" + fs-extra "^4.0.1" minimist "^1.2.0" - nugget "^2.0.0" - path-exists "^2.1.0" - rc "^1.1.2" - semver "^5.3.0" - sumchecker "^1.2.0" + nugget "^2.0.1" + path-exists "^3.0.0" + rc "^1.2.1" + semver "^5.4.1" + sumchecker "^2.0.2" -electron@^2.0.12: - version "2.0.12" - resolved "https://registry.yarnpkg.com/electron/-/electron-2.0.12.tgz#04b11ef3246cd2a5839a8f16314051341dc5c449" - integrity sha512-mw8hoM/GPtFPP8FGiJcVNe8Rx63YJ7O8bf7McQj21HAvrXGAwReGFrpIe5xN6ec10fDXNSNyfzRucjFXtOtLcg== +electron@3.0.10: + version "3.0.10" + resolved "https://registry.yarnpkg.com/electron/-/electron-3.0.10.tgz#7d412856e8cf0d3041a612a32dd09e2af2d50f50" + integrity sha512-I39IeQP3NOlbjKzTDK8uK2JdiHDfhV5SruCS2Gttkn2MaKCY+yIzQ6Wr4DyBXLeTEkL1sbZxbqQVhCavAliv5w== dependencies: "@types/node" "^8.0.24" - electron-download "^3.0.1" + electron-download "^4.1.0" extract-zip "^1.0.3" entities@^1.1.1, entities@~1.1.1: @@ -598,6 +610,11 @@ entities@^1.1.1, entities@~1.1.1: resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" integrity sha1-blwtClYhtdra7O+AuQ7ftc13cvA= +env-paths@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0" + integrity sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA= + error-ex@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" @@ -605,11 +622,6 @@ error-ex@^1.2.0: dependencies: is-arrayish "^0.2.1" -es6-promise@^4.0.5: - version "4.1.1" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.1.1.tgz#8811e90915d9a0dba36274f0b242dbda78f9c92a" - integrity sha512-OaU1hHjgJf+b0NzsxCg7NdIYERD6Hy/PEmFLTjw+b65scuisG3Kt4QoTvJ66BBkPZ581gr0kpoVzKnxniM8nng== - escape-string-regexp@1.0.5, escape-string-regexp@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -744,16 +756,14 @@ form-data@~2.3.1: combined-stream "^1.0.5" mime-types "^2.1.12" -fs-extra@^0.30.0: - version "0.30.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.30.0.tgz#f233ffcc08d4da7d432daa449776989db1df93f0" - integrity sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A= +fs-extra@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" + integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg== dependencies: graceful-fs "^4.1.2" - jsonfile "^2.1.0" - klaw "^1.0.0" - path-is-absolute "^1.0.0" - rimraf "^2.2.8" + jsonfile "^4.0.0" + universalify "^0.1.0" fs.realpath@^1.0.0: version "1.0.0" @@ -847,7 +857,7 @@ glob@7.1.2, glob@^7.0.5: once "^1.3.0" path-is-absolute "^1.0.0" -graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: +graceful-fs@^4.1.2, graceful-fs@^4.1.6: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" integrity sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg= @@ -940,11 +950,6 @@ hoek@4.x.x: resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" integrity sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ== -home-path@^1.0.1: - version "1.0.5" - resolved "https://registry.yarnpkg.com/home-path/-/home-path-1.0.5.tgz#788b29815b12d53bacf575648476e6f9041d133f" - integrity sha1-eIspgVsS1Tus9XVkhHbm+QQdEz8= - hosted-git-info@^2.1.4: version "2.5.0" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" @@ -1155,10 +1160,10 @@ json-stringify-safe@~5.0.1: resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= -jsonfile@^2.1.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" - integrity sha1-NzaitCi4e72gzIO1P6PWM6NcKug= +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= optionalDependencies: graceful-fs "^4.1.6" @@ -1191,13 +1196,6 @@ kind-of@^4.0.0: dependencies: is-buffer "^1.1.5" -klaw@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" - integrity sha1-QIhDO0azsbolnXh4XY6W9zugJDk= - optionalDependencies: - graceful-fs "^4.1.9" - load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -1377,6 +1375,11 @@ ms@2.0.0: resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= +ms@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== + nan@^2.3.0: version "2.10.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" @@ -1439,7 +1442,7 @@ npmlog@^4.0.2: gauge "~2.7.3" set-blocking "~2.0.0" -nugget@^2.0.0: +nugget@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/nugget/-/nugget-2.0.1.tgz#201095a487e1ad36081b3432fa3cada4f8d071b0" integrity sha1-IBCVpIfhrTYIGzQy+jytpPjQcbA= @@ -1522,13 +1525,18 @@ parse-json@^2.2.0: dependencies: error-ex "^1.2.0" -path-exists@^2.0.0, path-exists@^2.1.0: +path-exists@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" integrity sha1-D+tsZPD8UY2adU3V77YscCJ2H0s= dependencies: pinkie-promise "^2.0.0" +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -1643,16 +1651,6 @@ randomatic@^1.1.3: is-number "^3.0.0" kind-of "^4.0.0" -rc@^1.1.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.2.tgz#d8ce9cb57e8d64d9c7badd9876c7c34cbe3c7077" - integrity sha1-2M6ctX6NZNnHut2YdsfDTL48cHc= - dependencies: - deep-extend "~0.4.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - rc@^1.1.7: version "1.2.6" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.6.tgz#eb18989c6d4f4f162c399f79ddd29f3835568092" @@ -1663,6 +1661,16 @@ rc@^1.1.7: minimist "^1.2.0" strip-json-comments "~2.0.1" +rc@^1.2.1: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" @@ -1831,7 +1839,7 @@ resolve@^1.1.7: dependencies: path-parse "^1.0.5" -rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1: +rimraf@2, rimraf@^2.5.1, rimraf@^2.6.1: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" integrity sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w== @@ -1853,6 +1861,11 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" integrity sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg== +semver@^5.4.1: + version "5.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" + integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== + set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -2021,13 +2034,12 @@ subarg@^1.0.0: dependencies: minimist "^1.1.0" -sumchecker@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-1.3.1.tgz#79bb3b4456dd04f18ebdbc0d703a1d1daec5105d" - integrity sha1-ebs7RFbdBPGOvbwNcDodHa7FEF0= +sumchecker@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-2.0.2.tgz#0f42c10e5d05da5d42eea3e56c3399a37d6c5b3e" + integrity sha1-D0LBDl0F2l1C7qPlbDOZo31sWz4= dependencies: debug "^2.2.0" - es6-promise "^4.0.5" supports-color@5.4.0: version "5.4.0" @@ -2142,6 +2154,11 @@ uid-number@^0.0.6: resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" integrity sha1-DqEOgDXo61uOREnwbaHHMGY7qoE= +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" diff --git a/yarn.lock b/yarn.lock index 231e608ea25..fcfa4e53a1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -34,10 +34,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-4.2.22.tgz#cf488a0f6b4a9c245d09927f4f757ca278b9c8ce" integrity sha512-LXRap3bb4AjtLZ5NOFc4ssVZrQPTgdPcNm++0SEJuJZaOA+xHkojJNYqy33A5q/94BmG5tA6yaMeD4VdCv5aSA== -"@types/node@^8.9.1": - version "8.10.34" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.34.tgz#a94d9f3767fe45f211e09e49af598bb84822280c" - integrity sha512-alypNiaAEd0RBGXoWehJ2gchPYCITmw4CYBoB5nDlji8l8on7FsklfdfIs4DDmgpKLSX3OF3ha6SV+0W7cTzUA== +"@types/node@^10.12.12": + version "10.12.12" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.12.tgz#e15a9d034d9210f00320ef718a50c4a799417c47" + integrity sha512-Pr+6JRiKkfsFvmU/LK68oBRCQeEg36TyAbPhc2xpez24OOZZCuoIhWGTd39VZy6nGafSbxzGouFPTFD/rR1A0A== "@types/semver@^5.4.0", "@types/semver@^5.5.0": version "5.5.0"