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

Issue 1829893003: Fix how Save-Page-As responds to web requests blocked by extensions. (Closed)

Created:
4 years, 9 months ago by Łukasz Anforowicz
Modified:
4 years, 9 months ago
Reviewers:
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@2661
Target Ref:
refs/pending/branch-heads/2661
Project:
chromium
Visibility:
Public.

Description

Fix how Save-Page-As responds to web requests blocked by extensions. AdBlocker extensions exercise (via chrome.webRequest API) a code path where ResourceHandler (and in particular SaveFileResourceHandler) reports a failure via OnResponseCompleted without first calling OnResponseStarted. This code path is also executed when the request fails before HTTP headers are received and parsed (i.e. if the host name could not be resolved by DNS). In this code path, SaveFileManager::SaveFinished is called before SaveFileManager::StartSave got called. This means that when SaveFinished calls LookupSaveFile, it won't find anything. This behavior has regressed in https://crrev.com/1484093002, which removed the "else" clause in SaveFinished method, incorrectly thinking that save_item_id-based lookup will always succeed because of the other changes made in the CL. This CL fixes the problem by always calling OnSaveFinished (even if LookupSaveFile failed). To make this work, we need to make sure that SavePackage lookup in SaveFinished succeeds, even if OnStartSave was not called (this is where |package_| map was populated before the fix). To accomplish this, the fix moves populating the |package_| map (SaveItemId to SavePackage* map) earlier - from OnStartSave into SaveURL method. BUG=595345 Review URL: https://codereview.chromium.org/1812693002 Cr-Commit-Position: refs/heads/master@{#382577} (cherry picked from commit 2813991c65e09a65de095074c867e88af557088e) Committed: https://chromium.googlesource.com/chromium/src/+/c9bda843237953f3ebba5e6a3234bcc96421df48

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+31 lines, -13 lines) Patch
M content/browser/download/save_file_manager.h View 1 chunk +4 lines, -2 lines 0 comments Download
M content/browser/download/save_file_manager.cc View 3 chunks +19 lines, -9 lines 0 comments Download
M content/browser/download/save_package.cc View 1 chunk +8 lines, -2 lines 0 comments Download

Messages

Total messages: 2 (1 generated)
Łukasz Anforowicz
4 years, 9 months ago (2016-03-23 22:18:23 UTC) #2
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
c9bda843237953f3ebba5e6a3234bcc96421df48.

Powered by Google App Engine
This is Rietveld 408576698