Skip to content

chrome.downloads.download fails around filename determination #15781

Description

@jonathansampson

Description

The chrome.downloads.download method doesn't appear to work as expected in Brave.

Steps to Reproduce

Create a new directory with the following files:

manifest.json

{
    "name": "chrome.downloads.download test",
    "version": "0.0.0.1",
    "manifest_version": 3,
    "permissions": [
        "downloads"
    ],
    "background": {
        "service_worker": "background.js"
    }
}

background.js

chrome.runtime.onInstalled.addListener(() => {
    const url = "https://brave.com/static-assets/images/brave-og.png";
    chrome.downloads.download({ url }, downloadId => {
        console.log(`Download ID is ${downloadId}`);
    });
});

Navigate to brave://extensions/ and enable Developer Mode. Then select Load unpacked, and find the extension directory with the contents above.

Actual result:

Nothing happens. No download is initiated, but a download ID is generated and returned.

Brave Nightly 1.26.11
brave-downloads

Expected result:

A download should automatically be initiated when the extension is loaded, or refreshed. Clicking the "service worker" link should also reveal a generated download ID in the console.

Chrome Canary 92.0.4505.0
chrome-downloads

Reproduces how often:

Consistently.

Brave version (brave://version info)

1.26.11

Version/Channel Information:

  • Can you reproduce this issue with the current release? Yes
  • Can you reproduce this issue with the beta channel? Yes
  • Can you reproduce this issue with the nightly channel? Yes

Other Additional Information:

  • Is the issue reproducible on the latest version of Chrome? No

Miscellaneous Information:

By hooking into the downloads lifecycle events, we can see that Brave stops around filename determination, whereas Chrome resolves a full path and filename and proceeds with the download:

chrome.downloads.onCreated.addListener( item => {
    console.log( "onCreated", item );
});

chrome.downloads.onChanged.addListener( item => {
    console.log( "onChanged", item );
});

chrome.downloads.onDeterminingFilename.addListener( item => {
    console.log( "onDeterminingFilename", item );
});

chrome.downloads.onErased.addListener( item => {
    console.log( "onErased", item );
});

image

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions