Commit 00c235b7 authored by Carsten Schoenert's avatar Carsten Schoenert
Browse files

New upstream version 78.7.0

parent 07b47332
......@@ -89,6 +89,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
WebNavigationFrames: "resource://gre/modules/WebNavigationFrames.jsm",
fxAccounts: "resource://gre/modules/FxAccounts.jsm",
webrtcUI: "resource:///modules/webrtcUI.jsm",
WebsiteFilter: "resource:///modules/policies/WebsiteFilter.jsm",
ZoomUI: "resource:///modules/ZoomUI.jsm",
});
......
......@@ -453,6 +453,16 @@ class nsContextMenu {
"context-savelink",
this.onSaveableLink || this.onPlainTextLink
);
if (
(this.onSaveableLink || this.onPlainTextLink) &&
Services.policies.status === Services.policies.ACTIVE
) {
this.setItemAttr(
"context-savelink",
"disabled",
!WebsiteFilter.isAllowed(this.linkURL)
);
}
// Save image depends on having loaded its content, video and audio don't.
this.showItem("context-saveimage", this.onLoadedImage || this.onCanvas);
......
......@@ -2277,7 +2277,11 @@ function installAddonFromURL(url, extensionID, addon) {
)} - {url}`
);
},
onInstallEnded: () => {
/* eslint-disable-next-line no-shadow */
onInstallEnded: (install, addon) => {
if (addon.type == "theme") {
addon.enable();
}
install.removeListener(listener);
log.debug(`Installation succeeded - ${url}`);
},
......
......@@ -134,4 +134,15 @@ let WebsiteFilter = {
createInstance(outer, iid) {
return this.QueryInterface(iid);
},
isAllowed(url) {
if (this._blockPatterns?.matches(url.toLowerCase())) {
if (
!this._exceptionsPatterns ||
!this._exceptionsPatterns.matches(url.toLowerCase())
) {
return false;
}
}
return true;
},
};
......@@ -7,6 +7,7 @@ support-files =
policytest_v0.2.xpi
policy_websitefilter_block.html
policy_websitefilter_exception.html
policy_websitefilter_savelink.html
../../../../../toolkit/components/antitracking/test/browser/page.html
../../../../../toolkit/components/antitracking/test/browser/subResources.sjs
extensionsettings.html
......
......@@ -6,6 +6,7 @@ const SUPPORT_FILES_PATH =
"http://mochi.test:8888/browser/browser/components/enterprisepolicies/tests/browser/";
const BLOCKED_PAGE = "policy_websitefilter_block.html";
const EXCEPTION_PAGE = "policy_websitefilter_exception.html";
const SAVELINKAS_PAGE = "policy_websitefilter_savelink.html";
add_task(async function test_http() {
await setupPolicyEngineWithJson({
......@@ -53,3 +54,75 @@ add_task(async function test_file() {
await checkBlockedPage("file:///this_should_be_blocked", true);
});
add_task(async function test_savelink() {
await setupPolicyEngineWithJson({
policies: {
WebsiteFilter: {
Block: ["*://mochi.test/*policy_websitefilter_block*"],
},
},
});
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
SUPPORT_FILES_PATH + SAVELINKAS_PAGE
);
let contextMenu = document.getElementById("contentAreaContextMenu");
let promiseContextMenuOpen = BrowserTestUtils.waitForEvent(
contextMenu,
"popupshown"
);
await BrowserTestUtils.synthesizeMouse(
"#savelink_blocked",
0,
0,
{
type: "contextmenu",
button: 2,
centered: true,
},
gBrowser.selectedBrowser
);
await promiseContextMenuOpen;
let saveLink = document.getElementById("context-savelink");
is(saveLink.disabled, true, "Save Link As should be disabled");
let promiseContextMenuHidden = BrowserTestUtils.waitForEvent(
contextMenu,
"popuphidden"
);
contextMenu.hidePopup();
await promiseContextMenuHidden;
promiseContextMenuOpen = BrowserTestUtils.waitForEvent(
contextMenu,
"popupshown"
);
await BrowserTestUtils.synthesizeMouse(
"#savelink_notblocked",
0,
0,
{
type: "contextmenu",
button: 2,
centered: true,
},
gBrowser.selectedBrowser
);
await promiseContextMenuOpen;
saveLink = document.getElementById("context-savelink");
is(saveLink.disabled, false, "Save Link As should not be disabled");
promiseContextMenuHidden = BrowserTestUtils.waitForEvent(
contextMenu,
"popuphidden"
);
contextMenu.hidePopup();
await promiseContextMenuHidden;
BrowserTestUtils.removeTab(tab);
});
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Save Link As test</title>
</head>
<body>
<a id="savelink_blocked" href="http://mochi.test:8888/browser/browser/components/enterprisepolicies/tests/browser/policy_websitefilter_block.html">Should not be saveable</a><br/>
<a id="savelink_notblocked" href="http://mochi.test:8888/browser/browser/components/enterprisepolicies/tests/browser/policy_websitefilter_no_block.html">Should be saveable</a>
</body>
</html>
......@@ -17,6 +17,7 @@ const server = AddonTestUtils.createHttpServer({ hosts: ["example.com"] });
const BASE_URL = `http://example.com/data`;
let addonID = "policytest2@mozilla.com";
let themeID = "policytheme@mozilla.com";
add_task(async function setup() {
await AddonTestUtils.promiseStartupManager();
......@@ -219,3 +220,36 @@ add_task(async function test_extensionsettings_string() {
);
equal(newRestrictedDomains, restrictedDomains + ",example.com,example.org");
});
add_task(async function test_theme() {
let themeFile = AddonTestUtils.createTempWebExtensionFile({
manifest: {
applications: {
gecko: {
id: themeID,
},
},
theme: {},
},
});
server.registerFile("/data/policy_theme.xpi", themeFile);
await Promise.all([
AddonTestUtils.promiseInstallEvent("onInstallEnded"),
setupPolicyEngineWithJson({
policies: {
ExtensionSettings: {
"policytheme@mozilla.com": {
installation_mode: "normal_installed",
install_url: BASE_URL + "/policy_theme.xpi",
},
},
},
}),
]);
let currentTheme = Services.prefs.getCharPref("extensions.activeThemeID");
equal(currentTheme, themeID, "Theme should be active");
let addon = await AddonManager.getAddonByID(themeID);
await addon.uninstall();
});
......@@ -27,7 +27,7 @@
"title": "baidu",
"url": "https://www.baidu.com/",
"image_url": "images/baidu-com@2x.png",
"favicon_url": "favicons/baidu-com.ico"
"favicon_url": "favicons/baidu-com.png"
},
{
"title": "bbc",
......
{
"name": "Bing",
"description": "Bing. Search by Microsoft.",
"description": "Microsoft Bing",
"manifest_version": 2,
"version": "1.1",
"version": "1.1.1",
"applications": {
"gecko": {
"id": "bing@search.mozilla.org"
......
......@@ -47,7 +47,7 @@ add_task(async function test() {
const EXPECTED_ENGINE = {
name: "Bing",
alias: null,
description: "Bing. Search by Microsoft.",
description: "Microsoft Bing",
searchForm: "https://www.bing.com/search?pc=MOZI&q=",
hidden: false,
wrappedJSObject: {
......
......@@ -94,6 +94,7 @@ var NetworkManager = (function NetworkManagerClosure() {
var rangeStr = args.begin + "-" + (args.end - 1);
xhr.setRequestHeader("Range", "bytes=" + rangeStr);
pendingRequest.expectedStatus = 206;
xhr.channel.QueryInterface(Ci.nsIHttpChannel).redirectionLimit = 0;
} else {
pendingRequest.expectedStatus = 200;
}
......
......@@ -1609,7 +1609,22 @@ Function SetAsDefaultAppUserHKCU
${Unless} ${Errors}
; This is all protected by a user choice hash in Windows 8 so it won't
; help, but it also won't hurt.
AppAssocReg::SetAppAsDefaultAll "$R9"
AppAssocReg::SetAppAsDefault "$R9" ".htm" "file"
Pop $0
AppAssocReg::SetAppAsDefault "$R9" ".html" "file"
Pop $0
AppAssocReg::SetAppAsDefault "$R9" ".shtml" "file"
Pop $0
AppAssocReg::SetAppAsDefault "$R9" ".webp" "file"
Pop $0
AppAssocReg::SetAppAsDefault "$R9" ".xht" "file"
Pop $0
AppAssocReg::SetAppAsDefault "$R9" ".xhtml" "file"
Pop $0
AppAssocReg::SetAppAsDefault "$R9" "http" "protocol"
Pop $0
AppAssocReg::SetAppAsDefault "$R9" "https" "protocol"
Pop $0
${EndUnless}
${RemoveDeprecatedKeys}
${MigrateTaskBarShortcut}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment