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

Issue 1373573002: ABANDONED: OOPIFs: Moving stitching of local paths from renderer to browser process. (Closed)

Created:
5 years, 2 months ago by Łukasz Anforowicz
Modified:
5 years, 1 month ago
Reviewers:
ncarter (slow), dcheng
CC:
asanka, benjhayden+dwatch_chromium.org, chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, jam, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org, nasko+codewatch_chromium.org, site-isolation-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@page-serialization-recursive-begone
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

ABANDONED CL - REPLACED WITH crrev.com/1413103003 OOPIFs: Moving stitching of local paths from renderer to browser process. Context ======= Save-Page-As in complete-html mode replaces links to subframes and savable resources (i.e. img elements) with paths to locally saved files. This replacement used to be done in the renderer process, but has to be moved to the browser process, because with OOP iframes renderer process is not able to look into any data belonging to subframes living in another process (and "any data" covers URLs of subframes or lists of resources contained in subframes). Before this CL, saving (as complete html) a page with cross-site iframes in OOPIFs mode would crash the renderer process. After this CL there is no crash (and the test in save_page_browsertest.cc should prevent regressions). IPC Messages ============ This CL replaces the following 2 IPC messages: IPC_MESSAGE_ROUTED3(FrameMsg_GetSerializedHtmlWithLocalLinks, std::vector<GURL> /* urls that have local copy */, std::vector<base::FilePath> /* paths of local copy */, base::FilePath /* local directory path */) IPC_MESSAGE_ROUTED3(FrameHostMsg_SerializedHtmlWithLocalLinksResponse, GURL /* frame URL */, std::string /* data buffer */, int32 /* complete status */) with the following 5 IPC messages: IPC_MESSAGE_ROUTED0(FrameMsg_GetSerializedHtmlWithLocalLinks); IPC_MESSAGE_ROUTED1(FrameHostMsg_SerializedHtmlFragment, std::string /* data buffer */); IPC_MESSAGE_ROUTED1(FrameHostMsg_SerializedLocalPathForChildFrame, int /* RenderFrame's or RenderFrameProxy's routing id for the child frame we need a local path for.*/); IPC_MESSAGE_ROUTED1(FrameHostMsg_SerializedLocalPathForSavableResource, GURL /* savable resource link */); IPC_MESSAGE_ROUTED0(FrameHostMsg_SerializedEndOfFrame) Notice that - Urls and local paths are no longer passed from browser to renderer processes. - Renderer responses have been split into more granular responses (html fragment, local path for subresource, local path for child frame, end of data). All the other changes in the CL are a consequence of the IPC change outlined above. Other notes =========== Mapping frames and subframes to SaveItems is done via frame_tree_node_id. Note that the old WebPageSerializerImpl code [1] did *not* escape file paths embedded in serializer output as html attribute values. The current CL preserves this behavior (in SavePackage::SerializeLocalPathForSaveItem). [1] https://chromium.googlesource.com/chromium/blink/+/9d8944796d0b1208175177cda807910385f09d0b/Source/web/WebPageSerializerImpl.cpp#332 BUG=526786

Patch Set 1 #

Patch Set 2 : Self-review. #

Total comments: 5

Patch Set 3 : Rebasing... #

Total comments: 4

Patch Set 4 : Addressed Daniel's feedback + fixed issues uncovered by crrev.com/1362973003. #

Patch Set 5 : Rebasing... #

Total comments: 8

Patch Set 6 : Addressed 2nd round of Daniel's feedback. #

Patch Set 7 : Removed no longer needed WebKit dependency. #

Total comments: 46

Patch Set 8 : Addressed CR feedback from Nick (except escaping issue). #

Patch Set 9 : Addressing one more CR comment (missed in previous snapshot). #

Patch Set 10 : Rebasing... #

Total comments: 2

Patch Set 11 : Escaping of HTML attributes (+ some comment tweaks). #

