refactor: remove duplicate <webview> event list (#25697)

This commit is contained in:
Milan Burda 2020-10-06 15:11:26 +02:00 committed by GitHub
parent 8207f6901d
commit db911f29ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 73 deletions

View file

@ -5,46 +5,13 @@ const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-interna
const ipcMainUtils = require('@electron/internal/browser/ipc-main-internal-utils');
const { parseWebViewWebPreferences } = require('@electron/internal/common/parse-features-string');
const { syncMethods, asyncMethods, properties } = require('@electron/internal/common/web-view-methods');
const { webViewEvents } = require('@electron/internal/common/web-view-events');
const { serialize } = require('@electron/internal/common/type-utils');
// Doesn't exist in early initialization.
let webViewManager = null;
const supportedWebViewEvents = [
'load-commit',
'did-attach',
'did-finish-load',
'did-fail-load',
'did-frame-finish-load',
'did-start-loading',
'did-stop-loading',
'dom-ready',
'console-message',
'context-menu',
'devtools-opened',
'devtools-closed',
'devtools-focused',
'will-navigate',
'did-start-navigation',
'did-navigate',
'did-frame-navigate',
'did-navigate-in-page',
'focus-change',
'close',
'crashed',
'render-process-gone',
'plugin-crashed',
'destroyed',
'page-title-updated',
'page-favicon-updated',
'enter-html-full-screen',
'leave-html-full-screen',
'media-started-playing',
'media-paused',
'found-in-page',
'did-change-theme-color',
'update-target-url'
];
const supportedWebViewEvents = Object.keys(webViewEvents);
const guestInstances = {};
const embedderElementsMap = {};
@ -119,7 +86,9 @@ const createGuest = function (embedder, params) {
});
};
for (const event of supportedWebViewEvents) {
fn(event);
if (event !== 'new-window') {
fn(event);
}
}
guest.on('new-window', function (event, url, frameName, disposition, options, additionalFeatures, referrer) {