chore: remove promisification deprecation callbacks (#17907)

* chore: remove promisification deprecation callbacks

* update docs

* fix smoke test

* fix executejs issue

* cleanup leftovers

* fix webContents.executeJavaScript tests

* cleanup WebContents.prototype.takeHeapSnapshot

* fix "sets arbitrary webContents as devtools" test

* fix executeJavaScriptInFrame related tests
This commit is contained in:
Shelley Vohr 2019-04-30 07:08:33 -07:00 committed by John Kleinschmidt
parent fdf5f838f4
commit d87b3ead76
44 changed files with 94 additions and 1418 deletions

View file

@ -610,29 +610,6 @@ You can request the following paths by the name:
* `logs` Directory for your app's log folder.
* `pepperFlashSystemPlugin` Full path to the system version of the Pepper Flash plugin.
### `app.getFileIcon(path[, options], callback)`
* `path` String
* `options` Object (optional)
* `size` String
* `small` - 16x16
* `normal` - 32x32
* `large` - 48x48 on _Linux_, 32x32 on _Windows_, unsupported on _macOS_.
* `callback` Function
* `error` Error
* `icon` [NativeImage](native-image.md)
Fetches a path's associated icon.
On _Windows_, there are 2 kinds of icons:
* Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
* Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
On _Linux_ and _macOS_, icons depend on the application associated with file mime type.
**[Deprecated Soon](modernization/promisification.md)**
### `app.getFileIcon(path[, options])`
* `path` String

View file

@ -1221,18 +1221,6 @@ Returns `Boolean` - Whether the window's document has been edited.
#### `win.blurWebView()`
#### `win.capturePage([rect, ]callback)`
* `rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture
* `callback` Function
* `image` [NativeImage](native-image.md)
Captures a snapshot of the page within `rect`. Upon completion `callback` will
be called with `callback(image)`. The `image` is an instance of [NativeImage](native-image.md)
that stores data of the snapshot. Omitting `rect` will capture the whole visible page.
**[Deprecated Soon](modernization/promisification.md)**
#### `win.capturePage([rect])`
* `rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture

View file

@ -37,37 +37,12 @@ app.on('ready', () => {
The `contentTracing` module has the following methods:
### `contentTracing.getCategories(callback)`
* `callback` Function
* `categories` String[]
Get a set of category groups. The category groups can change as new code paths are reached.
Once all child processes have acknowledged the `getCategories` request the `callback` is invoked with an array of category groups.
**[Deprecated Soon](modernization/promisification.md)**
### `contentTracing.getCategories()`
Returns `Promise<String[]>` - resolves with an array of category groups once all child processes have acknowledged the `getCategories` request
Get a set of category groups. The category groups can change as new code paths are reached.
### `contentTracing.startRecording(options, callback)`
* `options` ([TraceCategoriesAndOptions](structures/trace-categories-and-options.md) | [TraceConfig](structures/trace-config.md))
* `callback` Function
Start recording on all processes.
Recording begins immediately locally and asynchronously on child processes
as soon as they receive the EnableRecording request. The `callback` will be
called once all child processes have acknowledged the `startRecording` request.
**[Deprecated Soon](modernization/promisification.md)**
### `contentTracing.startRecording(options)`
* `options` ([TraceCategoriesAndOptions](structures/trace-categories-and-options.md) | [TraceConfig](structures/trace-config.md))
@ -79,29 +54,6 @@ Start recording on all processes.
Recording begins immediately locally and asynchronously on child processes
as soon as they receive the EnableRecording request.
### `contentTracing.stopRecording(resultFilePath, callback)`
* `resultFilePath` String
* `callback` Function
* `resultFilePath` String
Stop recording on all processes.
Child processes typically cache trace data and only rarely flush and send
trace data back to the main process. This helps to minimize the runtime overhead
of tracing since sending trace data over IPC can be an expensive operation. So,
to end tracing, we must asynchronously ask all child processes to flush any
pending trace data.
Once all child processes have acknowledged the `stopRecording` request,
`callback` will be called with a file that contains the traced data.
Trace data will be written into `resultFilePath` if it is not empty or into a
temporary file. The actual file path will be passed to `callback` if it's not
`null`.
**[Deprecated Soon](modernization/promisification.md)**
### `contentTracing.stopRecording(resultFilePath)`
* `resultFilePath` String
@ -119,19 +71,6 @@ pending trace data.
Trace data will be written into `resultFilePath` if it is not empty or into a
temporary file.
### `contentTracing.getTraceBufferUsage(callback)`
* `callback` Function
* Object
* `value` Number
* `percentage` Number
Get the maximum usage across processes of trace buffer as a percentage of the
full state. When the TraceBufferUsage value is determined the `callback` is
called.
**[Deprecated Soon](modernization/promisification.md)**
### `contentTracing.getTraceBufferUsage()`
Returns `Promise<Object>` - Resolves with an object containing the `value` and `percentage` of trace buffer maximum usage

View file

@ -81,26 +81,6 @@ Returns `Promise<Cookie[]>` - A promise which resolves an array of cookie object
Sends a request to get all cookies matching `filter`, and resolves a promise with
the response.
#### `cookies.get(filter, callback)`
* `filter` Object
* `url` String (optional) - Retrieves cookies which are associated with
`url`. Empty implies retrieving cookies of all urls.
* `name` String (optional) - Filters cookies by name.
* `domain` String (optional) - Retrieves cookies whose domains match or are
subdomains of `domains`.
* `path` String (optional) - Retrieves cookies whose path matches `path`.
* `secure` Boolean (optional) - Filters cookies by their Secure property.
* `session` Boolean (optional) - Filters out session or persistent cookies.
* `callback` Function
* `error` Error
* `cookies` [Cookie[]](structures/cookie.md) - an array of cookie objects.
Sends a request to get all cookies matching `filter`, `callback` will be called
with `callback(error, cookies)` on complete.
**[Deprecated Soon](modernization/promisification.md)**
#### `cookies.set(details)`
* `details` Object
@ -121,29 +101,6 @@ Returns `Promise<void>` - A promise which resolves when the cookie has been set
Sets a cookie with `details`.
#### `cookies.set(details, callback)`
* `details` Object
* `url` String - The url to associate the cookie with.
* `name` String (optional) - The name of the cookie. Empty by default if omitted.
* `value` String (optional) - The value of the cookie. Empty by default if omitted.
* `domain` String (optional) - The domain of the cookie. Empty by default if omitted.
* `path` String (optional) - The path of the cookie. Empty by default if omitted.
* `secure` Boolean (optional) - Whether the cookie should be marked as Secure. Defaults to
false.
* `httpOnly` Boolean (optional) - Whether the cookie should be marked as HTTP only.
Defaults to false.
* `expirationDate` Double (optional) - The expiration date of the cookie as the number of
seconds since the UNIX epoch. If omitted then the cookie becomes a session
cookie and will not be retained between sessions.
* `callback` Function
* `error` Error
Sets a cookie with `details`, `callback` will be called with `callback(error)`
on complete.
**[Deprecated Soon](modernization/promisification.md)**
#### `cookies.remove(url, name)`
* `url` String - The URL associated with the cookie.
@ -153,27 +110,8 @@ Returns `Promise<void>` - A promise which resolves when the cookie has been remo
Removes the cookies matching `url` and `name`
#### `cookies.remove(url, name, callback)`
* `url` String - The URL associated with the cookie.
* `name` String - The name of cookie to remove.
* `callback` Function
Removes the cookies matching `url` and `name`, `callback` will called with
`callback()` on complete.
**[Deprecated Soon](modernization/promisification.md)**
#### `cookies.flushStore()`
Returns `Promise<void>` - A promise which resolves when the cookie store has been flushed
Writes any unwritten cookies data to disk.
#### `cookies.flushStore(callback)`
* `callback` Function
Writes any unwritten cookies data to disk.
**[Deprecated Soon](modernization/promisification.md)**

View file

@ -48,20 +48,6 @@ Returns `Boolean` - Whether a debugger is attached to the `webContents`.
Detaches the debugger from the `webContents`.
#### `debugger.sendCommand(method[, commandParams, callback])`
* `method` String - Method name, should be one of the methods defined by the
[remote debugging protocol][rdp].
* `commandParams` Object (optional) - JSON object with request parameters.
* `callback` Function (optional) - Response
* `error` Object - Error message indicating the failure of the command.
* `result` Any - Response defined by the 'returns' attribute of
the command description in the remote debugging protocol.
Send given command to the debugging target.
**[Deprecated Soon](modernization/promisification.md)**
#### `debugger.sendCommand(method[, commandParams])`
* `method` String - Method name, should be one of the methods defined by the

View file

@ -76,33 +76,6 @@ const constraints = {
The `desktopCapturer` module has the following methods:
### `desktopCapturer.getSources(options, callback)`
* `options` Object
* `types` String[] - An array of Strings that lists the types of desktop sources
to be captured, available types are `screen` and `window`.
* `thumbnailSize` [Size](structures/size.md) (optional) - The size that the media source thumbnail
should be scaled to. Default is `150` x `150`. Set width or height to 0 when you do not need
the thumbnails. This will save the processing time required for capturing the content of each
window and screen.
* `fetchWindowIcons` Boolean (optional) - Set to true to enable fetching window icons. The default
value is false. When false the appIcon property of the sources return null. Same if a source has
the type screen.
* `callback` Function
* `error` Error
* `sources` [DesktopCapturerSource[]](structures/desktop-capturer-source.md)
Starts gathering information about all available desktop media sources,
and calls `callback(error, sources)` when finished.
`sources` is an array of [`DesktopCapturerSource`](structures/desktop-capturer-source.md)
objects, each `DesktopCapturerSource` represents a screen or an individual window that can be
captured.
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
**[Deprecated Soon](modernization/promisification.md)**
### `desktopCapturer.getSources(options)`
* `options` Object

View file

@ -225,15 +225,14 @@ expanding and collapsing the dialog.
* `message` String - Content of the message box.
* `detail` String (optional) - Extra information of the message.
* `checkboxLabel` String (optional) - If provided, the message box will
include a checkbox with the given label. The checkbox state can be
inspected only when using `callback`.
include a checkbox with the given label.
* `checkboxChecked` Boolean (optional) - Initial checked state of the
checkbox. `false` by default.
* `icon` [NativeImage](native-image.md) (optional)
* `cancelId` Integer (optional) - The index of the button to be used to cancel the dialog, via
the `Esc` key. By default this is assigned to the first button with "cancel" or "no" as the
label. If no such labeled buttons exist and this option is not set, `0` will be used as the
return value or callback response.
return value.
* `noLink` Boolean (optional) - On Windows Electron will try to figure out which one of
the `buttons` are common buttons (like "Cancel" or "Yes"), and show the
others as command links in the dialog. This can make the dialog appear in
@ -271,15 +270,14 @@ The `browserWindow` argument allows the dialog to attach itself to a parent wind
* `message` String - Content of the message box.
* `detail` String (optional) - Extra information of the message.
* `checkboxLabel` String (optional) - If provided, the message box will
include a checkbox with the given label. The checkbox state can be
inspected only when using `callback`.
include a checkbox with the given label.
* `checkboxChecked` Boolean (optional) - Initial checked state of the
checkbox. `false` by default.
* `icon` [NativeImage](native-image.md) (optional)
* `cancelId` Integer (optional) - The index of the button to be used to cancel the dialog, via
the `Esc` key. By default this is assigned to the first button with "cancel" or "no" as the
label. If no such labeled buttons exist and this option is not set, `0` will be used as the
return value or callback response.
return value.
* `noLink` Boolean (optional) - On Windows Electron will try to figure out which one of
the `buttons` are common buttons (like "Cancel" or "Yes"), and show the
others as command links in the dialog. This can make the dialog appear in
@ -315,28 +313,6 @@ it is usually used to report errors in early stage of startup. If called
before the app `ready`event on Linux, the message will be emitted to stderr,
and no GUI dialog will appear.
### `dialog.showCertificateTrustDialog([browserWindow, ]options, callback)` _macOS_ _Windows_
* `browserWindow` [BrowserWindow](browser-window.md) (optional)
* `options` Object
* `certificate` [Certificate](structures/certificate.md) - The certificate to trust/import.
* `message` String - The message to display to the user.
* `callback` Function
On macOS, this displays a modal dialog that shows a message and certificate
information, and gives the user the option of trusting/importing the
certificate. If you provide a `browserWindow` argument the dialog will be
attached to the parent window, making it modal.
On Windows the options are more limited, due to the Win32 APIs used:
* The `message` argument is not used, as the OS provides its own confirmation
dialog.
* The `browserWindow` argument is ignored since it is not possible to make
this confirmation dialog modal.
**[Deprecated Soon](modernization/promisification.md)**
### `dialog.showCertificateTrustDialog([browserWindow, ]options)` _macOS_ _Windows_
* `browserWindow` [BrowserWindow](browser-window.md) (optional)

View file

@ -21,17 +21,6 @@ Returns:
The `inAppPurchase` module has the following methods:
### `inAppPurchase.purchaseProduct(productID, quantity, callback)`
* `productID` String - The identifiers of the product to purchase. (The identifier of `com.example.app.product1` is `product1`).
* `quantity` Integer (optional) - The number of items the user wants to purchase.
* `callback` Function (optional) - The callback called when the payment is added to the PaymentQueue.
* `isProductValid` Boolean - Determine if the product is valid and added to the payment queue.
You should listen for the `transactions-updated` event as soon as possible and certainly before you call `purchaseProduct`.
**[Deprecated Soon](modernization/promisification.md)**
### `inAppPurchase.purchaseProduct(productID, quantity)`
* `productID` String - The identifiers of the product to purchase. (The identifier of `com.example.app.product1` is `product1`).
@ -41,16 +30,6 @@ Returns `Promise<Boolean>` - Returns `true` if the product is valid and added to
You should listen for the `transactions-updated` event as soon as possible and certainly before you call `purchaseProduct`.
### `inAppPurchase.getProducts(productIDs, callback)`
* `productIDs` String[] - The identifiers of the products to get.
* `callback` Function - The callback called with the products or an empty array if the products don't exist.
* `products` Product[] - Array of [`Product`](structures/product.md) objects
Retrieves the product descriptions.
**[Deprecated Soon](modernization/promisification.md)**
### `inAppPurchase.getProducts(productIDs)`
* `productIDs` String[] - The identifiers of the products to get.

View file

@ -28,15 +28,6 @@ of the `app` module gets emitted.
Starts recording network events to `path`.
### `netLog.stopLogging([callback])`
* `callback` Function (optional)
* `path` String - File path to which network logs were recorded.
Stops recording network events. If not called, net logging will automatically end when app quits.
**[Deprecated Soon](modernization/promisification.md)**
### `netLog.stopLogging()`
Returns `Promise<String>` - resolves with a file path to which network logs were recorded.

View file

@ -312,17 +312,6 @@ protocol.registerStreamProtocol('atom', (request, callback) => {
Unregisters the custom protocol of `scheme`.
### `protocol.isProtocolHandled(scheme, callback)`
* `scheme` String
* `callback` Function
* `handled` Boolean
The `callback` will be called with a boolean that indicates whether there is
already a handler for `scheme`.
**[Deprecated Soon](modernization/promisification.md)**
### `protocol.isProtocolHandled(scheme)`
* `scheme` String

View file

@ -22,7 +22,7 @@ win.loadURL('https://github.com')
```
**Note:** For the reverse (access the renderer process from the main process),
you can use [webContents.executeJavaScript](web-contents.md#contentsexecutejavascriptcode-usergesture-callback).
you can use [webContents.executeJavaScript](web-contents.md#contentsexecutejavascriptcode-usergesture).
**Note:** The remote module can be disabled for security reasons in the following contexts:
- [`BrowserWindow`](browser-window.md) - by setting the `enableRemoteModule` option to `false`.

View file

@ -93,51 +93,16 @@ session.defaultSession.on('will-download', (event, item, webContents) => {
The following methods are available on instances of `Session`:
#### `ses.getCacheSize(callback)`
* `callback` Function
* `size` Integer - Cache size used in bytes.
* `error` Integer - The error code corresponding to the failure.
Callback is invoked with the session's current cache size.
**[Deprecated Soon](modernization/promisification.md)**
#### `ses.getCacheSize()`
Returns `Promise<Integer>` - the session's current cache size, in bytes.
#### `ses.clearCache(callback)`
* `callback` Function - Called when operation is done.
* `error` Integer - The error code corresponding to the failure.
Clears the sessions HTTP cache.
**[Deprecated Soon](modernization/promisification.md)**
#### `ses.clearCache()`
Returns `Promise<void>` - resolves when the cache clear operation is complete.
Clears the sessions HTTP cache.
#### `ses.clearStorageData([options,] callback)`
* `options` Object (optional)
* `origin` String (optional) - Should follow `window.location.origin`s representation
`scheme://host:port`.
* `storages` String[] (optional) - The types of storages to clear, can contain:
`appcache`, `cookies`, `filesystem`, `indexdb`, `localstorage`,
`shadercache`, `websql`, `serviceworkers`, `cachestorage`.
* `quotas` String[] (optional) - The types of quotas to clear, can contain:
`temporary`, `persistent`, `syncable`.
* `callback` Function (optional) - Called when operation is done.
Clears the storage data for the current session.
**[Deprecated Soon](modernization/promisification.md)**
#### `ses.clearStorageData([options])`
* `options` Object (optional)
@ -155,84 +120,6 @@ Returns `Promise<void>` - resolves when the storage data has been cleared.
Writes any unwritten DOMStorage data to disk.
#### `ses.setProxy(config, callback)`
* `config` Object
* `pacScript` String - The URL associated with the PAC file.
* `proxyRules` String - Rules indicating which proxies to use.
* `proxyBypassRules` String - Rules indicating which URLs should
bypass the proxy settings.
* `callback` Function - Called when operation is done.
Sets the proxy settings.
When `pacScript` and `proxyRules` are provided together, the `proxyRules`
option is ignored and `pacScript` configuration is applied.
The `proxyRules` has to follow the rules below:
```sh
proxyRules = schemeProxies[";"<schemeProxies>]
schemeProxies = [<urlScheme>"="]<proxyURIList>
urlScheme = "http" | "https" | "ftp" | "socks"
proxyURIList = <proxyURL>[","<proxyURIList>]
proxyURL = [<proxyScheme>"://"]<proxyHost>[":"<proxyPort>]
```
For example:
* `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
HTTP proxy `foopy2:80` for `ftp://` URLs.
* `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
* `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
* `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
* `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
* `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
proxy if `foopy` is unavailable.
* `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
`socks4://foopy2` for all other URLs.
The `proxyBypassRules` is a comma separated list of rules described below:
* `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
Match all hostnames that match the pattern HOSTNAME_PATTERN.
Examples:
"foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
"https://x.*.y.com:99"
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
Match a particular domain suffix.
Examples:
".google.com", ".com", "http://.google.com"
* `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
Match URLs which are IP address literals.
Examples:
"127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
* `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
Match any URL that is to an IP literal that falls between the
given range. IP range is specified using CIDR notation.
Examples:
"192.168.1.1/16", "fefe:13::abc/33".
* `<local>`
Match local addresses. The meaning of `<local>` is whether the
host matches one of: "127.0.0.1", "::1", "localhost".
**[Deprecated Soon](modernization/promisification.md)**
#### `ses.setProxy(config)`
* `config` Object
@ -310,17 +197,6 @@ The `proxyBypassRules` is a comma separated list of rules described below:
Match local addresses. The meaning of `<local>` is whether the
host matches one of: "127.0.0.1", "::1", "localhost".
#### `ses.resolveProxy(url, callback)`
* `url` URL
* `callback` Function
* `proxy` String
Resolves the proxy information for `url`. The `callback` will be called with
`callback(proxy)` when the request is performed.
**[Deprecated Soon](modernization/promisification.md)**
#### `ses.resolveProxy(url)`
* `url` URL
@ -457,14 +333,6 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents,
})
```
#### `ses.clearHostResolverCache(callback)`
* `callback` Function (optional) - Called when operation is done.
Clears the host resolver cache.
**[Deprecated Soon](modernization/promisification.md)**
#### `ses.clearHostResolverCache()`
Returns `Promise<void>` - Resolves when the operation is complete.
@ -506,14 +374,6 @@ This doesn't affect existing `WebContents`, and each `WebContents` can use
Returns `String` - The user agent for this session.
#### `ses.getBlobData(identifier, callback)`
* `identifier` String - Valid UUID.
* `callback` Function
* `result` Buffer - Blob data.
**[Deprecated Soon](modernization/promisification.md)**
#### `ses.getBlobData(identifier)`
* `identifier` String - Valid UUID.
@ -539,15 +399,6 @@ event. The [DownloadItem](download-item.md) will not have any `WebContents` asso
the initial state will be `interrupted`. The download will start only when the
`resume` API is called on the [DownloadItem](download-item.md).
#### `ses.clearAuthCache(options, callback)`
* `options` ([RemovePassword](structures/remove-password.md) | [RemoveClientCertificate](structures/remove-client-certificate.md))
* `callback` Function - Called when operation is done.
Clears the sessions HTTP authentication cache.
**[Deprecated Soon](modernization/promisification.md)**
#### `ses.clearAuthCache(options)`
* `options` ([RemovePassword](structures/remove-password.md) | [RemoveClientCertificate](structures/remove-client-certificate.md))

View file

@ -2,5 +2,5 @@
* `bytes` Buffer - Content being sent.
* `file` String - Path of file being uploaded.
* `blobUUID` String - UUID of blob data. Use [ses.getBlobData](../session.md#sesgetblobdataidentifier-callback) method
* `blobUUID` String - UUID of blob data. Use [ses.getBlobData](../session.md#sesgetblobdataidentifier method
to retrieve the data.

View file

@ -957,31 +957,6 @@ contents.on('did-finish-load', function () {
})
```
#### `contents.executeJavaScript(code[, userGesture, callback])`
* `code` String
* `userGesture` Boolean (optional) - Default is `false`.
* `callback` Function (optional) - Called after script has been executed.
* `result` Any
Returns `Promise<any>` - A promise that resolves with the result of the executed code
or is rejected if the result of the code is a rejected promise.
Evaluates `code` in page.
In the browser window some HTML APIs like `requestFullScreen` can only be
invoked by a gesture from the user. Setting `userGesture` to `true` will remove
this limitation.
```js
contents.executeJavaScript('fetch("https://jsonplaceholder.typicode.com/users/1").then(resp => resp.json())', true)
.then((result) => {
console.log(result) // Will be the JSON object from the fetch call
})
```
**[Deprecated Soon](modernization/promisification.md)**
#### `contents.executeJavaScript(code[, userGesture])`
* `code` String
@ -1169,18 +1144,6 @@ const requestId = webContents.findInPage('api')
console.log(requestId)
```
#### `contents.capturePage([rect, ]callback)`
* `rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture
* `callback` Function
* `image` [NativeImage](native-image.md)
Captures a snapshot of the page within `rect`. Upon completion `callback` will
be called with `callback(image)`. The `image` is an instance of [NativeImage](native-image.md)
that stores data of the snapshot. Omitting `rect` will capture the whole visible page.
**[Deprecated Soon](modernization/promisification.md)**
#### `contents.capturePage([rect])`
* `rect` [Rectangle](structures/rectangle.md) (optional) - The area of the page to be captured.
@ -1214,29 +1177,6 @@ Calling `window.print()` in web page is equivalent to calling
Use `page-break-before: always; ` CSS style to force to print to a new page.
#### `contents.printToPDF(options, callback)`
* `options` Object
* `marginsType` Integer (optional) - Specifies the type of margins to use. Uses 0 for
default margin, 1 for no margin, and 2 for minimum margin.
* `pageSize` String | Size (optional) - Specify page size of the generated PDF. Can be `A3`,
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`
and `width` in microns.
* `printBackground` Boolean (optional) - Whether to print CSS backgrounds.
* `printSelectionOnly` Boolean (optional) - Whether to print selection only.
* `landscape` Boolean (optional) - `true` for landscape, `false` for portrait.
* `callback` Function
* `error` Error
* `data` Buffer
Prints window's web page as PDF with Chromium's preview printing custom
settings.
The `callback` will be called with `callback(error, data)` on completion. The
`data` is a `Buffer` that contains the generated PDF data.
**[Deprecated Soon](modernization/promisification.md)**
#### `contents.printToPDF(options)`
* `options` Object

View file

@ -107,24 +107,6 @@ Inserts `css` as a style sheet in the document.
Inserts `text` to the focused element.
### `webFrame.executeJavaScript(code[, userGesture, callback])`
* `code` String
* `userGesture` Boolean (optional) - Default is `false`.
* `callback` Function (optional) - Called after script has been executed.
* `result` Any
Returns `Promise<any>` - A promise that resolves with the result of the executed code
or is rejected if the result of the code is a rejected promise.
Evaluates `code` in page.
In the browser window some HTML APIs like `requestFullScreen` can only be
invoked by a gesture from the user. Setting `userGesture` to `true` will remove
this limitation.
**[Deprecated Soon](modernization/promisification.md)**
### `webFrame.executeJavaScript(code[, userGesture])`
* `code` String
@ -139,21 +121,6 @@ In the browser window some HTML APIs like `requestFullScreen` can only be
invoked by a gesture from the user. Setting `userGesture` to `true` will remove
this limitation.
### `webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])`
* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electrons `contextIsolation` feature. Chrome extensions reserve the range of IDs in `[1 << 20, 1 << 29)`. You can provide any integer here.
* `scripts` [WebSource[]](structures/web-source.md)
* `userGesture` Boolean (optional) - Default is `false`.
* `callback` Function (optional) - Called after script has been executed.
* `result` Any
Returns `Promise<any>` - A promise that resolves with the result of the executed code
or is rejected if the result of the code is a rejected promise.
Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
**[Deprecated Soon](modernization/promisification.md)**
### `webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture])`
* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electrons `contextIsolation` feature. You can provide any integer here.

View file

@ -381,22 +381,6 @@ Returns `String` - The user agent for guest page.
Injects CSS into the guest page.
### `<webview>.executeJavaScript(code[, userGesture, callback])`
* `code` String
* `userGesture` Boolean (optional) - Default `false`.
* `callback` Function (optional) - Called after script has been executed.
* `result` Any
Returns `Promise<any>` - A promise that resolves with the result of the executed code
or is rejected if the result of the code is a rejected promise.
Evaluates `code` in page. If `userGesture` is set, it will create the user
gesture context in the page. HTML APIs like `requestFullScreen`, which require
user action, can take advantage of this option for automation.
**[Deprecated Soon](modernization/promisification.md)**
### `<webview>.executeJavaScript(code[, userGesture])`
* `code` String
@ -549,25 +533,6 @@ Stops any `findInPage` request for the `webview` with the provided `action`.
Prints `webview`'s web page. Same as `webContents.print([options])`.
### `<webview>.printToPDF(options, callback)`
* `options` Object
* `marginsType` Integer (optional) - Specifies the type of margins to use. Uses 0 for
default margin, 1 for no margin, and 2 for minimum margin.
* `pageSize` String | Size (optional) - Specify page size of the generated PDF. Can be `A3`,
`A4`, `A5`, `Legal`, `Letter`, `Tabloid` or an Object containing `height`
and `width` in microns.
* `printBackground` Boolean (optional) - Whether to print CSS backgrounds.
* `printSelectionOnly` Boolean (optional) - Whether to print selection only.
* `landscape` Boolean (optional) - `true` for landscape, `false` for portrait.
* `callback` Function
* `error` Error
* `data` Buffer
Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options, callback)`.
**[Deprecated Soon](modernization/promisification.md)**
### `<webview>.printToPDF(options)`
* `options` Object
@ -584,18 +549,6 @@ Returns `Promise<Buffer>` - Resolves with the generated PDF data.
Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
### `<webview>.capturePage([rect, ]callback)`
* `rect` [Rectangle](structures/rectangle.md) (optional) - The bounds to capture
* `callback` Function
* `image` [NativeImage](native-image.md)
Captures a snapshot of the page within `rect`. Upon completion `callback` will
be called with `callback(image)`. The `image` is an instance of [NativeImage](native-image.md)
that stores data of the snapshot. Omitting `rect` will capture the whole visible page.
**[Deprecated Soon](modernization/promisification.md)**
### `<webview>.capturePage([rect])`
* `rect` [Rectangle](structures/rectangle.md) (optional) - The area of the page to be captured.