зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1250611: Fix xpinstall mochitests to work when add-ons must be signed by AMO. r=rhelmer
These tests verify that the InstallTrigger API works as expected and that the old style of signing add-ons is verified correctly. Other applications still care about this so we don't want to regress it. This switches most tests that previously expected an unsigned add-on to use an AMO signed add-on. In apps that care that will allow it to install, in apps that don't it will be effectively the same as unsigned (untrusted root). Other tests that actually verify that the old style of signatures are either seen or not seen are marked as skipped when AMO-signing is required. In some cases that meant doubling up a few tests to make sure we have coverage. MozReview-Commit-ID: 6V4U1U1HTqx --HG-- extra : rebase_source : dff81ecb6f55898296aa3163b25487b7f122c079 extra : amend_source : b2f0083c2c1c936b5f8464ce12a71a9952db0b37
This commit is contained in:
Родитель
43d0a9d541
Коммит
fa191fdee2
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -1,5 +1,7 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
amosigned.xpi
|
||||
amosigned2.xpi
|
||||
authRedirect.sjs
|
||||
bug540558.html
|
||||
bug638292.html
|
||||
|
@ -19,6 +21,7 @@ support-files =
|
|||
navigate.html
|
||||
redirect.sjs
|
||||
restartless.xpi
|
||||
signed-multipackage.xpi
|
||||
signed-no-cn.xpi
|
||||
signed-no-o.xpi
|
||||
signed-tampered.xpi
|
||||
|
@ -31,6 +34,10 @@ support-files =
|
|||
triggerredirect.html
|
||||
unsigned.xpi
|
||||
|
||||
[browser_amosigned_trigger.js]
|
||||
[browser_amosigned_trigger_iframe.js]
|
||||
skip-if = buildapp == "mulet"
|
||||
[browser_amosigned_url.js]
|
||||
[browser_auth.js]
|
||||
[browser_auth2.js]
|
||||
[browser_auth3.js]
|
||||
|
@ -77,21 +84,31 @@ skip-if = true # Bug 1084646
|
|||
[browser_navigateaway4.js]
|
||||
[browser_offline.js]
|
||||
[browser_relative.js]
|
||||
[browser_signed_multipackage.js]
|
||||
skip-if = require_signing
|
||||
[browser_signed_multiple.js]
|
||||
skip-if = require_signing
|
||||
[browser_signed_naming.js]
|
||||
skip-if = require_signing
|
||||
[browser_signed_tampered.js]
|
||||
skip-if = require_signing
|
||||
[browser_signed_trigger.js]
|
||||
skip-if = require_signing
|
||||
[browser_signed_untrusted.js]
|
||||
skip-if = require_signing
|
||||
[browser_signed_url.js]
|
||||
skip-if = require_signing
|
||||
[browser_softwareupdate.js]
|
||||
[browser_switchtab.js]
|
||||
[browser_trigger_redirect.js]
|
||||
[browser_unsigned_trigger.js]
|
||||
skip-if = require_signing
|
||||
[browser_unsigned_trigger_iframe.js]
|
||||
skip-if = buildapp == "mulet"
|
||||
skip-if = buildapp == "mulet" || require_signing
|
||||
[browser_unsigned_trigger_xorigin.js]
|
||||
skip-if = buildapp == "mulet"
|
||||
[browser_unsigned_url.js]
|
||||
skip-if = require_signing
|
||||
[browser_whitelist.js]
|
||||
[browser_whitelist2.js]
|
||||
[browser_whitelist3.js]
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests installing an unsigned add-on through an InstallTrigger call in web
|
||||
// content.
|
||||
function test() {
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.finalContentEvent = "InstallComplete";
|
||||
Harness.setup();
|
||||
|
||||
var pm = Services.perms;
|
||||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
URL: TESTROOT + "amosigned.xpi",
|
||||
IconURL: TESTROOT + "icon.png",
|
||||
toString: function() { return this.URL; }
|
||||
}
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
}
|
||||
|
||||
function confirm_install(window) {
|
||||
var items = window.document.getElementById("itemList").childNodes;
|
||||
is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
|
||||
is(items[0].name, "XPI Test", "Should have seen the name");
|
||||
is(items[0].url, TESTROOT + "amosigned.xpi", "Should have listed the correct url for the item");
|
||||
is(items[0].icon, TESTROOT + "icon.png", "Should have listed the correct icon for the item");
|
||||
is(items[0].signed, "false", "Should have listed the item as unsigned");
|
||||
return true;
|
||||
}
|
||||
|
||||
function install_ended(install, addon) {
|
||||
install.cancel();
|
||||
}
|
||||
|
||||
function finish_test(count) {
|
||||
is(count, 1, "1 Add-on should have been successfully installed");
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com"), "install");
|
||||
|
||||
var doc = gBrowser.contentDocument;
|
||||
is(doc.getElementById("return").textContent, "true", "installTrigger should have claimed success");
|
||||
is(doc.getElementById("status").textContent, "0", "Callback should have seen a success");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
Harness.finish();
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Test for bug 589598 - Ensure that installing through InstallTrigger
|
||||
// works in an iframe in web content.
|
||||
|
||||
function test() {
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.finalContentEvent = "InstallComplete";
|
||||
Harness.setup();
|
||||
|
||||
var pm = Services.perms;
|
||||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var inner_url = encodeURIComponent(TESTROOT + "installtrigger.html?" + encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
URL: TESTROOT + "amosigned.xpi",
|
||||
IconURL: TESTROOT + "icon.png",
|
||||
toString: function() { return this.URL; }
|
||||
}
|
||||
})));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger_frame.html?" + inner_url);
|
||||
}
|
||||
|
||||
function confirm_install(window) {
|
||||
var items = window.document.getElementById("itemList").childNodes;
|
||||
is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
|
||||
is(items[0].name, "XPI Test", "Should have seen the name");
|
||||
is(items[0].url, TESTROOT + "amosigned.xpi", "Should have listed the correct url for the item");
|
||||
is(items[0].icon, TESTROOT + "icon.png", "Should have listed the correct icon for the item");
|
||||
is(items[0].signed, "false", "Should have listed the item as unsigned");
|
||||
return true;
|
||||
}
|
||||
|
||||
function install_ended(install, addon) {
|
||||
install.cancel();
|
||||
}
|
||||
|
||||
function finish_test(count) {
|
||||
is(count, 1, "1 Add-on should have been successfully installed");
|
||||
|
||||
Services.perms.remove(makeURI("http://example.com"), "install");
|
||||
|
||||
var doc = gBrowser.contentWindow.frames[0].document; // Document of iframe
|
||||
is(doc.getElementById("return").textContent, "true", "installTrigger in iframe should have claimed success");
|
||||
is(doc.getElementById("status").textContent, "0", "Callback in iframe should have seen a success");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
Harness.finish();
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests installing an unsigned add-on by navigating directly to the url
|
||||
function test() {
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab("about:blank");
|
||||
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||
gBrowser.loadURI(TESTROOT + "amosigned.xpi");
|
||||
});
|
||||
}
|
||||
|
||||
function confirm_install(window) {
|
||||
let items = window.document.getElementById("itemList").childNodes;
|
||||
is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
|
||||
is(items[0].name, "XPI Test", "Should have had the filename for the item name");
|
||||
is(items[0].url, TESTROOT + "amosigned.xpi", "Should have listed the correct url for the item");
|
||||
is(items[0].icon, "", "Should have listed no icon for the item");
|
||||
is(items[0].signed, "false", "Should have listed the item as unsigned");
|
||||
return true;
|
||||
}
|
||||
|
||||
function install_ended(install, addon) {
|
||||
install.cancel();
|
||||
}
|
||||
|
||||
function finish_test(count) {
|
||||
is(count, 1, "1 Add-on should have been successfully installed");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
Harness.finish();
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
|
@ -16,7 +16,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -14,7 +14,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -22,7 +22,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -21,7 +21,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gNewTab = gBrowser.addTab();
|
||||
gBrowser.getBrowserForTab(gNewTab).loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify(TESTROOT + "unsigned.xpi"));
|
||||
var triggers = encodeURIComponent(JSON.stringify(TESTROOT + "amosigned.xpi"));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
|
||||
function loadListener() {
|
||||
|
|
|
@ -11,7 +11,7 @@ function test() {
|
|||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
URL: TESTROOT + "unsigned.xpi",
|
||||
URL: TESTROOT + "amosigned.xpi",
|
||||
Hash: "sha1:643b08418599ddbd1ea8a511c90696578fb844b9",
|
||||
toString: function() { return this.URL; }
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ function test() {
|
|||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
URL: TESTROOT + "unsigned.xpi",
|
||||
URL: TESTROOT + "amosigned.xpi",
|
||||
Hash: "foo:3d0dc22e1f394e159b08aaf5f0f97de4d5c65f4f",
|
||||
toString: function() { return this.URL; }
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -14,8 +14,8 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Signed XPI": TESTROOT + "signed.xpi",
|
||||
"Signed XPI 2": TESTROOT + "signed2.xpi",
|
||||
"Unsigned XPI": TESTROOT + "amosigned.xpi",
|
||||
"Unsigned XPI 2": TESTROOT + "amosigned2.xpi",
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
@ -33,17 +33,15 @@ function get_item(items, url) {
|
|||
function confirm_install(window) {
|
||||
let items = window.document.getElementById("itemList").childNodes;
|
||||
is(items.length, 2, "Should be 2 items listed in the confirmation dialog");
|
||||
let item = get_item(items, TESTROOT + "signed.xpi");
|
||||
let item = get_item(items, TESTROOT + "amosigned.xpi");
|
||||
if (item) {
|
||||
is(item.name, "Signed XPI Test", "Should have seen the name from the trigger list");
|
||||
is(item.cert, "(Object Signer)", "Should have seen the signer");
|
||||
is(item.signed, "true", "Should have listed the item as signed");
|
||||
is(item.name, "XPI Test", "Should have seen the name from the trigger list");
|
||||
is(item.signed, "false", "Should have listed the item as signed");
|
||||
}
|
||||
item = get_item(items, TESTROOT + "signed2.xpi");
|
||||
item = get_item(items, TESTROOT + "amosigned2.xpi");
|
||||
if (item) {
|
||||
is(item.name, "Signed XPI Test", "Should have seen the name from the trigger list");
|
||||
is(item.cert, "(Object Signer)", "Should have seen the signer");
|
||||
is(item.signed, "true", "Should have listed the item as signed");
|
||||
is(item.signed, "false", "Should have listed the item as signed");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Cookie check": TESTROOT + "cookieRedirect.sjs?" + TESTROOT + "unsigned.xpi"
|
||||
"Cookie check": TESTROOT + "cookieRedirect.sjs?" + TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -16,7 +16,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Cookie check": TESTROOT + "cookieRedirect.sjs?" + TESTROOT + "unsigned.xpi"
|
||||
"Cookie check": TESTROOT + "cookieRedirect.sjs?" + TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -18,7 +18,7 @@ function test() {
|
|||
Services.prefs.setIntPref("network.cookie.cookieBehavior", 1);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Cookie check": TESTROOT + "cookieRedirect.sjs?" + TESTROOT + "unsigned.xpi"
|
||||
"Cookie check": TESTROOT + "cookieRedirect.sjs?" + TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -19,7 +19,7 @@ function test() {
|
|||
Services.prefs.setIntPref("network.cookie.cookieBehavior", 1);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Cookie check": TESTROOT2 + "cookieRedirect.sjs?" + TESTROOT + "unsigned.xpi"
|
||||
"Cookie check": TESTROOT2 + "cookieRedirect.sjs?" + TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -18,7 +18,7 @@ function test() {
|
|||
Harness.setup();
|
||||
|
||||
setup_redirect({
|
||||
"Location": "data:text/html,<script>window.location.href='" + TESTROOT + "unsigned.xpi'</script>"
|
||||
"Location": "data:text/html,<script>window.location.href='" + TESTROOT + "amosigned.xpi'</script>"
|
||||
});
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
|
|
|
@ -9,7 +9,7 @@ function test() {
|
|||
Services.prefs.setBoolPref("xpinstall.enabled", false);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ function test() {
|
|||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
URL: TESTROOT + "unsigned.xpi",
|
||||
Hash: "sha1:3d0dc22e1f394e159b08aaf5f0f97de4d5c65f4f",
|
||||
URL: TESTROOT + "amosigned.xpi",
|
||||
Hash: "sha1:36ffb0acfd9c6e9682473aaebaab394d38b473c9",
|
||||
toString: function() { return this.URL; }
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -11,8 +11,8 @@ function test() {
|
|||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
URL: TESTROOT + "unsigned.xpi",
|
||||
Hash: "sha1:3D0DC22E1F394E159B08AAF5F0F97DE4D5C65F4F",
|
||||
URL: TESTROOT + "amosigned.xpi",
|
||||
Hash: "sha1:36FFB0ACFD9C6E9682473AAEBAAB394D38B473C9",
|
||||
toString: function() { return this.URL; }
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -12,7 +12,7 @@ function test() {
|
|||
Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, false);
|
||||
|
||||
var url = "https://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
|
||||
url += "?sha1:3d0dc22e1f394e159b08aaf5f0f97de4d5c65f4f|" + TESTROOT + "unsigned.xpi";
|
||||
url += "?sha1:36ffb0acfd9c6e9682473aaebaab394d38b473c9|" + TESTROOT + "amosigned.xpi";
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
|
|
|
@ -12,7 +12,7 @@ function test() {
|
|||
Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, false);
|
||||
|
||||
var url = "https://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
|
||||
url += "?sha1:foobar|" + TESTROOT + "unsigned.xpi";
|
||||
url += "?sha1:foobar|" + TESTROOT + "amosigned.xpi";
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
|
|
|
@ -11,12 +11,12 @@ function test() {
|
|||
Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, false);
|
||||
|
||||
var url = "https://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
|
||||
url += "?sha1:foobar|" + TESTROOT + "unsigned.xpi";
|
||||
url += "?sha1:foobar|" + TESTROOT + "amosigned.xpi";
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
URL: url,
|
||||
Hash: "sha1:3d0dc22e1f394e159b08aaf5f0f97de4d5c65f4f",
|
||||
Hash: "sha1:36ffb0acfd9c6e9682473aaebaab394d38b473c9",
|
||||
toString: function() { return this.URL; }
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -10,7 +10,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var url = "http://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
|
||||
url += "?sha1:foobar|" + TESTROOT + "unsigned.xpi";
|
||||
url += "?sha1:foobar|" + TESTROOT + "amosigned.xpi";
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
|
|
|
@ -11,9 +11,9 @@ function test() {
|
|||
Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, false);
|
||||
|
||||
var url = "https://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
|
||||
url += "?sha1:3d0dc22e1f394e159b08aaf5f0f97de4d5c65f4f|";
|
||||
url += "?sha1:36ffb0acfd9c6e9682473aaebaab394d38b473c9|";
|
||||
url += "https://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
|
||||
url += "?sha1:foobar|" + TESTROOT + "unsigned.xpi";
|
||||
url += "?sha1:foobar|" + TESTROOT + "amosigned.xpi";
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
|
|
|
@ -26,7 +26,7 @@ function test() {
|
|||
// Set up the redirect to give a bad hash
|
||||
setup_redirect({
|
||||
"X-Target-Digest": "sha1:foo",
|
||||
"Location": "http://example.com/browser/" + RELATIVE_DIR + "unsigned.xpi"
|
||||
"Location": "http://example.com/browser/" + RELATIVE_DIR + "amosigned.xpi"
|
||||
});
|
||||
|
||||
var url = "https://example.com/browser/" + RELATIVE_DIR + "redirect.sjs?mode=redirect";
|
||||
|
@ -55,8 +55,8 @@ function finish_failed_download() {
|
|||
|
||||
// Give it the right hash this time
|
||||
setup_redirect({
|
||||
"X-Target-Digest": "sha1:3d0dc22e1f394e159b08aaf5f0f97de4d5c65f4f",
|
||||
"Location": "http://example.com/browser/" + RELATIVE_DIR + "unsigned.xpi"
|
||||
"X-Target-Digest": "sha1:36ffb0acfd9c6e9682473aaebaab394d38b473c9",
|
||||
"Location": "http://example.com/browser/" + RELATIVE_DIR + "amosigned.xpi"
|
||||
});
|
||||
|
||||
// The harness expects onNewInstall events for all installs that are about to start
|
||||
|
|
|
@ -9,7 +9,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installchrome.html? " + encodeURIComponent(TESTROOT + "unsigned.xpi"));
|
||||
gBrowser.loadURI(TESTROOT + "installchrome.html? " + encodeURIComponent(TESTROOT + "amosigned.xpi"));
|
||||
}
|
||||
|
||||
function install_ended(install, addon) {
|
||||
|
|
|
@ -11,7 +11,7 @@ function test() {
|
|||
var chromeroot = extractChromeRoot(gTestPath);
|
||||
var xpipath = chromeroot + "unsigned.xpi";
|
||||
try {
|
||||
xpipath = cr.convertChromeURL(makeURI(chromeroot + "unsigned.xpi")).spec;
|
||||
xpipath = cr.convertChromeURL(makeURI(chromeroot + "amosigned.xpi")).spec;
|
||||
} catch (ex) {
|
||||
//scenario where we are running from a .jar and already extracted
|
||||
}
|
||||
|
|
|
@ -8,9 +8,9 @@ function test() {
|
|||
.getService(Components.interfaces.nsIChromeRegistry);
|
||||
|
||||
var chromeroot = getChromeRoot(gTestPath);
|
||||
var xpipath = chromeroot + "unsigned.xpi";
|
||||
var xpipath = chromeroot + "amosigned.xpi";
|
||||
try {
|
||||
xpipath = cr.convertChromeURL(makeURI(chromeroot + "unsigned.xpi")).spec;
|
||||
xpipath = cr.convertChromeURL(makeURI(xpipath)).spec;
|
||||
} catch (ex) {
|
||||
//scenario where we are running from a .jar and already extracted
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ function test() {
|
|||
.getService(Components.interfaces.nsIChromeRegistry);
|
||||
|
||||
var chromeroot = extractChromeRoot(gTestPath);
|
||||
var xpipath = chromeroot + "unsigned.xpi";
|
||||
var xpipath = chromeroot + "amosigned.xpi";
|
||||
try {
|
||||
xpipath = cr.convertChromeURL(makeURI(chromeroot + "unsigned.xpi")).spec;
|
||||
xpipath = cr.convertChromeURL(makeURI(xpipath)).spec;
|
||||
} catch (ex) {
|
||||
//scenario where we are running from a .jar and already extracted
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ function test() {
|
|||
//scenario where we are running from a .jar and already extracted
|
||||
}
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(xpipath + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -33,8 +33,7 @@ function confirm_install(window) {
|
|||
|
||||
item = get_item(items, "Signed XPI Test");
|
||||
if (item) {
|
||||
is(item.cert, "(Object Signer)", "Should have seen the signer");
|
||||
is(item.signed, "true", "Should have listed the item as signed");
|
||||
is(item.signed, "false", "Should have listed the item as signed");
|
||||
is(item.icon, "", "Should have listed no icon for the item");
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -11,7 +11,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -14,7 +14,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -13,7 +13,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -11,7 +11,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -12,7 +12,7 @@ function test() {
|
|||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
URL: "unsigned.xpi",
|
||||
URL: "amosigned.xpi",
|
||||
IconURL: "icon.png",
|
||||
toString: function() { return this.URL; }
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ function confirm_install(window) {
|
|||
var items = window.document.getElementById("itemList").childNodes;
|
||||
is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
|
||||
is(items[0].name, "XPI Test", "Should have seen the name");
|
||||
is(items[0].url, TESTROOT + "unsigned.xpi", "Should have listed the correct url for the item");
|
||||
is(items[0].url, TESTROOT + "amosigned.xpi", "Should have listed the correct url for the item");
|
||||
is(items[0].icon, TESTROOT + "icon.png", "Should have listed the correct icon for the item");
|
||||
is(items[0].signed, "false", "Should have listed the item as unsigned");
|
||||
return true;
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests installing an signed add-on by navigating directly to the url
|
||||
function test() {
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab("about:blank");
|
||||
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||
gBrowser.loadURI(TESTROOT + "signed-multipackage.xpi");
|
||||
});
|
||||
}
|
||||
|
||||
function get_item(items, name) {
|
||||
for (let item of items) {
|
||||
if (item.name == name)
|
||||
return item;
|
||||
}
|
||||
ok(false, "Item for " + name + " was not listed");
|
||||
return null;
|
||||
}
|
||||
|
||||
function confirm_install(window) {
|
||||
let items = window.document.getElementById("itemList").childNodes;
|
||||
is(items.length, 2, "Should be 2 items listed in the confirmation dialog");
|
||||
|
||||
let item = get_item(items, "XPI Test");
|
||||
if (item) {
|
||||
is(item.signed, "false", "Should not have listed the item as signed");
|
||||
is(item.icon, "", "Should have listed no icon for the item");
|
||||
}
|
||||
|
||||
item = get_item(items, "Signed XPI Test");
|
||||
if (item) {
|
||||
is(item.cert, "(Object Signer)", "Should have seen the signer");
|
||||
is(item.signed, "true", "Should have listed the item as signed");
|
||||
is(item.icon, "", "Should have listed no icon for the item");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function install_ended(install, addon) {
|
||||
install.cancel();
|
||||
}
|
||||
|
||||
function finish_test(count) {
|
||||
is(count, 2, "2 Add-ons should have been successfully installed");
|
||||
gBrowser.removeCurrentTab();
|
||||
Harness.finish();
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
|
@ -9,7 +9,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "startsoftwareupdate.html? " + encodeURIComponent(TESTROOT + "unsigned.xpi"));
|
||||
gBrowser.loadURI(TESTROOT + "startsoftwareupdate.html? " + encodeURIComponent(TESTROOT + "amosigned.xpi"));
|
||||
}
|
||||
|
||||
function install_ended(install, addon) {
|
||||
|
|
|
@ -14,7 +14,7 @@ function test() {
|
|||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
URL: TESTROOT + "unsigned.xpi",
|
||||
URL: TESTROOT + "amosigned.xpi",
|
||||
IconURL: TESTROOT + "icon.png",
|
||||
toString: function() { return this.URL; }
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ function confirm_install(window) {
|
|||
var items = window.document.getElementById("itemList").childNodes;
|
||||
is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
|
||||
is(items[0].name, "XPI Test", "Should have seen the name");
|
||||
is(items[0].url, TESTROOT + "unsigned.xpi", "Should have listed the correct url for the item");
|
||||
is(items[0].url, TESTROOT + "amosigned.xpi", "Should have listed the correct url for the item");
|
||||
is(items[0].icon, TESTROOT + "icon.png", "Should have listed the correct icon for the item");
|
||||
is(items[0].signed, "false", "Should have listed the item as unsigned");
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ function confirm_install(window) {
|
|||
var items = window.document.getElementById("itemList").childNodes;
|
||||
is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
|
||||
is(items[0].name, "XPI Test", "Should have seen the name");
|
||||
is(items[0].url, TESTROOT + "unsigned.xpi", "Should have listed the correct url for the item");
|
||||
is(items[0].url, TESTROOT + "amosigned.xpi", "Should have listed the correct url for the item");
|
||||
is(items[0].icon, TESTROOT + "icon.png", "Should have listed the correct icon for the item");
|
||||
is(items[0].signed, "false", "Should have listed the item as unsigned");
|
||||
return true;
|
||||
|
|
|
@ -14,7 +14,7 @@ function test() {
|
|||
|
||||
var inner_url = encodeURIComponent(TESTROOT + "installtrigger.html?" + encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": {
|
||||
URL: TESTROOT + "unsigned.xpi",
|
||||
URL: TESTROOT + "amosigned.xpi",
|
||||
IconURL: TESTROOT + "icon.png",
|
||||
toString: function() { return this.URL; }
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ function test() {
|
|||
Harness.setup();
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
@ -26,7 +26,7 @@ function confirm_install(window) {
|
|||
var items = window.document.getElementById("itemList").childNodes;
|
||||
is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
|
||||
is(items[0].name, "XPI Test", "Should have seen the name from the trigger list");
|
||||
is(items[0].url, TESTROOT + "unsigned.xpi", "Should have listed the correct url for the item");
|
||||
is(items[0].url, TESTROOT + "amosigned.xpi", "Should have listed the correct url for the item");
|
||||
is(items[0].signed, "false", "Should have listed the item as unsigned");
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ function test() {
|
|||
pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT2 + "unsigned.xpi"
|
||||
"Unsigned XPI": TESTROOT2 + "amosigned.xpi"
|
||||
}));
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests installing an unsigned add-on through a navigation. Should not be
|
||||
// blocked since the referer is whitelisted.
|
||||
var url = TESTROOT2 + "navigate.html?" + encodeURIComponent(TESTROOT + "unsigned.xpi");
|
||||
var url = TESTROOT2 + "navigate.html?" + encodeURIComponent(TESTROOT + "amosigned.xpi");
|
||||
|
||||
function test() {
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests installing an unsigned add-on through a navigation. Should be
|
||||
// blocked since the referer is not whitelisted even though the target is.
|
||||
var url = TESTROOT2 + "navigate.html?" + encodeURIComponent(TESTROOT + "unsigned.xpi");
|
||||
var url = TESTROOT2 + "navigate.html?" + encodeURIComponent(TESTROOT + "amosigned.xpi");
|
||||
|
||||
function test() {
|
||||
Harness.installBlockedCallback = allow_blocked;
|
||||
|
|
|
@ -8,7 +8,7 @@ function test() {
|
|||
Harness.setup();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "startsoftwareupdate.html? " + encodeURIComponent(TESTROOT + "unsigned.xpi"));
|
||||
gBrowser.loadURI(TESTROOT + "startsoftwareupdate.html? " + encodeURIComponent(TESTROOT + "amosigned.xpi"));
|
||||
}
|
||||
|
||||
function allow_blocked(installInfo) {
|
||||
|
|
|
@ -8,7 +8,7 @@ function test() {
|
|||
Harness.setup();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(TESTROOT + "installchrome.html? " + encodeURIComponent(TESTROOT + "unsigned.xpi"));
|
||||
gBrowser.loadURI(TESTROOT + "installchrome.html? " + encodeURIComponent(TESTROOT + "amosigned.xpi"));
|
||||
}
|
||||
|
||||
function allow_blocked(installInfo) {
|
||||
|
|
|
@ -12,7 +12,7 @@ function test() {
|
|||
|
||||
gBrowser.selectedTab = gBrowser.addTab("about:blank");
|
||||
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
|
||||
gBrowser.loadURI(TESTROOT + "unsigned.xpi");
|
||||
gBrowser.loadURI(TESTROOT + "amosigned.xpi");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<script type="text/javascript">
|
||||
function startInstall() {
|
||||
window.InstallTrigger.install({
|
||||
"Unsigned XPI": "unsigned.xpi"
|
||||
"Unsigned XPI": "amosigned.xpi"
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -20,7 +20,7 @@ function startInstall() {
|
|||
Object.defineProperty(document, "documentURIObject", { spec : { href : whiteUrl } });
|
||||
|
||||
InstallTrigger.install({
|
||||
"Unsigned XPI": "http://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/unsigned.xpi"
|
||||
"Unsigned XPI": "http://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/amosigned.xpi"
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -19,7 +19,7 @@ function installCallback(url, status) {
|
|||
function startInstall() {
|
||||
var root = location.href.replace("concurrent_installs.html", "");
|
||||
var triggers = {
|
||||
"Unsigned XPI": root + "unsigned.xpi"
|
||||
"Unsigned XPI": root + "amosigned.xpi"
|
||||
};
|
||||
try {
|
||||
document.getElementById("return").textContent = InstallTrigger.install(triggers, installCallback);
|
||||
|
|
Двоичные данные
toolkit/mozapps/extensions/test/xpinstall/multipackage.xpi
Двоичные данные
toolkit/mozapps/extensions/test/xpinstall/multipackage.xpi
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -20,7 +20,7 @@ function installCallback(url, status) {
|
|||
function startInstall() {
|
||||
InstallTrigger.install({
|
||||
"Unsigned XPI": {
|
||||
URL: "unsigned.xpi",
|
||||
URL: "amosigned.xpi",
|
||||
IconURL: "icon.png",
|
||||
toString: function() { return this.URL; }
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче