Skip to content

chore: remove promisification deprecation callbacks - #17907

Merged
jkleinsc merged 9 commits into
masterfrom
bye-bye-cbs
Apr 30, 2019
Merged

jkleinsc merged 9 commits into
masterfrom
bye-bye-cbs

Conversation

@codebytere

@codebytere codebytere commented Apr 23, 2019 •

Copy link
Copy Markdown
Member

Description of Change

Remove promisification deprecations and tests verifying callback versions. I think i got everything but please let me know if i missed any of them!

cc @miniak @MarshallOfSound

Checklist

Release Notes

Notes: Removed deprecations for asynchronous functions to force use of promises.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Apr 23, 2019
@electron-cation electron-cation Bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Apr 23, 2019
@electron-cation electron-cation Bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Apr 23, 2019

@miniak miniak left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the following changes are missing:

diff --git a/lib/browser/api/app.ts b/lib/browser/api/app.ts
index 0d6110e4c..625581e1b 100644
--- a/lib/browser/api/app.ts
+++ b/lib/browser/api/app.ts
@@ -89,9 +89,6 @@ for (const name of events) {
   })
 }
 
-// Function Deprecations
-app.getFileIcon = deprecate.promisify(app.getFileIcon)
-
 // Property Deprecations
 deprecate.fnToProperty(app, 'accessibilitySupportEnabled', '_isAccessibilitySupportEnabled', '_setAccessibilitySupportEnabled')
 
diff --git a/lib/renderer/api/web-frame.ts b/lib/renderer/api/web-frame.ts
index ca640c30a..4d3b06489 100644
--- a/lib/renderer/api/web-frame.ts
+++ b/lib/renderer/api/web-frame.ts
@@ -85,15 +85,6 @@ function getWebFrame (context: Window) {
   return context ? new WebFrame(context) : null
 }
 
-const promisifiedMethods = new Set<string>([
-  'executeJavaScript',
-  'executeJavaScriptInIsolatedWorld'
-])
-
-for (const method of promisifiedMethods) {
-  (WebFrame as any).prototype[method] = deprecate.promisify((WebFrame as any).prototype[method])
-}
-
 const _webFrame = new WebFrame(window)
 
 export default _webFrame
diff --git a/lib/renderer/web-view/web-view-impl.ts b/lib/renderer/web-view/web-view-impl.ts
index 6849f3061..94e8f32b4 100644
--- a/lib/renderer/web-view/web-view-impl.ts
+++ b/lib/renderer/web-view/web-view-impl.ts
@@ -1,4 +1,4 @@
-import { deprecate, remote, webFrame } from 'electron'
+import { remote, webFrame } from 'electron'
 
 import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils'
 import * as guestViewInternal from '@electron/internal/renderer/web-view/guest-view-internal'
@@ -273,7 +273,7 @@ export const setupMethods = (WebViewElement: typeof ElectronInternal.WebViewElem
   }
 
   for (const method of asyncPromiseMethods) {
-    (WebViewElement.prototype as Record<string, any>)[method] = deprecate.promisify(createPromiseHandler(method))
+    (WebViewElement.prototype as Record<string, any>)[method] = createPromiseHandler(method)
   }
 }

@miniak

miniak commented Apr 23, 2019

Copy link
Copy Markdown
Contributor

@codebytere shouldn't we also remove the documentation for the callback versions?

@miniak miniak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

desktopCapturer tests will be fixed by

diff --git a/lib/renderer/api/desktop-capturer.js b/lib/renderer/api/desktop-capturer.js
index 08b6f5b0f..13f89f875 100644
--- a/lib/renderer/api/desktop-capturer.js
+++ b/lib/renderer/api/desktop-capturer.js
@@ -19,7 +19,7 @@ function mapSources (sources) {
   }))
 }
 
-const getSources = (options) => {
+exports.getSources = (options) => {
   return new Promise((resolve, reject) => {
     if (!isValid(options)) throw new Error('Invalid options')

@codebytere

Copy link
Copy Markdown
Member Author

I need to fix the smoke tests here 👇

@miniak

miniak commented Apr 23, 2019 •

Copy link
Copy Markdown
Contributor

I need to fix the smoke tests here 👇

yeah, when I tried locally what happens when the docs are updated, I could see a lot of those blowing up :)

@codebytere

codebytere commented Apr 24, 2019 •

Copy link
Copy Markdown
Member Author

Fixed now pending a issue with electron-ts-defs; we need to update such that ts Promise inner types are correctly parsed as arrays instead of raw types unconditionally.

cc @MarshallOfSound

Comment thread docs/api/session.md Resolved

@miniak miniak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved by mistake

@release-clerk

release-clerk Bot commented Apr 30, 2019

Copy link
Copy Markdown

Release Notes Persisted

Removed deprecations for asynchronous functions to force use of promises.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants