Skip to content

Commit 4affe0e

Browse files
committed
Bug 1744425 - xre: Use nsID::GeneratorUUIDInPlace() instead of the nsUUIDGenerator service. r=mossop
This change is needed to avoid toolkit/components/backgroundtasks/tests/browser/browser_xpcom_graph_wait.js test failures where the nsUUIDGenerator service was loaded during ASan test runs but not non-ASan test runs (due to differences in temp profile directory paths). With this change, the nsUUIDGenerator service is no longer needed in BackgroundTasks. Using nsID::GenerateUUIDInPlace() also avoids the overhead of instantiating the nsUUIDGenerator service. Depends on D136992 Differential Revision: https://phabricator.services.mozilla.com/D136993
1 parent 43e2ed0 commit 4affe0e

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

toolkit/components/backgroundtasks/tests/browser/browser_xpcom_graph_wait.js

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ const backgroundtaskPhases = {
8383
"@mozilla.org/storage/service;1",
8484
"@mozilla.org/thirdpartyutil;1",
8585
"@mozilla.org/toolkit/app-startup;1",
86-
"@mozilla.org/uuid-generator;1",
8786
{
8887
name: "@mozilla.org/widget/appshell/mac;1",
8988
condition: MAC,

toolkit/xre/nsAppRunner.cpp

+1-8
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
#include "nsIStringBundle.h"
8484
#include "nsISupportsPrimitives.h"
8585
#include "nsIToolkitProfile.h"
86-
#include "nsIUUIDGenerator.h"
8786
#include "nsToolkitProfileService.h"
8887
#include "nsIURI.h"
8988
#include "nsIURL.h"
@@ -134,9 +133,6 @@
134133

135134
#if defined(MOZ_SANDBOX)
136135
# include "mozilla/SandboxSettings.h"
137-
# if (defined(XP_WIN) || defined(XP_MACOSX))
138-
# include "nsIUUIDGenerator.h"
139-
# endif
140136
#endif
141137

142138
#ifdef ACCESSIBILITY
@@ -3146,10 +3142,7 @@ static void SubmitDowngradeTelemetry(const nsCString& aLastVersion,
31463142
NS_ENSURE_SUCCESS_VOID(rv);
31473143

31483144
nsID uuid;
3149-
nsCOMPtr<nsIUUIDGenerator> uuidGen =
3150-
do_GetService("@mozilla.org/uuid-generator;1");
3151-
NS_ENSURE_TRUE_VOID(uuidGen);
3152-
rv = uuidGen->GenerateUUIDInPlace(&uuid);
3145+
rv = nsID::GenerateUUIDInPlace(uuid);
31533146
NS_ENSURE_SUCCESS_VOID(rv);
31543147

31553148
nsCString arch("null");

toolkit/xre/nsXREDirProvider.cpp

+3-8
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979
#if defined(MOZ_SANDBOX)
8080
# include "mozilla/SandboxSettings.h"
81-
# include "nsIUUIDGenerator.h"
81+
# include "nsID.h"
8282
# include "mozilla/Unused.h"
8383
# if defined(XP_WIN)
8484
# include "sandboxBroker.h"
@@ -721,15 +721,10 @@ static already_AddRefed<nsIFile> CreateProcessSandboxTempDir(
721721
nsresult rv;
722722
nsAutoString tempDirSuffix;
723723
mozilla::Preferences::GetString(pref, tempDirSuffix);
724-
if (tempDirSuffix.IsEmpty()) {
725-
nsCOMPtr<nsIUUIDGenerator> uuidgen =
726-
do_GetService("@mozilla.org/uuid-generator;1", &rv);
727-
if (NS_WARN_IF(NS_FAILED(rv))) {
728-
return nullptr;
729-
}
730724

725+
if (tempDirSuffix.IsEmpty()) {
731726
nsID uuid;
732-
rv = uuidgen->GenerateUUIDInPlace(&uuid);
727+
rv = nsID::GenerateUUIDInPlace(uuid);
733728
if (NS_WARN_IF(NS_FAILED(rv))) {
734729
return nullptr;
735730
}

0 commit comments

Comments
 (0)