mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
trigger beforeunload; fix crash when getting webContents after destroy
This commit is contained in:
@@ -47,6 +47,10 @@ BrowserWindow.prototype._init = function (this: BWT) {
|
||||
|
||||
this._browserViews = [];
|
||||
|
||||
this.on('close', () => {
|
||||
this._browserViews.forEach(b => b.webContents.close({ waitForBeforeUnload: true }));
|
||||
});
|
||||
|
||||
const warn = deprecate.warnOnceMessage('\'scroll-touch-{begin,end,edge}\' are deprecated and will be removed. Please use the WebContents \'input-event\' event instead.');
|
||||
this.webContents.on('input-event', (_, e) => {
|
||||
if (e.type === 'gestureScrollBegin') {
|
||||
|
||||
@@ -54,7 +54,10 @@ WebContentsView::~WebContentsView() {
|
||||
}
|
||||
|
||||
gin::Handle<WebContents> WebContentsView::GetWebContents(v8::Isolate* isolate) {
|
||||
return gin::CreateHandle(isolate, api_web_contents_);
|
||||
if (api_web_contents_)
|
||||
return gin::CreateHandle(isolate, api_web_contents_);
|
||||
else
|
||||
return gin::Handle<WebContents>();
|
||||
}
|
||||
|
||||
void WebContentsView::SetBackgroundColor(absl::optional<WrappedSkColor> color) {
|
||||
|
||||
Reference in New Issue
Block a user