Compare commits

..

4 Commits

Author SHA1 Message Date
Electron Bot
6c04533fca Bump v10.0.0-beta.15 2020-07-29 11:03:57 -07:00
Jeremy Rose
99f1d7e57a fix: wrap OnWindowMessage w/ handlescope (#24716) (#24768) 2020-07-28 20:34:20 -07:00
trop[bot]
009105db4f fix: crash when navigating from a page with webview that has inherited zoom level (#24763)
* fix: cleanup webview zoom level observers on navigation

* add spec

* webview should be on same partition

* wait for webview to finish loading

Co-authored-by: deepak1556 <hop2deep@gmail.com>
2020-07-28 19:18:39 -07:00
trop[bot]
b2f09a1469 fix: disable rosetta as Electron does not run under rosetta (#24742)
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
2020-07-28 10:56:18 -07:00
13 changed files with 59 additions and 6 deletions

View File

@@ -1 +1 @@
10.0.0-beta.14
10.0.0-beta.15

View File

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

View File

@@ -12,5 +12,7 @@
<string>APPL</string>
<key>LSBackgroundOnly</key>
<true/>
<key>LSRequiresNativeExecution</key>
<true/>
</dict>
</plist>

View File

@@ -14,6 +14,7 @@
#include "shell/browser/api/electron_api_menu.h"
#include "shell/browser/api/electron_api_view.h"
#include "shell/browser/api/electron_api_web_contents.h"
#include "shell/browser/javascript_environment.h"
#include "shell/common/color_util.h"
#include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_converters/file_path_converter.h"
@@ -300,9 +301,12 @@ void TopLevelWindow::OnWindowMessage(UINT message,
WPARAM w_param,
LPARAM l_param) {
if (IsWindowMessageHooked(message)) {
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
v8::Locker locker(isolate);
v8::HandleScope scope(isolate);
messages_callback_map_[message].Run(
ToBuffer(isolate(), static_cast<void*>(&w_param), sizeof(WPARAM)),
ToBuffer(isolate(), static_cast<void*>(&l_param), sizeof(LPARAM)));
ToBuffer(isolate, static_cast<void*>(&w_param), sizeof(WPARAM)),
ToBuffer(isolate, static_cast<void*>(&l_param), sizeof(LPARAM)));
}
}
#endif

View File

@@ -1418,6 +1418,11 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
// we need to make sure the api::WebContents is also deleted.
// For #4, the WebContents will be destroyed by embedder.
void WebContents::WebContentsDestroyed() {
// Give chance for guest delegate to cleanup its observers
// since the native class is only destroyed in the next tick.
if (guest_delegate_)
guest_delegate_->WillDestroy();
// Cleanup relationships with other parts.
RemoveFromWeakMap();

View File

@@ -40,5 +40,7 @@
<string>This app needs access to the microphone</string>
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera</string>
<key>LSRequiresNativeExecution</key>
<true/>
</dict>
</plist>

View File

@@ -50,8 +50,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 10,0,0,14
PRODUCTVERSION 10,0,0,14
FILEVERSION 10,0,0,15
PRODUCTVERSION 10,0,0,15
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L

View File

@@ -57,6 +57,10 @@ void WebViewGuestDelegate::AttachToIframe(
api_web_contents_->Emit("did-attach");
}
void WebViewGuestDelegate::WillDestroy() {
ResetZoomController();
}
void WebViewGuestDelegate::DidDetach() {
ResetZoomController();
}

View File

@@ -24,6 +24,7 @@ class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate,
// Attach to the iframe.
void AttachToIframe(content::WebContents* embedder_web_contents,
int embedder_frame_id);
void WillDestroy();
protected:
// content::BrowserPluginGuestDelegate:

View File

@@ -14,5 +14,7 @@
<true/>
<key>CFBundleVersion</key>
<string>${ELECTRON_VERSION}</string>
<key>LSRequiresNativeExecution</key>
<true/>
</dict>
</plist>

View File

@@ -12,5 +12,7 @@
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>LSRequiresNativeExecution</key>
<true/>
</dict>
</plist>

View File

@@ -315,6 +315,25 @@ describe('<webview> tag', function () {
const [, zoomLevel] = await emittedOnce(ipcMain, 'webview-origin-zoom-level');
expect(zoomLevel).to.equal(2.0);
});
it('does not crash when navigating with zoom level inherited from parent', async () => {
const w = new BrowserWindow({
show: false,
webPreferences: {
webviewTag: true,
nodeIntegration: true,
zoomFactor: 1.2,
session: webviewSession
}
});
const attachPromise = emittedOnce(w.webContents, 'did-attach-webview');
const readyPromise = emittedOnce(ipcMain, 'dom-ready');
w.loadFile(path.join(fixtures, 'pages', 'webview-zoom-inherited.html'));
const [, webview] = await attachPromise;
await readyPromise;
expect(webview.getZoomFactor()).to.equal(1.2);
await w.loadURL(`${zoomScheme}://host1`);
});
});
describe('nativeWindowOpen option', () => {

View File

@@ -0,0 +1,12 @@
<html>
<body>
<webview src="./a.html" id="view" partition="webview-temp"/>
</body>
<script>
const {ipcRenderer} = require('electron')
const view = document.getElementById('view')
view.addEventListener('dom-ready', () => {
ipcRenderer.send('dom-ready')
})
</script>
</html>