Compare commits

..

8 Commits

Author SHA1 Message Date
Electron Bot
717b5263d5 Bump v11.4.7 2021-05-17 11:05:46 -07:00
trop[bot]
108e20a623 docs: --force-fieldtrials was h2 rather than h3 (#29180)
All the other argument headers were h3 (`###`) but `--force-fieldtrials` was h2 (`##`) for some reason.
I changed it to make it consistent with the others.

Co-authored-by: Noelle Leigh <5957867+noelleleigh@users.noreply.github.com>
2021-05-16 18:15:32 -07:00
trop[bot]
966a8623ab docs: Improve description of findInPage options (#29144) 2021-05-13 23:38:37 +02:00
Milan Burda
74ac9c2e13 fix: [webview] fix missing properties on events when contextIsolation: true (#26289) (#29150)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-05-13 23:38:17 +02:00
trop[bot]
776a6102e6 build: make patch auto fixes come from PatchUp rather than Electron Bot (#29157)
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-05-13 23:37:57 +02:00
Jeremy Rose
2ed8e63cfe fix: don't warn about enableRemoteModule when it's undefined (#29023)
* fix: don't warn about enableRemoteModule when it's undefined

* fix tests
2021-05-13 10:46:59 +02:00
trop[bot]
90b6db93a2 Create README.md (#29147)
Co-authored-by: Ondreas <74183220+OndreasCZ@users.noreply.github.com>
2021-05-12 23:40:44 -07:00
Shatyuka
48605866c4 fix: increase corner radius for vibrancy view on big sur (#29072) 2021-05-10 18:11:52 -04:00
16 changed files with 67 additions and 50 deletions

View File

@@ -261,7 +261,7 @@ step-gclient-sync: &step-gclient-sync
if ! git diff-index --quiet HEAD --; then
# There are changes to the patches. Make a git commit with the updated patches
git add patches
GIT_COMMITTER_NAME="Electron Bot" GIT_COMMITTER_EMAIL="electron@github.com" git commit -m "update patches" --author="Electron Bot <electron@github.com>"
GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
# Export it
mkdir -p ../../patches
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch

View File

@@ -1 +1 @@
11.4.6
11.4.7

View File

@@ -5,7 +5,7 @@
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/4lggi9dpjc1qob7k/branch/master?svg=true)](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/master)
[![devDependency Status](https://david-dm.org/electron/electron/dev-status.svg)](https://david-dm.org/electron/electron?type=dev)
:memo: Available Translations: 🇨🇳 🇹🇼 🇧🇷 🇪🇸 🇰🇷 🇯🇵 🇷🇺 🇫🇷 🇹🇭 🇳🇱 🇹🇷 🇮🇩 🇺🇦 🇨🇿 🇮🇹 🇵🇱.
:memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪.
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/).
The Electron framework lets you write cross-platform desktop applications

View File

@@ -79,7 +79,7 @@ This switch can not be used in `app.commandLine.appendSwitch` since it is parsed
earlier than user's app is loaded, but you can set the `ELECTRON_ENABLE_LOGGING`
environment variable to achieve the same effect.
## --force-fieldtrials=`trials`
### --force-fieldtrials=`trials`
Field trials to be forcefully enabled or disabled.

View File

@@ -1233,8 +1233,7 @@ Inserts `text` to the focused element.
* `text` String - Content to be searched, must not be empty.
* `options` Object (optional)
* `forward` Boolean (optional) - Whether to search forward or backward, defaults to `true`.
* `findNext` Boolean (optional) - Whether the operation is first request or a follow up,
defaults to `false`.
* `findNext` Boolean (optional) - Whether to begin a new text finding session with this request. Should be `true` for initial requests, and `false` for follow-up requests. Defaults to `false`.
* `matchCase` Boolean (optional) - Whether search should be case-sensitive,
defaults to `false`.
* `wordStart` Boolean (optional) - Whether to look only at the start of words.

View File

@@ -515,8 +515,7 @@ Inserts `text` to the focused element.
* `text` String - Content to be searched, must not be empty.
* `options` Object (optional)
* `forward` Boolean (optional) - Whether to search forward or backward, defaults to `true`.
* `findNext` Boolean (optional) - Whether the operation is first request or a follow up,
defaults to `false`.
* `findNext` Boolean (optional) - Whether to begin a new text finding session with this request. Should be `true` for initial requests, and `false` for follow-up requests. Defaults to `false`.
* `matchCase` Boolean (optional) - Whether search should be case-sensitive,
defaults to `false`.
* `wordStart` Boolean (optional) - Whether to look only at the start of words.

View File

@@ -270,7 +270,7 @@ const warnAboutAllowedPopups = function () {
const warnAboutRemoteModuleWithRemoteContent = function (webPreferences?: Electron.WebPreferences) {
if (!webPreferences || isLocalhost()) return;
const remoteModuleEnabled = webPreferences.enableRemoteModule != null ? !!webPreferences.enableRemoteModule : true;
const remoteModuleEnabled = webPreferences.enableRemoteModule != null ? !!webPreferences.enableRemoteModule : false;
if (!remoteModuleEnabled) return;
if (getIsRemoteProtocol()) {

View File

@@ -1,4 +1,4 @@
import { webFrame, IpcMessageEvent } from 'electron';
import { webFrame } from 'electron';
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal';
import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils';
@@ -52,15 +52,15 @@ const dispatchEvent = function (
dispatchEvent(webView, DEPRECATED_EVENTS[eventName], eventKey, ...args);
}
const domEvent = new Event(eventName) as ElectronInternal.WebViewEvent;
const props: Record<string, any> = {};
WEB_VIEW_EVENTS[eventKey].forEach((prop, index) => {
(domEvent as any)[prop] = args[index];
props[prop] = args[index];
});
webView.dispatchEvent(domEvent);
webView.dispatchEvent(eventName, props);
if (eventName === 'load-commit') {
webView.onLoadCommit(domEvent);
webView.onLoadCommit(props);
} else if (eventName === 'focus-change') {
webView.onFocusChange();
}
@@ -70,8 +70,7 @@ export function registerEvents (webView: WebViewImpl, viewInstanceId: number) {
ipcRendererInternal.onMessageFromMain(`ELECTRON_GUEST_VIEW_INTERNAL_DESTROY_GUEST-${viewInstanceId}`, function () {
webView.guestInstanceId = undefined;
webView.reset();
const domEvent = new Event('destroyed');
webView.dispatchEvent(domEvent);
webView.dispatchEvent('destroyed');
});
ipcRendererInternal.onMessageFromMain(`ELECTRON_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-${viewInstanceId}`, function (event, eventName, ...args) {
@@ -79,11 +78,7 @@ export function registerEvents (webView: WebViewImpl, viewInstanceId: number) {
});
ipcRendererInternal.onMessageFromMain(`ELECTRON_GUEST_VIEW_INTERNAL_IPC_MESSAGE-${viewInstanceId}`, function (event, channel, ...args) {
const domEvent = new Event('ipc-message') as IpcMessageEvent;
domEvent.channel = channel;
domEvent.args = args;
webView.dispatchEvent(domEvent);
webView.dispatchEvent('ipc-message', { channel, args });
});
}

View File

@@ -39,7 +39,13 @@ const defineWebViewElement = (v8Util: NodeJS.V8UtilBinding, webViewImpl: typeof
constructor () {
super();
v8Util.setHiddenValue(this, 'internal', new WebViewImpl(this));
const internal = new WebViewImpl(this);
internal.dispatchEventInMainWorld = (eventName, props) => {
const event = new Event(eventName);
Object.assign(event, props);
return internal.webviewNode.dispatchEvent(event);
};
v8Util.setHiddenValue(this, 'internal', internal);
}
connectedCallback () {

View File

@@ -37,6 +37,8 @@ export class WebViewImpl {
public attributes = new Map<string, WebViewAttribute>();
public setupWebViewAttributes (): void {}
public dispatchEventInMainWorld?: (eventName: string, props: any) => boolean;
constructor (public webviewNode: HTMLElement) {
// Create internal iframe element.
this.internalElement = this.createInternalElement();
@@ -107,10 +109,11 @@ export class WebViewImpl {
}
onElementResize () {
const resizeEvent = new Event('resize') as ElectronInternal.WebFrameResizeEvent;
resizeEvent.newWidth = this.webviewNode.clientWidth;
resizeEvent.newHeight = this.webviewNode.clientHeight;
this.dispatchEvent(resizeEvent);
const props = {
newWidth: this.webviewNode.clientWidth,
newHeight: this.webviewNode.clientHeight
};
this.dispatchEvent('resize', props);
}
createGuest () {
@@ -119,8 +122,8 @@ export class WebViewImpl {
});
}
dispatchEvent (webViewEvent: Electron.Event) {
this.webviewNode.dispatchEvent(webViewEvent);
dispatchEvent (eventName: string, props: Record<string, any> = {}) {
this.dispatchEventInMainWorld!(eventName, props);
}
// Adds an 'on<event>' property on the webview, which can be used to set/unset
@@ -145,10 +148,10 @@ export class WebViewImpl {
}
// Updates state upon loadcommit.
onLoadCommit (webViewEvent: ElectronInternal.WebViewEvent) {
onLoadCommit (props: Record<string, any>) {
const oldValue = this.webviewNode.getAttribute(WEB_VIEW_CONSTANTS.ATTRIBUTE_SRC);
const newValue = webViewEvent.url;
if (webViewEvent.isMainFrame && (oldValue !== newValue)) {
const newValue = props.url;
if (props.isMainFrame && (oldValue !== newValue)) {
// Touching the src attribute triggers a navigation. To avoid
// triggering a page reload on every guest-initiated navigation,
// we do not handle this mutation.
@@ -161,7 +164,7 @@ export class WebViewImpl {
const hasFocus = this.webviewNode.ownerDocument.activeElement === this.webviewNode;
if (hasFocus !== this.hasFocus) {
this.hasFocus = hasFocus;
this.dispatchEvent(new Event(hasFocus ? 'focus' : 'blur'));
this.dispatchEvent(hasFocus ? 'focus' : 'blur');
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "electron",
"version": "11.4.6",
"version": "11.4.7",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {

View File

@@ -1580,7 +1580,12 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
// Make frameless Vibrant windows have rounded corners.
if (!has_frame() && !is_modal()) {
CGFloat radius = 5.0f; // default corner radius
CGFloat radius;
if (@available(macOS 11.0, *)) {
radius = 9.0f;
} else {
radius = 5.0f; // smaller corner radius on older versions
}
CGFloat dimension = 2 * radius + 1;
NSSize size = NSMakeSize(dimension, dimension);
NSImage* maskImage = [NSImage imageWithSize:size

View File

@@ -50,8 +50,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 11,4,6,0
PRODUCTVERSION 11,4,6,0
FILEVERSION 11,4,7,0
PRODUCTVERSION 11,4,7,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -68,12 +68,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "GitHub, Inc."
VALUE "FileDescription", "Electron"
VALUE "FileVersion", "11.4.6"
VALUE "FileVersion", "11.4.7"
VALUE "InternalName", "electron.exe"
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
VALUE "OriginalFilename", "electron.exe"
VALUE "ProductName", "Electron"
VALUE "ProductVersion", "11.4.6"
VALUE "ProductVersion", "11.4.7"
VALUE "SquirrelAwareVersion", "1"
END
END

View File

@@ -228,7 +228,7 @@ describe('security warnings', () => {
it('should warn about enabled remote module with remote content', async () => {
w = new BrowserWindow({
show: false,
webPreferences
webPreferences: { ...webPreferences, enableRemoteModule: true }
});
w.loadURL(`${serverUrl}/base-page-security.html`);
@@ -239,7 +239,7 @@ describe('security warnings', () => {
it('should not warn about enabled remote module with remote content from localhost', async () => {
w = new BrowserWindow({
show: false,
webPreferences
webPreferences: { ...webPreferences, enableRemoteModule: true }
});
w.loadURL(`${serverUrl}/base-page-security-onload-message.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', isLoaded);

View File

@@ -687,6 +687,26 @@ describe('<webview> tag', function () {
describe('DOM events', () => {
afterEach(closeAllWindows);
it('receives extra properties on DOM events when contextIsolation is enabled', async () => {
const w = new BrowserWindow({
show: false,
webPreferences: {
webviewTag: true,
contextIsolation: true
}
});
await w.loadURL('about:blank');
const message = await w.webContents.executeJavaScript(`new Promise((resolve, reject) => {
const webview = new WebView()
webview.setAttribute('src', 'data:text/html,<script>console.log("hi")</script>')
webview.addEventListener('console-message', (e) => {
resolve(e.message)
})
document.body.appendChild(webview)
})`);
expect(message).to.equal('hi');
});
it('emits focus event when contextIsolation is enabled', async () => {
const w = new BrowserWindow({
show: false,

View File

@@ -277,16 +277,6 @@ declare namespace ElectronInternal {
allowGuestViewElementDefinition(window: Window, context: any): void;
}
interface WebFrameResizeEvent extends Electron.Event {
newWidth: number;
newHeight: number;
}
interface WebViewEvent extends Event {
url: string;
isMainFrame: boolean;
}
class WebViewElement extends HTMLElement {
static observedAttributes: Array<string>;