зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 7cfa9199cc7e (bug 1577344) for mozilla::net::nsSocketTransport::InitiateSocket crashes CLOSED TREE
This commit is contained in:
Родитель
d2fa14f4ef
Коммит
1c9a64d4d6
|
@ -14,15 +14,6 @@ const { AppConstants } = ChromeUtils.import(
|
|||
|
||||
XPCOMUtils.defineLazyServiceGetters(this, {
|
||||
gCertDB: ["@mozilla.org/security/x509certdb;1", "nsIX509CertDB"],
|
||||
gExternalProtocolService: [
|
||||
"@mozilla.org/uriloader/external-protocol-service;1",
|
||||
"nsIExternalProtocolService",
|
||||
],
|
||||
gHandlerService: [
|
||||
"@mozilla.org/uriloader/handler-service;1",
|
||||
"nsIHandlerService",
|
||||
],
|
||||
gMIMEService: ["@mozilla.org/mime;1", "nsIMIMEService"],
|
||||
gXulStore: ["@mozilla.org/xul/xulstore;1", "nsIXULStore"],
|
||||
});
|
||||
|
||||
|
@ -1027,41 +1018,6 @@ var Policies = {
|
|||
},
|
||||
},
|
||||
|
||||
Handlers: {
|
||||
onBeforeAddons(manager, param) {
|
||||
if ("mimeTypes" in param) {
|
||||
for (let mimeType in param.mimeTypes) {
|
||||
let mimeInfo = param.mimeTypes[mimeType];
|
||||
let realMIMEInfo = gMIMEService.getFromTypeAndExtension(mimeType, "");
|
||||
processMIMEInfo(mimeInfo, realMIMEInfo);
|
||||
}
|
||||
}
|
||||
if ("extensions" in param) {
|
||||
for (let extension in param.extensions) {
|
||||
let mimeInfo = param.extensions[extension];
|
||||
try {
|
||||
let realMIMEInfo = gMIMEService.getFromTypeAndExtension(
|
||||
"",
|
||||
extension
|
||||
);
|
||||
processMIMEInfo(mimeInfo, realMIMEInfo);
|
||||
} catch (e) {
|
||||
log.error(`Invalid file extension (${extension})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("schemes" in param) {
|
||||
for (let scheme in param.schemes) {
|
||||
let handlerInfo = param.schemes[scheme];
|
||||
let realHandlerInfo = gExternalProtocolService.getProtocolHandlerInfo(
|
||||
scheme
|
||||
);
|
||||
processMIMEInfo(handlerInfo, realHandlerInfo);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
HardwareAcceleration: {
|
||||
onBeforeAddons(manager, param) {
|
||||
if (!param) {
|
||||
|
@ -2142,71 +2098,3 @@ function pemToBase64(pem) {
|
|||
.replace(/-----END CERTIFICATE-----/, "")
|
||||
.replace(/[\r\n]/g, "");
|
||||
}
|
||||
|
||||
function processMIMEInfo(mimeInfo, realMIMEInfo) {
|
||||
if ("handlers" in mimeInfo) {
|
||||
let firstHandler = true;
|
||||
for (let handler of mimeInfo.handlers) {
|
||||
// handler can be null which means they don't
|
||||
// want a preferred handler.
|
||||
if (handler) {
|
||||
let handlerApp;
|
||||
if ("path" in handler) {
|
||||
try {
|
||||
let file = new FileUtils.File(handler.path);
|
||||
handlerApp = Cc[
|
||||
"@mozilla.org/uriloader/local-handler-app;1"
|
||||
].createInstance(Ci.nsILocalHandlerApp);
|
||||
handlerApp.executable = file;
|
||||
} catch (ex) {
|
||||
log.error(`Unable to create handler executable (${handler.path})`);
|
||||
continue;
|
||||
}
|
||||
} else if ("uriTemplate" in handler) {
|
||||
let templateURL = new URL(handler.uriTemplate);
|
||||
if (templateURL.protocol != "https:") {
|
||||
log.error(`Web handler must be https (${handler.uriTemplate})`);
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
!templateURL.pathname.includes("%s") &&
|
||||
!templateURL.search.includes("%s")
|
||||
) {
|
||||
log.error(`Web handler must contain %s (${handler.uriTemplate})`);
|
||||
continue;
|
||||
}
|
||||
handlerApp = Cc[
|
||||
"@mozilla.org/uriloader/web-handler-app;1"
|
||||
].createInstance(Ci.nsIWebHandlerApp);
|
||||
handlerApp.uriTemplate = handler.uriTemplate;
|
||||
} else {
|
||||
log.error("Invalid handler");
|
||||
continue;
|
||||
}
|
||||
if ("name" in handler) {
|
||||
handlerApp.name = handler.name;
|
||||
}
|
||||
realMIMEInfo.possibleApplicationHandlers.appendElement(handlerApp);
|
||||
if (firstHandler) {
|
||||
realMIMEInfo.preferredApplicationHandler = handlerApp;
|
||||
}
|
||||
}
|
||||
firstHandler = false;
|
||||
}
|
||||
}
|
||||
if ("action" in mimeInfo) {
|
||||
let action = realMIMEInfo[mimeInfo.action];
|
||||
if (
|
||||
action == realMIMEInfo.useHelperApp &&
|
||||
!realMIMEInfo.possibleApplicationHandlers.length
|
||||
) {
|
||||
log.error("useHelperApp requires a handler");
|
||||
return;
|
||||
}
|
||||
realMIMEInfo.preferredAction = action;
|
||||
}
|
||||
if ("ask" in mimeInfo) {
|
||||
realMIMEInfo.alwaysAskBeforeHandling = mimeInfo.ask;
|
||||
}
|
||||
gHandlerService.store(realMIMEInfo);
|
||||
}
|
||||
|
|
|
@ -526,46 +526,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
"Handlers": {
|
||||
"type": ["JSON", "object"],
|
||||
"patternProperties": {
|
||||
"^(mimeTypes|extensions|schemes)$": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^.*$": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
"type": "string",
|
||||
"enum": ["saveToDisk", "useHelperApp", "useSystemDefault"]
|
||||
},
|
||||
"ask": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"handlers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"uriTemplate": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"HardwareAcceleration": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
|
|
@ -43,7 +43,6 @@ skip-if = (verify && debug && (os == 'mac'))
|
|||
[browser_policy_downloads.js]
|
||||
[browser_policy_extensionsettings.js]
|
||||
[browser_policy_firefoxhome.js]
|
||||
[browser_policy_handlers.js]
|
||||
[browser_policy_override_postupdatepage.js]
|
||||
[browser_policy_pageinfo_permissions.js]
|
||||
[browser_policy_passwordmanager.js]
|
||||
|
|
|
@ -1,150 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const gMIMEService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
|
||||
|
||||
const gExternalProtocolService = Cc[
|
||||
"@mozilla.org/uriloader/external-protocol-service;1"
|
||||
].getService(Ci.nsIExternalProtocolService);
|
||||
|
||||
// This seems odd, but for test purposes, this just has to be a file that we know exists,
|
||||
// and by using this file, we don't have to worry about different platforms.
|
||||
let exeFile = Services.dirsvc.get("XREExeF", Ci.nsIFile);
|
||||
|
||||
add_task(async function test_valid_handlers() {
|
||||
await setupPolicyEngineWithJson({
|
||||
policies: {
|
||||
Handlers: {
|
||||
mimeTypes: {
|
||||
"application/marimba": {
|
||||
action: "useHelperApp",
|
||||
ask: true,
|
||||
handlers: [
|
||||
{
|
||||
name: "Launch",
|
||||
path: exeFile.path,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
schemes: {
|
||||
fake_scheme: {
|
||||
action: "useHelperApp",
|
||||
ask: false,
|
||||
handlers: [
|
||||
{
|
||||
name: "Name",
|
||||
uriTemplate: "https://www.example.org/?%s",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
extensions: {
|
||||
txt: {
|
||||
action: "saveToDisk",
|
||||
ask: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
let handlerInfo = gMIMEService.getFromTypeAndExtension(
|
||||
"application/marimba",
|
||||
""
|
||||
);
|
||||
is(handlerInfo.preferredAction, handlerInfo.useHelperApp);
|
||||
is(handlerInfo.alwaysAskBeforeHandling, true);
|
||||
is(handlerInfo.preferredApplicationHandler.name, "Launch");
|
||||
is(handlerInfo.preferredApplicationHandler.executable.path, exeFile.path);
|
||||
|
||||
handlerInfo = gExternalProtocolService.getProtocolHandlerInfo("fake_scheme");
|
||||
is(handlerInfo.preferredAction, handlerInfo.useHelperApp);
|
||||
is(handlerInfo.alwaysAskBeforeHandling, false);
|
||||
is(handlerInfo.preferredApplicationHandler.name, "Name");
|
||||
is(
|
||||
handlerInfo.preferredApplicationHandler.uriTemplate,
|
||||
"https://www.example.org/?%s"
|
||||
);
|
||||
|
||||
handlerInfo = gMIMEService.getFromTypeAndExtension("", "txt");
|
||||
is(handlerInfo.preferredAction, handlerInfo.saveToDisk);
|
||||
is(handlerInfo.alwaysAskBeforeHandling, false);
|
||||
});
|
||||
|
||||
add_task(async function test_no_handler() {
|
||||
await setupPolicyEngineWithJson({
|
||||
policies: {
|
||||
Handlers: {
|
||||
schemes: {
|
||||
no_handler: {
|
||||
action: "useHelperApp",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
let handlerInfo = gExternalProtocolService.getProtocolHandlerInfo(
|
||||
"no_handler"
|
||||
);
|
||||
is(handlerInfo.preferredAction, handlerInfo.alwaysAsk);
|
||||
is(handlerInfo.alwaysAskBeforeHandling, true);
|
||||
is(handlerInfo.preferredApplicationHandler, null);
|
||||
});
|
||||
|
||||
add_task(async function test_bad_web_handler1() {
|
||||
await setupPolicyEngineWithJson({
|
||||
policies: {
|
||||
Handlers: {
|
||||
schemes: {
|
||||
bas_web_handler1: {
|
||||
action: "useHelperApp",
|
||||
handlers: [
|
||||
{
|
||||
name: "Name",
|
||||
uriTemplate: "http://www.example.org/?%s",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
let handlerInfo = gExternalProtocolService.getProtocolHandlerInfo(
|
||||
"bad_web_handler1"
|
||||
);
|
||||
is(handlerInfo.preferredAction, handlerInfo.alwaysAsk);
|
||||
is(handlerInfo.alwaysAskBeforeHandling, true);
|
||||
is(handlerInfo.preferredApplicationHandler, null);
|
||||
});
|
||||
|
||||
add_task(async function test_bad_web_handler2() {
|
||||
await setupPolicyEngineWithJson({
|
||||
policies: {
|
||||
Handlers: {
|
||||
schemes: {
|
||||
bas_web_handler1: {
|
||||
action: "useHelperApp",
|
||||
handlers: [
|
||||
{
|
||||
name: "Name",
|
||||
uriTemplate: "http://www.example.org/",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
let handlerInfo = gExternalProtocolService.getProtocolHandlerInfo(
|
||||
"bad_web_handler1"
|
||||
);
|
||||
is(handlerInfo.preferredAction, handlerInfo.alwaysAsk);
|
||||
is(handlerInfo.alwaysAskBeforeHandling, true);
|
||||
is(handlerInfo.preferredApplicationHandler, null);
|
||||
});
|
|
@ -109,8 +109,6 @@ policy-FirefoxHome = Configure Firefox Home.
|
|||
|
||||
policy-FlashPlugin = Allow or deny usage of the Flash plugin.
|
||||
|
||||
policy-Handlers = Configure default application handlers.
|
||||
|
||||
policy-HardwareAcceleration = If false, turn off hardware acceleration.
|
||||
|
||||
# “lock” means that the user won’t be able to change this setting
|
||||
|
|
Загрузка…
Ссылка в новой задаче