feat: expose frame & move properties to console-message event object (#43617)

* feat: expose frame on console-message event

refactor: use property names similar to ServiceWorker's console-message event

refactor: don't use deprecated params in tests

doc: console-message breaking change

chore: add deprecation warning

docs: restore deprecated argument descriptions

* move console-message deprecations to v34

---------

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
Sam Maddock 2024-10-18 16:07:06 -04:00 коммит произвёл GitHub
Родитель 35aeab6ecd
Коммит 87bd665e41
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
13 изменённых файлов: 140 добавлений и 65 удалений

Просмотреть файл

@ -955,11 +955,17 @@ Emitted when a `<webview>` has been attached to this web contents.
Returns:
* `event` Event
* `level` Integer - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
* `message` string - The actual console message
* `line` Integer - The line number of the source that triggered this console message
* `sourceId` string
* `details` Event\<\>
* `message` string - Message text
* `level` string - Message severity
Possible values include `info`, `warning`, `error`, and `debug`.
* `lineNumber` Integer - Line number in the log source
* `sourceId` string - URL of the log source
* `frame` WebFrameMain - Frame that logged the message
* `level` Integer _Deprecated_ - The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and `error`.
* `message` string _Deprecated_ - The actual console message
* `line` Integer _Deprecated_ - The line number of the source that triggered this console message
* `sourceId` string _Deprecated_
Emitted when the associated window logs a console message.

Просмотреть файл

@ -12,6 +12,23 @@ This document uses the following convention to categorize breaking changes:
* **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release.
* **Removed:** An API or feature was removed, and is no longer supported by Electron.
## Planned Breaking API Changes (34.0)
### Deprecated: `level`, `message`, `line`, and `sourceId` arguments in `console-message` event on `WebContents`
The `console-message` event on `WebContents` has been updated to provide details on the `Event`
argument.
```js
// Deprecated
webContents.on('console-message', (event, level, message, line, sourceId) => {})
// Replace with:
webContents.on('console-message', ({ level, message, lineNumber, sourceId, frame }) => {})
```
Additionally, `level` is now a string with possible values of `info`, `warning`, `error`, and `debug`.
## Planned Breaking API Changes (33.0)
### Behavior Changed: frame properties may retrieve detached WebFrameMain instances or none at all

Просмотреть файл

@ -549,6 +549,8 @@ WebContents.prototype.goToOffset = function (index: number) {
return this._goToOffset(index);
};
const consoleMessageDeprecated = deprecate.warnOnceMessage('\'console-message\' arguments are deprecated and will be removed. Please use Event<WebContentsConsoleMessageEventParams> object instead.');
// Add JavaScript wrappers for WebContents class.
WebContents.prototype._init = function () {
const prefs = this.getLastWebPreferences() || {};
@ -909,6 +911,15 @@ WebContents.prototype._init = function () {
openDialogs.clear();
});
// TODO(samuelmaddock): remove deprecated 'console-message' arguments
this.on('-console-message' as any, (event: Electron.Event<Electron.WebContentsConsoleMessageEventParams>) => {
const hasDeprecatedListener = this.listeners('console-message').some(listener => listener.length > 1);
if (hasDeprecatedListener) {
consoleMessageDeprecated();
}
this.emit('console-message', event, (event as any)._level, event.message, event.lineNumber, event.sourceId);
});
app.emit('web-contents-created', { sender: this, preventDefault () {}, get defaultPrevented () { return false; } }, this);
// Properties

Просмотреть файл

@ -1068,14 +1068,31 @@ void WebContents::Close(std::optional<gin_helper::Dictionary> options) {
}
}
bool WebContents::DidAddMessageToConsole(
content::WebContents* source,
void WebContents::OnDidAddMessageToConsole(
content::RenderFrameHost* source_frame,
blink::mojom::ConsoleMessageLevel level,
const std::u16string& message,
int32_t line_no,
const std::u16string& source_id) {
return Emit("console-message", static_cast<int32_t>(level), message, line_no,
source_id);
const std::u16string& source_id,
const std::optional<std::u16string>& untrusted_stack_trace) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::HandleScope handle_scope(isolate);
gin::Handle<gin_helper::internal::Event> event =
gin_helper::internal::Event::New(isolate);
v8::Local<v8::Object> event_object = event.ToV8().As<v8::Object>();
gin_helper::Dictionary dict(isolate, event_object);
dict.SetGetter("frame", source_frame);
dict.Set("level", level);
dict.Set("message", message);
dict.Set("lineNumber", line_no);
dict.Set("sourceId", source_id);
// TODO(samuelmaddock): Delete when deprecated arguments are fully removed.
dict.Set("_level", static_cast<int32_t>(level));
EmitWithoutEvent("-console-message", event);
}
void WebContents::OnCreateWindow(

Просмотреть файл

@ -530,11 +530,6 @@ class WebContents final : public ExclusiveAccessContext,
#endif
// content::WebContentsDelegate:
bool DidAddMessageToConsole(content::WebContents* source,
blink::mojom::ConsoleMessageLevel level,
const std::u16string& message,
int32_t line_no,
const std::u16string& source_id) override;
bool IsWebContentsCreationOverridden(
content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type,
@ -680,6 +675,13 @@ class WebContents final : public ExclusiveAccessContext,
content::RenderWidgetHost* render_widget_host) override;
void OnWebContentsLostFocus(
content::RenderWidgetHost* render_widget_host) override;
void OnDidAddMessageToConsole(
content::RenderFrameHost* source_frame,
blink::mojom::ConsoleMessageLevel level,
const std::u16string& message,
int32_t line_no,
const std::u16string& source_id,
const std::optional<std::u16string>& untrusted_stack_trace) override;
// InspectableWebContentsDelegate:
void DevToolsReloadPage() override;

Просмотреть файл

@ -28,6 +28,7 @@
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
#include "third_party/blink/public/common/widget/device_emulation_params.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom.h"
#include "third_party/blink/public/mojom/loader/referrer.mojom.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/events/blink/blink_event_util.h"
@ -699,4 +700,18 @@ bool Converter<blink::CloneableMessage>::FromV8(v8::Isolate* isolate,
return electron::SerializeV8Value(isolate, val, out);
}
// static
v8::Local<v8::Value> Converter<blink::mojom::ConsoleMessageLevel>::ToV8(
v8::Isolate* isolate,
const blink::mojom::ConsoleMessageLevel& in) {
using Val = blink::mojom::ConsoleMessageLevel;
static constexpr auto Lookup = base::MakeFixedFlatMap<Val, std::string_view>({
{Val::kVerbose, "debug"},
{Val::kInfo, "info"},
{Val::kWarning, "warning"},
{Val::kError, "error"},
});
return StringToV8(isolate, Lookup.at(in));
}
} // namespace gin

