Bug 1365566 - use PR_GetSystemInfo to get OS version on Firefox desktop. r=dragana.
MozReview-Commit-ID: J5qlptRVzQe
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -2,16 +2,18 @@
/* vim:set ts=4 sw=4 sts=4 et cin: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// HttpLog.h should generally be included first
#include "HttpLog.h"
+#include "prsystem.h"
+
#include "nsHttp.h"
#include "nsHttpHandler.h"
#include "nsHttpChannel.h"
#include "nsHttpAuthCache.h"
#include "nsStandardURL.h"
#include "nsIDOMWindow.h"
#include "nsIDOMNavigator.h"
#include "nsIMozNavigatorNetwork.h"
@@ -265,27 +267,32 @@ nsHttpHandler::nsHttpHandler()
void
nsHttpHandler::SetFastOpenOSSupport()
{
mFastOpenSupported = false;
#if !defined(XP_WIN) && !defined(XP_LINUX) && !defined(ANDROID) && !defined(HAS_CONNECTX)
return;
#else
- nsCOMPtr<nsIPropertyBag2> infoService =
- do_GetService("@mozilla.org/system-info;1");
- MOZ_ASSERT(infoService, "Could not find a system info service");
nsAutoCString version;
nsresult rv;
#ifdef ANDROID
+ nsCOMPtr<nsIPropertyBag2> infoService =
+ do_GetService("@mozilla.org/system-info;1");
+ MOZ_ASSERT(infoService, "Could not find a system info service");
rv = infoService->GetPropertyAsACString(
NS_LITERAL_STRING("sdk_version"), version);
#else
- rv = infoService->GetPropertyAsACString(
- NS_LITERAL_STRING("version"), version);
+ char buf[SYS_INFO_BUFFER_LENGTH];
+ if (PR_GetSystemInfo(PR_SI_RELEASE, buf, sizeof(buf)) == PR_SUCCESS) {
+ version = buf;
+ rv = NS_OK;
+ } else {
+ rv = NS_ERROR_FAILURE;
+ }
#endif
LOG(("nsHttpHandler::SetFastOpenOSSupport version %s", version.get()));
if (NS_SUCCEEDED(rv)) {
// set min version minus 1.
#ifdef XP_WIN
int min_version[] = {10, 0};