Skip to content

Commit

Permalink
Merge autoland to m-c. a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
rvandermeulen committed Aug 23, 2016
2 parents 08c87d1 + b36f20f commit 787ee7b
Show file tree
Hide file tree
Showing 115 changed files with 1,975 additions and 542 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ ifdef MOZ_CRASHREPORTER
grep 'sym' $(SYMBOL_INDEX_NAME) > $(SYMBOL_INDEX_NAME).tmp && \
mv $(SYMBOL_INDEX_NAME).tmp $(SYMBOL_INDEX_NAME)
cd $(DIST)/crashreporter-symbols && \
zip -r5D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt' -x '*test*' -x '*Test*'
zip -r5D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt'
endif # MOZ_CRASHREPORTER

uploadsymbols:
Expand Down
3 changes: 2 additions & 1 deletion browser/base/content/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ var ClickEventHandler = {
ctrlKey: event.ctrlKey, metaKey: event.metaKey,
altKey: event.altKey, href: null, title: null,
bookmark: false, referrerPolicy: referrerPolicy,
originAttributes: principal ? principal.originAttributes : {} };
originAttributes: principal ? principal.originAttributes : {},
isContentWindowPrivate: PrivateBrowsingUtils.isContentWindowPrivate(ownerDoc.defaultView)};

