New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 821219 link

Starred by 6 users

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Cannot download files from extension popup anymore

Reported by gabr...@gsdb.net, Mar 12 2018

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.146 Safari/537.36

Steps to reproduce the problem:
// You can't download a file with javascript (data URI/blob) (Nothing happens)
var a = document.createElement('a');
a.href = 'data:text/plain,hello%20world';
a.download = 'test.txt';
a.click();

// This doesn't work either
<a href="data:text/plain,hello%20world" download="test.txt">Click me</a>

// But you can download a local file with javascript...
var a = document.createElement('a');
a.href = chrome.runtime.getURL('manifest.json');
a.download = 'manifest.json';
a.click();

// ...or with html
<a href="manifest.json" download="manifest.json">manifest.json</a>

What is the expected behavior?
The file should be downloaded.

What went wrong?
Nothing happens. No exception thrown. The file isn't downloaded.

Did this work before? Yes 64

Does this work in other browsers? Yes

Chrome version: 65.0.3325.146  Channel: stable
OS Version: 16.04.4
Flash Version: 

Tested with:
Chrome Stable 65.0.3325.146 (Ubuntu 16.04.4)
Chrome Dev 66.0.3346.8 (Ubuntu 16.04.4)
Canary 67.0.3368.1 (Windows 7)
 
extension-test.zip
1.3 KB Download

Comment 1 by gabr...@gsdb.net, Mar 13 2018

It used to work with Chrome 64.0.3282.140

Comment 2 by woxxom@gmail.com, Mar 13 2018

Bisect info: 526470 (good) - 526476 (bad)
https://chromium.googlesource.com/chromium/src/+log/c6e321c6..eadeea9d?pretty=fuller
Suspecting r526475 = f2d2fe87028de36a489f7db3f5fb28da2e9d9b2b = https://crrev.com/c/758236 by jochen@chromium.org
"Use navigation for <a download>"
Landed in 65.0.3310.0

The only workaround I know of is to use download inside a temporary iframe:
  var iframe = Object.assign(document.createElement('iframe'), {
    onload() {
      var doc = this.contentDocument;
      var a = Object.assign(doc.createElement('a'), {
        href: 'data:text/plain;base64,' + btoa('Lorem ipsum dolor sit amet'),
        download: 'data-uri-base-64.txt',
      });
      doc.body.appendChild(a);
      a.dispatchEvent(new MouseEvent('click'));
      setTimeout(() => this.remove());
    },
    style: 'display: none',
  });
  document.body.appendChild(iframe);

Comment 3 by gabr...@gsdb.net, Mar 13 2018

Thanks, woxxom

Comment 4 by mattm@chromium.org, Mar 13 2018

Cc: jochen@chromium.org
Components: UI>Browser>Navigation
Labels: Needs-Bisect Needs-Triage-M65
Cc: -jochen@chromium.org vamshi.kommuri@chromium.org
Labels: -Pri-2 -Needs-Bisect ReleaseBlock-Stable Triaged-ET RegressedIn-65 M-65 FoundIn-66 Target-67 Target-66 Target-65 FoundIn-65 FoundIn-67 hasbisect OS-Mac OS-Windows Pri-1
Owner: jochen@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce the issue on reported chrome version 65.0.3325.146, on the latest stable 65.0.3325.162 and on the latest canary 67.0.3368.0 using Windows 10, Ubuntu 14.04 and Mac 10.13.1. 

Bisect Info:
==============
Last Good Build: 65.0.3309.0
First Bad Build: 65.0.3310.0

Suspecting the same from the change log provided in comment#2
https://chromium.googlesource.com/chromium/src/+/f2d2fe87028de36a489f7db3f5fb28da2e9d9b2b
Review URL: https://chromium-review.googlesource.com/758236

@Jochen Eisinger: Please help in assigning it to others if this is not related to your change.

Note: Adding RB-Stable as this is a recent break, Please feel free to remove if not the case. Removing label Needs-Bisect label.

Thanks!

Comment 7 by gov...@chromium.org, Mar 13 2018

Labels: M-66 M-67

Comment 8 by jochen@chromium.org, Mar 13 2018

Labels: -Hotlist-Interop -ReleaseBlock-Stable
while this should be easy to fix, I don't think this justifies merging a fix back without sufficient bake time, so I'm dropping the releaseblock label.

I'm also dropping interop, as there's no interop issue here (extensions are chrome only)

Comment 9 by gov...@chromium.org, Mar 16 2018

Related  bug 822542 .
fix is pending reviews btw, but getting reviews during this time of the year is slow :/
Project Member

Comment 11 by bugdroid1@chromium.org, Mar 20 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/71fdb27d0bf6f3493ee68b2236ff624320fad7e7

commit 71fdb27d0bf6f3493ee68b2236ff624320fad7e7
Author: Jochen Eisinger <jochen@chromium.org>
Date: Tue Mar 20 10:52:28 2018

Allow downloads again from extension views

Now that downloads initially look like navigations, we have to allow
some navigations from extension views such as popups

BUG= 821219 , 823639 
R=clamy@chromium.org,rdevlin.cronin@chromium.org

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I2276a5649120a17974bf576791f74e3eac3d4e3a
Reviewed-on: https://chromium-review.googlesource.com/960003
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544324}
[modify] https://crrev.com/71fdb27d0bf6f3493ee68b2236ff624320fad7e7/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
[modify] https://crrev.com/71fdb27d0bf6f3493ee68b2236ff624320fad7e7/chrome/browser/extensions/extension_view_host.cc
[add] https://crrev.com/71fdb27d0bf6f3493ee68b2236ff624320fad7e7/chrome/test/data/extensions/api_test/browser_action/popup_download/chromium.png
[add] https://crrev.com/71fdb27d0bf6f3493ee68b2236ff624320fad7e7/chrome/test/data/extensions/api_test/browser_action/popup_download/manifest.json
[add] https://crrev.com/71fdb27d0bf6f3493ee68b2236ff624320fad7e7/chrome/test/data/extensions/api_test/browser_action/popup_download/popup.html
[add] https://crrev.com/71fdb27d0bf6f3493ee68b2236ff624320fad7e7/chrome/test/data/extensions/api_test/browser_action/popup_download/popup.js
[modify] https://crrev.com/71fdb27d0bf6f3493ee68b2236ff624320fad7e7/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter

Status: Fixed (was: Assigned)

Comment 13 by gabr...@gsdb.net, Mar 20 2018

Thank you, jochen!
Cc: abdulsyed@chromium.org manoranj...@chromium.org
Labels: -M-65 ReleaseBlock-Stable
Pls request a merge to M66 if cl listed at #11 is safe to merge to M66. Thank you.

Adding "RBS" for M66 for tracking the merge just in case if needed. 

Comment 15 Deleted

it should work in 66, have you verified?

Comment 17 by woxxom@gmail.com, Apr 20 2018

Ah, my bad, thanks, it does work in Chrome 66.

Sign in to add a comment