Просмотреть файл

@ -10,6 +10,7 @@
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/messaging/cloneable_message.h"
#include "third_party/blink/public/common/web_cache/web_cache_resource_type_stats.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom-forward.h"
#include "third_party/blink/public/mojom/loader/referrer.mojom-forward.h"
namespace blink {
@ -126,6 +127,12 @@ struct Converter<blink::CloneableMessage> {
blink::CloneableMessage* out);
};
template <>
struct Converter<blink::mojom::ConsoleMessageLevel> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const blink::mojom::ConsoleMessageLevel& in);
};
v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags);
v8::Local<v8::Value> MediaFlagsToV8(v8::Isolate* isolate, int mediaFlags);

Просмотреть файл

@ -977,7 +977,7 @@ describe('protocol module', () => {
contextIsolation: false
});
const consoleMessages: string[] = [];
newContents.on('console-message', (e, level, message) => consoleMessages.push(message));
newContents.on('console-message', (e) => consoleMessages.push(e.message));
try {
newContents.loadURL(standardScheme + '://fake-host');
const [, response] = await once(ipcMain, 'response');
@ -1631,7 +1631,7 @@ describe('protocol module', () => {
defer(() => { protocol.unhandle('cors'); });
await contents.loadFile(path.resolve(fixturesPath, 'pages', 'base-page.html'));
contents.on('console-message', (e, level, message) => console.log(message));
contents.on('console-message', (e) => console.log(e.message));
const ok = await contents.executeJavaScript(`(async () => {
function wait(milliseconds) {
return new Promise((resolve) => setTimeout(resolve, milliseconds));

Просмотреть файл

@ -1965,9 +1965,9 @@ describe('webContents module', () => {
afterEach(closeAllWindows);
it('is triggered with correct log message', (done) => {
const w = new BrowserWindow({ show: true });
w.webContents.on('console-message', (e, level, message) => {
w.webContents.on('console-message', (e) => {
// Don't just assert as Chromium might emit other logs that we should ignore.
if (message === 'a') {
if (e.message === 'a') {
done();
}
});

Просмотреть файл

@ -379,7 +379,7 @@ describe('web security', () => {
console.log(e.message)
}
</script>`);
const [,, message] = await once(w.webContents, 'console-message');
const [{ message }] = await once(w.webContents, 'console-message');
expect(message).to.match(/Refused to evaluate a string/);
});
@ -399,7 +399,7 @@ describe('web security', () => {
console.log(e.message)
}
</script>`);
const [,, message] = await once(w.webContents, 'console-message');
const [{ message }] = await once(w.webContents, 'console-message');
expect(message).to.equal('true');
});
@ -1428,7 +1428,7 @@ describe('chromium features', () => {
w.loadURL('about:blank');
w.webContents.executeJavaScript('window.child = window.open(); child.opener = null');
const [, { webContents }] = await once(app, 'browser-window-created');
const [,, message] = await once(webContents, 'console-message');
const [{ message }] = await once(webContents, 'console-message');
expect(message).to.equal('{"require":"function","module":"object","exports":"object","process":"object","Buffer":"function"}');
});

Просмотреть файл

@ -111,7 +111,7 @@ describe('chrome extensions', () => {
const message = { method: 'query' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.have.lengthOf(1);
@ -434,7 +434,7 @@ describe('chrome extensions', () => {
const message = { method: 'executeScript', args: ['1 + 2'] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal(3);
@ -448,7 +448,7 @@ describe('chrome extensions', () => {
const message = { method: 'connectTab', args: [portName] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = responseString.split(',');
expect(response[0]).to.equal(portName);
expect(response[1]).to.equal('howdy');
@ -461,7 +461,7 @@ describe('chrome extensions', () => {
const message = { method: 'sendMessage', args: ['Hello World!'] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response.message).to.equal('Hello World!');
@ -480,7 +480,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [w2.webContents.id, { url }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
await w2Navigated;
@ -801,7 +801,7 @@ describe('chrome extensions', () => {
w.webContents.executeJavaScript('window.postMessage(\'fetch-confirmation\', \'*\')');
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { message } = JSON.parse(responseString);
expect(message).to.equal('Hello from background.js');
@ -834,7 +834,7 @@ describe('chrome extensions', () => {
const message = { method: 'getAcceptLanguages' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.be.an('array').that.is.not.empty('languages array is empty');
@ -846,7 +846,7 @@ describe('chrome extensions', () => {
const message = { method: 'getUILanguage' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.be.a('string');
@ -858,7 +858,7 @@ describe('chrome extensions', () => {
const message = { method: 'getMessage' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal('Hola mundo!!');
@ -877,7 +877,7 @@ describe('chrome extensions', () => {
const message = { method: 'detectLanguage', args: [greetings] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.be.an('array');
@ -925,7 +925,7 @@ describe('chrome extensions', () => {
const message = { method: 'isEnabled' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal(false);
@ -937,7 +937,7 @@ describe('chrome extensions', () => {
const message = { method: 'setIcon' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal(null);
@ -949,7 +949,7 @@ describe('chrome extensions', () => {
const message = { method: 'getBadgeText' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal('');
@ -982,7 +982,7 @@ describe('chrome extensions', () => {
const message = { method: 'getZoom' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.equal(1);
@ -994,7 +994,7 @@ describe('chrome extensions', () => {
const message = { method: 'setZoom', args: [2] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.deep.equal(2);
@ -1006,7 +1006,7 @@ describe('chrome extensions', () => {
const message = { method: 'getZoomSettings' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.deep.equal({
@ -1022,7 +1022,7 @@ describe('chrome extensions', () => {
const message = { method: 'setZoomSettings', args: [{ mode: 'disabled' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.deep.equal({
@ -1039,7 +1039,7 @@ describe('chrome extensions', () => {
const message = { method: 'get' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.have.property('url').that.is.a('string');
@ -1065,7 +1065,7 @@ describe('chrome extensions', () => {
await w.loadURL(url);
w.webContents.executeJavaScript('window.postMessage(\'{}\', \'*\')');
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).not.to.have.property('url');
expect(response).not.to.have.property('title');
@ -1092,7 +1092,7 @@ describe('chrome extensions', () => {
const consoleMessage = once(w.webContents, 'console-message');
const finish = once(w.webContents, 'did-finish-load');
await Promise.all([consoleMessage, finish]).then(([[,, responseString]]) => {
await Promise.all([consoleMessage, finish]).then(([[{ message: responseString }]]) => {
const response = JSON.parse(responseString);
expect(response.status).to.equal('reloaded');
});
@ -1105,7 +1105,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ muted: true }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.have.property('mutedInfo').that.is.a('object');
@ -1122,7 +1122,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ url: 'chrome://crash' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { error } = JSON.parse(responseString);
expect(error).to.eq('I\'m sorry. I\'m afraid I can\'t do that.');
});
@ -1133,7 +1133,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ url: 'chrome://crash' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { error } = JSON.parse(responseString);
expect(error).to.eq('I\'m sorry. I\'m afraid I can\'t do that.');
});
@ -1144,7 +1144,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ url: 'devtools://blah' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { error } = JSON.parse(responseString);
expect(error).to.eq('Cannot navigate to a devtools:// page without either the devtools or debugger permission.');
});
@ -1155,7 +1155,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ url: 'chrome-untrusted://blah' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { error } = JSON.parse(responseString);
expect(error).to.eq('Cannot navigate to a chrome-untrusted:// page.');
});
@ -1166,7 +1166,7 @@ describe('chrome extensions', () => {
const message = { method: 'update', args: [{ url: 'file://blah' }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const { error } = JSON.parse(responseString);
expect(error).to.eq('Cannot navigate to a file URL without local file access.');
});
@ -1183,7 +1183,7 @@ describe('chrome extensions', () => {
const message = { method: 'query', args: [{ muted: true }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.have.lengthOf(1);
@ -1220,7 +1220,7 @@ describe('chrome extensions', () => {
const message = { method: 'query', args: [{ muted: true }] };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [, , responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.have.lengthOf(2);
for (const tab of response) {
@ -1270,7 +1270,7 @@ describe('chrome extensions', () => {
const message = { method: 'registerContentScripts' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.be.an('array').with.lengthOf(1);
expect(response[0]).to.deep.equal({
@ -1290,7 +1290,7 @@ describe('chrome extensions', () => {
const message = { method: 'globalParams' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response).to.deep.equal({ changed: true });
});
@ -1304,7 +1304,7 @@ describe('chrome extensions', () => {
const message = { method: 'insertCSS' };
w.webContents.executeJavaScript(`window.postMessage('${JSON.stringify(message)}', '*')`);
const [,, responseString] = await once(w.webContents, 'console-message');
const [{ message: responseString }] = await once(w.webContents, 'console-message');
const response = JSON.parse(responseString);
expect(response.success).to.be.true();

Просмотреть файл

@ -13,8 +13,8 @@ app.whenReady().then(function () {
win.loadFile('index.html');
win.webContents.on('console-message', (event, level, message) => {
console.log(message);
win.webContents.on('console-message', (event) => {
console.log(event.message);
});
win.webContents.on('did-finish-load', () => app.quit());

Просмотреть файл

@ -75,7 +75,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('Node.js Integration with Remote Content');
});
@ -88,7 +88,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security-onload-message.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', isLoaded);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', isLoaded);
expect(message).to.not.include('Node.js Integration with Remote Content');
});
@ -104,7 +104,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('Disabled webSecurity');
});
@ -116,7 +116,7 @@ describe('security warnings', () => {
useCsp = false;
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('Insecure Content-Security-Policy');
});
@ -146,7 +146,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('allowRunningInsecureContent');
});
@ -160,7 +160,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('experimentalFeatures');
});
@ -174,7 +174,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/base-page-security.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('enableBlinkFeatures');
});
@ -185,7 +185,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/webview-allowpopups.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('allowpopups');
});
@ -196,7 +196,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/insecure-resources.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.include('Insecure Resources');
});
@ -207,7 +207,7 @@ describe('security warnings', () => {
});
w.loadURL(`${serverUrl}/insecure-resources.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
const [{ message }] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning);
expect(message).to.not.include('insecure-resources.html');
});
});