Patch Set 12 : Rebasing... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+477 lines, -462 lines) Patch
M chrome/browser/download/save_page_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -3 lines 0 comments Download
M content/browser/DEPS View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -1 line 0 comments Download
M content/browser/download/save_item.h View 1 2 3 4 5 6 7 3 chunks +6 lines, -7 lines 0 comments Download
M content/browser/download/save_item.cc View 1 2 3 4 5 6 7 8 chunks +30 lines, -12 lines 0 comments Download
M content/browser/download/save_package.h View 1 2 3 4 5 6 7 5 chunks +60 lines, -33 lines 0 comments Download
M content/browser/download/save_package.cc View 1 2 3 4 5 6 7 8 9 10 13 chunks +189 lines, -144 lines 0 comments Download
M content/common/frame_messages.h View 1 2 3 4 5 6 7 8 9 2 chunks +24 lines, -11 lines 0 comments Download
M content/renderer/dom_serializer_browsertest.cc View 1 2 3 4 5 6 7 23 chunks +47 lines, -95 lines 0 comments Download
M content/renderer/render_frame_impl.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +6 lines, -8 lines 0 comments Download
M content/renderer/render_frame_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +25 lines, -25 lines 0 comments Download
M third_party/WebKit/Source/web/WebPageSerializer.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/web/WebPageSerializerImpl.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +10 lines, -32 lines 0 comments Download
M third_party/WebKit/Source/web/WebPageSerializerImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 10 chunks +33 lines, -47 lines 0 comments Download
M third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +17 lines, -3 lines 0 comments Download
M third_party/WebKit/public/web/WebPageSerializer.h View 1 chunk +1 line, -9 lines 0 comments Download
M third_party/WebKit/public/web/WebPageSerializerClient.h View 1 2 3 4 5 6 7 1 chunk +24 lines, -25 lines 0 comments Download

Messages

Total messages: 17 (4 generated)
Łukasz Anforowicz
Daniel, could you please take a look?
5 years, 2 months ago (2015-09-25 18:10:01 UTC) #2
Charlie Reis
Quick side note that I forgot to mention earlier: Please CC site-isolation-reviews@chromium.org on OOPIF related ...
5 years, 2 months ago (2015-09-25 19:52:09 UTC) #3
dcheng
The Blink bits looked fine. I reviewed the //content side, and individually, the pieces look ...
5 years, 2 months ago (2015-09-30 05:37:33 UTC) #4
Łukasz Anforowicz
Thanks Daniel. Could you take another look please? Please note that in addition to addressing ...
5 years, 2 months ago (2015-10-01 20:39:58 UTC) #5
dcheng
https://codereview.chromium.org/1373573002/diff/80001/content/browser/download/save_package.cc File content/browser/download/save_package.cc (left): https://codereview.chromium.org/1373573002/diff/80001/content/browser/download/save_package.cc#oldcode1221 content/browser/download/save_package.cc:1221: if (frame_url.is_valid()) It seems like we don't have this ...
5 years, 2 months ago (2015-10-05 07:53:08 UTC) #6
Łukasz Anforowicz
Charlie, could you please take a look? Daniel suggested that this CL might be ready ...
5 years, 2 months ago (2015-10-05 17:57:57 UTC) #8
Łukasz Anforowicz
Nick, could you please take a look?
5 years, 2 months ago (2015-10-06 19:42:43 UTC) #10
ncarter (slow)
https://codereview.chromium.org/1373573002/diff/120001/content/browser/download/save_package.cc File content/browser/download/save_package.cc (right): https://codereview.chromium.org/1373573002/diff/120001/content/browser/download/save_package.cc#newcode166 content/browser/download/save_package.cc:166: contents_id_(web_contents->GetRenderProcessHost()->GetID()), Not introduced by your cl, but just wanted ...
5 years, 2 months ago (2015-10-08 20:57:56 UTC) #11
ncarter (slow)
https://codereview.chromium.org/1373573002/diff/120001/content/browser/download/save_package.cc File content/browser/download/save_package.cc (right): https://codereview.chromium.org/1373573002/diff/120001/content/browser/download/save_package.cc#newcode1168 content/browser/download/save_package.cc:1168: attr_value = fallback_url.spec(); When does this happen? Could you ...
5 years, 2 months ago (2015-10-08 21:04:14 UTC) #12
Łukasz Anforowicz
Nick, can you take another look please? https://codereview.chromium.org/1373573002/diff/120001/content/browser/download/save_package.cc File content/browser/download/save_package.cc (right): https://codereview.chromium.org/1373573002/diff/120001/content/browser/download/save_package.cc#newcode166 content/browser/download/save_package.cc:166: contents_id_(web_contents->GetRenderProcessHost()->GetID()), On ...
5 years, 2 months ago (2015-10-09 16:54:08 UTC) #13
dcheng
https://codereview.chromium.org/1373573002/diff/120001/third_party/WebKit/Source/web/WebPageSerializerImpl.h File third_party/WebKit/Source/web/WebPageSerializerImpl.h (right): https://codereview.chromium.org/1373573002/diff/120001/third_party/WebKit/Source/web/WebPageSerializerImpl.h#newcode76 third_party/WebKit/Source/web/WebPageSerializerImpl.h:76: WebPageSerializerImpl(WebFrame*, WebPageSerializerClient*); On 2015/10/09 at 16:54:08, Łukasz Anforowicz wrote: ...
5 years, 2 months ago (2015-10-09 16:59:33 UTC) #14
ncarter (slow)
https://codereview.chromium.org/1373573002/diff/120001/content/browser/download/save_package.cc File content/browser/download/save_package.cc (right): https://codereview.chromium.org/1373573002/diff/120001/content/browser/download/save_package.cc#newcode166 content/browser/download/save_package.cc:166: contents_id_(web_contents->GetRenderProcessHost()->GetID()), On 2015/10/09 16:54:08, Łukasz Anforowicz wrote: > On ...
5 years, 2 months ago (2015-10-12 23:31:48 UTC) #15
Łukasz Anforowicz
5 years, 2 months ago (2015-10-21 22:50:35 UTC) #16
I am publishing replies to 2 CR comments addressed in recent patchsets (mostly
to get this CR out of the "issues with drafts by me" list in my Rietveld UI),
but please hold off with looking at the CL just yet - this CL will be most
likely abandoned and replaced with crrev.com/1414453007

