зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset c6490dad74ac (bug 1629376) for causing browser_toolbar_library_open_recent.js failures CLOSED TREE
This commit is contained in:
Родитель
5bcef30e8b
Коммит
c95ead91a9
|
@ -502,6 +502,20 @@ DownloadsSubview.Button = class extends DownloadsViewUI.DownloadElementShell {
|
|||
}
|
||||
}
|
||||
|
||||
static get markup() {
|
||||
return `
|
||||
<image class="toolbarbutton-icon" validate="always"/>
|
||||
<vbox class="toolbarbutton-text" flex="1">
|
||||
<label crop="end"/>
|
||||
<label class="status-text status-full" crop="end"/>
|
||||
<label class="status-text status-open" crop="end"/>
|
||||
<label class="status-text status-retry" crop="end"/>
|
||||
<label class="status-text status-show" crop="end"/>
|
||||
</vbox>
|
||||
<toolbarbutton class="action-button"/>
|
||||
`;
|
||||
}
|
||||
|
||||
// DownloadElementShell
|
||||
connect() {
|
||||
let document = this.element.ownerDocument;
|
||||
|
@ -510,17 +524,9 @@ DownloadsSubview.Button = class extends DownloadsViewUI.DownloadElementShell {
|
|||
);
|
||||
if (!downloadsSubviewItemFragment) {
|
||||
let MozXULElement = document.defaultView.MozXULElement;
|
||||
downloadsSubviewItemFragment = MozXULElement.parseXULToFragment(`
|
||||
<image class="toolbarbutton-icon" validate="always"/>
|
||||
<vbox class="toolbarbutton-text" flex="1">
|
||||
<label crop="end"/>
|
||||
<label class="status-text status-full" crop="end"/>
|
||||
<label class="status-text status-open" crop="end"/>
|
||||
<label class="status-text status-retry" crop="end"/>
|
||||
<label class="status-text status-show" crop="end"/>
|
||||
</vbox>
|
||||
<toolbarbutton class="action-button"/>
|
||||
`);
|
||||
downloadsSubviewItemFragment = MozXULElement.parseXULToFragment(
|
||||
this.markup
|
||||
);
|
||||
gDownloadsSubviewItemFragments.set(
|
||||
document,
|
||||
downloadsSubviewItemFragment
|
||||
|
|
|
@ -173,6 +173,28 @@ DownloadsViewUI.DownloadElementShell.prototype = {
|
|||
return !!this._active;
|
||||
},
|
||||
|
||||
get markup() {
|
||||
return `
|
||||
<hbox class="downloadMainArea" flex="1" align="center">
|
||||
<stack>
|
||||
<image class="downloadTypeIcon" validate="always"/>
|
||||
<image class="downloadBlockedBadge" />
|
||||
</stack>
|
||||
<vbox class="downloadContainer" flex="1" pack="center">
|
||||
<description class="downloadTarget" crop="center"/>
|
||||
<description class="downloadDetails downloadDetailsNormal"
|
||||
crop="end"/>
|
||||
<description class="downloadDetails downloadDetailsHover"
|
||||
crop="end"/>
|
||||
<description class="downloadDetails downloadDetailsButtonHover"
|
||||
crop="end"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<toolbarseparator />
|
||||
<button class="downloadButton"/>
|
||||
`;
|
||||
},
|
||||
|
||||
connect() {
|
||||
let document = this.element.ownerDocument;
|
||||
let downloadListItemFragment = gDownloadListItemFragments.get(document);
|
||||
|
@ -182,25 +204,7 @@ DownloadsViewUI.DownloadElementShell.prototype = {
|
|||
// actions based on the check if originaltarget was not a button.
|
||||
if (!downloadListItemFragment) {
|
||||
let MozXULElement = document.defaultView.MozXULElement;
|
||||
downloadListItemFragment = MozXULElement.parseXULToFragment(`
|
||||
<hbox class="downloadMainArea" flex="1" align="center">
|
||||
<stack>
|
||||
<image class="downloadTypeIcon" validate="always"/>
|
||||
<image class="downloadBlockedBadge" />
|
||||
</stack>
|
||||
<vbox class="downloadContainer" flex="1" pack="center">
|
||||
<description class="downloadTarget" crop="center"/>
|
||||
<description class="downloadDetails downloadDetailsNormal"
|
||||
crop="end"/>
|
||||
<description class="downloadDetails downloadDetailsHover"
|
||||
crop="end"/>
|
||||
<description class="downloadDetails downloadDetailsButtonHover"
|
||||
crop="end"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<toolbarseparator />
|
||||
<button class="downloadButton"/>
|
||||
`);
|
||||
downloadListItemFragment = MozXULElement.parseXULToFragment(this.markup);
|
||||
gDownloadListItemFragments.set(document, downloadListItemFragment);
|
||||
}
|
||||
this.element.setAttribute("active", true);
|
||||
|
|
|
@ -92,7 +92,6 @@ skip-if = (os == "mac" && debug) # Bug 1467049
|
|||
[browser_sort_in_library.js]
|
||||
[browser_stayopenmenu.js]
|
||||
[browser_toolbar_drop_text.js]
|
||||
[browser_toolbar_library_downloads.js]
|
||||
[browser_toolbar_library_open_recent.js]
|
||||
[browser_toolbar_overflow.js]
|
||||
skip-if = os == "linux" && bits == 32 && debug # bug 1463443
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Tests that downloads are available in the downloads subview.
|
||||
*/
|
||||
|
||||
async function openDownloadsInLibraryToolbarButton() {
|
||||
let libraryBtn = document.getElementById("library-button");
|
||||
let libView = document.getElementById("appMenu-libraryView");
|
||||
let viewShownPromise = BrowserTestUtils.waitForEvent(libView, "ViewShown");
|
||||
libraryBtn.click();
|
||||
await viewShownPromise;
|
||||
|
||||
let downloadsButton;
|
||||
await BrowserTestUtils.waitForCondition(() => {
|
||||
downloadsButton = document.getElementById(
|
||||
"appMenu-library-downloads-button"
|
||||
);
|
||||
return downloadsButton;
|
||||
}, "Should have the downloads bookmarks button");
|
||||
|
||||
let DownloadsView = document.getElementById("PanelUI-downloads");
|
||||
let viewRecentPromise = BrowserTestUtils.waitForEvent(
|
||||
DownloadsView,
|
||||
"ViewShown"
|
||||
);
|
||||
info("clicking on downloads library button");
|
||||
downloadsButton.click();
|
||||
await viewRecentPromise;
|
||||
}
|
||||
|
||||
async function testDownloadedItems() {
|
||||
let testURIs = ["http://ubuntu.org/", "http://google.com/"];
|
||||
let downloadsMenu = document.getElementById("panelMenu_downloadsMenu");
|
||||
let items = downloadsMenu.childNodes;
|
||||
|
||||
Assert.ok(items, "Download items should exists");
|
||||
Assert.equal(items.length, testURIs.length);
|
||||
Assert.equal(
|
||||
items[0]._shell.download.source.url,
|
||||
testURIs[0],
|
||||
"Should have the expected URL"
|
||||
);
|
||||
Assert.equal(
|
||||
items[1]._shell.download.source.url,
|
||||
testURIs[1],
|
||||
"Should have the expected URL"
|
||||
);
|
||||
|
||||
let shownItems = downloadsMenu.querySelectorAll("toolbarbutton");
|
||||
Assert.equal(shownItems.length, 2, "Both downloads are shown");
|
||||
}
|
||||
|
||||
add_task(async function test_downloads() {
|
||||
await PlacesTestUtils.addVisits([
|
||||
{
|
||||
uri: "http://google.com",
|
||||
transition: PlacesUtils.history.TRANSITION_DOWNLOAD,
|
||||
},
|
||||
{
|
||||
uri: "http://ubuntu.org",
|
||||
transition: PlacesUtils.history.TRANSITION_DOWNLOAD,
|
||||
},
|
||||
]);
|
||||
await openDownloadsInLibraryToolbarButton();
|
||||
|
||||
testDownloadedItems();
|
||||
});
|
Загрузка…
Ссылка в новой задаче