mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 815523. patches stolen from 782542 Parts 1,2,3: Necko IPC security pref, and disable for xpcshell tests, r=ted,jdm
This commit is contained in:
parent
1db66739bf
commit
689255c2e5
@ -773,6 +773,9 @@ pref("security.fileuri.strict_origin_policy", true);
|
|||||||
// the results
|
// the results
|
||||||
pref("network.allow-experiments", true);
|
pref("network.allow-experiments", true);
|
||||||
|
|
||||||
|
// Turn off interprocess security checks. Needed to run xpcshell tests.
|
||||||
|
pref("network.disable.ipc.security", false);
|
||||||
|
|
||||||
// Default action for unlisted external protocol handlers
|
// Default action for unlisted external protocol handlers
|
||||||
pref("network.protocol-handler.external-default", true); // OK to load
|
pref("network.protocol-handler.external-default", true); // OK to load
|
||||||
pref("network.protocol-handler.warn-external-default", true); // warn before load
|
pref("network.protocol-handler.warn-external-default", true); // warn before load
|
||||||
|
@ -14,17 +14,22 @@
|
|||||||
#include "mozilla/net/FTPChannelChild.h"
|
#include "mozilla/net/FTPChannelChild.h"
|
||||||
#include "mozilla/net/WebSocketChannelChild.h"
|
#include "mozilla/net/WebSocketChannelChild.h"
|
||||||
#include "mozilla/dom/network/TCPSocketChild.h"
|
#include "mozilla/dom/network/TCPSocketChild.h"
|
||||||
|
#include "mozilla/Preferences.h"
|
||||||
|
|
||||||
using mozilla::dom::TCPSocketChild;
|
using mozilla::dom::TCPSocketChild;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace net {
|
namespace net {
|
||||||
|
|
||||||
|
static bool gDisableIPCSecurity = false;
|
||||||
|
static const char kPrefDisableIPCSecurity[] = "network.disable.ipc.security";
|
||||||
|
|
||||||
PNeckoChild *gNeckoChild = nullptr;
|
PNeckoChild *gNeckoChild = nullptr;
|
||||||
|
|
||||||
// C++ file contents
|
// C++ file contents
|
||||||
NeckoChild::NeckoChild()
|
NeckoChild::NeckoChild()
|
||||||
{
|
{
|
||||||
|
Preferences::AddBoolVarCache(&gDisableIPCSecurity, kPrefDisableIPCSecurity);
|
||||||
}
|
}
|
||||||
|
|
||||||
NeckoChild::~NeckoChild()
|
NeckoChild::~NeckoChild()
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "mozilla/net/WebSocketChannelParent.h"
|
#include "mozilla/net/WebSocketChannelParent.h"
|
||||||
#include "mozilla/dom/TabParent.h"
|
#include "mozilla/dom/TabParent.h"
|
||||||
#include "mozilla/dom/network/TCPSocketParent.h"
|
#include "mozilla/dom/network/TCPSocketParent.h"
|
||||||
|
#include "mozilla/Preferences.h"
|
||||||
|
|
||||||
#include "nsHTMLDNSPrefetch.h"
|
#include "nsHTMLDNSPrefetch.h"
|
||||||
|
|
||||||
@ -24,9 +25,13 @@ using mozilla::dom::TCPSocketParent;
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace net {
|
namespace net {
|
||||||
|
|
||||||
|
static bool gDisableIPCSecurity = false;
|
||||||
|
static const char kPrefDisableIPCSecurity[] = "network.disable.ipc.security";
|
||||||
|
|
||||||
// C++ file contents
|
// C++ file contents
|
||||||
NeckoParent::NeckoParent()
|
NeckoParent::NeckoParent()
|
||||||
{
|
{
|
||||||
|
Preferences::AddBoolVarCache(&gDisableIPCSecurity, kPrefDisableIPCSecurity);
|
||||||
}
|
}
|
||||||
|
|
||||||
NeckoParent::~NeckoParent()
|
NeckoParent::~NeckoParent()
|
||||||
|
@ -36,16 +36,27 @@ let (ios = Components.classes["@mozilla.org/network/io-service;1"]
|
|||||||
ios.offline = false;
|
ios.offline = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable IPv6 lookups for 'localhost' on windows.
|
// Determine if we're running on parent or child
|
||||||
|
let runningInParent = true;
|
||||||
try {
|
try {
|
||||||
if ("@mozilla.org/windows-registry-key;1" in Components.classes) {
|
runningInParent = Components.classes["@mozilla.org/xre/runtime;1"].
|
||||||
let processType = Components.classes["@mozilla.org/xre/runtime;1"].
|
getService(Components.interfaces.nsIXULRuntime).processType
|
||||||
getService(Components.interfaces.nsIXULRuntime).processType;
|
== Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||||
if (processType == Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
}
|
||||||
let (prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
catch (e) { }
|
||||||
.getService(Components.interfaces.nsIPrefBranch)) {
|
|
||||||
prefs.setCharPref("network.dns.ipv4OnlyDomains", "localhost");
|
try {
|
||||||
}
|
if (runningInParent) {
|
||||||
|
let prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
|
.getService(Components.interfaces.nsIPrefBranch);
|
||||||
|
|
||||||
|
// disable necko IPC security checks for xpcshell, as they lack the
|
||||||
|
// docshells needed to pass them
|
||||||
|
prefs.setBoolPref("network.disable.ipc.security", true);
|
||||||
|
|
||||||
|
// Disable IPv6 lookups for 'localhost' on windows.
|
||||||
|
if ("@mozilla.org/windows-registry-key;1" in Components.classes) {
|
||||||
|
prefs.setCharPref("network.dns.ipv4OnlyDomains", "localhost");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,9 +68,7 @@ catch (e) { }
|
|||||||
// Note that if we're in a child process, we don't want to init the
|
// Note that if we're in a child process, we don't want to init the
|
||||||
// crashreporter component.
|
// crashreporter component.
|
||||||
try { // nsIXULRuntime is not available in some configurations.
|
try { // nsIXULRuntime is not available in some configurations.
|
||||||
let processType = Components.classes["@mozilla.org/xre/runtime;1"].
|
if (runningInParent &&
|
||||||
getService(Components.interfaces.nsIXULRuntime).processType;
|
|
||||||
if (processType == Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT &&
|
|
||||||
"@mozilla.org/toolkit/crash-reporter;1" in Components.classes) {
|
"@mozilla.org/toolkit/crash-reporter;1" in Components.classes) {
|
||||||
// Remember to update </toolkit/crashreporter/test/unit/test_crashreporter.js>
|
// Remember to update </toolkit/crashreporter/test/unit/test_crashreporter.js>
|
||||||
// too if you change this initial setting.
|
// too if you change this initial setting.
|
||||||
@ -800,11 +809,7 @@ function do_get_profile() {
|
|||||||
function do_load_child_test_harness()
|
function do_load_child_test_harness()
|
||||||
{
|
{
|
||||||
// Make sure this isn't called from child process
|
// Make sure this isn't called from child process
|
||||||
var runtime = Components.classes["@mozilla.org/xre/app-info;1"]
|
if (!runningInParent) {
|
||||||
.getService(Components.interfaces.nsIXULRuntime);
|
|
||||||
if (runtime.processType !=
|
|
||||||
Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT)
|
|
||||||
{
|
|
||||||
do_throw("run_test_in_child cannot be called from child!");
|
do_throw("run_test_in_child cannot be called from child!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user