michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIPrefService.h" michael@0: #include "nsIX509CertDB.h" michael@0: #include "nsServiceManagerUtils.h" michael@0: michael@0: int michael@0: main(int argc, char* argv[]) michael@0: { michael@0: { michael@0: NS_InitXPCOM2(nullptr, nullptr, nullptr); michael@0: nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); michael@0: if (!prefs) { michael@0: return -1; michael@0: } michael@0: // When NSS initializes, it attempts to get some localized strings. michael@0: // As a result, OS X and Windows flip out if this isn't set. michael@0: // (This isn't done automatically since this test doesn't have a michael@0: // lot of the other boilerplate components that would otherwise michael@0: // keep the certificate db alive longer than we want it to.) michael@0: nsresult rv = prefs->SetBoolPref("intl.locale.matchOS", true); michael@0: if (NS_FAILED(rv)) { michael@0: return -1; michael@0: } michael@0: nsCOMPtr certdb(do_GetService(NS_X509CERTDB_CONTRACTID)); michael@0: if (!certdb) { michael@0: return -1; michael@0: } michael@0: } // this scopes the nsCOMPtrs michael@0: // no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM michael@0: NS_ShutdownXPCOM(nullptr); michael@0: return 0; michael@0: }