Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Issue 112203003: Fix renderer crashes when frame gets detached while injectng user scripts. (Closed)

Created:
7 years ago by mharanczyk
Modified:
6 years, 1 month ago
CC:
chromium-reviews, joi+watch-content_chromium.org, chromium-apps-reviews_chromium.org, darin-cc_chromium.org, jam, extensions-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Fix renderer crashes when frame gets detached while injectng user scripts. If extension injected user script contains synchronous XHR it will cause handling of onload event for given frame. Handling this event may detach frame. Added checks if render/web view still exists for that frame after injecting extension scripts to avoid crashes. BUG=328342

Patch Set 1 #

Patch Set 2 : Added render view browser tests that perform synchronous frame removal on loading finished. #

Total comments: 2

Patch Set 3 : Review fixes. #

Patch Set 4 : Added <!DOCTYPE html> to tests. #

Patch Set 5 : Updated patch to latest WebFrame/Frame lifetime changes. #

Total comments: 2

Patch Set 6 : Rebase #

Patch Set 7 : Moved some null checks from RenderViewImpl to RenderFrameImpl after rebase. document_start injectio… #

Patch Set 8 : Defer frame destruction until event loop. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+9548 lines, -9463 lines) Patch
M chrome/renderer/extensions/dispatcher.cc View 1 2 3 4 5 6 7 1 chunk +1696 lines, -1693 lines 0 comments Download
M chrome/renderer/extensions/user_script_slave.cc View 1 2 3 4 5 6 7 1 chunk +383 lines, -381 lines 0 comments Download
M components/autofill/content/renderer/page_click_tracker.cc View 1 2 3 4 5 6 7 1 chunk +148 lines, -146 lines 0 comments Download
M components/autofill/content/renderer/password_autofill_agent.cc View 1 2 3 4 5 6 7 1 chunk +879 lines, -879 lines 0 comments Download
M content/renderer/render_frame_impl.h View 1 2 3 4 5 6 7 1 chunk +417 lines, -414 lines 0 comments Download
M content/renderer/render_frame_impl.cc View 1 2 3 4 5 6 7 1 chunk +2239 lines, -2221 lines 1 comment Download
M content/renderer/render_view_browsertest.cc View 1 2 3 4 5 6 7 1 chunk +2307 lines, -2253 lines 0 comments Download
M content/renderer/render_view_impl.h View 1 2 3 4 5 6 7 1 chunk +1479 lines, -1476 lines 1 comment Download

Messages

Total messages: 25 (0 generated)
mharanczyk
7 years ago (2013-12-13 11:11:31 UTC) #1
asargent_no_longer_on_chrome
lgtm
7 years ago (2013-12-13 17:20:41 UTC) #2
jamesr
Test? To unsubscribe from this group and stop receiving emails from it, send an email ...
7 years ago (2013-12-13 17:55:38 UTC) #3
mharanczyk
On 2013/12/13 17:55:38, jamesr wrote: > Test? > > To unsubscribe from this group and ...
7 years ago (2013-12-17 13:57:42 UTC) #4
jamesr
I don't know what the best way to test this is, but without a regression ...
7 years ago (2013-12-19 21:26:17 UTC) #5
mharanczyk
Added render view browsertests.
6 years, 11 months ago (2014-01-08 08:10:29 UTC) #6
mharanczyk
James, can you please give me your opinion on the tests? I prefer to make ...
6 years, 11 months ago (2014-01-15 08:17:56 UTC) #7
jamesr
I don't understand your comment about sync XHR. Does this test fail without your patch? ...
6 years, 11 months ago (2014-01-15 18:56:14 UTC) #8
mharanczyk
Yes, both tests cause crash and fail without patch. Regarding XHR comment: test do same ...
6 years, 11 months ago (2014-01-16 08:57:35 UTC) #9
mharanczyk
James, is my explanation sufficient?
6 years, 11 months ago (2014-01-23 10:15:13 UTC) #10
jamesr
sorry for the delay. lgtm, but add <!DOCTYPE html> to the start of the test ...
6 years, 11 months ago (2014-01-25 01:35:49 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mharanczyk@opera.com/112203003/190001
6 years, 11 months ago (2014-01-27 09:47:03 UTC) #12
commit-bot: I haz the power
Retried try job too often on mac_rel for step(s) content_browsertests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=mac_rel&number=216568
6 years, 11 months ago (2014-01-27 10:14:31 UTC) #13
mharanczyk
Hi! It looks like behavior changed a bit while this patch was in review, unfortunately ...
6 years, 10 months ago (2014-01-30 11:20:36 UTC) #14
jamesr
+nasko who's been following the frame lifetime changes lately. Do you have anything to suggest ...
6 years, 10 months ago (2014-02-03 22:24:03 UTC) #15
nasko
Adding dcheng@, who has been changing lifetime of Frame/WebFrame.
6 years, 10 months ago (2014-02-03 22:49:57 UTC) #16
dcheng
Nasko points out that we're calling WebFrame::executeScriptInIsolatedWorld() in a loop. Any one of these script ...
6 years, 10 months ago (2014-02-03 23:05:48 UTC) #17
mharanczyk
I already have minimal changes that fix the crash, but here are my thoughts: 1. ...
6 years, 10 months ago (2014-02-04 10:04:13 UTC) #18
mharanczyk
Since there was no response I've updated patch with minimal changes required to fix the ...
6 years, 10 months ago (2014-02-07 13:28:27 UTC) #19
Jói
//components LGTM
6 years, 10 months ago (2014-02-07 13:41:05 UTC) #20
dcheng
Wouldn't we need a similar guard for "document_idle" or "document_end" as well? (I'm not sure ...
6 years, 10 months ago (2014-02-07 16:53:37 UTC) #21
mharanczyk
> Wouldn't we need a similar guard for "document_idle" or "document_end" as well? > (I'm ...
6 years, 10 months ago (2014-02-21 08:29:32 UTC) #22
mharanczyk
I created TCs for all three injection cases and uploaded fixes for document_start and document_end. ...
6 years, 10 months ago (2014-02-25 10:27:24 UTC) #23
dcheng
On 2014/02/25 10:27:24, mharanczyk wrote: > I created TCs for all three injection cases and ...
6 years, 10 months ago (2014-02-26 06:31:41 UTC) #24
dcheng
6 years, 10 months ago (2014-02-26 19:37:22 UTC) #25
https://codereview.chromium.org/112203003/diff/630001/content/renderer/render...
File content/renderer/render_frame_impl.cc (right):

https://codereview.chromium.org/112203003/diff/630001/content/renderer/render...
content/renderer/render_frame_impl.cc:1052:
base::Bind(&RenderFrameImpl::closeFrame, frame));
We can simplify this slightly:
base::Bind(&WebFrame::close, base::Unretained(frame))

No need to thunk through a static. That being said, I've given this some thought
and I think we should move this logic into WebFrame. So you might be able to
remove this part from your CL completely (we'll still need the null checks that
were added)

https://codereview.chromium.org/112203003/diff/630001/content/renderer/render...
File content/renderer/render_view_impl.h (right):

https://codereview.chromium.org/112203003/diff/630001/content/renderer/render...
content/renderer/render_view_impl.h:803:
FRIEND_TEST_ALL_PREFIXES(SynchronousFrameRemovalOnLoadTest, StaticFrame);
Are these friend declarations needed? I don't see any reference to RVI in the
browser tests.

Powered by Google App Engine
This is Rietveld 408576698