Skip to content

Commit 43e2ed0

Browse files
committed
Bug 1744425 - widget/windows: Use nsID::GenerateUUIDInPlace() instead of the nsUUIDGenerator service. r=tkikuchi
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). Using nsID::GenerateUUIDInPlace() also avoids the overhead of instantiating the nsUUIDGenerator service. Depends on D132866 Differential Revision: https://phabricator.services.mozilla.com/D136992
1 parent 2ae60be commit 43e2ed0

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

widget/windows/AudioSession.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
#include "mozilla/RefPtr.h"
1212
#include "nsIStringBundle.h"
13-
#include "nsIUUIDGenerator.h"
1413

1514
//#include "AudioSession.h"
1615
#include "nsCOMPtr.h"
16+
#include "nsID.h"
1717
#include "nsServiceManagerUtils.h"
1818
#include "nsString.h"
1919
#include "nsThreadUtils.h"
@@ -193,10 +193,8 @@ nsresult AudioSession::Start() {
193193
mIconPath.GetMutableData(&buffer, MAX_PATH);
194194
::GetModuleFileNameW(nullptr, buffer, MAX_PATH);
195195

196-
nsCOMPtr<nsIUUIDGenerator> uuidgen =
197-
do_GetService("@mozilla.org/uuid-generator;1");
198-
NS_ENSURE_TRUE(uuidgen, NS_ERROR_FAILURE);
199-
uuidgen->GenerateUUIDInPlace(&mSessionGroupingParameter);
196+
nsresult rv = nsID::GenerateUUIDInPlace(mSessionGroupingParameter);
197+
NS_ENSURE_SUCCESS(rv, rv);
200198
}
201199

202200
mState = FAILED;

widget/windows/ToastNotificationHandler.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "nsIDUtils.h"
1818
#include "nsIStringBundle.h"
1919
#include "nsIURI.h"
20-
#include "nsIUUIDGenerator.h"
2120
#include "nsIWidget.h"
2221
#include "nsIWindowMediator.h"
2322
#include "nsNetUtil.h"
@@ -534,14 +533,8 @@ nsresult ToastNotificationHandler::AsyncSaveImage(imgIRequest* aRequest) {
534533
return rv;
535534
}
536535

537-
nsCOMPtr<nsIUUIDGenerator> idGen =
538-
do_GetService("@mozilla.org/uuid-generator;1", &rv);
539-
if (NS_WARN_IF(NS_FAILED(rv))) {
540-
return rv;
541-
}
542-
543536
nsID uuid;
544-
rv = idGen->GenerateUUIDInPlace(&uuid);
537+
rv = nsID::GenerateUUIDInPlace(uuid);
545538
if (NS_WARN_IF(NS_FAILED(rv))) {
546539
return rv;
547540
}

0 commit comments

Comments
 (0)