Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: webview crash on iframe removal #18976

Merged
merged 4 commits into from Jun 28, 2019

Conversation

alexstrat
Copy link
Contributor

@alexstrat alexstrat commented Jun 25, 2019

Fixes #18788 #17890

Description of Change

Backports this Chromium fix as a patch in 5-0-0 branch.

As a consequence, remove the previous and temporary patch introduced in electron/libchromiumcontent#676

cc @codebytere @zcbenz @deepak1556

Checklist

Release Notes

Notes: Fix webview crash on iframe removal

@alexstrat alexstrat requested a review from a team as a code owner June 25, 2019 15:53
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jun 25, 2019
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexandre=20Lach=C3=A8ze?= <alexandre.lacheze@gmail.com>
Date: Tue, 25 Jun 2019 17:36:08 +0200
Subject: Portals: Fix crash when detaching OOPIF from portal.
Copy link
Contributor Author

@alexstrat alexstrat Jun 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cherry-picked the Chromium commit as it. Not sure it is the expected patch formatting for electron in the end.

@codebytere
Copy link
Member

@alexstrat were you able to determine what specifically about this patch breaks the functionality? Ideally i'd love to pare down the patch as much as possible to just the components that are necessary to revert 🤔

@alexstrat
Copy link
Contributor Author

alexstrat commented Jun 25, 2019

@codebytere my interpretation is that:

Previously, Chromium was unable to detach a subframe of a (inner) webcontents inside a (outter) webcontens (for instance, in our case, a webview in a BrowserWindow). That's basically the statement I read in this comment and that led @zcbenz to this patch (we just don't detach).

The Chromium patch seems to fix exactly this case:

Prior to this change, any detachment of a proxy would cause the inner WebContents to get detached from the outer WebContents.

That's why I would argue to keep the whole patch as it.

That being said, my current knowledge of Chromium architecture did not allow me to:

  • understand/find the root cause of the issue, so I'm providing what I'm only considering as an interpretation for now
  • understand correctly how the patch in Chromium actually fixes the issue

Therefore, I think the interpretation and opinion of @zcbenz is necessary here.

@deepak1556
Copy link
Member

deepak1556 commented Jun 25, 2019

Should also try to revert the manual management #14487 and see if the issue persists on reload. The new CL seems to address the concerns raised by Cheng's PR, but would be great to get in some tests.

@alexstrat can you add in tests for the iframe issues that are fixed by the new patch, seems like there are repros that could be turned into a test. Thanks!

@alexstrat
Copy link
Contributor Author

Should also try to revert the manual management #14487 and see if the issue persists on reload. The new CL seems to address the concerns raised by Cheng's PR, but would be great to get in some tests.

I should rather do that on master, right?

@alexstrat can you add in tests for the iframe issues that are fixed by the new patch, seems like there are repros that could be turned into a test. Thanks!

Yes, I’ll try that. Though the difficulty is that the webview does not really crash, it just stops to render. So, I still don’t know how to catch that in a test. I’d appreciate ideas!

@deepak1556
Copy link
Member

Though the difficulty is that the webview does not really crash, it just stops to render. So, I still don’t know how to catch that in a test. I’d appreciate ideas!

Does that trigger webContents unresponsive event ? we could listen for that.

@zcbenz
Copy link
Member

zcbenz commented Jun 26, 2019

Can you double check this wouldn't cause regression on #14211?

@alexstrat
Copy link
Contributor Author

alexstrat commented Jun 26, 2019

@deepak1556 Regarding testing, neither the 'unresponsive' nor 'crashed' events are fired when the webview freezes.

I tried to hook into the 'paint' event as well but it does not seem I'm able to catch the paint events for the webview and the paint event for the outer webcontents (BrowserWindow) keeps flowing after iframe removal. 😞

Have you other suggestion?

@alexstrat
Copy link
Contributor Author

alexstrat commented Jun 26, 2019

@zcbenz I tried to reproduce #14211 with the instructions provided in description (I waited for ~20 reloads) and could not reproduce it => this patch does NOT cause a regression on #14211

Edit: after reverting #14487 on top of this patch, I did not reproduce #14211. So I guess this patch makes #14487 not useful anymore.

I can suggest a PR that reverts #14487 but I think we should 1/ first backport this CL like suggested here so that 5-0-0 matches 6-0-0 and master, and 2/ revert #14487 on master and backport the revert in 6-0-0 and 5-0-0.

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jun 26, 2019
@zcbenz
Copy link
Member

zcbenz commented Jun 27, 2019

I can suggest a PR that reverts #14211 but I think we should 1/ first backport this CL like suggested here so that 5-0-0 matches 6-0-0 and master, and 2/ revert #14211 on master and backport the revert in 6-0-0 and 5-0-0.

The plan sounds good to me.

@deepak1556
Copy link
Member

deepak1556 commented Jun 27, 2019

Can you revert the deletion of disable_detach_webview_frame.patch otherwise it doesn't match 6-0-x and master. And as you suggested, a separate PR targeting master can then remove this patch along with the manual management, and probably add some tests.

@alexstrat
Copy link
Contributor Author

alexstrat commented Jun 27, 2019

Can you revert the deletion of disable_detach_webview_frame.patch otherwise, it doesn't match 6-0-x and master.

@deepak1556 good catch, yes!

✅done:

  • I made sure the CL is the first patch executed
  • I took disable_detach_webview_frame.patch as it is just after bumping chromium to 76.0.3783.1 so that it matches as much as possible 6-0-x and master (even if it does not seem to have evolved since then)

@deepak1556 deepak1556 added 5-0-x backport This is a backport PR labels Jun 27, 2019
@zcbenz zcbenz merged commit 61d9d7c into electron:5-0-x Jun 28, 2019
@release-clerk
Copy link

release-clerk bot commented Jun 28, 2019

Release Notes Persisted

Fix webview crash on iframe removal

@subbiah95
Copy link

subbiah95 commented Mar 2, 2020

@deepak1556 , I have a similar crash going on in V4.0.0, I am using webview, the crash happened twice, 3 and 5 seconds after start
the crash points to..
/content/browser/frame_host/render_frame_host_manager.cc
GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv, nullptr);

Is my crash same as this one ?
I am not attaching the dump file as I have changed few codes in a few modules(nothing to do with crash)
electron_crash

@deepak1556
Copy link
Member

@subbiah95 Can't say for sure without the dump, but I would suggest to try newer versions of electron where the crash might be fixed, V4 is quite old and unsupported release line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5-0-x backport This is a backport PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants