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

Issue 233723002: Workarounding fix for save complete page problems.

Created:
6 years, 8 months ago by pdamek
Modified:
4 years, 2 months ago
CC:
chromium-reviews, benjhayden+dwatch_chromium.org, jam, jshin+watch_chromium.org, darin-cc_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Workarounding fix for save complete page problems. BUG=32771 This change is something between a real fix and a workaround in strict sense. The current save complete page architecture doesn't handle the cases of duplicate urls of the serializable resources, these are typically the do cuments - main one and the ones in iframes. The most severe symptom of the flaw is when an iframe has the same url as the main document. This is possible in a case when a document in the iframe is filled by a js document.write calls from the parent's document script(s). And there is no direct url loading in that iframe - e.g. by setting src attribute or by location DOM object of the iframe's window. In such case the main index file might not be saved, because an inappropriate sequence of actions were carried out - like save finished, write another data to already finished file. The fact that the architecture is flawed is also visible in a way the save page data is received from the renderer. First we get the list of serializable urls with no information about the number of occurences for each. And then when the data is received, we might get separate contents for each occurence of the given url. Knowing all above, the simple workaround is to prevent writing any more data when the file is already finished. This way we don't regress anything - in worst case the saved page will be incomplete. But there are plenty other possiblities it will be incomplete, because of more complex scripts that are generating content. Also, since index file is serialized as first, we won't suffer the case of not saving it and it is the most important file naturally. The complete fix would require a big task that would actually improve the whole save complete page functionality, so I simply elevated the workaround to a workarounding fix that should be sufficient as it fixes most cases and doesn't regress anything. With this change, saving the complete pages with duplicate urls among iframes and main doc should be considered successful in the SavePackage::wait_state_ sense, but the fact of the url duplication will be noted when trying to write more data to already finished file.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+164 lines, -18 lines) Patch
M chrome/browser/browser_encoding_browsertest.cc View 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/download/save_page_browsertest.cc View 1 chunk +4 lines, -2 lines 0 comments Download
M content/browser/download/download_manager_impl.h View 1 chunk +3 lines, -2 lines 0 comments Download
M content/browser/download/download_manager_impl.cc View 1 chunk +3 lines, -3 lines 0 comments Download
M content/browser/download/save_item.h View 2 chunks +12 lines, -0 lines 0 comments Download
M content/browser/download/save_item.cc View 2 chunks +6 lines, -0 lines 0 comments Download
M content/browser/download/save_package.h View 1 chunk +5 lines, -0 lines 0 comments Download
M content/browser/download/save_package.cc View 5 chunks +35 lines, -6 lines 0 comments Download
M content/browser/download/save_package_browsertest.cc View 3 chunks +71 lines, -0 lines 0 comments Download
M content/public/browser/download_manager.h View 1 chunk +4 lines, -3 lines 0 comments Download
A content/test/data/iframe_doc_write.htm View 1 chunk +17 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
pdamek
That is what I managed to do about https://code.google.com/p/chromium/issues/detail?id=32771
6 years, 8 months ago (2014-04-10 20:02:27 UTC) #1
asanka
On 2014/04/10 20:02:27, pdamek wrote: > That is what I managed to do about > ...
6 years, 8 months ago (2014-04-14 23:35:22 UTC) #2
pdamek
On 2014/04/14 23:35:22, asanka wrote: > On 2014/04/10 20:02:27, pdamek wrote: > > That is ...
6 years, 8 months ago (2014-04-15 13:27:13 UTC) #3
asanka
+rdsmith: FHI On 2014/04/15 13:27:13, pdamek wrote: > On 2014/04/14 23:35:22, asanka wrote: > > ...
6 years, 8 months ago (2014-04-15 20:10:43 UTC) #4
Randy Smith (Not in Mondays)
My perspective on this type of change is that user experience comes first, with code ...
6 years, 8 months ago (2014-04-15 20:47:52 UTC) #5
pdamek
> > document.open() sets the target document's url and origin to be equal to that ...
6 years, 8 months ago (2014-04-16 19:30:21 UTC) #6
Jay Civelli
4 years, 2 months ago (2016-10-21 22:43:21 UTC) #7
Can this CL be closed?

Powered by Google App Engine
This is Rietveld 408576698