New issue
Advanced search Search tips

Issue 892133 link

Starred by 9 users

Issue metadata

Status: Unconfirmed
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug-Regression



Sign in to add a comment

downloading a blob url with chrome.downloads.download fails

Reported by cpextens...@gmail.com, Oct 4

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.45 Safari/537.36

Steps to reproduce the problem:
1. install the attached extension.
it's background page contains the following code:
chrome.browserAction.onClicked.addListener(function() {
    let blob = new Blob(["this is a blob download test"], {type : 'text/plain'});
    var url = URL.createObjectURL(blob);
	console.log(url);
    chrome.downloads.download({url: url, filename: "download_test.txt"}, function() {
        if (chrome.runtime.lastError) {
            console.error(chrome.runtime.lastError.message);
        }
        else {
            console.info('download ok');
        }
    });
});
2. click on browser action

What is the expected behavior?
1. the extension background page adds a browser action event listener. upon click it will generate a 'text/plain' blob, create it's url, and download it as a file named 'download_test.txt' by calling chrome.downloads.download api.

2. upon clicking on the browser action, a file named 'download_test.txt' should be downloaded without an error

What went wrong?
the file download fails with 'Fail - network error' message in the download manager. The displayed file name is the blob uuid, not the expected name 'download_test.txt'.

Note, that there is no chrome.runtime.lastError or any JS exception thrown

Did this work before? Yes  69.0.3497.100

Does this work in other browsers? Yes

Chrome version: 70.0.3538.45  Channel: beta
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
 
test_extension.zip
2.1 KB Download
FWIW your extension works here in Chrome 69, 70, 71 on Windows 7.
Can you reproduce the bug in a new clean browser profile?
Labels: Needs-Triage-M70 Needs-Bisect
Cc: susan.boorgula@chromium.org
Components: Platform>Extensions
Labels: Needs-Feedback Triaged-ET
cpextensions@ Thanks for the issue.

Tested this issue on Windows 10 on the reported version 70.0.3538.45 and the latest Canary 71.0.3570.0 by following the below steps.

1. Launched Chrome and added the given extensions.
2. Clicked on the extension icon and can observe that a file named 'download_test.txt' is downloaded and no issues are observed.
Attached is the screen cast for reference.

Request you to retry the issue on a new chrome profile without any flags/extensions and update the thread with the observations.

Thanks..
892133.mp4
651 KB View Download
Hi
Indeed when creating a clean profile the issue does not reproduce. Thank you.
Do you think the issue happened because some sort of profile corruption? Are there any logs that are useful to diagnose this? I tried looking over Chrome debug logs but didn't see any obvious errors triggered by the download action.
Project Member

Comment 5 by sheriffbot@chromium.org, Oct 7

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: Needs-Feedback
cpextensions@ Thanks for the update.

As per comment #4, as the issue is not reproducible on a new chrome profile, can you please confirm if this issue can be closed?

Thanks..
Interesting. I hit a very similar error on a linux machine, but in addition to having the blob uuid as the download name, the browser also crashes. This happens even if:

1. I am on a fresh new chrome profile.
2. I cancel the download.
3. On build Version 71.0.3573.0 (Official Build) dev (64-bit) and build Version 70.0.3538.54 (Official Build) beta (64-bit).
More repro info:

After more testing, here are my findings:

1. The original issue reported by cpextensions@gmail.com does not repro with the original attached extension.
2. The crash repros if I modify the chrome.downloads.download call with the 'saveAs: true' option. 


I will narrow down a repro and file a separate bug. Thanks!
Labels: -Hotlist-Interop
Possibly related to this issue: https://bugs.chromium.org/p/chromium/issues/detail?id=766303

But I can confirm that this happens occasionally with our customers in non-incognito mode. I have seen in on both windows and on osx. 

It is difficult to repro this. It happens occasionally. 

Here is how we call the api:

...
        fileContent = URL.createObjectURL(new Blob([csv], {type: 'text/csv;charset=utf-8;'}));
...

 chrome.downloads.download(
            {
                url: fileContent,
                filename: 'myfile.csv',
                saveAs: true
            },
            callBackFn
        );
More investigation results ...

On a machine which we have a consistent repro of this I was able to download the content using this method:

var link = document.createElement('a');
  
var blob = new Blob(["Hello, World!"], { type: 'text/plain' });
var url = URL.createObjectURL(blob);
link.href = url;

link.setAttribute('download', 'foo.txt');
link.click();


So the problem is chrome.downloads.download api. Because the content is stored correctly by createObjectURL.

Please note that the URL is in this format:
chrome-extension://slkdfjslkjlkkjsdfkjsldfkjsdfj/aa592a36-5156-4ce0-b4a2-ea86362bbfeb

where slkdfjslkjlkkjsdfkjsldfkjsdfj is the extension ID.

When downloading this with the chrome.downloads.download api the name "aa592a36-5156-4ce0-b4a2-ea86362bbfeb" will be populated in the file name dialog instead of the name 'myfile.csv' provided to the api. Also this download fails with "Network Error" where as it succeeds with the link.click() method.


Also to node that there were no other extensions installed and nothing else is interfering with the downloads. Just our own extension installed works for more than 100K+ users. Our extension creates a file dynamically and puts it in createObjectURL and then tries to download that data with chrome.downloads.download. This problem happens occasionally for some users 1-2% of users. But it consistently repros on those user profiles that have the issue. On other new user profiles on the same machine the download functionality of extension works without an issue. 

The user visible symptom is that you click on download button (which calls the chrome.downloads.download) and the saveAs dialog pops ups up with a GUID or UUID in the file name field. Then you start the download process the downloading of the file starts in the browser but fails immediately with a Network Error and leaves the failed download file icon the bottom of the browser screen. 

Sign in to add a comment