mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 35e6bbc2136b (bug 1134596) for Android Crashtest failures
This commit is contained in:
parent
4323e2c753
commit
02786021b3
@ -615,7 +615,7 @@ pref("mousewheel.with_win.action", 1);
|
||||
pref("browser.xul.error_pages.enabled", true);
|
||||
pref("browser.xul.error_pages.expert_bad_cert", false);
|
||||
|
||||
// If true, network link events will change the value of navigator.onLine
|
||||
// Work Offline is best manually managed by the user.
|
||||
pref("network.manage-offline-status", false);
|
||||
|
||||
// We want to make sure mail URLs are handled externally...
|
||||
|
@ -794,13 +794,11 @@ ContentChild::InitXPCOM()
|
||||
NS_WARNING("Couldn't register console listener for child process");
|
||||
|
||||
bool isOffline;
|
||||
bool isConnected;
|
||||
ClipboardCapabilities clipboardCaps;
|
||||
DomainPolicyClone domainPolicy;
|
||||
|
||||
SendGetXPCOMProcessAttributes(&isOffline, &isConnected, &mAvailableDictionaries, &clipboardCaps, &domainPolicy);
|
||||
SendGetXPCOMProcessAttributes(&isOffline, &mAvailableDictionaries, &clipboardCaps, &domainPolicy);
|
||||
RecvSetOffline(isOffline);
|
||||
RecvSetConnectivity(isConnected);
|
||||
|
||||
if (domainPolicy.active()) {
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
@ -1829,18 +1827,6 @@ ContentChild::RecvSetOffline(const bool& offline)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::RecvSetConnectivity(const bool& connectivity)
|
||||
{
|
||||
nsCOMPtr<nsIIOService> io(do_GetIOService());
|
||||
nsCOMPtr<nsIIOServiceInternal> ioInternal(do_QueryInterface(io));
|
||||
NS_ASSERTION(ioInternal, "IO Service can not be null");
|
||||
|
||||
ioInternal->SetConnectivity(connectivity);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ContentChild::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
|
@ -296,7 +296,6 @@ public:
|
||||
virtual bool DeallocPRemoteSpellcheckEngineChild(PRemoteSpellcheckEngineChild*) override;
|
||||
|
||||
virtual bool RecvSetOffline(const bool& offline) override;
|
||||
virtual bool RecvSetConnectivity(const bool& connectivity) override;
|
||||
|
||||
virtual bool RecvSpeakerManagerNotify() override;
|
||||
|
||||
|
@ -385,7 +385,6 @@ bool ContentParent::sNuwaReady = false;
|
||||
#endif
|
||||
|
||||
#define NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC "ipc:network:set-offline"
|
||||
#define NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC "ipc:network:set-connectivity"
|
||||
|
||||
class MemoryReportRequestParent : public PMemoryReportRequestParent
|
||||
{
|
||||
@ -600,7 +599,6 @@ static const char* sObserverTopics[] = {
|
||||
"xpcom-shutdown",
|
||||
"profile-before-change",
|
||||
NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC,
|
||||
NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC,
|
||||
"child-memory-reporter-request",
|
||||
"memory-pressure",
|
||||
"child-gc-request",
|
||||
@ -2820,14 +2818,12 @@ ContentParent::RecvAddNewProcess(const uint32_t& aPid,
|
||||
|
||||
// Update offline settings.
|
||||
bool isOffline;
|
||||
bool isConnected;
|
||||
InfallibleTArray<nsString> unusedDictionaries;
|
||||
ClipboardCapabilities clipboardCaps;
|
||||
DomainPolicyClone domainPolicy;
|
||||
RecvGetXPCOMProcessAttributes(&isOffline, &isConnected, &unusedDictionaries,
|
||||
RecvGetXPCOMProcessAttributes(&isOffline, &unusedDictionaries,
|
||||
&clipboardCaps, &domainPolicy);
|
||||
mozilla::unused << content->SendSetOffline(isOffline);
|
||||
mozilla::unused << content->SendSetConnectivity(isConnected);
|
||||
MOZ_ASSERT(!clipboardCaps.supportsSelectionClipboard() &&
|
||||
!clipboardCaps.supportsFindClipboard(),
|
||||
"Unexpected values");
|
||||
@ -2918,17 +2914,6 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||
}
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (!strcmp(aTopic, NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC)) {
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
if (!(IsNuwaReady() && IsNuwaProcess())) {
|
||||
#endif
|
||||
if (!SendSetConnectivity(NS_LITERAL_STRING("true").Equals(aData))) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// listening for alert notifications
|
||||
@ -3179,7 +3164,6 @@ ContentParent::RecvGetProcessAttributes(ContentParentId* aCpId,
|
||||
|
||||
bool
|
||||
ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
|
||||
bool* aIsConnected,
|
||||
InfallibleTArray<nsString>* dictionaries,
|
||||
ClipboardCapabilities* clipboardCaps,
|
||||
DomainPolicyClone* domainPolicy)
|
||||
@ -3189,9 +3173,6 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
|
||||
DebugOnly<nsresult> rv = io->GetOffline(aIsOffline);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting offline?");
|
||||
|
||||
rv = io->GetConnectivity(aIsConnected);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting connectivity?");
|
||||
|
||||
nsCOMPtr<nsISpellChecker> spellChecker(do_GetService(NS_SPELLCHECKER_CONTRACTID));
|
||||
MOZ_ASSERT(spellChecker, "No spell checker?");
|
||||
|
||||
|
@ -535,7 +535,6 @@ private:
|
||||
bool* aIsForApp,
|
||||
bool* aIsForBrowser) override;
|
||||
virtual bool RecvGetXPCOMProcessAttributes(bool* aIsOffline,
|
||||
bool* aIsConnected,
|
||||
InfallibleTArray<nsString>* dictionaries,
|
||||
ClipboardCapabilities* clipboardCaps,
|
||||
DomainPolicyClone* domainPolicy)
|
||||
|
@ -476,7 +476,6 @@ child:
|
||||
RegisterChromeItem(ChromeRegistryItem item);
|
||||
|
||||
async SetOffline(bool offline);
|
||||
async SetConnectivity(bool connectivity);
|
||||
|
||||
async NotifyVisited(URIParams uri);
|
||||
|
||||
@ -617,9 +616,7 @@ parent:
|
||||
sync GetProcessAttributes()
|
||||
returns (ContentParentId cpId, bool isForApp, bool isForBrowser);
|
||||
sync GetXPCOMProcessAttributes()
|
||||
returns (bool isOffline,
|
||||
bool isConnected,
|
||||
nsString[] dictionaries,
|
||||
returns (bool isOffline, nsString[] dictionaries,
|
||||
ClipboardCapabilities clipboardCaps,
|
||||
DomainPolicyClone domainPolicy);
|
||||
|
||||
|
@ -22,7 +22,7 @@ interface nsILoadInfo;
|
||||
* as a convenience to the programmer and in some cases to improve performance
|
||||
* by eliminating intermediate data structures and interfaces.
|
||||
*/
|
||||
[scriptable, uuid(4286de5a-b2ea-446f-8f70-e2a461f42694)]
|
||||
[scriptable, uuid(b1c3c61d-2df9-4240-ae16-0355b51a2770)]
|
||||
interface nsIIOService : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -177,11 +177,6 @@ interface nsIIOService : nsISupports
|
||||
*/
|
||||
attribute boolean offline;
|
||||
|
||||
/**
|
||||
* Returns false if there are no interfaces for a network request
|
||||
*/
|
||||
readonly attribute boolean connectivity;
|
||||
|
||||
/**
|
||||
* Set whether network appears to be offline for network connections from
|
||||
* a given appID.
|
||||
@ -273,14 +268,3 @@ interface nsIAppOfflineInfo : nsISupports
|
||||
*/
|
||||
#define NS_IOSERVICE_APP_OFFLINE_STATUS_TOPIC "network:app-offline-status-changed"
|
||||
%}
|
||||
|
||||
[builtinclass, uuid(cd66ffef-3bc3-40de-841a-e2dcbea213a2)]
|
||||
interface nsIIOServiceInternal : nsISupports
|
||||
{
|
||||
/**
|
||||
* This is an internal method that should only be called from ContentChild
|
||||
* in order to pass the connectivity state from the chrome process to the
|
||||
* content process. It throws if called outside the content process.
|
||||
*/
|
||||
void SetConnectivity(in boolean connectivity);
|
||||
};
|
||||
|
@ -158,8 +158,7 @@ NS_IMPL_ISUPPORTS(nsAppOfflineInfo, nsIAppOfflineInfo)
|
||||
nsIOService::nsIOService()
|
||||
: mOffline(true)
|
||||
, mOfflineForProfileChange(false)
|
||||
, mManageLinkStatus(false)
|
||||
, mConnectivity(true)
|
||||
, mManageOfflineStatus(false)
|
||||
, mSettingOffline(false)
|
||||
, mSetOfflineValue(false)
|
||||
, mShutdown(false)
|
||||
@ -285,10 +284,17 @@ nsIOService::InitializeNetworkLinkService()
|
||||
if (mNetworkLinkService) {
|
||||
mNetworkLinkServiceInitialized = true;
|
||||
}
|
||||
else {
|
||||
// We can't really determine if the machine has a usable network connection,
|
||||
// so let's cross our fingers!
|
||||
mManageOfflineStatus = false;
|
||||
}
|
||||
|
||||
// After initializing the networkLinkService, query the connectivity state
|
||||
OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN);
|
||||
|
||||
if (mManageOfflineStatus)
|
||||
OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN);
|
||||
else
|
||||
SetOffline(false);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -317,7 +323,6 @@ NS_IMPL_ISUPPORTS(nsIOService,
|
||||
nsINetUtil,
|
||||
nsISpeculativeConnect,
|
||||
nsIObserver,
|
||||
nsIIOServiceInternal,
|
||||
nsISupportsWeakReference)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -917,8 +922,7 @@ nsIOService::SetOffline(bool offline)
|
||||
mProxyService->ReloadPAC();
|
||||
|
||||
// don't care if notification fails
|
||||
// Only send the ONLINE notification if there is connectivity
|
||||
if (observerService && mConnectivity)
|
||||
if (observerService)
|
||||
observerService->NotifyObservers(subject,
|
||||
NS_IOSERVICE_OFFLINE_STATUS_TOPIC,
|
||||
NS_LITERAL_STRING(NS_IOSERVICE_ONLINE).get());
|
||||
@ -944,72 +948,6 @@ nsIOService::SetOffline(bool offline)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::GetConnectivity(bool *aConnectivity)
|
||||
{
|
||||
*aConnectivity = mConnectivity;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::SetConnectivity(bool aConnectivity)
|
||||
{
|
||||
// This should only be called from ContentChild to pass the connectivity
|
||||
// value from the chrome process to the content process.
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
return SetConnectivityInternal(aConnectivity);
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsIOService::SetConnectivityInternal(bool aConnectivity)
|
||||
{
|
||||
if (mConnectivity == aConnectivity) {
|
||||
// Nothing to do here.
|
||||
return NS_OK;
|
||||
}
|
||||
mConnectivity = aConnectivity;
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
if (!observerService) {
|
||||
return NS_OK;
|
||||
}
|
||||
// This notification sends the connectivity to the child processes
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
observerService->NotifyObservers(nullptr,
|
||||
NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC, aConnectivity ?
|
||||
MOZ_UTF16("true") :
|
||||
MOZ_UTF16("false"));
|
||||
}
|
||||
|
||||
if (mOffline) {
|
||||
// We don't need to send any notifications if we're offline
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aConnectivity) {
|
||||
// If we were previously offline due to connectivity=false,
|
||||
// send the ONLINE notification
|
||||
observerService->NotifyObservers(
|
||||
static_cast<nsIIOService *>(this),
|
||||
NS_IOSERVICE_OFFLINE_STATUS_TOPIC,
|
||||
NS_LITERAL_STRING(NS_IOSERVICE_ONLINE).get());
|
||||
} else {
|
||||
// If we were previously online and lost connectivity
|
||||
// send the OFFLINE notification
|
||||
const nsLiteralString offlineString(MOZ_UTF16(NS_IOSERVICE_OFFLINE));
|
||||
observerService->NotifyObservers(static_cast<nsIIOService *>(this),
|
||||
NS_IOSERVICE_GOING_OFFLINE_TOPIC,
|
||||
offlineString.get());
|
||||
observerService->NotifyObservers(static_cast<nsIIOService *>(this),
|
||||
NS_IOSERVICE_OFFLINE_STATUS_TOPIC,
|
||||
offlineString.get());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::AllowPort(int32_t inPort, const char *scheme, bool *_retval)
|
||||
@ -1238,8 +1176,11 @@ nsIOService::Observe(nsISupports *subject,
|
||||
} else if (!strcmp(topic, kProfileChangeNetRestoreTopic)) {
|
||||
if (mOfflineForProfileChange) {
|
||||
mOfflineForProfileChange = false;
|
||||
SetOffline(false);
|
||||
}
|
||||
if (!mManageOfflineStatus ||
|
||||
NS_FAILED(OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN))) {
|
||||
SetOffline(false);
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(topic, kProfileDoChange)) {
|
||||
if (data && NS_LITERAL_STRING("startup").Equals(data)) {
|
||||
// Lazy initialization of network link service (see bug 620472)
|
||||
@ -1247,10 +1188,6 @@ nsIOService::Observe(nsISupports *subject,
|
||||
// Set up the initilization flag regardless the actuall result.
|
||||
// If we fail here, we will fail always on.
|
||||
mNetworkLinkServiceInitialized = true;
|
||||
|
||||
// The browser starts off as offline. We go into online mode after this.
|
||||
SetOffline(false);
|
||||
|
||||
// And now reflect the preference setting
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||
GetPrefBranch(getter_AddRefs(prefBranch));
|
||||
@ -1267,7 +1204,9 @@ nsIOService::Observe(nsISupports *subject,
|
||||
// Break circular reference.
|
||||
mProxyService = nullptr;
|
||||
} else if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) {
|
||||
OnNetworkLinkEvent(NS_ConvertUTF16toUTF8(data).get());
|
||||
if (!mOfflineForProfileChange && mManageOfflineStatus) {
|
||||
OnNetworkLinkEvent(NS_ConvertUTF16toUTF8(data).get());
|
||||
}
|
||||
} else if (!strcmp(topic, NS_WIDGET_WAKE_OBSERVER_TOPIC)) {
|
||||
// coming back alive from sleep
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
@ -1411,26 +1350,32 @@ nsIOService::NewSimpleNestedURI(nsIURI* aURI, nsIURI** aResult)
|
||||
NS_IMETHODIMP
|
||||
nsIOService::SetManageOfflineStatus(bool aManage)
|
||||
{
|
||||
mManageLinkStatus = aManage;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// When detection is not activated, the default connectivity state is true.
|
||||
if (!mManageLinkStatus) {
|
||||
SetConnectivityInternal(true);
|
||||
return NS_OK;
|
||||
}
|
||||
// SetManageOfflineStatus must throw when we fail to go from non-managed
|
||||
// to managed. Usually because there is no link monitoring service
|
||||
// available. Failure to do this switch is detected by a failure of
|
||||
// OnNetworkLinkEvent(). When there is no network link available during
|
||||
// call to InitializeNetworkLinkService(), application is put to offline
|
||||
// mode. And when we change mMangeOfflineStatus to false on the next line
|
||||
// we get stuck on being offline even though the link becomes later
|
||||
// available.
|
||||
bool wasManaged = mManageOfflineStatus;
|
||||
mManageOfflineStatus = aManage;
|
||||
|
||||
InitializeNetworkLinkService();
|
||||
// If the NetworkLinkService is already initialized, it does not call
|
||||
// OnNetworkLinkEvent. This is needed, when mManageLinkStatus goes from
|
||||
// false to true.
|
||||
OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN);
|
||||
return NS_OK;
|
||||
|
||||
if (mManageOfflineStatus && !wasManaged) {
|
||||
rv = OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN);
|
||||
if (NS_FAILED(rv))
|
||||
mManageOfflineStatus = false;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::GetManageOfflineStatus(bool* aManage)
|
||||
{
|
||||
*aManage = mManageLinkStatus;
|
||||
nsIOService::GetManageOfflineStatus(bool* aManage) {
|
||||
*aManage = mManageOfflineStatus;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1444,7 +1389,7 @@ nsIOService::OnNetworkLinkEvent(const char *data)
|
||||
if (mShutdown)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
if (!mManageLinkStatus) {
|
||||
if (!mManageOfflineStatus) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1457,19 +1402,21 @@ nsIOService::OnNetworkLinkEvent(const char *data)
|
||||
// dial option is set to always autodial. If so, then we are
|
||||
// always up for the purposes of offline management.
|
||||
if (autodialEnabled) {
|
||||
bool isUp = true;
|
||||
#if defined(XP_WIN)
|
||||
// On Windows, we should first check with the OS to see if
|
||||
// autodial is enabled. If it is enabled then we are allowed
|
||||
// to manage the offline state.
|
||||
isUp = nsNativeConnectionHelper::IsAutodialEnabled();
|
||||
if (nsNativeConnectionHelper::IsAutodialEnabled()) {
|
||||
return SetOffline(false);
|
||||
}
|
||||
#else
|
||||
return SetOffline(false);
|
||||
#endif
|
||||
return SetConnectivityInternal(isUp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isUp = true;
|
||||
bool isUp;
|
||||
if (!strcmp(data, NS_NETWORK_LINK_DATA_CHANGED)) {
|
||||
// CHANGED means UP/DOWN didn't change
|
||||
return NS_OK;
|
||||
@ -1485,7 +1432,7 @@ nsIOService::OnNetworkLinkEvent(const char *data)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return SetConnectivityInternal(isUp);
|
||||
return SetOffline(!isUp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -26,7 +26,6 @@
|
||||
// Intended internal use only for remoting offline/inline events.
|
||||
// See Bug 552829
|
||||
#define NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC "ipc:network:set-offline"
|
||||
#define NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC "ipc:network:set-connectivity"
|
||||
|
||||
static const char gScheme[][sizeof("resource")] =
|
||||
{"chrome", "file", "http", "https", "jar", "data", "resource"};
|
||||
@ -50,7 +49,6 @@ class nsIOService final : public nsIIOService2
|
||||
, public nsINetUtil
|
||||
, public nsISpeculativeConnect
|
||||
, public nsSupportsWeakReference
|
||||
, public nsIIOServiceInternal
|
||||
{
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
@ -59,7 +57,6 @@ public:
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSINETUTIL
|
||||
NS_DECL_NSISPECULATIVECONNECT
|
||||
NS_DECL_NSIIOSERVICEINTERNAL
|
||||
|
||||
// Gets the singleton instance of the IO Service, creating it as needed
|
||||
// Returns nullptr on out of memory or failure to initialize.
|
||||
@ -89,7 +86,6 @@ private:
|
||||
// - destroy using Release
|
||||
nsIOService();
|
||||
~nsIOService();
|
||||
nsresult SetConnectivityInternal(bool aConnectivity);
|
||||
|
||||
nsresult OnNetworkLinkEvent(const char *data);
|
||||
|
||||
@ -125,8 +121,7 @@ private:
|
||||
private:
|
||||
bool mOffline;
|
||||
bool mOfflineForProfileChange;
|
||||
bool mManageLinkStatus;
|
||||
bool mConnectivity;
|
||||
bool mManageOfflineStatus;
|
||||
|
||||
// Used to handle SetOffline() reentrancy. See the comment in
|
||||
// SetOffline() for more details.
|
||||
|
@ -1956,13 +1956,10 @@ inline bool
|
||||
NS_IsOffline()
|
||||
{
|
||||
bool offline = true;
|
||||
bool connectivity = true;
|
||||
nsCOMPtr<nsIIOService> ios = do_GetIOService();
|
||||
if (ios) {
|
||||
if (ios)
|
||||
ios->GetOffline(&offline);
|
||||
ios->GetConnectivity(&connectivity);
|
||||
}
|
||||
return offline || !connectivity;
|
||||
return offline;
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
Loading…
Reference in New Issue
Block a user