From 5d6023ae0dfa289b8ce1427722b0a8c0ab24e648 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Fri, 13 Oct 2023 03:00:44 -0700 Subject: [PATCH] docs: fix some string union typings (#40180) --- docs/api/app.md | 8 ++++---- docs/api/web-contents.md | 2 +- docs/api/web-frame.md | 2 +- spec/ts-smoke/electron/main.ts | 10 ++++++++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/api/app.md b/docs/api/app.md index 05bb19fef255..40f2422a92e1 100755 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -1134,11 +1134,11 @@ indicates success while any other value indicates failure according to Chromium resolver will attempt to use the system's DNS settings to do DNS lookups itself. Enabled by default on macOS, disabled by default on Windows and Linux. - * `secureDnsMode` string (optional) - Can be "off", "automatic" or "secure". - Configures the DNS-over-HTTP mode. When "off", no DoH lookups will be - performed. When "automatic", DoH lookups will be performed first if DoH is + * `secureDnsMode` string (optional) - Can be 'off', 'automatic' or 'secure'. + Configures the DNS-over-HTTP mode. When 'off', no DoH lookups will be + performed. When 'automatic', DoH lookups will be performed first if DoH is available, and insecure DNS lookups will be performed as a fallback. When - "secure", only DoH lookups will be performed. Defaults to "automatic". + 'secure', only DoH lookups will be performed. Defaults to 'automatic'. * `secureDnsServers` string[] (optional) - A list of DNS-over-HTTP server templates. See [RFC8484 ยง 3][] for details on the template format. Most servers support the POST method; the template for such servers is diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 1fdd7d47e430..d1d419f2ce48 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -1211,7 +1211,7 @@ Returns `string` - The user agent for this web page. * `css` string * `options` Object (optional) - * `cssOrigin` string (optional) - Can be either 'user' or 'author'. Sets the [cascade origin](https://www.w3.org/TR/css3-cascade/#cascade-origin) of the inserted stylesheet. Default is 'author'. + * `cssOrigin` string (optional) - Can be 'user' or 'author'. Sets the [cascade origin](https://www.w3.org/TR/css3-cascade/#cascade-origin) of the inserted stylesheet. Default is 'author'. Returns `Promise` - A promise that resolves with a key for the inserted CSS that can later be used to remove the CSS via `contents.removeInsertedCSS(key)`. diff --git a/docs/api/web-frame.md b/docs/api/web-frame.md index db4ec1c31a33..f2ec5aff2db2 100644 --- a/docs/api/web-frame.md +++ b/docs/api/web-frame.md @@ -113,7 +113,7 @@ webFrame.setSpellCheckProvider('en-US', { * `css` string * `options` Object (optional) - * `cssOrigin` string (optional) - Can be either 'user' or 'author'. Sets the [cascade origin](https://www.w3.org/TR/css3-cascade/#cascade-origin) of the inserted stylesheet. Default is 'author'. + * `cssOrigin` string (optional) - Can be 'user' or 'author'. Sets the [cascade origin](https://www.w3.org/TR/css3-cascade/#cascade-origin) of the inserted stylesheet. Default is 'author'. Returns `string` - A key for the inserted CSS that can later be used to remove the CSS via `webFrame.removeInsertedCSS(key)`. diff --git a/spec/ts-smoke/electron/main.ts b/spec/ts-smoke/electron/main.ts index 6c770d35cfcf..319321f215e3 100644 --- a/spec/ts-smoke/electron/main.ts +++ b/spec/ts-smoke/electron/main.ts @@ -429,6 +429,11 @@ win2.once('ready-to-show', () => { app.relaunch({ args: process.argv.slice(1).concat(['--relaunch']) }); app.exit(0); +app.configureHostResolver({ secureDnsMode: 'off' }); + +// @ts-expect-error Invalid type value +app.configureHostResolver({ secureDnsMode: 'foo' }); + // @ts-expect-error Removed API console.log(app.runningUnderRosettaTranslation); @@ -1284,6 +1289,11 @@ win4.webContents.on('devtools-open-url', (event, url) => { console.log(url); }); +win4.webContents.insertCSS('body {}', { cssOrigin: 'user' }); + +// @ts-expect-error Invalid type value +win4.webContents.insertCSS('body {}', { cssOrigin: 'foo' }); + win4.loadURL('http://github.com'); // @ts-expect-error Removed API