Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

close tab if the download is the initial navigation #9623

Merged
merged 1 commit into from
Jun 21, 2017
Merged

Conversation

bridiver
Copy link
Collaborator

fix #9620

Still needs a test
also opened brave/muon#225 to move this to muon

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.

Test Plan:
See issue

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@bridiver bridiver added the bug label Jun 21, 2017
@bridiver bridiver added this to the 0.17.x (Beta Channel) milestone Jun 21, 2017
@bridiver bridiver self-assigned this Jun 21, 2017
@bbondy bbondy modified the milestones: 0.18.x (Developer Channel), 0.17.x (Beta Channel) Jun 21, 2017
@bridiver
Copy link
Collaborator Author

from chrome download_ui

content::WebContents* web_contents = item->GetWebContents();
  if (web_contents) {
    Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
    // If the download occurs in a new tab, and it's not a save page
    // download (started before initial navigation completed) close it.
    // Avoid calling CloseContents if the tab is not in this browser's tab strip
    // model; this can happen if the download was initiated by something
    // internal to Chrome, such as by the app list.
    if (browser && web_contents->GetController().IsInitialNavigation() &&
        browser->tab_strip_model()->count() > 1 &&
        browser->tab_strip_model()->GetIndexOfWebContents(web_contents) !=
            TabStripModel::kNoTab &&
        !item->IsSavePackageDownload()) {
      web_contents->Close();
    }

@bbondy bbondy modified the milestones: 0.17.x (Beta Channel), 0.18.x (Developer Channel) Jun 21, 2017
@bbondy bbondy merged commit 94e78ca into master Jun 21, 2017
bbondy added a commit that referenced this pull request Jun 21, 2017
close tab if the download is the initial navigation
bbondy added a commit that referenced this pull request Jun 21, 2017
close tab if the download is the initial navigation
@cezaraugusto cezaraugusto deleted the issue-9620 branch June 21, 2017 20:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

download leaves about:blank page loading
2 participants