chore: make WebContentsView take webPreferences as parameter (#22997)

* chore: add WebContentsView.webContents helper

* chore: no need to handle webContents option

* chore: Create WebContentsView in C++

* chore: make WebContentsView accept web_preferences

* fix: nativeWindowOpen still passes WebContents to BrowserWindow

* chore: no more need of WebContentsViewRelay

* test: WebContentsView now takes options

* fix: avoid creating 2 constructors
This commit is contained in:
Cheng Zhao 2020-04-09 16:01:16 +09:00 committed by GitHub
parent de893360f7
commit ca947307db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 108 additions and 92 deletions

View file

@ -1,7 +1,7 @@
'use strict';
const electron = require('electron');
const { WebContentsView, TopLevelWindow, deprecate } = electron;
const { TopLevelWindow, deprecate } = electron;
const { BrowserWindow } = process.electronBinding('window');
Object.setPrototypeOf(BrowserWindow.prototype, TopLevelWindow.prototype);
@ -13,9 +13,6 @@ BrowserWindow.prototype._init = function () {
// Avoid recursive require.
const { app } = electron;
// Create WebContentsView.
this.setContentView(new WebContentsView(this.webContents));
const nativeSetBounds = this.setBounds;
this.setBounds = (bounds, ...opts) => {
bounds = {