https://codereview.chromium.org/1373573002/diff/120001/third_party/WebKit/Sou...
File third_party/WebKit/Source/web/WebPageSerializerImpl.h (right):

https://codereview.chromium.org/1373573002/diff/120001/third_party/WebKit/Sou...
third_party/WebKit/Source/web/WebPageSerializerImpl.h:76:
WebPageSerializerImpl(WebFrame*, WebPageSerializerClient*);
On 2015/10/09 16:59:33, dcheng wrote:
> On 2015/10/09 at 16:54:08, Łukasz Anforowicz wrote:
> > On 2015/10/08 20:57:55, ncarter wrote:
> > > Why drop the parameter names -- is that just The Blink Way? 
> > > 
> > > blink code is outside of my stylistic expertise, but to my
chromium-colored
> > > eyes, it seems like removing the parameter names and having the comments
> refer
> > > to the params by position makes this harder to understand than before.
> > 
> > Yes - this is blink-ism.  The error method from presubmit checks is:
> > 
> > ** Presubmit ERRORS **
> > check-webkit-style failed
> > third_party/WebKit/Source/web/WebPageSerializerImpl.h:76:  The parameter
name
> "client" adds no information, so it should be removed. 
> [readability/parameter_name] [5]
> > 
> > Yes - I also find documentation comments in blink world weird, when they
> cannot use parameter names when documenting them.  Maybe something worth
raising
> on chromium-dev?
> 
> Usually, we don't document parameters by position. I'd just update this
comment
> to say:
> Creates a serializer to serialize the given frame, sending the data to a
client
> sink interface to consume.

Done.

https://codereview.chromium.org/1373573002/diff/180001/content/browser/downlo...
File content/browser/download/save_package.cc (right):

https://codereview.chromium.org/1373573002/diff/180001/content/browser/downlo...
content/browser/download/save_package.cc:1188: // TODO(lukasza): Escape
attr_value (&quot; + &amp;).
On 2015/10/12 23:31:48, ncarter wrote:
> Responding to your comments in the earlier thread, three thoughts:
> 
> ==
> 
> I don't see this as being worrisome attack surface for a sandbox escape (since
> the attacker can write whatever they want to the file already), but it might
be
> an interesting target somehow from the web, to the extent that a saved-page
can
> insert """>;}"'/>"""LPT1 or something into what becomes the saved the
filename.
> We definitely need to plug the latter kind of hole as part of this CL, since
> we're losing the protection offered by blink.
> 
> ==
> 
> I don't see why we need any HTML escaping at all here?
> 
> The renderer has written everything up to and including the quotation mark,
say:
> 
> <img src="
> 
> And we have to write something after that that's a legal URL, that maps to the
> filename, and that doesn't break out of the context?, right? I think URL
> canonicalization (via GURL, or maybe there's another util) will do that.
> 
> In other words, quotation marks should become %22, not &quot; -- right?
> 
> ==
> 
> It looks like there might be some utils in net for going between file-scheme
> URLs and FilePaths, but I'm not sure if they help here or not.

Daniel pointed out net::EscapeForHTML.  I am not sure how I could have missed it
earlier.  Works great.

Powered by Google App Engine
This is Rietveld 408576698