зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1754441 - Explicit set prefs to enable InstallTrigger on all tests that depend on its availability. r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D138793
This commit is contained in:
Родитель
026eb6d7cf
Коммит
d9c980ced7
|
@ -3,6 +3,12 @@
|
|||
const INSTALL_PAGE = `${BASE}/file_install_extensions.html`;
|
||||
|
||||
async function installTrigger(filename) {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.InstallTrigger.enabled", true],
|
||||
["extensions.InstallTriggerImpl.enabled", true],
|
||||
],
|
||||
});
|
||||
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, INSTALL_PAGE);
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ add_task(async function test_unsigned() {
|
|||
set: [
|
||||
["extensions.webapi.testing", true],
|
||||
["extensions.install.requireBuiltInCerts", false],
|
||||
["extensions.InstallTrigger.enabled", true],
|
||||
["extensions.InstallTriggerImpl.enabled", true],
|
||||
],
|
||||
});
|
||||
|
||||
|
|
|
@ -33,6 +33,17 @@ function promisePopupNotificationShown(name) {
|
|||
});
|
||||
}
|
||||
|
||||
add_setup(async function ensureInstallTriggerEnabled() {
|
||||
// Once InstallTrigger is removed, the tests targeting InstallTrigger should
|
||||
// be removed or adapted to don't use InstallTrigger.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.InstallTrigger.enabled", true],
|
||||
["extensions.InstallTriggerImpl.enabled", true],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_install_source_blocked_link() {
|
||||
await setupPolicyEngineWithJson({
|
||||
policies: {
|
||||
|
|
|
@ -5,7 +5,12 @@
|
|||
<meta charset="UTF-8">
|
||||
<script type="text/javascript">
|
||||
function installTrigger(url) {
|
||||
InstallTrigger.install({extension: url});
|
||||
try {
|
||||
InstallTrigger.install({extension: url});
|
||||
} catch (err) {
|
||||
dump(`Failed to execute InstallTrigger.install: ${err}\n`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
@ -14,7 +19,7 @@ function installTrigger(url) {
|
|||
<a id="policytest" href="policytest_v0.1.xpi">policytest@mozilla.com</a>
|
||||
</p>
|
||||
<p>
|
||||
<a id="policytest_installtrigger" onclick="installTrigger(this.href);return false;" href="policytest_v0.1.xpi">policytest@mozilla.com</a>
|
||||
<a id="policytest_installtrigger" onclick="return installTrigger(this.href);" href="policytest_v0.1.xpi">policytest@mozilla.com</a>
|
||||
</p>
|
||||
<p>
|
||||
<a id="policytest_otherdomain" href="http://example.org:80/browser/browser/components/enterprisepolicies/tests/browser/policytest_v0.1.xpi">policytest@mozilla.com</a>
|
||||
|
|
|
@ -110,7 +110,7 @@ load 628599-1.html
|
|||
load 637116.html
|
||||
load 637214-1.svg
|
||||
load 637214-2.svg
|
||||
load 642022-1.html
|
||||
pref(extensions.InstallTrigger.enabled,true) pref(extensions.InstallTriggerImpl.enabled,true) load 642022-1.html
|
||||
load 646184.html
|
||||
load 658845-1.svg
|
||||
load 666869.html
|
||||
|
|
|
@ -669,7 +669,13 @@ var interfaceNamesInGlobalScope = [
|
|||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "InputEvent", insecureContext: true },
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "InstallTrigger", insecureContext: true },
|
||||
{
|
||||
name: "InstallTrigger",
|
||||
insecureContext: true,
|
||||
disabled: !SpecialPowers.Services.prefs.getBoolPref(
|
||||
"extensions.InstallTrigger.enabled"
|
||||
),
|
||||
},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "IntersectionObserver", insecureContext: true },
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
load 117307-1.html
|
||||
load 193710.html
|
||||
load 290162-1.html
|
||||
pref(extensions.InstallTrigger.enabled,true) pref(extensions.InstallTriggerImpl.enabled,true) load 290162-1.html
|
||||
load 326615-1.html
|
||||
load 328553-1.html
|
||||
load 346258-1.html
|
||||
|
@ -28,11 +28,11 @@ load 601284-1.html
|
|||
load 603146-1.html
|
||||
load 603858-1.html
|
||||
load 608963.html
|
||||
load 616930-1.html
|
||||
pref(extensions.InstallTrigger.enabled,true) pref(extensions.InstallTriggerImpl.enabled,true) load 616930-1.html
|
||||
# This test has jit-related infinite recursion, which is slow enough to cause
|
||||
# timeouts on mac. See bug 908895.
|
||||
skip-if(cocoaWidget&&isDebugBuild) load 639737-1.html
|
||||
load 648206-1.html
|
||||
pref(extensions.InstallTrigger.enabled,true) pref(extensions.InstallTriggerImpl.enabled,true) load 648206-1.html
|
||||
load 720305-1.html
|
||||
load 721910.html
|
||||
load 723465.html
|
||||
|
|
|
@ -18,9 +18,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=628410
|
|||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 628410 **/
|
||||
window.toString();
|
||||
InstallTrigger + "";
|
||||
|
||||
if (SpecialPowers.Services.prefs.getBoolPref("extensions.InstallTrigger.enabled") &&
|
||||
SpecialPowers.Services.prefs.getBoolPref("extensions.InstallTriggerImpl.enabled")) {
|
||||
InstallTrigger + "";
|
||||
}
|
||||
|
||||
console + "";
|
||||
ok(true, "Things didn't throw");
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ add_task(async function setup() {
|
|||
set: [
|
||||
["extensions.webapi.testing", true],
|
||||
["extensions.install.requireBuiltInCerts", false],
|
||||
["extensions.InstallTrigger.enabled", true],
|
||||
["extensions.InstallTriggerImpl.enabled", true],
|
||||
],
|
||||
});
|
||||
|
||||
|
|
|
@ -16,6 +16,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887098
|
|||
/* globals $,evalRef */
|
||||
|
||||
async function loaded() {
|
||||
if (!SpecialPowers.Services.prefs.getBoolPref("extensions.InstallTrigger.enabled") ||
|
||||
!SpecialPowers.Services.prefs.getBoolPref("extensions.InstallTriggerImpl.enabled")) {
|
||||
ok(true, "InstallTrigger is not enabled");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// Bug 1703215: Using SpecialPowers causes about:mozilla to be loaded in the wrong
|
||||
// process, hence we have to flip the pref and don't enforce IPC based Principal Vetting.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
|
|
|
@ -23,7 +23,14 @@ async function assertInstallTriggetRejected(page, xpi_url, expectedError) {
|
|||
}
|
||||
|
||||
add_task(
|
||||
async function test_InstallTriggerThrows_on_unsupported_xpi_schemesì_blob() {
|
||||
{
|
||||
// Once InstallTrigger is removed, this test should be removed as well.
|
||||
pref_set: [
|
||||
["extensions.InstallTrigger.enabled", true],
|
||||
["extensions.InstallTriggerImpl.enabled", true],
|
||||
],
|
||||
},
|
||||
async function test_InstallTriggerThrows_on_unsupported_xpi_schemes_blob() {
|
||||
const page = await ExtensionTestUtils.loadContentPage("http://example.com");
|
||||
const blob_url = await page.spawn([], () => {
|
||||
return this.content.eval(`(function () {
|
||||
|
@ -37,6 +44,13 @@ add_task(
|
|||
);
|
||||
|
||||
add_task(
|
||||
{
|
||||
// Once InstallTrigger is removed, this test should be removed as well.
|
||||
pref_set: [
|
||||
["extensions.InstallTrigger.enabled", true],
|
||||
["extensions.InstallTriggerImpl.enabled", true],
|
||||
],
|
||||
},
|
||||
async function test_InstallTriggerThrows_on_unsupported_xpi_schemes_data() {
|
||||
const page = await ExtensionTestUtils.loadContentPage("http://example.com");
|
||||
const data_url = "data:;,fakexpicontent";
|
||||
|
|
|
@ -14,6 +14,9 @@ AddonTestUtils.initMochitest(this);
|
|||
// Tests installing an unsigned add-on through an InstallTrigger call in web
|
||||
// content.
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// works in an iframe in web content.
|
||||
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Test whether an install succeeds when authentication is required
|
||||
// This verifies bug 312473
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
// Turn off the authentication dialog blocking for this test.
|
||||
Services.prefs.setBoolPref(
|
||||
"network.auth.non-web-content-triggered-resources-http-auth-allow",
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// credentials are given
|
||||
// This verifies bug 312473
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
// Turn off the authentication dialog blocking for this test.
|
||||
Services.prefs.setBoolPref(
|
||||
"network.auth.non-web-content-triggered-resources-http-auth-allow",
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// canceled
|
||||
// This verifies bug 312473
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
// Turn off the authentication dialog blocking for this test.
|
||||
Services.prefs.setBoolPref(
|
||||
"network.auth.non-web-content-triggered-resources-http-auth-allow",
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
var gNewTab;
|
||||
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
// Turn off the authentication dialog blocking for this test.
|
||||
Services.prefs.setBoolPref(
|
||||
"network.auth.non-web-content-triggered-resources-http-auth-allow",
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Test whether passing a simple string to InstallTrigger.install throws an
|
||||
// exception
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify(TESTROOT + "amosigned.xpi"));
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Test whether passing an undefined url InstallTrigger.install throws an
|
||||
// exception
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
var triggers = encodeURIComponent(
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Test whether an install fails when an invalid hash is included
|
||||
// This verifies bug 302284
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.downloadFailedCallback = download_failed;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Test whether an install fails when an unknown hash type is included
|
||||
// This verifies bug 302284
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.downloadFailedCallback = download_failed;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -25,9 +25,9 @@ function changeFullscreen(browser, fullscreenState) {
|
|||
});
|
||||
}
|
||||
|
||||
function triggerInstall(browser, trigger) {
|
||||
return SpecialPowers.spawn(browser, [trigger], async function(trigger) {
|
||||
content.InstallTrigger.install(trigger);
|
||||
function triggerInstall(browser, xpi_url) {
|
||||
return SpecialPowers.spawn(browser, [xpi_url], async function(xpi_url) {
|
||||
content.location = xpi_url;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ add_task(async function testFullscreenBlockAddonInstallPrompt() {
|
|||
let addonEventPromise = TestUtils.topicObserved(
|
||||
"addon-install-fullscreen-blocked"
|
||||
);
|
||||
await triggerInstall(gBrowser.selectedBrowser, { XPI: "amosigned.xpi" });
|
||||
await triggerInstall(gBrowser.selectedBrowser, "amosigned.xpi");
|
||||
await addonEventPromise;
|
||||
|
||||
// Test if addon installation prompt has been blocked
|
||||
|
@ -70,20 +70,22 @@ add_task(async function testFullscreenBlockAddonInstallPrompt() {
|
|||
|
||||
// This tests if the addon install prompt is closed when entering fullscreen
|
||||
add_task(async function testFullscreenCloseAddonInstallPrompt() {
|
||||
let triggers = encodeURIComponent(
|
||||
JSON.stringify({
|
||||
XPI: "amosigned.xpi",
|
||||
})
|
||||
);
|
||||
let target = TESTROOT + "installtrigger.html?" + triggers;
|
||||
|
||||
// Open example.com
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com");
|
||||
|
||||
// Trigger addon installation
|
||||
let addonEventPromise = TestUtils.topicObserved("addon-install-blocked");
|
||||
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, target);
|
||||
let addonEventPromise = TestUtils.topicObserved(
|
||||
"webextension-permission-prompt"
|
||||
);
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[TESTROOT + "amosigned.xpi"],
|
||||
xpi_url => {
|
||||
this.content.location = xpi_url;
|
||||
}
|
||||
);
|
||||
// Wait for addon install event
|
||||
info("Wait for webextension-permission-prompt");
|
||||
await addonEventPromise;
|
||||
|
||||
// Test if addon installation prompt is visible
|
||||
|
@ -93,10 +95,10 @@ add_task(async function testFullscreenCloseAddonInstallPrompt() {
|
|||
);
|
||||
Assert.ok(
|
||||
PopupNotifications.getNotification(
|
||||
"addon-install-blocked",
|
||||
"addon-webext-permissions",
|
||||
gBrowser.selectedBrowser
|
||||
) != null,
|
||||
"Opened notification is installation blocked prompt"
|
||||
"Opened notification is webextension permissions prompt"
|
||||
);
|
||||
|
||||
// Switch to fullscreen and test for addon installation prompt close
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests that calling InstallTrigger.installChrome works
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.installChrome availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installEndedCallback = check_xpi_install;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
// Test whether setting a new property in InstallTrigger then persists to other
|
||||
// page loads
|
||||
add_task(async function test() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.InstallTrigger.enabled", true],
|
||||
["extensions.InstallTriggerImpl.enabled", true],
|
||||
],
|
||||
});
|
||||
|
||||
await BrowserTestUtils.withNewTab(
|
||||
{ gBrowser, url: TESTROOT + "enabled.html" },
|
||||
async function(browser) {
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Test whether an InstallTrigger.enabled is working
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.InstallTrigger.enabled", true],
|
||||
["extensions.InstallTriggerImpl.enabled", true],
|
||||
],
|
||||
});
|
||||
|
||||
let testtab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
TESTROOT + "bug638292.html"
|
||||
|
|
|
@ -3,6 +3,18 @@
|
|||
// content. This should be blocked by the whitelist check.
|
||||
// This verifies bug 645699
|
||||
function test() {
|
||||
if (
|
||||
!SpecialPowers.Services.prefs.getBoolPref(
|
||||
"extensions.InstallTrigger.enabled"
|
||||
) ||
|
||||
!SpecialPowers.Services.prefs.getBoolPref(
|
||||
"extensions.InstallTriggerImpl.enabled"
|
||||
)
|
||||
) {
|
||||
ok(true, "InstallTrigger is not enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
// prompt prior to download
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.postDownloadThirdPartyPrompt", false]],
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// content. This should be blocked by the origin allow check.
|
||||
// This verifies bug 645699
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installBlockedCallback = allow_blocked;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
var gWindowWatcher = null;
|
||||
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installCancelledCallback = cancelled_install;
|
||||
Harness.installEndedCallback = complete_install;
|
||||
|
|
|
@ -35,6 +35,9 @@ function check_channel(subject) {
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests we send the right cookies when installing through an InstallTrigger call
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// are set
|
||||
// This verifies bug 462739
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.downloadFailedCallback = download_failed;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// are set
|
||||
// This verifies bug 462739
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// are set and third party cookies are disabled.
|
||||
// This verifies bug 462739
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
// party.
|
||||
// This verifies bug 462739
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.downloadFailedCallback = download_failed;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Test whether an install fails when the xpi is corrupt.
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.downloadFailedCallback = download_failed;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.finalContentEvent = "InstallComplete";
|
||||
|
|
|
@ -1461,6 +1461,9 @@ add_task(async function() {
|
|||
["extensions.strictCompatibility", true],
|
||||
["extensions.install.requireSecureOrigin", false],
|
||||
["security.dialog_enable_delay", 0],
|
||||
// These tests currently depends on InstallTrigger.install.
|
||||
["extensions.InstallTrigger.enabled", true],
|
||||
["extensions.InstallTriggerImpl.enabled", true],
|
||||
],
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Test whether an install fails when there is no install script present.
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.downloadFailedCallback = download_failed;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
add_setup(async function() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.InstallTrigger.enabled", true],
|
||||
["extensions.InstallTriggerImpl.enabled", true],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
// Test whether an InstallTrigger.enabled is working
|
||||
add_task(async function test_enabled() {
|
||||
await BrowserTestUtils.openNewForegroundTab(
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Test whether an install succeeds when a valid hash is included
|
||||
// This verifies bug 302284
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Test whether an install succeeds using case-insensitive hashes
|
||||
// This verifies bug 603021
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// request
|
||||
// This verifies bug 591070
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// request
|
||||
// This verifies bug 591070
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.downloadFailedCallback = download_failed;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Tests that the HTTPS hash is ignored when InstallTrigger is passed a hash.
|
||||
// This verifies bug 591070
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Test that hashes are ignored in the headers of HTTP requests
|
||||
// This verifies bug 591070
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Test that only the first HTTPS hash is used
|
||||
// This verifies bug 591070
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -16,6 +16,9 @@ function setup_redirect(aSettings) {
|
|||
var gInstall = null;
|
||||
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.downloadFailedCallback = download_failed;
|
||||
Harness.installsCompletedCallback = finish_failed_download;
|
||||
Harness.setup();
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests that calling InstallTrigger.installChrome works
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.installChrome availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
add_setup(async function() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.InstallTrigger.enabled", true],
|
||||
["extensions.InstallTriggerImpl.enabled", true],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Test whether an install fails if the url is a local file when requested from
|
||||
// web content
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Tests installing an add-on from a local file with file origins disabled.
|
||||
// This should be blocked by the origin allowed check.
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
// prompt prior to download
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.postDownloadThirdPartyPrompt", false]],
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Tests installing an add-on from a local file with file origins disabled.
|
||||
// This should be blocked by the origin allowed check.
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installBlockedCallback = allow_blocked;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
// Prevent the Harness from ending the test on download cancel.
|
||||
|
|
|
@ -8,6 +8,10 @@ let popupPromise;
|
|||
const exampleURI = Services.io.newURI("http://example.com");
|
||||
async function test() {
|
||||
waitForExplicitFinish(); // have to call this ourselves because we're async.
|
||||
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.security.https_first", false]],
|
||||
});
|
||||
|
|
|
@ -3,6 +3,9 @@ var proxyPrefValue;
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests that going offline cancels an in progress download.
|
||||
function test() {
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.downloadProgressCallback = download_progress;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -36,6 +36,10 @@ function check_channel(subject) {
|
|||
let gPrivateWin;
|
||||
async function test() {
|
||||
waitForExplicitFinish(); // have to call this ourselves because we're async.
|
||||
|
||||
// This test currently depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.security.https_first_pbm", false]],
|
||||
});
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests that InstallTrigger deals with relative urls correctly.
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests installing an signed add-on through an InstallTrigger call in web
|
||||
// content.
|
||||
function test() {
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
||||
PermissionTestUtils.add(
|
||||
"http://example.com/",
|
||||
"install",
|
||||
Services.perms.ALLOW_ACTION
|
||||
);
|
||||
|
||||
var triggers = encodeURIComponent(
|
||||
JSON.stringify({
|
||||
"Signed XPI": TESTROOT + "amosigned.xpi",
|
||||
})
|
||||
);
|
||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
||||
BrowserTestUtils.loadURI(
|
||||
gBrowser,
|
||||
TESTROOT + "installtrigger.html?" + triggers
|
||||
);
|
||||
}
|
||||
|
||||
function confirm_install(panel) {
|
||||
is(panel.getAttribute("name"), "XPI Test", "Should have seen the name");
|
||||
return true;
|
||||
}
|
||||
|
||||
function install_ended(install, addon) {
|
||||
return addon.uninstall();
|
||||
}
|
||||
|
||||
function finish_test(count) {
|
||||
is(count, 1, "1 Add-on should have been successfully installed");
|
||||
|
||||
PermissionTestUtils.remove("http://example.com", "install");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
Harness.finish();
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests that calling InstallTrigger.startSoftwareUpdate works
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.startSoftwareUpdate availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests that the InstallTrigger callback can redirect to a relative url.
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Tests installing an unsigned add-on through an InstallTrigger call in web
|
||||
// content.
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// works in an iframe in web content.
|
||||
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
var wasOriginBlocked = false;
|
||||
|
||||
function test() {
|
||||
// This test depends on InstallTrigger.install availability.
|
||||
setInstallTriggerPrefs();
|
||||
|
||||
Harness.installOriginBlockedCallback = install_blocked;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.finalContentEvent = "InstallComplete";
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Tests installing an unsigned add-on through an InstallTrigger call in web
|
||||
// content. This should be blocked by the whitelist check.
|
||||
// This verifies bug 252830
|
||||
function test() {
|
||||
Harness.installConfirmCallback = confirm_install;
|
||||
Harness.installBlockedCallback = allow_blocked;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
||||
var triggers = encodeURIComponent(
|
||||
JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "amosigned.xpi",
|
||||
})
|
||||
);
|
||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
||||
BrowserTestUtils.loadURI(
|
||||
gBrowser,
|
||||
TESTROOT + "installtrigger.html?" + triggers
|
||||
);
|
||||
}
|
||||
|
||||
function allow_blocked(installInfo) {
|
||||
is(
|
||||
installInfo.browser,
|
||||
gBrowser.selectedBrowser,
|
||||
"Install should have been triggered by the right browser"
|
||||
);
|
||||
is(
|
||||
installInfo.originatingURI.spec,
|
||||
gBrowser.currentURI.spec,
|
||||
"Install should have been triggered by the right uri"
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
function confirm_install(panel) {
|
||||
is(panel.getAttribute("name"), "XPI Test", "Should have seen the name");
|
||||
return true;
|
||||
}
|
||||
|
||||
function install_ended(install, addon) {
|
||||
return addon.uninstall();
|
||||
}
|
||||
|
||||
const finish_test = async function(count) {
|
||||
is(count, 1, "1 Add-on should have been successfully installed");
|
||||
|
||||
const results = await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[],
|
||||
() => {
|
||||
return {
|
||||
return: content.document.getElementById("return").textContent,
|
||||
status: content.document.getElementById("status").textContent,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
is(results.return, "false", "installTrigger should seen a failure");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
Harness.finish();
|
||||
};
|
||||
// ----------------------------------------------------------------------------
|
|
@ -37,6 +37,17 @@ function extractChromeRoot(path) {
|
|||
return chromeRootPath;
|
||||
}
|
||||
|
||||
function setInstallTriggerPrefs() {
|
||||
Services.prefs.setBoolPref("extensions.InstallTrigger.enabled", true);
|
||||
Services.prefs.setBoolPref("extensions.InstallTriggerImpl.enabled", true);
|
||||
registerCleanupFunction(clearInstallTriggerPrefs);
|
||||
}
|
||||
|
||||
function clearInstallTriggerPrefs() {
|
||||
Services.prefs.clearUserPref("extensions.InstallTrigger.enabled");
|
||||
Services.prefs.clearUserPref("extensions.InstallTriggerImpl.enabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a test harness designed to handle responding to UI during the process
|
||||
* of installing an XPI. A test can set callbacks to hear about specific parts
|
||||
|
|
|
@ -421,7 +421,6 @@ avoid-blacklist-and-whitelist:
|
|||
- toolkit/mozapps/extensions/test/xpinstall/browser_localfile3.js
|
||||
- toolkit/mozapps/extensions/test/xpinstall/browser_localfile4.js
|
||||
- toolkit/mozapps/extensions/test/xpinstall/browser_localfile4_postDownload.js
|
||||
- toolkit/mozapps/extensions/test/xpinstall/browser_whitelist.js
|
||||
- toolkit/mozapps/extensions/test/xpinstall/head.js
|
||||
- toolkit/xre/nsAppRunner.cpp
|
||||
- toolkit/xre/nsEmbedFunctions.cpp
|
||||
|
|
Загрузка…
Ссылка в новой задаче