Bug 1433334 - Add installTelemetryInfo to addon installed from "drag-and-drop" file urls on Firefox Desktop.
MozReview-Commit-ID: JiYgsTVbtcL
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -971,17 +971,18 @@ function serializeInputStream(aStream) {
*/
function handleUriInChrome(aBrowser, aUri) {
if (aUri.scheme == "file") {
try {
let mimeType = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService)
.getTypeFromURI(aUri);
if (mimeType == "application/x-xpinstall") {
let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
- AddonManager.getInstallForURL(aUri.spec, mimeType).then(install => {
+ AddonManager.getInstallForURL(aUri.spec, mimeType, null, null, null, null, null,
+ {source: "file-url"}).then(install => {
AddonManager.installAddonFromWebpage(mimeType, aBrowser, systemPrincipal,
install);
});
return true;
}
} catch (e) {
return false;
}
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_localfile.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_localfile.js
@@ -18,16 +18,19 @@ function test() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:blank");
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
gBrowser.loadURI(xpipath);
});
}
function install_ended(install, addon) {
+ Assert.deepEqual(install.installTelemetryInfo, {source: "file-url"},
+ "Got the expected install.installTelemetryInfo");
+
install.cancel();
}
function finish_test(count) {
is(count, 1, "1 Add-on should have been successfully installed");
gBrowser.removeCurrentTab();
Harness.finish();