From 438ac61ff782a30d98a090ef90a38a3445c34fd5 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 09:04:39 -0700 Subject: [PATCH 01/19] remove clipboard deprecations --- docs/tutorial/planned-breaking-changes.md | 33 ----------------------- lib/common/api/clipboard.js | 33 ----------------------- 2 files changed, 66 deletions(-) diff --git a/docs/tutorial/planned-breaking-changes.md b/docs/tutorial/planned-breaking-changes.md index 08fa88491af..ffe4c8d3003 100644 --- a/docs/tutorial/planned-breaking-changes.md +++ b/docs/tutorial/planned-breaking-changes.md @@ -5,15 +5,6 @@ The following list includes the APIs that will be removed in Electron 3.0. There is no timetable for when this release will occur but deprecation warnings will be added at least [one major version](electron-versioning.md#semver) beforehand. -## `app` - -```js -// Deprecated -app.getAppMemoryInfo() -// Replace with -app.getAppMetrics() -``` - ## `BrowserWindow` ```js @@ -38,30 +29,6 @@ window.on('app-command', (e, cmd) => { }) ``` -## `clipboard` - -```js -// Deprecated -clipboard.readRtf() -// Replace with -clipboard.readRTF() - -// Deprecated -clipboard.writeRtf() -// Replace with -clipboard.writeRTF() - -// Deprecated -clipboard.readHtml() -// Replace with -clipboard.readHTML() - -// Deprecated -clipboard.writeHtml() -// Replace with -clipboard.writeHTML() -``` - ## `crashReporter` ```js diff --git a/lib/common/api/clipboard.js b/lib/common/api/clipboard.js index d5efbdb06ae..b52524d7599 100644 --- a/lib/common/api/clipboard.js +++ b/lib/common/api/clipboard.js @@ -2,41 +2,8 @@ if (process.platform === 'linux' && process.type === 'renderer') { // On Linux we could not access clipboard in renderer process. module.exports = require('electron').remote.clipboard } else { - const {deprecate} = require('electron') const clipboard = process.atomBinding('clipboard') - // TODO(codebytere): remove in 3.0 - clipboard.readHtml = function () { - if (!process.noDeprecations) { - deprecate.warn('clipboard.readHtml', 'clipboard.readHTML') - } - return clipboard.readHTML() - } - - // TODO(codebytere): remove in 3.0 - clipboard.writeHtml = function () { - if (!process.noDeprecations) { - deprecate.warn('clipboard.writeHtml', 'clipboard.writeHTML') - } - return clipboard.writeHTML() - } - - // TODO(codebytere): remove in 3.0 - clipboard.readRtf = function () { - if (!process.noDeprecations) { - deprecate.warn('clipboard.readRtf', 'clipboard.writeRTF') - } - return clipboard.readRTF() - } - - // TODO(codebytere): remove in 3.0 - clipboard.writeRtf = function () { - if (!process.noDeprecations) { - deprecate.warn('clipboard.writeRtf', 'clipboard.writeRTF') - } - return clipboard.writeRTF() - } - // Read/write to find pasteboard over IPC since only main process is notified // of changes if (process.platform === 'darwin' && process.type === 'renderer') { From cc30f4c4fd4c572d90067cc28055d6ad58532aa7 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 09:07:14 -0700 Subject: [PATCH 02/19] remove crashReporter deprecation --- docs/tutorial/planned-breaking-changes.md | 17 ----------------- lib/common/api/crash-reporter.js | 9 ++------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/docs/tutorial/planned-breaking-changes.md b/docs/tutorial/planned-breaking-changes.md index ffe4c8d3003..ac13bf0841e 100644 --- a/docs/tutorial/planned-breaking-changes.md +++ b/docs/tutorial/planned-breaking-changes.md @@ -29,23 +29,6 @@ window.on('app-command', (e, cmd) => { }) ``` -## `crashReporter` - -```js -// Deprecated -crashReporter.start({ - companyName: 'Crashly', - submitURL: 'https://crash.server.com', - autoSubmit: true -}) -// Replace with -crashReporter.start({ - companyName: 'Crashly', - submitURL: 'https://crash.server.com', - uploadToServer: true -}) -``` - ## `nativeImage` ```js diff --git a/lib/common/api/crash-reporter.js b/lib/common/api/crash-reporter.js index 1b20fa52aab..1090d425e4c 100644 --- a/lib/common/api/crash-reporter.js +++ b/lib/common/api/crash-reporter.js @@ -4,7 +4,7 @@ const {spawn} = require('child_process') const os = require('os') const path = require('path') const electron = require('electron') -const {app, deprecate} = process.type === 'browser' ? electron : electron.remote +const {app} = process.type === 'browser' ? electron : electron.remote const binding = process.atomBinding('crash_reporter') class CrashReporter { @@ -21,12 +21,7 @@ class CrashReporter { } = options if (uploadToServer == null) { - if (options.autoSubmit) { - deprecate.warn('autoSubmit', 'uploadToServer') - uploadToServer = options.autoSubmit - } else { - uploadToServer = true - } + uploadToServer = true } if (ignoreSystemCrashHandler == null) ignoreSystemCrashHandler = false From 72c63a10ee7707d8dc342db921c0228f1a39ea76 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 09:11:48 -0700 Subject: [PATCH 03/19] remove screen.getMenuBarHeight() deprecation --- atom/browser/api/atom_api_screen.cc | 3 --- atom/browser/api/atom_api_screen.h | 4 ---- atom/browser/api/atom_api_screen_mac.mm | 19 ------------------- docs/api/screen.md | 4 ---- docs/tutorial/planned-breaking-changes.md | 9 --------- lib/browser/api/screen.js | 9 --------- 6 files changed, 48 deletions(-) delete mode 100644 atom/browser/api/atom_api_screen_mac.mm diff --git a/atom/browser/api/atom_api_screen.cc b/atom/browser/api/atom_api_screen.cc index b382d32579a..65a11eed0cc 100644 --- a/atom/browser/api/atom_api_screen.cc +++ b/atom/browser/api/atom_api_screen.cc @@ -145,9 +145,6 @@ void Screen::BuildPrototype(v8::Isolate* isolate, .SetMethod("dipToScreenPoint", &display::win::ScreenWin::DIPToScreenPoint) .SetMethod("screenToDipRect", &ScreenToDIPRect) .SetMethod("dipToScreenRect", &DIPToScreenRect) -#endif -#if defined(OS_MACOSX) - .SetMethod("getMenuBarHeight", &Screen::getMenuBarHeight) #endif .SetMethod("getDisplayMatching", &Screen::GetDisplayMatching); } diff --git a/atom/browser/api/atom_api_screen.h b/atom/browser/api/atom_api_screen.h index 105c924e271..33c322abf4d 100644 --- a/atom/browser/api/atom_api_screen.h +++ b/atom/browser/api/atom_api_screen.h @@ -40,10 +40,6 @@ class Screen : public mate::EventEmitter, display::Display GetDisplayNearestPoint(const gfx::Point& point); display::Display GetDisplayMatching(const gfx::Rect& match_rect); -#if defined(OS_MACOSX) - int getMenuBarHeight(); -#endif - // display::DisplayObserver: void OnDisplayAdded(const display::Display& new_display) override; void OnDisplayRemoved(const display::Display& old_display) override; diff --git a/atom/browser/api/atom_api_screen_mac.mm b/atom/browser/api/atom_api_screen_mac.mm deleted file mode 100644 index 4b213b9abd3..00000000000 --- a/atom/browser/api/atom_api_screen_mac.mm +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2017 GitHub, Inc. -// Use of this source code is governed by the MIT license that can be -// found in the LICENSE file. - -#import -#import "atom/browser/api/atom_api_screen.h" - -namespace atom { - -namespace api { - -// TODO(codebytere): deprecated; remove in 3.0 -int Screen::getMenuBarHeight() { - return [[NSApp mainMenu] menuBarHeight]; -} - -} // namespace api - -} // namespace atom diff --git a/docs/api/screen.md b/docs/api/screen.md index c162ba8ca41..cf96c456ff8 100644 --- a/docs/api/screen.md +++ b/docs/api/screen.md @@ -95,10 +95,6 @@ Returns [`Point`](structures/point.md) The current absolute position of the mouse pointer. -### `screen.getMenuBarHeight()` _macOS_ - -Returns `Integer` - The height of the menu bar in pixels. - ### `screen.getPrimaryDisplay()` Returns [`Display`](structures/display.md) - The primary display. diff --git a/docs/tutorial/planned-breaking-changes.md b/docs/tutorial/planned-breaking-changes.md index ac13bf0841e..90f6b6045f3 100644 --- a/docs/tutorial/planned-breaking-changes.md +++ b/docs/tutorial/planned-breaking-changes.md @@ -40,15 +40,6 @@ nativeImage.createFromBuffer(buffer, { }) ``` -## `screen` - -```js -// Deprecated -screen.getMenuBarHeight() -// Replace with -screen.getPrimaryDisplay().workArea -``` - ## `session` ```js diff --git a/lib/browser/api/screen.js b/lib/browser/api/screen.js index bbbc1bbe172..8287bfa8bfd 100644 --- a/lib/browser/api/screen.js +++ b/lib/browser/api/screen.js @@ -1,17 +1,8 @@ const {EventEmitter} = require('events') -const {deprecate} = require('electron') const {screen, Screen} = process.atomBinding('screen') // Screen is an EventEmitter. Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype) EventEmitter.call(screen) -const nativeFn = screen.getMenuBarHeight -screen.getMenuBarHeight = function () { - if (!process.noDeprecations) { - deprecate.warn('screen.getMenuBarHeight', 'screen.getPrimaryDisplay().workArea') - } - return nativeFn.call(this) -} - module.exports = screen From 003a5a01608d07284e5041c23f9974c5e0ff5257 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 09:20:39 -0700 Subject: [PATCH 04/19] remove tray.setHighlightMode() deprecation --- atom/browser/api/atom_api_tray.cc | 10 ---------- docs/tutorial/planned-breaking-changes.md | 14 -------------- lib/browser/api/tray.js | 14 -------------- 3 files changed, 38 deletions(-) diff --git a/atom/browser/api/atom_api_tray.cc b/atom/browser/api/atom_api_tray.cc index 20416b012c3..552563bacfc 100644 --- a/atom/browser/api/atom_api_tray.cc +++ b/atom/browser/api/atom_api_tray.cc @@ -40,16 +40,6 @@ struct Converter { return true; } } - - bool highlight; - if (ConvertFromV8(isolate, val, &highlight)) { - if (highlight) - *out = atom::TrayIcon::HighlightMode::SELECTION; - else - *out = atom::TrayIcon::HighlightMode::NEVER; - return true; - } - return false; } }; diff --git a/docs/tutorial/planned-breaking-changes.md b/docs/tutorial/planned-breaking-changes.md index 90f6b6045f3..2785527f02a 100644 --- a/docs/tutorial/planned-breaking-changes.md +++ b/docs/tutorial/planned-breaking-changes.md @@ -53,20 +53,6 @@ ses.setCertificateVerifyProc(function (request, callback) { }) ``` -## `Tray` - -```js -// Deprecated -tray.setHighlightMode(true) -// Replace with -tray.setHighlightMode('on') - -// Deprecated -tray.setHighlightMode(false) -// Replace with -tray.setHighlightMode('off') -``` - ## `webContents` ```js diff --git a/lib/browser/api/tray.js b/lib/browser/api/tray.js index 8f2ee5acd0a..bc0a9d26f65 100644 --- a/lib/browser/api/tray.js +++ b/lib/browser/api/tray.js @@ -1,20 +1,6 @@ const {EventEmitter} = require('events') -const {deprecate} = require('electron') const {Tray} = process.atomBinding('tray') Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype) -// TODO(codebytere): remove in 3.0 -const nativeSetHighlightMode = Tray.prototype.setHighlightMode -Tray.prototype.setHighlightMode = function (param) { - if (!process.noDeprecations && typeof param === 'boolean') { - if (param) { - deprecate.warn('tray.setHighlightMode(true)', `tray.setHighlightMode("on")`) - } else { - deprecate.warn('tray.setHighlightMode(false)', `tray.setHighlightMode("off")`) - } - } - return nativeSetHighlightMode.call(this, param) -} - module.exports = Tray From 3deffa859d5dde1e4555981774f31eb841b15001 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 09:24:32 -0700 Subject: [PATCH 05/19] remove appcommand media-play_pause option deprecation --- atom/browser/native_window_views_win.cc | 4 ---- docs/tutorial/planned-breaking-changes.md | 13 ------------- 2 files changed, 17 deletions(-) diff --git a/atom/browser/native_window_views_win.cc b/atom/browser/native_window_views_win.cc index 430f30904a9..c9802b2e0a8 100644 --- a/atom/browser/native_window_views_win.cc +++ b/atom/browser/native_window_views_win.cc @@ -143,10 +143,6 @@ bool NativeWindowViews::ExecuteWindowsCommand(int command_id) { std::string command = AppCommandToString(command_id); NotifyWindowExecuteWindowsCommand(command); - if (command_id == APPCOMMAND_MEDIA_PLAY_PAUSE) - // FIXME(htk3): Remove media-play_pause in 3.0 - NotifyWindowExecuteWindowsCommand("media-play_pause"); - return false; } diff --git a/docs/tutorial/planned-breaking-changes.md b/docs/tutorial/planned-breaking-changes.md index 2785527f02a..dc03ed6a2bf 100644 --- a/docs/tutorial/planned-breaking-changes.md +++ b/docs/tutorial/planned-breaking-changes.md @@ -14,19 +14,6 @@ let windowA = new BrowserWindow(optionsA) // Replace with let optionsB = {webPreferences: {enableBlinkFeatures: ''}} let windowB = new BrowserWindow(optionsB) - -// Deprecated -window.on('app-command', (e, cmd) => { - if (cmd === 'media-play_pause') { - // do something - } -}) -// Replace with -window.on('app-command', (e, cmd) => { - if (cmd === 'media-play-pause') { - // do something - } -}) ``` ## `nativeImage` From 4a90056462635ac45a87dd30a92717ee9f8d0781 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 09:30:15 -0700 Subject: [PATCH 06/19] remove webContents.openDevTools() deprecation --- atom/browser/api/atom_api_web_contents.cc | 5 ----- docs/tutorial/planned-breaking-changes.md | 9 --------- lib/browser/api/web-contents.js | 8 -------- 3 files changed, 22 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 7a578e153cb..682bd3f9895 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1300,11 +1300,6 @@ void WebContents::OpenDevTools(mate::Arguments* args) { mate::Dictionary options; if (args->GetNext(&options)) { options.Get("mode", &state); - - // TODO(kevinsawicki) Remove in 2.0 - options.Get("detach", &detach); - if (state.empty() && detach) - state = "detach"; } } managed_web_contents()->SetDockState(state); diff --git a/docs/tutorial/planned-breaking-changes.md b/docs/tutorial/planned-breaking-changes.md index dc03ed6a2bf..6cbba789eee 100644 --- a/docs/tutorial/planned-breaking-changes.md +++ b/docs/tutorial/planned-breaking-changes.md @@ -40,15 +40,6 @@ ses.setCertificateVerifyProc(function (request, callback) { }) ``` -## `webContents` - -```js -// Deprecated -webContents.openDevTools({detach: true}) -// Replace with -webContents.openDevTools({mode: 'detach'}) -``` - ## `webFrame` ```js diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index 96e0e16442c..ccfc26d7c01 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -165,14 +165,6 @@ for (const method of webFrameMethodsWithResult) { } } -const nativeOpenDevTools = WebContents.prototype.openDevTools -WebContents.prototype.openDevTools = function (params) { - if (!process.noDeprecations && params && 'detach' in params) { - deprecate.warn('webContents.openDevTools({detach: true})', `webContents.openDevTools({mode: 'detach'})`) - } - return nativeOpenDevTools.call(this, params) -} - // Make sure WebContents::executeJavaScript would run the code only when the // WebContents has been loaded. WebContents.prototype.executeJavaScript = function (code, hasUserGesture, callback) { From 94e825378c4b730ed57906ccc01a971e1f201220 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 09:33:57 -0700 Subject: [PATCH 07/19] remove webFrame.registerURLSchemeAsSecure() deprecation --- atom/renderer/api/atom_api_web_frame.cc | 18 +++--------------- atom/renderer/api/atom_api_web_frame.h | 1 - docs/api/web-frame.md | 10 ---------- docs/tutorial/planned-breaking-changes.md | 5 ----- 4 files changed, 3 insertions(+), 31 deletions(-) diff --git a/atom/renderer/api/atom_api_web_frame.cc b/atom/renderer/api/atom_api_web_frame.cc index c4b23d9164e..179edd448c2 100644 --- a/atom/renderer/api/atom_api_web_frame.cc +++ b/atom/renderer/api/atom_api_web_frame.cc @@ -206,12 +206,6 @@ void WebFrame::SetSpellCheckProvider(mate::Arguments* args, web_frame_->SetSpellCheckPanelHostClient(spell_check_client_.get()); } -void WebFrame::RegisterURLSchemeAsSecure(const std::string& scheme) { - // TODO(pfrazee): Remove 2.0 - blink::SchemeRegistry::RegisterURLSchemeAsSecure( - WTF::String::FromUTF8(scheme.data(), scheme.length())); -} - void WebFrame::RegisterURLSchemeAsBypassingCSP(const std::string& scheme) { // Register scheme to bypass pages's Content Security Policy. blink::SchemeRegistry::RegisterURLSchemeAsBypassingContentSecurityPolicy( @@ -243,10 +237,6 @@ void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme, // Register scheme to privileged list (https, wss, data, chrome-extension) WTF::String privileged_scheme( WTF::String::FromUTF8(scheme.data(), scheme.length())); - if (secure) { - // TODO(pfrazee): Remove 2.0 - blink::SchemeRegistry::RegisterURLSchemeAsSecure(privileged_scheme); - } if (bypassCSP) { blink::SchemeRegistry::RegisterURLSchemeAsBypassingContentSecurityPolicy( privileged_scheme); @@ -442,13 +432,13 @@ v8::Local WebFrame::FindFrameByName(const std::string& name) const { v8::Local WebFrame::FindFrameByRoutingId(int routing_id) const { content::RenderFrame* render_frame = - content::RenderFrame::FromRoutingID(routing_id); + content::RenderFrame::FromRoutingID(routing_id); blink::WebLocalFrame* local_frame = nullptr; if (render_frame) local_frame = render_frame->GetWebFrame(); if (local_frame) - return mate::CreateHandle(isolate(), - new WebFrame(isolate(), local_frame)).ToV8(); + return mate::CreateHandle(isolate(), new WebFrame(isolate(), local_frame)) + .ToV8(); else return v8::Null(isolate()); } @@ -479,8 +469,6 @@ void WebFrame::BuildPrototype(v8::Isolate* isolate, .SetMethod("attachGuest", &WebFrame::AttachGuest) .SetMethod("detachGuest", &WebFrame::DetachGuest) .SetMethod("setSpellCheckProvider", &WebFrame::SetSpellCheckProvider) - .SetMethod("registerURLSchemeAsSecure", - &WebFrame::RegisterURLSchemeAsSecure) .SetMethod("registerURLSchemeAsBypassingCSP", &WebFrame::RegisterURLSchemeAsBypassingCSP) .SetMethod("registerURLSchemeAsPrivileged", diff --git a/atom/renderer/api/atom_api_web_frame.h b/atom/renderer/api/atom_api_web_frame.h index 1e39c544d7b..3c28b19ff75 100644 --- a/atom/renderer/api/atom_api_web_frame.h +++ b/atom/renderer/api/atom_api_web_frame.h @@ -66,7 +66,6 @@ class WebFrame : public mate::Wrappable { bool auto_spell_correct_turned_on, v8::Local provider); - void RegisterURLSchemeAsSecure(const std::string& scheme); void RegisterURLSchemeAsBypassingCSP(const std::string& scheme); void RegisterURLSchemeAsPrivileged(const std::string& scheme, mate::Arguments* args); diff --git a/docs/api/web-frame.md b/docs/api/web-frame.md index 72fda772d93..c891bd5e567 100644 --- a/docs/api/web-frame.md +++ b/docs/api/web-frame.md @@ -81,16 +81,6 @@ webFrame.setSpellCheckProvider('en-US', true, { }) ``` -### `webFrame.registerURLSchemeAsSecure(scheme)` - -* `scheme` String - -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. - ### `webFrame.registerURLSchemeAsBypassingCSP(scheme)` * `scheme` String diff --git a/docs/tutorial/planned-breaking-changes.md b/docs/tutorial/planned-breaking-changes.md index 6cbba789eee..3af50e26469 100644 --- a/docs/tutorial/planned-breaking-changes.md +++ b/docs/tutorial/planned-breaking-changes.md @@ -43,11 +43,6 @@ ses.setCertificateVerifyProc(function (request, callback) { ## `webFrame` ```js -// Deprecated -webFrame.registerURLSchemeAsSecure('app') -// Replace with -protocol.registerStandardSchemes(['app'], {secure: true}) - // Deprecated webFrame.registerURLSchemeAsPrivileged('app', {secure: true}) // Replace with From 22fed0c79826191f2597ebb0f0d60d851598a271 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 09:43:58 -0700 Subject: [PATCH 08/19] remove nativeImage.createFromBuffer() deprecation --- atom/common/api/atom_api_native_image.cc | 3 --- docs/api/native-image.md | 2 +- docs/tutorial/planned-breaking-changes.md | 20 +++++++++++--------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index b52b438ae1a..980f2641e50 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -517,9 +517,6 @@ mate::Handle NativeImage::CreateFromBuffer( options.Get("width", &width); options.Get("height", &height); options.Get("scaleFactor", &scale_factor); - } else { - // TODO(kevinsawicki): Remove in 2.0, deprecate before then with warnings - args->GetNext(&scale_factor); } gfx::ImageSkia image_skia; diff --git a/docs/api/native-image.md b/docs/api/native-image.md index f1d9e5ce284..7f2aaecf8e1 100644 --- a/docs/api/native-image.md +++ b/docs/api/native-image.md @@ -137,7 +137,7 @@ let image = nativeImage.createFromPath('/Users/somebody/images/icon.png') console.log(image) ``` -### `nativeImage.createFromBuffer(buffer[, options])` +### `nativeImage.createFromBuffer(buffer, options)` * `buffer` [Buffer][buffer] * `options` Object (optional) diff --git a/docs/tutorial/planned-breaking-changes.md b/docs/tutorial/planned-breaking-changes.md index 3af50e26469..a0ec132a994 100644 --- a/docs/tutorial/planned-breaking-changes.md +++ b/docs/tutorial/planned-breaking-changes.md @@ -40,15 +40,6 @@ ses.setCertificateVerifyProc(function (request, callback) { }) ``` -## `webFrame` - -```js -// Deprecated -webFrame.registerURLSchemeAsPrivileged('app', {secure: true}) -// Replace with -protocol.registerStandardSchemes(['app'], {secure: true}) -``` - ## Node Headers URL This is the URL specified as `disturl` in a `.npmrc` file or as the `--dist-url` @@ -71,6 +62,17 @@ The following list includes the APIs that will be removed in Electron 4.0. There is no timetable for when this release will occur but deprecation warnings will be added at least [one major version](electron-versioning.md#semver) beforehand. +## `webFrame` + +```js +// Deprecated +webFrame.registerURLSchemeAsPrivileged('app', {secure: true}) +// Replace with +protocol.registerStandardSchemes(['app'], {secure: true}) +``` + +*Nota Bene:* Before we can remove this we need to update all of the relevant specs to `protocol.registerStandardSchemes(['app'], {secure: true})`. + ## `app.makeSingleInstance` ```js From fb4a8e9cb94f4071c256ca8629fc9333e4579185 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 09:47:14 -0700 Subject: [PATCH 09/19] remove ses.setCertificateVerifyProc() deprecation --- docs/tutorial/planned-breaking-changes.md | 38 +++++------------------ lib/browser/api/session.js | 13 +------- 2 files changed, 8 insertions(+), 43 deletions(-) diff --git a/docs/tutorial/planned-breaking-changes.md b/docs/tutorial/planned-breaking-changes.md index a0ec132a994..6b7c996b24c 100644 --- a/docs/tutorial/planned-breaking-changes.md +++ b/docs/tutorial/planned-breaking-changes.md @@ -16,30 +16,6 @@ let optionsB = {webPreferences: {enableBlinkFeatures: ''}} let windowB = new BrowserWindow(optionsB) ``` -## `nativeImage` - -```js -// Deprecated -nativeImage.createFromBuffer(buffer, 1.0) -// Replace with -nativeImage.createFromBuffer(buffer, { - scaleFactor: 1.0 -}) -``` - -## `session` - -```js -// Deprecated -ses.setCertificateVerifyProc(function (hostname, certificate, callback) { - callback(true) -}) -// Replace with -ses.setCertificateVerifyProc(function (request, callback) { - callback(0) -}) -``` - ## Node Headers URL This is the URL specified as `disturl` in a `.npmrc` file or as the `--dist-url` @@ -49,12 +25,6 @@ Deprecated: https://atom.io/download/atom-shell Replace with: https://atom.io/download/electron -## `FIXME` comments - -The `FIXME` string is used in code comments to denote things that should be -fixed for the 3.0 release. See -https://github.com/electron/electron/search?q=fixme - # Planned Breaking API Changes (4.0) The following list includes the APIs that will be removed in Electron 4.0. @@ -94,4 +64,10 @@ app.on('second-instance', function (argv, cwd) { app.releaseSingleInstance() // Replace with app.releaseSingleInstanceLock() -``` \ No newline at end of file +``` + +## `FIXME` comments + +The `FIXME` string is used in code comments to denote things that should be +fixed for the 3.0 release. See +https://github.com/electron/electron/search?q=fixme \ No newline at end of file diff --git a/lib/browser/api/session.js b/lib/browser/api/session.js index 6c103d25d62..33e40dd84d0 100644 --- a/lib/browser/api/session.js +++ b/lib/browser/api/session.js @@ -22,16 +22,5 @@ Session.prototype._init = function () { } Session.prototype.setCertificateVerifyProc = function (verifyProc) { - if (verifyProc != null && verifyProc.length > 2) { - // TODO(kevinsawicki): Remove in 2.0, deprecate before then with warnings - this._setCertificateVerifyProc(({hostname, certificate, verificationResult}, cb) => { - verifyProc(hostname, certificate, (result) => { - // Disabled due to false positive in StandardJS - // eslint-disable-next-line standard/no-callback-literal - cb(result ? 0 : -2) - }) - }) - } else { - this._setCertificateVerifyProc(verifyProc) - } + this._setCertificateVerifyProc(verifyProc) } From bc10be3de6b1a7f6d97e22b55636fb797829e267 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 13:51:28 -0700 Subject: [PATCH 10/19] rename exposed session method to setCertificateVerifyProc --- atom/browser/api/atom_api_session.cc | 2 +- lib/browser/api/session.js | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index 3668cc8663c..c80973f439a 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -821,7 +821,7 @@ void Session::BuildPrototype(v8::Isolate* isolate, .SetMethod("setDownloadPath", &Session::SetDownloadPath) .SetMethod("enableNetworkEmulation", &Session::EnableNetworkEmulation) .SetMethod("disableNetworkEmulation", &Session::DisableNetworkEmulation) - .SetMethod("_setCertificateVerifyProc", &Session::SetCertVerifyProc) + .SetMethod("setCertificateVerifyProc", &Session::SetCertVerifyProc) .SetMethod("setPermissionRequestHandler", &Session::SetPermissionRequestHandler) .SetMethod("clearHostResolverCache", &Session::ClearHostResolverCache) diff --git a/lib/browser/api/session.js b/lib/browser/api/session.js index 33e40dd84d0..ac47244db32 100644 --- a/lib/browser/api/session.js +++ b/lib/browser/api/session.js @@ -20,7 +20,3 @@ Object.setPrototypeOf(Cookies.prototype, EventEmitter.prototype) Session.prototype._init = function () { app.emit('session-created', this) } - -Session.prototype.setCertificateVerifyProc = function (verifyProc) { - this._setCertificateVerifyProc(verifyProc) -} From 5f5322c64e77bf6ba871cfdb0d747af0cf7039fc Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 14:01:34 -0700 Subject: [PATCH 11/19] rename blinkFeatures to enableBlinkFeatures --- atom/common/options_switches.cc | 3 +-- atom/common/options_switches.h | 2 +- docs/api/browser-window.md | 2 +- docs/api/webview-tag.md | 4 ++-- docs/tutorial/planned-breaking-changes.md | 27 ----------------------- docs/tutorial/security.md | 8 +++---- lib/browser/guest-view-manager.js | 2 +- lib/renderer/init.js | 4 ++-- lib/renderer/security-warnings.js | 14 ++++++------ 9 files changed, 19 insertions(+), 47 deletions(-) diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index 9d62dcfc9f7..a01cce5fd83 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -127,8 +127,7 @@ const char kOpenerID[] = "openerId"; const char kScrollBounce[] = "scrollBounce"; // Enable blink features. -// TODO(kevinsawicki) Rename to enableBlinkFeatures in 2.0 -const char kBlinkFeatures[] = "blinkFeatures"; +const char kBlinkFeatures[] = "enableBlinkFeatures"; // Disable blink features. const char kDisableBlinkFeatures[] = "disableBlinkFeatures"; diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index cdd55e457b8..968c2ebd540 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -64,7 +64,7 @@ extern const char kExperimentalFeatures[]; extern const char kExperimentalCanvasFeatures[]; extern const char kOpenerID[]; extern const char kScrollBounce[]; -extern const char kBlinkFeatures[]; +extern const char kEnableBlinkFeatures[]; extern const char kDisableBlinkFeatures[]; extern const char kNodeIntegrationInWorker[]; extern const char kWebviewTag[]; diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index a6dfe1d6587..2de0e12d9c3 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -309,7 +309,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. canvas features. Default is `false`. * `scrollBounce` Boolean (optional) - Enables scroll bounce (rubber banding) effect on macOS. Default is `false`. - * `blinkFeatures` String (optional) - A list of feature strings separated by `,`, like + * `enableBlinkFeatures` String (optional) - A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey` to enable. The full list of supported feature strings can be found in the [RuntimeEnabledFeatures.json5][runtime-enabled-features] file. diff --git a/docs/api/webview-tag.md b/docs/api/webview-tag.md index 1d991ff2e69..614b3f50330 100644 --- a/docs/api/webview-tag.md +++ b/docs/api/webview-tag.md @@ -214,10 +214,10 @@ A name by itself is given a `true` boolean value. A preference can be set to another value by including an `=`, followed by the value. Special values `yes` and `1` are interpreted as `true`, while `no` and `0` are interpreted as `false`. -### `blinkfeatures` +### `enableblinkfeatures` ```html - + ``` A list of strings which specifies the blink features to be enabled separated by `,`. diff --git a/docs/tutorial/planned-breaking-changes.md b/docs/tutorial/planned-breaking-changes.md index 6b7c996b24c..42eed660ce9 100644 --- a/docs/tutorial/planned-breaking-changes.md +++ b/docs/tutorial/planned-breaking-changes.md @@ -1,30 +1,3 @@ -# Planned Breaking API Changes (3.0) - -The following list includes the APIs that will be removed in Electron 3.0. - -There is no timetable for when this release will occur but deprecation -warnings will be added at least [one major version](electron-versioning.md#semver) beforehand. - -## `BrowserWindow` - -```js -// Deprecated -let optionsA = {webPreferences: {blinkFeatures: ''}} -let windowA = new BrowserWindow(optionsA) -// Replace with -let optionsB = {webPreferences: {enableBlinkFeatures: ''}} -let windowB = new BrowserWindow(optionsB) -``` - -## Node Headers URL - -This is the URL specified as `disturl` in a `.npmrc` file or as the `--dist-url` -command line flag when building native Node modules. - -Deprecated: https://atom.io/download/atom-shell - -Replace with: https://atom.io/download/electron - # Planned Breaking API Changes (4.0) The following list includes the APIs that will be removed in Electron 4.0. diff --git a/docs/tutorial/security.md b/docs/tutorial/security.md index 7d75e98c689..45154215174 100644 --- a/docs/tutorial/security.md +++ b/docs/tutorial/security.md @@ -78,7 +78,7 @@ improve the security of your application. 7. [Override and disable `eval`](#7-override-and-disable-eval), which allows strings to be executed as code. 8. [Do not set `allowRunningInsecureContent` to `true`](#8-do-not-set-allowrunninginsecurecontent-to-true) 9. [Do not enable experimental features](#9-do-not-enable-experimental-features) -10. [Do not use `blinkFeatures`](#10-do-not-use-blinkfeatures) +10. [Do not use `enableBlinkFeatures`](#10-do-not-use-enableblinkfeatures) 11. [WebViews: Do not use `allowpopups`](#11-do-not-use-allowpopups) 12. [WebViews: Verify the options and params of all `` tags](#12-verify-webview-options-before-creation) @@ -452,12 +452,12 @@ const mainWindow = new BrowserWindow({}) ``` -## 10) Do Not Use `blinkFeatures` +## 10) Do Not Use `enableBlinkFeatures` _Recommendation is Electron's default_ Blink is the name of the rendering engine behind Chromium. As with -`experimentalFeatures`, the `blinkFeatures` property allows developers to +`experimentalFeatures`, the `enableBlinkFeatures` property allows developers to enable features that have been disabled by default. ### Why? @@ -473,7 +473,7 @@ no circumstances should you enable features speculatively. // Bad const mainWindow = new BrowserWindow({ webPreferences: { - blinkFeatures: ['ExecCommandInJavaScript'] + enableBlinkFeatures: ['ExecCommandInJavaScript'] } }) ``` diff --git a/lib/browser/guest-view-manager.js b/lib/browser/guest-view-manager.js index e7f620a6e29..a9a99fe2ea7 100644 --- a/lib/browser/guest-view-manager.js +++ b/lib/browser/guest-view-manager.js @@ -217,7 +217,7 @@ const attachGuest = function (event, elementInstanceId, guestInstanceId, params) plugins: params.plugins, zoomFactor: embedder._getZoomFactor(), webSecurity: !params.disablewebsecurity, - blinkFeatures: params.blinkfeatures, + enableBlinkFeatures: params.blinkfeatures, disableBlinkFeatures: params.disableblinkfeatures } diff --git a/lib/renderer/init.js b/lib/renderer/init.js index 93129849ae0..2470a5e8be8 100644 --- a/lib/renderer/init.js +++ b/lib/renderer/init.js @@ -31,7 +31,7 @@ const { warnAboutDisabledWebSecurity, warnAboutInsecureContentAllowed, warnAboutExperimentalFeatures, - warnAboutBlinkFeatures, + warnAboutEnableBlinkFeatures, warnAboutInsecureResources, warnAboutInsecureCSP, warnAboutAllowedPopups, @@ -177,7 +177,7 @@ window.addEventListener('load', function loadHandler () { warnAboutInsecureResources() warnAboutInsecureContentAllowed() warnAboutExperimentalFeatures() - warnAboutBlinkFeatures() + warnAboutEnableBlinkFeatures() warnAboutInsecureCSP() warnAboutAllowedPopups() } diff --git a/lib/renderer/security-warnings.js b/lib/renderer/security-warnings.js index 4f7d6ef9e59..2f8ebee5bd0 100644 --- a/lib/renderer/security-warnings.js +++ b/lib/renderer/security-warnings.js @@ -229,23 +229,23 @@ module.exports = { }, /** - * #10 on the checklist: Do not use blinkFeatures + * #10 on the checklist: Do not use enableBlinkFeatures * - * Logs a warning message about blinkFeatures + * Logs a warning message about enableBlinkFeatures */ - warnAboutBlinkFeatures: () => { + warnAboutEnableBlinkFeatures: () => { const webPreferences = getWebPreferences() - if (!webPreferences || !webPreferences.blinkFeatures || - (webPreferences.blinkFeatures.length && webPreferences.blinkFeatures.length === 0)) { + if (!webPreferences || !webPreferences.enableBlinkFeatures || + (webPreferences.enableBlinkFeatures.length && webPreferences.enableBlinkFeatures.length === 0)) { return } - let warning = 'This renderer process has additional "blinkFeatures" ' + + let warning = 'This renderer process has additional "enableBlinkFeatures" ' + 'enabled. This exposes users of this app to some security risk. ' + 'If you do not need this feature, you should disable it.\n' + moreInformation - console.warn('%cElectron Security Warning (blinkFeatures)', + console.warn('%cElectron Security Warning (enableBlinkFeatures)', 'font-weight: bold;', warning) }, From 322a3036833820b4ce88471e8fe55d5ae060ddf8 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 23 May 2018 15:57:58 -0700 Subject: [PATCH 12/19] address changes from review --- docs/api/native-image.md | 2 +- lib/renderer/security-warnings.js | 67 ++++++++++++++----------------- 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/docs/api/native-image.md b/docs/api/native-image.md index 7f2aaecf8e1..f1d9e5ce284 100644 --- a/docs/api/native-image.md +++ b/docs/api/native-image.md @@ -137,7 +137,7 @@ let image = nativeImage.createFromPath('/Users/somebody/images/icon.png') console.log(image) ``` -### `nativeImage.createFromBuffer(buffer, options)` +### `nativeImage.createFromBuffer(buffer[, options])` * `buffer` [Buffer][buffer] * `options` Object (optional) diff --git a/lib/renderer/security-warnings.js b/lib/renderer/security-warnings.js index 2f8ebee5bd0..033fcdb1c16 100644 --- a/lib/renderer/security-warnings.js +++ b/lib/renderer/security-warnings.js @@ -91,9 +91,9 @@ const getWebPreferences = function () { } } -const moreInformation = '\nFor more information and help, consult ' + - 'https://electronjs.org/docs/tutorial/security.\n' + - 'This warning will not show up once the app is packaged.' +const moreInformation = `\nFor more information and help, consult +https://electronjs.org/docs/tutorial/security.\n This warning will not show up +once the app is packaged.` module.exports = { shouldLogSecurityWarnings, @@ -119,11 +119,10 @@ module.exports = { return } - let warning = 'This renderer process loads resources using insecure protocols. ' + - 'This exposes users of this app to unnecessary security risks. ' + - 'Consider loading the following resources over HTTPS or FTPS. \n' + - resources + '\n' + - moreInformation + const warning = `This renderer process loads resources using insecure + protocols.This exposes users of this app to unnecessary security risks. + Consider loading the following resources over HTTPS or FTPS. \n ${resources} + \n ${moreInformation}` console.warn('%cElectron Security Warning (Insecure Resources)', 'font-weight: bold;', warning) @@ -137,10 +136,9 @@ module.exports = { */ warnAboutNodeWithRemoteContent: () => { if (getIsRemoteProtocol()) { - let warning = 'This renderer process has Node.js integration enabled ' + - 'and attempted to load remote content. This exposes users of this app to severe ' + - 'security risks.\n' + - moreInformation + const warning = `This renderer process has Node.js integration enabled + and attempted to load remote content. This exposes users of this app to + severe security risks.\n ${moreInformation}` console.warn('%cElectron Security Warning (Node.js Integration with Remote Content)', 'font-weight: bold;', warning) @@ -162,9 +160,8 @@ module.exports = { const webPreferences = getWebPreferences() if (!webPreferences || webPreferences.webSecurity !== false) return - let warning = 'This renderer process has "webSecurity" disabled. ' + - 'This exposes users of this app to severe security risks.\n' + - moreInformation + const warning = `This renderer process has "webSecurity" disabled. This + exposes users of this app to severe security risks.\n ${moreInformation}` console.warn('%cElectron Security Warning (Disabled webSecurity)', 'font-weight: bold;', warning) @@ -180,10 +177,9 @@ module.exports = { */ warnAboutInsecureCSP: () => { if (isUnsafeEvalEnabled()) { - let warning = 'This renderer process has either no Content Security Policy set ' + - 'or a policy with "unsafe-eval" enabled. This exposes users of this ' + - 'app to unnecessary security risks.\n' + - moreInformation + const warning = `This renderer process has either no Content Security + Policy set or a policy with "unsafe-eval" enabled. This exposes users of + this app to unnecessary security risks.\n ${moreInformation}` console.warn('%cElectron Security Warning (Insecure Content-Security-Policy)', 'font-weight: bold;', warning) @@ -199,9 +195,9 @@ module.exports = { const webPreferences = getWebPreferences() if (!webPreferences || !webPreferences.allowRunningInsecureContent) return - let warning = 'This renderer process has "allowRunningInsecureContent" ' + - 'enabled. This exposes users of this app to severe security risks.\n' + - moreInformation + const warning = `This renderer process has "allowRunningInsecureContent" + enabled. This exposes users of this app to severe security risks.\n + ${moreInformation}` console.warn('%cElectron Security Warning (allowRunningInsecureContent)', 'font-weight: bold;', warning) @@ -219,10 +215,9 @@ module.exports = { return } - let warning = 'This renderer process has "experimentalFeatures" ' + - 'enabled. This exposes users of this app to some security risk. ' + - 'If you do not need this feature, you should disable it.\n' + - moreInformation + const warning = `This renderer process has "experimentalFeatures" enabled. + This exposes users of this app to some security risk. If you do not need + this feature, you should disable it.\n ${moreInformation}` console.warn('%cElectron Security Warning (experimentalFeatures)', 'font-weight: bold;', warning) @@ -235,15 +230,15 @@ module.exports = { */ warnAboutEnableBlinkFeatures: () => { const webPreferences = getWebPreferences() - if (!webPreferences || !webPreferences.enableBlinkFeatures || - (webPreferences.enableBlinkFeatures.length && webPreferences.enableBlinkFeatures.length === 0)) { + if (webPreferences === null || + !webPreferences.hasOwnProperty('enableBlinkFeatures') || + webPreferences.enableBlinkFeatures.length === 0) { return } - let warning = 'This renderer process has additional "enableBlinkFeatures" ' + - 'enabled. This exposes users of this app to some security risk. ' + - 'If you do not need this feature, you should disable it.\n' + - moreInformation + const warning = `This renderer process has additional "enableBlinkFeatures" + enabled. This exposes users of this app to some security risk. If you do not + need this feature, you should disable it.\n ${moreInformation}` console.warn('%cElectron Security Warning (enableBlinkFeatures)', 'font-weight: bold;', warning) @@ -262,10 +257,10 @@ module.exports = { return } - let warning = 'A has "allowpopups" set to true. ' + - 'This exposes users of this app to some security risk, since popups are just ' + - 'BrowserWindows. If you do not need this feature, you should disable it.\n' + - moreInformation + const warning = `A has "allowpopups" set to true. This exposes + users of this app to some security risk, since popups are just + BrowserWindows. If you do not need this feature, you should disable it.\n + ${moreInformation}` console.warn('%cElectron Security Warning (allowpopups)', 'font-weight: bold;', warning) From 5beadd90eed2b7b3d981278116522234c5c46095 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 25 May 2018 10:41:26 -0700 Subject: [PATCH 13/19] update electron-typescript-definitions to 1.3.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 27ea5a033a7..825b01c8a16 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "dugite": "^1.45.0", "electabul": "~0.0.4", "electron-docs-linter": "^2.3.4", - "electron-typescript-definitions": "^1.3.4", + "electron-typescript-definitions": "^1.3.5", "github": "^9.2.0", "husky": "^0.14.3", "lint": "^1.1.2", From b7e245aba1c57acd378f0ae4c7532f04ed4692d8 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 25 May 2018 11:01:05 -0700 Subject: [PATCH 14/19] remove atom_api_screen_mac from filenames.gypi --- filenames.gypi | 1 - 1 file changed, 1 deletion(-) diff --git a/filenames.gypi b/filenames.gypi index ec0c59f0a02..68295e38a93 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -151,7 +151,6 @@ 'atom/browser/api/atom_api_render_process_preferences.h', 'atom/browser/api/atom_api_screen.cc', 'atom/browser/api/atom_api_screen.h', - 'atom/browser/api/atom_api_screen_mac.mm', 'atom/browser/api/atom_api_session.cc', 'atom/browser/api/atom_api_session.h', 'atom/browser/api/atom_api_system_preferences.cc', From 8bb7525fe09c034f73631af4f72310319aa940b1 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 25 May 2018 11:12:40 -0700 Subject: [PATCH 15/19] fix missing instance of kBlinkFeatures => kEnableBlinkFeatures --- atom/browser/web_contents_preferences.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index 27ea03430ba..c2e5aeab962 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -231,7 +231,7 @@ void WebContentsPreferences::AppendCommandLineSwitches( } // Enable blink features. - if (dict_.GetString(options::kBlinkFeatures, &s)) + if (dict_.GetString(options::kEnableBlinkFeatures, &s)) command_line->AppendSwitchASCII(::switches::kEnableBlinkFeatures, s); // Disable blink features. From 104fa96d4d24249312791483984e4484af02d2db Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 25 May 2018 11:13:15 -0700 Subject: [PATCH 16/19] fix options switch for kBlinkFeatures --- atom/common/options_switches.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index a01cce5fd83..8339da6bd53 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -127,7 +127,7 @@ const char kOpenerID[] = "openerId"; const char kScrollBounce[] = "scrollBounce"; // Enable blink features. -const char kBlinkFeatures[] = "enableBlinkFeatures"; +const char kEnableBlinkFeatures[] = "enableBlinkFeatures"; // Disable blink features. const char kDisableBlinkFeatures[] = "disableBlinkFeatures"; From 6935addd380aeed91efcc8963442bc064073fd10 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 29 May 2018 16:14:21 +0200 Subject: [PATCH 17/19] fix: remove unused variable --- atom/browser/api/atom_api_web_contents.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 682bd3f9895..ae8538775cc 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1296,7 +1296,6 @@ void WebContents::OpenDevTools(mate::Arguments* args) { state = "detach"; } if (args && args->Length() == 1) { - bool detach = false; mate::Dictionary options; if (args->GetNext(&options)) { options.Get("mode", &state); From 2660859434aa953a6576f1f9beb2c31dcfc959f4 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 29 May 2018 10:54:27 -0400 Subject: [PATCH 18/19] update signature for setCertificateVerifyProc in session spec --- spec/api-session-spec.js | 4 ++-- spec/security-warnings-spec.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/api-session-spec.js b/spec/api-session-spec.js index 891771f3d06..dd6b148b868 100644 --- a/spec/api-session-spec.js +++ b/spec/api-session-spec.js @@ -589,7 +589,7 @@ describe('session module', () => { describe('deprecated function signature', () => { it('supports accepting the request', (done) => { - session.defaultSession.setCertificateVerifyProc((hostname, certificate, callback) => { + session.defaultSession.setCertificateVerifyProc(({hostname, certificate}, callback) => { assert.equal(hostname, '127.0.0.1') callback(true) }) @@ -602,7 +602,7 @@ describe('session module', () => { }) it('supports rejecting the request', (done) => { - session.defaultSession.setCertificateVerifyProc((hostname, certificate, callback) => { + session.defaultSession.setCertificateVerifyProc(({hostname, certificate}, callback) => { assert.equal(hostname, '127.0.0.1') callback(false) }) diff --git a/spec/security-warnings-spec.js b/spec/security-warnings-spec.js index 85fd0973b60..6315a9420e0 100644 --- a/spec/security-warnings-spec.js +++ b/spec/security-warnings-spec.js @@ -133,16 +133,16 @@ describe('security warnings', () => { w.loadURL(`http://127.0.0.1:8881/base-page-security.html`) }) - it('should warn about blinkFeatures', (done) => { + it('should warn about enableBlinkFeatures', (done) => { w = new BrowserWindow({ show: false, webPreferences: { - blinkFeatures: ['my-cool-feature'], + enableBlinkFeatures: ['my-cool-feature'], nodeIntegration: false } }) w.webContents.once('console-message', (e, level, message) => { - assert(message.includes('blinkFeatures'), message) + assert(message.includes('enableBlinkFeatures'), message) done() }) From d40cce92bfb9e1a719d4c1c63fa6badabf483ba9 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 29 May 2018 11:42:03 -0400 Subject: [PATCH 19/19] remove deprecated signature tests --- spec/api-session-spec.js | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/spec/api-session-spec.js b/spec/api-session-spec.js index dd6b148b868..1b864440fe8 100644 --- a/spec/api-session-spec.js +++ b/spec/api-session-spec.js @@ -587,35 +587,6 @@ describe('session module', () => { w.loadURL(`https://127.0.0.1:${server.address().port}`) }) - describe('deprecated function signature', () => { - it('supports accepting the request', (done) => { - session.defaultSession.setCertificateVerifyProc(({hostname, certificate}, callback) => { - assert.equal(hostname, '127.0.0.1') - callback(true) - }) - - w.webContents.once('did-finish-load', () => { - assert.equal(w.webContents.getTitle(), 'hello') - done() - }) - w.loadURL(`https://127.0.0.1:${server.address().port}`) - }) - - it('supports rejecting the request', (done) => { - session.defaultSession.setCertificateVerifyProc(({hostname, certificate}, callback) => { - assert.equal(hostname, '127.0.0.1') - callback(false) - }) - - const url = `https://127.0.0.1:${server.address().port}` - w.webContents.once('did-finish-load', () => { - assert.equal(w.webContents.getTitle(), url) - done() - }) - w.loadURL(url) - }) - }) - it('rejects the request when the callback is called with -2', (done) => { session.defaultSession.setCertificateVerifyProc(({hostname, certificate, verificationResult}, callback) => { assert.equal(hostname, '127.0.0.1')