Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsCOMPtr.h" |
michael@0 | 7 | #include "nsIPrefService.h" |
michael@0 | 8 | #include "nsIX509CertDB.h" |
michael@0 | 9 | #include "nsServiceManagerUtils.h" |
michael@0 | 10 | |
michael@0 | 11 | int |
michael@0 | 12 | main(int argc, char* argv[]) |
michael@0 | 13 | { |
michael@0 | 14 | { |
michael@0 | 15 | NS_InitXPCOM2(nullptr, nullptr, nullptr); |
michael@0 | 16 | nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); |
michael@0 | 17 | if (!prefs) { |
michael@0 | 18 | return -1; |
michael@0 | 19 | } |
michael@0 | 20 | // When NSS initializes, it attempts to get some localized strings. |
michael@0 | 21 | // As a result, OS X and Windows flip out if this isn't set. |
michael@0 | 22 | // (This isn't done automatically since this test doesn't have a |
michael@0 | 23 | // lot of the other boilerplate components that would otherwise |
michael@0 | 24 | // keep the certificate db alive longer than we want it to.) |
michael@0 | 25 | nsresult rv = prefs->SetBoolPref("intl.locale.matchOS", true); |
michael@0 | 26 | if (NS_FAILED(rv)) { |
michael@0 | 27 | return -1; |
michael@0 | 28 | } |
michael@0 | 29 | nsCOMPtr<nsIX509CertDB> certdb(do_GetService(NS_X509CERTDB_CONTRACTID)); |
michael@0 | 30 | if (!certdb) { |
michael@0 | 31 | return -1; |
michael@0 | 32 | } |
michael@0 | 33 | } // this scopes the nsCOMPtrs |
michael@0 | 34 | // no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM |
michael@0 | 35 | NS_ShutdownXPCOM(nullptr); |
michael@0 | 36 | return 0; |
michael@0 | 37 | } |