Chromium Code Reviews
DescriptionWorkarounding 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 #Messages
Total messages: 7 (0 generated)
|