if (href) {
try {
Expand Down
1 change: 1 addition & 0 deletions browser/base/content/test/general/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ subsuite = clipboard
skip-if = true # Disabled due to the clipboard not supporting real file types yet (bug 1288773)
[browser_contentAreaClick.js]
skip-if = e10s # Clicks in content don't go through contentAreaClick with e10s.
[browser_contentAltClick.js]
[browser_contextmenu.js]
subsuite = clipboard
tags = fullscreen
Expand Down
107 changes: 107 additions & 0 deletions browser/base/content/test/general/browser_contentAltClick.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
* Test for Bug 1109146.
* The tests opens a new tab and alt + clicks to download files
* and confirms those files are on the download list.
*
* The difference between this and the test "browser_contentAreaClick.js" is that
* the code path in e10s uses ContentClick.jsm instead of browser.js::contentAreaClick() util.
*/
"use strict";

XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
"resource://gre/modules/Downloads.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");

function setup(){
gPrefService.setBoolPref("browser.altClickSave", true);

let testPage =
'data:text/html,' +
'<p><a id="commonlink" href="http://mochi.test/moz/">Common link</a></p>' +
'<p><math id="mathxlink" xmlns="http://www.w3.org/1998/Math/MathML" xlink:type="simple" xlink:href="http://mochi.test/moz/"><mtext>MathML XLink</mtext></math></p>' +
'<p><svg id="svgxlink" xmlns="http://www.w3.org/2000/svg" width="100px" height="50px" version="1.1"><a xlink:type="simple" xlink:href="http://mochi.test/moz/"><text transform="translate(10, 25)">SVG XLink</text></a></svg></p>';

return BrowserTestUtils.openNewForegroundTab(gBrowser, testPage);
}

function* clean_up() {
// Remove downloads.
let downloadList = yield Downloads.getList(Downloads.ALL);
let downloads = yield downloadList.getAll();
for (let download of downloads) {
yield downloadList.remove(download);
yield download.finalize(true);
}
// Remove download history.
yield PlacesTestUtils.clearHistory();

gPrefService.clearUserPref("browser.altClickSave");
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
}

add_task(function* test_alt_click()
{
yield setup();

let downloadList = yield Downloads.getList(Downloads.ALL);
let downloads = [];
let downloadView;
// When 1 download has been attempted then resolve the promise.
let finishedAllDownloads = new Promise( (resolve)=> {
downloadView = {
onDownloadAdded: function (aDownload) {
downloads.push(aDownload);
resolve();
},
};
});
yield downloadList.addView(downloadView);
yield BrowserTestUtils.synthesizeMouseAtCenter("#commonlink", {altKey: true}, gBrowser.selectedBrowser);

// Wait for all downloads to be added to the download list.
yield finishedAllDownloads;
yield downloadList.removeView(downloadView);

is(downloads.length, 1, "1 downloads");
is(downloads[0].source.url, "http://mochi.test/moz/", "Downloaded #commonlink element");

yield* clean_up();
});

add_task(function* test_alt_click_on_xlinks()
{
yield setup();

let downloadList = yield Downloads.getList(Downloads.ALL);
let downloads = [];
let downloadView;
// When all 2 downloads have been attempted then resolve the promise.
let finishedAllDownloads = new Promise( (resolve)=> {
downloadView = {
onDownloadAdded: function (aDownload) {
downloads.push(aDownload);
if (downloads.length == 2) {
resolve();
}
},
};
});
yield downloadList.addView(downloadView);
yield BrowserTestUtils.synthesizeMouseAtCenter("#mathxlink", {altKey: true}, gBrowser.selectedBrowser);
yield BrowserTestUtils.synthesizeMouseAtCenter("#svgxlink", {altKey: true}, gBrowser.selectedBrowser);

// Wait for all downloads to be added to the download list.
yield finishedAllDownloads;
yield downloadList.removeView(downloadView);

is(downloads.length, 2, "2 downloads");
is(downloads[0].source.url, "http://mochi.test/moz/", "Downloaded #mathxlink element");
is(downloads[1].source.url, "http://mochi.test/moz/", "Downloaded #svgxlink element");

yield* clean_up();
});
19 changes: 13 additions & 6 deletions browser/base/content/utilityOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,20 @@ function openLinkIn(url, where, params) {
var aIndicateErrorPageLoad = params.indicateErrorPageLoad;

if (where == "save") {
if (!aInitiatingDoc) {
Components.utils.reportError("openUILink/openLinkIn was called with " +
"where == 'save' but without initiatingDoc. See bug 814264.");
return;
}
// TODO(1073187): propagate referrerPolicy.
saveURL(url, null, null, true, null, aNoReferrer ? null : aReferrerURI, aInitiatingDoc);

// ContentClick.jsm passes isContentWindowPrivate for saveURL instead of passing a CPOW initiatingDoc
if ("isContentWindowPrivate" in params) {
saveURL(url, null, null, true, true, aNoReferrer ? null : aReferrerURI, null, params.isContentWindowPrivate);
}
else {
if (!aInitiatingDoc) {
Components.utils.reportError("openUILink/openLinkIn was called with " +
"where == 'save' but without initiatingDoc. See bug 814264.");
return;
}
saveURL(url, null, null, true, true, aNoReferrer ? null : aReferrerURI, aInitiatingDoc);
}
return;
}

Expand Down
32 changes: 22 additions & 10 deletions browser/components/downloads/DownloadsCommon.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -508,20 +508,32 @@ this.DownloadsCommon = {
// or the file doesn't exist), try using the parent if we have it.
let parent = aFile.parent;
if (parent) {
try {
// Open the parent directory to show where the file should be.
parent.launch();
} catch (ex) {
// If launch also fails (probably because it's not implemented), let
// the OS handler try to open the parent.
Cc["@mozilla.org/uriloader/external-protocol-service;1"]
.getService(Ci.nsIExternalProtocolService)
.loadUrl(NetUtil.newURI(parent));
}
this.showDirectory(parent);
}
}
},

/**
* Show the specified folder in the system file manager.
*
* @param aDirectory
* a directory to be opened with system file manager.
*/
showDirectory(aDirectory) {
if (!(aDirectory instanceof Ci.nsIFile)) {
throw new Error("aDirectory must be a nsIFile object");
}
try {
aDirectory.launch();
} catch (ex) {
// If launch fails (probably because it's not implemented), let
// the OS handler try to open the directory.
Cc["@mozilla.org/uriloader/external-protocol-service;1"]
.getService(Ci.nsIExternalProtocolService)
.loadUrl(NetUtil.newURI(aDirectory));
}
},

/**
* Displays an alert message box which asks the user if they want to
* unblock the downloaded file or not.
Expand Down
2 changes: 1 addition & 1 deletion browser/components/downloads/content/downloads.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ richlistitem[type="download"].download-state[state="1"]:not([exists]) .downloadS

#downloadsSummary:not([inprogress]) > vbox > #downloadsSummaryProgress,
#downloadsSummary:not([inprogress]) > vbox > #downloadsSummaryDetails,
#downloadsFooter[showingsummary] > #downloadsHistory,
#downloadsFooter[showingsummary] > #downloadsFooterButtons,
#downloadsFooter:not([showingsummary]) > #downloadsSummary {
display: none;
}
Expand Down
27 changes: 27 additions & 0 deletions browser/components/downloads/content/downloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,23 @@ const DownloadsPanel = {
this._state = this.kStateHidden;
},

onFooterPopupShowing(aEvent) {
let itemClearList = document.getElementById("downloadsDropdownItemClearList");
if (DownloadsCommon.getData(window).canRemoveFinished) {
itemClearList.removeAttribute("hidden");
} else {
itemClearList.setAttribute("hidden", "true");
}

document.getElementById("downloadsFooterButtonsSplitter").classList
.add("downloadsDropmarkerSplitterExtend");
},

onFooterPopupHidden(aEvent) {
document.getElementById("downloadsFooterButtonsSplitter").classList
.remove("downloadsDropmarkerSplitterExtend");
},

//////////////////////////////////////////////////////////////////////////////
//// Related operations

Expand All @@ -382,6 +399,13 @@ const DownloadsPanel = {
BrowserDownloadsUI();
},

openDownloadsFolder() {
Downloads.getPreferredDownloadsDirectory().then(downloadsPath => {
DownloadsCommon.showDirectory(new FileUtils.File(downloadsPath));
}).catch(Cu.reportError);
this.hidePanel();
},

//////////////////////////////////////////////////////////////////////////////
//// Internal functions

Expand Down Expand Up @@ -1188,6 +1212,9 @@ const DownloadsViewController = {
//// nsIController

supportsCommand(aCommand) {
if (aCommand === "downloadsCmd_clearList") {
return true;
}
// Firstly, determine if this is a command that we can handle.
if (!DownloadsViewUI.isCommandName(aCommand)) {
return false;
Expand Down
34 changes: 27 additions & 7 deletions browser/components/downloads/content/downloadsOverlay.xul
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
<menuseparator/>

<menuitem command="downloadsCmd_clearList"
label="&cmd.clearList.label;"
accesskey="&cmd.clearList.accesskey;"/>
label="&cmd.clearList2.label;"
accesskey="&cmd.clearList2.accesskey;"/>
</menupopup>

<panelmultiview id="downloadsPanel-multiView"
Expand Down Expand Up @@ -148,11 +148,31 @@
crop="end"/>
</vbox>
</hbox>
<button id="downloadsHistory"
class="plain downloadsPanelFooterButton"
label="&downloadsHistory.label;"
accesskey="&downloadsHistory.accesskey;"
oncommand="DownloadsPanel.showDownloadsHistory();"/>
<hbox id="downloadsFooterButtons">
<button id="downloadsHistory"
class="plain downloadsPanelFooterButton"
label="&downloadsHistory.label;"
accesskey="&downloadsHistory.accesskey;"
flex="1"
oncommand="DownloadsPanel.showDownloadsHistory();"/>
<toolbarseparator id="downloadsFooterButtonsSplitter"
class="downloadsDropmarkerSplitter"/>
<button id="downloadsFooterDropmarker"
class="plain downloadsPanelFooterButton downloadsDropmarker"
type="menu">
<menupopup id="downloadSubPanel"
onpopupshowing="DownloadsPanel.onFooterPopupShowing(event);"
onpopuphidden="DownloadsPanel.onFooterPopupHidden(event);"
position="after_end">
<menuitem id="downloadsDropdownItemClearList"
command="downloadsCmd_clearList"
label="&cmd.clearList2.label;"/>
<menuitem id="downloadsDropdownItemOpenDownloadsFolder"
oncommand="DownloadsPanel.openDownloadsFolder();"
label="&openDownloadsFolder.label;"/>
</menupopup>
</button>
</hbox>
</vbox>
</panelview>

Expand Down
1 change: 1 addition & 0 deletions browser/components/downloads/test/browser/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ skip-if = os == "linux" # Bug 952422
[browser_confirm_unblock_download.js]
[browser_iframe_gone_mid_download.js]
[browser_downloads_panel_block.js]
[browser_downloads_panel_footer.js]
Loading

0 comments on commit 787ee7b

Please sign in to comment.