Backed out changeset 1778ca2ab291 (bug 1744425) for bc failures on browser_xpcom_graph_wait.js. CLOSED TREE

This commit is contained in:
Cosmin Sabou
2021-12-08 07:20:54 +02:00
parent 13c1674214
commit c26566def8
23 changed files with 88 additions and 31 deletions

View File

@@ -368,7 +368,7 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
nsILoadInfo::OPENER_POLICY_SAME_ORIGIN_ALLOW_POPUPS); nsILoadInfo::OPENER_POLICY_SAME_ORIGIN_ALLOW_POPUPS);
} }
fields.mHistoryID = nsID::GenerateUUID(); nsContentUtils::GenerateUUIDInPlace(fields.mHistoryID);
fields.mExplicitActive = [&] { fields.mExplicitActive = [&] {
if (parentBC) { if (parentBC) {
// Non-root browsing-contexts inherit their status from its parent. // Non-root browsing-contexts inherit their status from its parent.

View File

@@ -89,7 +89,8 @@ nsID ChildSHistory::AddPendingHistoryChange() {
nsID ChildSHistory::AddPendingHistoryChange(int32_t aIndexDelta, nsID ChildSHistory::AddPendingHistoryChange(int32_t aIndexDelta,
int32_t aLengthDelta) { int32_t aLengthDelta) {
nsID changeID = nsID::GenerateUUID(); nsID changeID = {};
nsContentUtils::GenerateUUIDInPlace(changeID);
PendingSHistoryChange change = {changeID, aIndexDelta, aLengthDelta}; PendingSHistoryChange change = {changeID, aIndexDelta, aLengthDelta};
mPendingSHistoryChanges.AppendElement(change); mPendingSHistoryChanges.AppendElement(change);
return changeID; return changeID;

View File

@@ -203,7 +203,7 @@ DocGroup::DocGroup(BrowsingContextGroup* aBrowsingContextGroup,
const nsACString& aKey) const nsACString& aKey)
: mKey(aKey), : mKey(aKey),
mBrowsingContextGroup(aBrowsingContextGroup), mBrowsingContextGroup(aBrowsingContextGroup),
mAgentClusterId(nsID::GenerateUUID()) { mAgentClusterId(nsContentUtils::GenerateUUID()) {
// This method does not add itself to // This method does not add itself to
// mBrowsingContextGroup->mDocGroups as the caller does it for us. // mBrowsingContextGroup->mDocGroups as the caller does it for us.
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());

View File

@@ -268,6 +268,7 @@
#include "nsIContentSecurityPolicy.h" #include "nsIContentSecurityPolicy.h"
#include "nsIContentSink.h" #include "nsIContentSink.h"
#include "nsIContentViewer.h" #include "nsIContentViewer.h"
#include "nsID.h"
#include "nsIDOMWindowUtils.h" #include "nsIDOMWindowUtils.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeItem.h"
@@ -325,6 +326,7 @@
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE) #if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
# include "nsIURIWithSpecialOrigin.h" # include "nsIURIWithSpecialOrigin.h"
#endif #endif
#include "nsIUUIDGenerator.h"
#include "nsIUserIdleService.h" #include "nsIUserIdleService.h"
#include "nsIWeakReferenceUtils.h" #include "nsIWeakReferenceUtils.h"
#include "nsIWebNavigation.h" #include "nsIWebNavigation.h"
@@ -413,6 +415,7 @@ nsIScriptSecurityManager* nsContentUtils::sSecurityManager;
nsIPrincipal* nsContentUtils::sSystemPrincipal; nsIPrincipal* nsContentUtils::sSystemPrincipal;
nsIPrincipal* nsContentUtils::sNullSubjectPrincipal; nsIPrincipal* nsContentUtils::sNullSubjectPrincipal;
nsIIOService* nsContentUtils::sIOService; nsIIOService* nsContentUtils::sIOService;
nsIUUIDGenerator* nsContentUtils::sUUIDGenerator;
nsIConsoleService* nsContentUtils::sConsoleService; nsIConsoleService* nsContentUtils::sConsoleService;
nsTHashMap<nsRefPtrHashKey<nsAtom>, EventNameMapping>* nsTHashMap<nsRefPtrHashKey<nsAtom>, EventNameMapping>*
nsContentUtils::sAtomEventTable = nullptr; nsContentUtils::sAtomEventTable = nullptr;
@@ -792,6 +795,13 @@ nsresult nsContentUtils::Init() {
Unused << nsRFPService::GetOrCreate(); Unused << nsRFPService::GetOrCreate();
nsCOMPtr<nsIUUIDGenerator> uuidGenerator =
do_GetService("@mozilla.org/uuid-generator;1", &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
uuidGenerator.forget(&sUUIDGenerator);
if (XRE_IsParentProcess()) { if (XRE_IsParentProcess()) {
AsyncPrecreateStringBundles(); AsyncPrecreateStringBundles();
} }
@@ -1860,7 +1870,7 @@ void nsContentUtils::Shutdown() {
NS_IF_RELEASE(sSystemPrincipal); NS_IF_RELEASE(sSystemPrincipal);
NS_IF_RELEASE(sNullSubjectPrincipal); NS_IF_RELEASE(sNullSubjectPrincipal);
NS_IF_RELEASE(sIOService); NS_IF_RELEASE(sIOService);
NS_IF_RELEASE(sUUIDGenerator);
sBidiKeyboard = nullptr; sBidiKeyboard = nullptr;
delete sAtomEventTable; delete sAtomEventTable;
@@ -7312,6 +7322,27 @@ bool nsContentUtils::IsJavascriptMIMEType(const nsAString& aMIMEType) {
return false; return false;
} }
nsresult nsContentUtils::GenerateUUIDInPlace(nsID& aUUID) {
MOZ_ASSERT(sUUIDGenerator);
nsresult rv = sUUIDGenerator->GenerateUUIDInPlace(&aUUID);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return NS_OK;
}
nsID nsContentUtils::GenerateUUID() {
MOZ_DIAGNOSTIC_ASSERT(sUUIDGenerator);
nsID uuid;
nsresult rv = sUUIDGenerator->GenerateUUIDInPlace(&uuid);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
return uuid;
}
bool nsContentUtils::PrefetchPreloadEnabled(nsIDocShell* aDocShell) { bool nsContentUtils::PrefetchPreloadEnabled(nsIDocShell* aDocShell) {
// //
// SECURITY CHECK: disable prefetching and preloading from mailnews! // SECURITY CHECK: disable prefetching and preloading from mailnews!

View File

@@ -44,6 +44,7 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsHashtablesFwd.h" #include "nsHashtablesFwd.h"
#include "nsIContentPolicy.h" #include "nsIContentPolicy.h"
#include "nsID.h"
#include "nsINode.h" #include "nsINode.h"
#include "nsIScriptError.h" #include "nsIScriptError.h"
#include "nsIThread.h" #include "nsIThread.h"
@@ -109,6 +110,7 @@ class nsIStringBundleService;
class nsISupports; class nsISupports;
class nsITransferable; class nsITransferable;
class nsIURI; class nsIURI;
class nsIUUIDGenerator;
class nsIWidget; class nsIWidget;
class nsIXPConnect; class nsIXPConnect;
class nsNodeInfoManager; class nsNodeInfoManager;
@@ -1225,6 +1227,16 @@ class nsContentUtils {
*/ */
static void SandboxFlagsToString(uint32_t aFlags, nsAString& aString); static void SandboxFlagsToString(uint32_t aFlags, nsAString& aString);
/**
* Helper function that generates a UUID.
*/
static nsresult GenerateUUIDInPlace(nsID& aUUID);
/**
* Infallable (with an assertion) helper function that generates a UUID.
*/
static nsID GenerateUUID();
static bool PrefetchPreloadEnabled(nsIDocShell* aDocShell); static bool PrefetchPreloadEnabled(nsIDocShell* aDocShell);
static void ExtractErrorValues(JSContext* aCx, JS::Handle<JS::Value> aValue, static void ExtractErrorValues(JSContext* aCx, JS::Handle<JS::Value> aValue,
@@ -3331,6 +3343,7 @@ class nsContentUtils {
static nsIPrincipal* sNullSubjectPrincipal; static nsIPrincipal* sNullSubjectPrincipal;
static nsIIOService* sIOService; static nsIIOService* sIOService;
static nsIUUIDGenerator* sUUIDGenerator;
static nsIConsoleService* sConsoleService; static nsIConsoleService* sConsoleService;

View File

@@ -23,6 +23,7 @@
#include "mozilla/ipc/BackgroundUtils.h" #include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/ipc/PBackgroundChild.h" #include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/StorageAccess.h" #include "mozilla/StorageAccess.h"
#include "nsContentUtils.h"
#include "nsICookieJarSettings.h" #include "nsICookieJarSettings.h"
#include "mozilla/dom/Document.h" #include "mozilla/dom/Document.h"
@@ -149,7 +150,7 @@ already_AddRefed<BroadcastChannel> BroadcastChannel::Constructor(
} }
nsID portUUID = {}; nsID portUUID = {};
aRv = nsID::GenerateUUIDInPlace(portUUID); aRv = nsContentUtils::GenerateUUIDInPlace(portUUID);
if (aRv.Failed()) { if (aRv.Failed()) {
return nullptr; return nullptr;
} }

View File

@@ -15,6 +15,7 @@
#include "mozilla/ipc/PBackgroundChild.h" #include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/ClearOnShutdown.h" // PastShutdownPhase #include "mozilla/ClearOnShutdown.h" // PastShutdownPhase
#include "mozilla/StaticPrefs_dom.h" #include "mozilla/StaticPrefs_dom.h"
#include "nsContentUtils.h"
#include "prthread.h" #include "prthread.h"
namespace mozilla::dom { namespace mozilla::dom {
@@ -105,7 +106,7 @@ UniquePtr<ClientSource> ClientManager::CreateSourceInternal(
NS_ASSERT_OWNINGTHREAD(ClientManager); NS_ASSERT_OWNINGTHREAD(ClientManager);
nsID id; nsID id;
nsresult rv = nsID::GenerateUUIDInPlace(id); nsresult rv = nsContentUtils::GenerateUUIDInPlace(id);
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
// If we can't even get a UUID, at least make sure not to use a garbage // If we can't even get a UUID, at least make sure not to use a garbage
@@ -338,7 +339,7 @@ Maybe<ClientInfo> ClientManager::CreateInfo(ClientType aType,
} }
nsID id; nsID id;
rv = nsID::GenerateUUIDInPlace(id); rv = nsContentUtils::GenerateUUIDInPlace(id);
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv)); MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
return Nothing(); return Nothing();

View File

@@ -46,7 +46,7 @@ ParentToParentStream ToParentToParentStream(
MOZ_ASSERT(XRE_IsParentProcess()); MOZ_ASSERT(XRE_IsParentProcess());
ParentToParentStream stream; ParentToParentStream stream;
stream.uuid() = nsID::GenerateUUID(); MOZ_ALWAYS_SUCCEEDS(nsContentUtils::GenerateUUIDInPlace(stream.uuid()));
GetRemoteLazyInputStreamStorage()->AddStream(aStream.get(), stream.uuid(), GetRemoteLazyInputStreamStorage()->AddStream(aStream.get(), stream.uuid(),
aStreamSize, 0); aStreamSize, 0);
return stream; return stream;

View File

@@ -7,6 +7,7 @@
#include "RemoteLazyInputStreamParent.h" #include "RemoteLazyInputStreamParent.h"
#include "mozilla/ipc/IPCStreamUtils.h" #include "mozilla/ipc/IPCStreamUtils.h"
#include "mozilla/InputStreamLengthHelper.h" #include "mozilla/InputStreamLengthHelper.h"
#include "nsContentUtils.h"
#include "RemoteLazyInputStreamStorage.h" #include "RemoteLazyInputStreamStorage.h"
namespace mozilla { namespace mozilla {
@@ -21,7 +22,7 @@ RemoteLazyInputStreamParent::CreateCommon(nsIInputStream* aInputStream,
MOZ_ASSERT(aRv); MOZ_ASSERT(aRv);
nsID id; nsID id;
*aRv = nsID::GenerateUUIDInPlace(id); *aRv = nsContentUtils::GenerateUUIDInPlace(id);
if (NS_WARN_IF(NS_FAILED(*aRv))) { if (NS_WARN_IF(NS_FAILED(*aRv))) {
return nullptr; return nullptr;
} }

View File

@@ -14,6 +14,7 @@
#include "mozilla/dom/IPCBlobUtils.h" #include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/ipc/IPCStreamUtils.h" #include "mozilla/ipc/IPCStreamUtils.h"
#include "FileSystemUtils.h" #include "FileSystemUtils.h"
#include "nsContentUtils.h"
#include "nsNetCID.h" #include "nsNetCID.h"
#include "nsProxyRelease.h" #include "nsProxyRelease.h"
@@ -447,7 +448,7 @@ void GetFilesHelperChild::Work(ErrorResult& aRv) {
return; return;
} }
aRv = nsID::GenerateUUIDInPlace(mUUID); aRv = nsContentUtils::GenerateUUIDInPlace(mUUID);
if (NS_WARN_IF(aRv.Failed())) { if (NS_WARN_IF(aRv.Failed())) {
return; return;
} }

View File

@@ -7,6 +7,7 @@
#include "FileSystem.h" #include "FileSystem.h"
#include "FileSystemRootDirectoryEntry.h" #include "FileSystemRootDirectoryEntry.h"
#include "mozilla/dom/FileSystemBinding.h" #include "mozilla/dom/FileSystemBinding.h"
#include "nsContentUtils.h"
#include "nsIDUtils.h" #include "nsIDUtils.h"
namespace mozilla::dom { namespace mozilla::dom {
@@ -28,7 +29,7 @@ already_AddRefed<FileSystem> FileSystem::Create(nsIGlobalObject* aGlobalObject)
MOZ_ASSERT(aGlobalObject); MOZ_ASSERT(aGlobalObject);
nsID id; nsID id;
nsresult rv = nsID::GenerateUUIDInPlace(id); nsresult rv = nsContentUtils::GenerateUUIDInPlace(id);
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr; return nullptr;
} }

View File

@@ -12,6 +12,7 @@
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
#include "mozilla/dom/ipc/StructuredCloneData.h" #include "mozilla/dom/ipc/StructuredCloneData.h"
#include "nsBaseHashtable.h" #include "nsBaseHashtable.h"
#include "nsContentUtils.h"
#include "nsDebug.h" #include "nsDebug.h"
namespace mozilla::dom { namespace mozilla::dom {
@@ -57,7 +58,7 @@ const nsID RefMessageBodyService::Register(
MOZ_ASSERT(body); MOZ_ASSERT(body);
nsID uuid = {}; nsID uuid = {};
aRv = nsID::GenerateUUIDInPlace(uuid); aRv = nsContentUtils::GenerateUUIDInPlace(uuid);
if (NS_WARN_IF(aRv.Failed())) { if (NS_WARN_IF(aRv.Failed())) {
return nsID(); return nsID();
} }

View File

@@ -14,6 +14,7 @@
#include "MediaTrackConstraints.h" #include "MediaTrackConstraints.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/ErrorNames.h" #include "mozilla/ErrorNames.h"
#include "nsContentUtils.h"
#include "nsIDUtils.h" #include "nsIDUtils.h"
#include "transport/runnable_utils.h" #include "transport/runnable_utils.h"
#include "Tracing.h" #include "Tracing.h"
@@ -1112,7 +1113,7 @@ nsCString MediaEngineWebRTCAudioCaptureSource::GetUUID() const {
nsCString asciiString; nsCString asciiString;
ErrorResult rv; ErrorResult rv;
rv = nsID::GenerateUUIDInPlace(uuid); rv = nsContentUtils::GenerateUUIDInPlace(uuid);
if (rv.Failed()) { if (rv.Failed()) {
return ""_ns; return ""_ns;
} }

View File

@@ -10,6 +10,7 @@
#include "mozilla/dom/MessagePort.h" #include "mozilla/dom/MessagePort.h"
#include "mozilla/dom/Navigator.h" #include "mozilla/dom/Navigator.h"
#include "mozilla/dom/WorkerRunnable.h" #include "mozilla/dom/WorkerRunnable.h"
#include "nsContentUtils.h"
#include "mozilla/dom/Document.h" #include "mozilla/dom/Document.h"
#include "nsIGlobalObject.h" #include "nsIGlobalObject.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
@@ -49,13 +50,13 @@ already_AddRefed<MessageChannel> MessageChannel::Constructor(
MOZ_ASSERT(aGlobal); MOZ_ASSERT(aGlobal);
nsID portUUID1; nsID portUUID1;
aRv = nsID::GenerateUUIDInPlace(portUUID1); aRv = nsContentUtils::GenerateUUIDInPlace(portUUID1);
if (aRv.Failed()) { if (aRv.Failed()) {
return nullptr; return nullptr;
} }
nsID portUUID2; nsID portUUID2;
aRv = nsID::GenerateUUIDInPlace(portUUID2); aRv = nsContentUtils::GenerateUUIDInPlace(portUUID2);
if (aRv.Failed()) { if (aRv.Failed()) {
return nullptr; return nullptr;
} }

View File

@@ -654,7 +654,7 @@ already_AddRefed<PaymentRequest> PaymentRequest::CreatePaymentRequest(
nsPIDOMWindowInner* aWindow, ErrorResult& aRv) { nsPIDOMWindowInner* aWindow, ErrorResult& aRv) {
// Generate a unique id for identification // Generate a unique id for identification
nsID uuid; nsID uuid;
if (NS_WARN_IF(NS_FAILED(nsID::GenerateUUIDInPlace(uuid)))) { if (NS_WARN_IF(NS_FAILED(nsContentUtils::GenerateUUIDInPlace(uuid)))) {
aRv.ThrowAbortError( aRv.ThrowAbortError(
"Failed to create an internal UUID for the PaymentRequest"); "Failed to create an internal UUID for the PaymentRequest");
return nullptr; return nullptr;

View File

@@ -11,6 +11,7 @@
#include "mozilla/dom/FetchTypes.h" #include "mozilla/dom/FetchTypes.h"
#include "mozilla/dom/ServiceWorkerOpArgs.h" #include "mozilla/dom/ServiceWorkerOpArgs.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsContentUtils.h"
#include "nsIInputStream.h" #include "nsIInputStream.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
@@ -49,7 +50,7 @@ nsresult MaybeDeserializeAndWrapForMainThread(
aSink = Some(ParentToParentStream()); aSink = Some(ParentToParentStream());
auto& uuid = aSink->uuid(); auto& uuid = aSink->uuid();
MOZ_TRY(nsID::GenerateUUIDInPlace(uuid)); MOZ_TRY(nsContentUtils::GenerateUUIDInPlace(uuid));
auto storageOrErr = RemoteLazyInputStreamStorage::Get(); auto storageOrErr = RemoteLazyInputStreamStorage::Get();

View File

@@ -819,8 +819,8 @@ nsresult MaybeStoreStreamForBackgroundThread(nsIInterceptedChannel* aChannel,
Maybe<BodyStreamVariant>& body = aIPCRequest.body(); Maybe<BodyStreamVariant>& body = aIPCRequest.body();
body.emplace(ParentToParentStream()); body.emplace(ParentToParentStream());
MOZ_TRY( MOZ_TRY(nsContentUtils::GenerateUUIDInPlace(
nsID::GenerateUUIDInPlace(body->get_ParentToParentStream().uuid())); body->get_ParentToParentStream().uuid()));
auto storageOrErr = RemoteLazyInputStreamStorage::Get(); auto storageOrErr = RemoteLazyInputStreamStorage::Get();
if (NS_WARN_IF(storageOrErr.isErr())) { if (NS_WARN_IF(storageOrErr.isErr())) {

View File

@@ -13,6 +13,7 @@
#include "mozilla/dom/ServiceWorkerInfo.h" #include "mozilla/dom/ServiceWorkerInfo.h"
#include "mozilla/dom/ServiceWorkerRegistrationBinding.h" #include "mozilla/dom/ServiceWorkerRegistrationBinding.h"
#include "mozilla/dom/ServiceWorkerRegistrationDescriptor.h" #include "mozilla/dom/ServiceWorkerRegistrationDescriptor.h"
#include "nsContentUtils.h"
#include "nsProxyRelease.h" #include "nsProxyRelease.h"
#include "nsTObserverArray.h" #include "nsTObserverArray.h"
@@ -38,7 +39,7 @@ class ServiceWorkerRegistrationInfo final
}; };
nsTArray<UniquePtr<VersionEntry>> mVersionList; nsTArray<UniquePtr<VersionEntry>> mVersionList;
const nsID mAgentClusterId = nsID::GenerateUUID(); const nsID mAgentClusterId = nsContentUtils::GenerateUUID();
uint32_t mControlledClientsCounter; uint32_t mControlledClientsCounter;
uint32_t mDelayMultiplier; uint32_t mDelayMultiplier;

View File

@@ -922,7 +922,7 @@ class CancelingRunnable final : public Runnable {
} /* anonymous namespace */ } /* anonymous namespace */
nsString ComputeWorkerPrivateId() { nsString ComputeWorkerPrivateId() {
nsID uuid = nsID::GenerateUUID(); nsID uuid = nsContentUtils::GenerateUUID();
return NSID_TrimBracketsUTF16(uuid); return NSID_TrimBracketsUTF16(uuid);
} }
@@ -2420,7 +2420,7 @@ WorkerPrivate::ComputeAgentClusterIdAndCoop(WorkerPrivate* aParent,
RefPtr<DocGroup> docGroup = doc->GetDocGroup(); RefPtr<DocGroup> docGroup = doc->GetDocGroup();
nsID agentClusterId = nsID agentClusterId =
docGroup ? docGroup->AgentClusterId() : nsID::GenerateUUID(); docGroup ? docGroup->AgentClusterId() : nsContentUtils::GenerateUUID();
BrowsingContext* bc = aLoadInfo->mWindow->GetBrowsingContext(); BrowsingContext* bc = aLoadInfo->mWindow->GetBrowsingContext();
MOZ_DIAGNOSTIC_ASSERT(bc); MOZ_DIAGNOSTIC_ASSERT(bc);
@@ -2429,7 +2429,7 @@ WorkerPrivate::ComputeAgentClusterIdAndCoop(WorkerPrivate* aParent,
// If the window object was failed to be set into the WorkerLoadInfo, we // If the window object was failed to be set into the WorkerLoadInfo, we
// make the worker into another agent cluster group instead of failures. // make the worker into another agent cluster group instead of failures.
return {nsID::GenerateUUID(), agentClusterCoop}; return {nsContentUtils::GenerateUUID(), agentClusterCoop};
} }
// static // static

View File

@@ -28,6 +28,7 @@
#include "mozilla/ipc/URIUtils.h" #include "mozilla/ipc/URIUtils.h"
#include "mozilla/net/CookieJarSettings.h" #include "mozilla/net/CookieJarSettings.h"
#include "mozilla/StorageAccess.h" #include "mozilla/StorageAccess.h"
#include "nsContentUtils.h"
#include "nsGlobalWindowInner.h" #include "nsGlobalWindowInner.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
@@ -194,7 +195,7 @@ already_AddRefed<SharedWorker> SharedWorker::Constructor(
ipcClientInfo.emplace(clientInfo.value().ToIPC()); ipcClientInfo.emplace(clientInfo.value().ToIPC());
} }
nsID agentClusterId = nsID::GenerateUUID(); nsID agentClusterId = nsContentUtils::GenerateUUID();
net::CookieJarSettingsArgs cjsData; net::CookieJarSettingsArgs cjsData;
MOZ_ASSERT(loadInfo.mCookieJarSettings); MOZ_ASSERT(loadInfo.mCookieJarSettings);

View File

@@ -102,7 +102,7 @@ LoadInfo::LoadInfo(
: aLoadingPrincipal), : aLoadingPrincipal),
mTriggeringPrincipal(aTriggeringPrincipal ? aTriggeringPrincipal mTriggeringPrincipal(aTriggeringPrincipal ? aTriggeringPrincipal
: mLoadingPrincipal.get()), : mLoadingPrincipal.get()),
mSandboxedNullPrincipalID(nsID::GenerateUUID()), mSandboxedNullPrincipalID(nsContentUtils::GenerateUUID()),
mClientInfo(aLoadingClientInfo), mClientInfo(aLoadingClientInfo),
mController(aController), mController(aController),
mLoadingContext(do_GetWeakReference(aLoadingContext)), mLoadingContext(do_GetWeakReference(aLoadingContext)),
@@ -315,7 +315,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
nsISupports* aContextForTopLevelLoad, nsISupports* aContextForTopLevelLoad,
nsSecurityFlags aSecurityFlags, uint32_t aSandboxFlags) nsSecurityFlags aSecurityFlags, uint32_t aSandboxFlags)
: mTriggeringPrincipal(aTriggeringPrincipal), : mTriggeringPrincipal(aTriggeringPrincipal),
mSandboxedNullPrincipalID(nsID::GenerateUUID()), mSandboxedNullPrincipalID(nsContentUtils::GenerateUUID()),
mContextForTopLevelLoad(do_GetWeakReference(aContextForTopLevelLoad)), mContextForTopLevelLoad(do_GetWeakReference(aContextForTopLevelLoad)),
mSecurityFlags(aSecurityFlags), mSecurityFlags(aSecurityFlags),
mSandboxFlags(aSandboxFlags), mSandboxFlags(aSandboxFlags),
@@ -374,7 +374,7 @@ LoadInfo::LoadInfo(dom::CanonicalBrowsingContext* aBrowsingContext,
const OriginAttributes& aOriginAttributes, const OriginAttributes& aOriginAttributes,
nsSecurityFlags aSecurityFlags, uint32_t aSandboxFlags) nsSecurityFlags aSecurityFlags, uint32_t aSandboxFlags)
: mTriggeringPrincipal(aTriggeringPrincipal), : mTriggeringPrincipal(aTriggeringPrincipal),
mSandboxedNullPrincipalID(nsID::GenerateUUID()), mSandboxedNullPrincipalID(nsContentUtils::GenerateUUID()),
mSecurityFlags(aSecurityFlags), mSecurityFlags(aSecurityFlags),
mSandboxFlags(aSandboxFlags), mSandboxFlags(aSandboxFlags),
@@ -416,7 +416,7 @@ LoadInfo::LoadInfo(dom::WindowGlobalParent* aParentWGP,
nsContentPolicyType aContentPolicyType, nsContentPolicyType aContentPolicyType,
nsSecurityFlags aSecurityFlags, uint32_t aSandboxFlags) nsSecurityFlags aSecurityFlags, uint32_t aSandboxFlags)
: mTriggeringPrincipal(aTriggeringPrincipal), : mTriggeringPrincipal(aTriggeringPrincipal),
mSandboxedNullPrincipalID(nsID::GenerateUUID()), mSandboxedNullPrincipalID(nsContentUtils::GenerateUUID()),
mSecurityFlags(aSecurityFlags), mSecurityFlags(aSecurityFlags),
mSandboxFlags(aSandboxFlags), mSandboxFlags(aSandboxFlags),
mInternalContentPolicyType(aContentPolicyType) { mInternalContentPolicyType(aContentPolicyType) {
@@ -883,7 +883,7 @@ const nsID& LoadInfo::GetSandboxedNullPrincipalID() {
} }
void LoadInfo::ResetSandboxedNullPrincipalID() { void LoadInfo::ResetSandboxedNullPrincipalID() {
mSandboxedNullPrincipalID = nsID::GenerateUUID(); mSandboxedNullPrincipalID = nsContentUtils::GenerateUUID();
} }
nsIPrincipal* LoadInfo::GetTopLevelPrincipal() { return mTopLevelPrincipal; } nsIPrincipal* LoadInfo::GetTopLevelPrincipal() { return mTopLevelPrincipal; }

View File

@@ -408,7 +408,7 @@ void nsHtml5StreamParser::SetViewSourceTitle(nsIURI* aURL) {
mURIToSendToDevtools = aURL; mURIToSendToDevtools = aURL;
nsID uuid; nsID uuid;
nsresult rv = nsID::GenerateUUIDInPlace(uuid); nsresult rv = nsContentUtils::GenerateUUIDInPlace(uuid);
if (!NS_FAILED(rv)) { if (!NS_FAILED(rv)) {
char buffer[NSID_LENGTH]; char buffer[NSID_LENGTH];
uuid.ToProvidedString(buffer); uuid.ToProvidedString(buffer);

View File

@@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsContentUtils.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "mozilla/AbstractThread.h" #include "mozilla/AbstractThread.h"
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
@@ -217,7 +218,7 @@ RefPtr<RequestMetricsPromise>
PerformanceMetricsCollector::RequestMetricsInternal() { PerformanceMetricsCollector::RequestMetricsInternal() {
// each request has its own UUID // each request has its own UUID
nsID uuid; nsID uuid;
nsresult rv = nsID::GenerateUUIDInPlace(uuid); nsresult rv = nsContentUtils::GenerateUUIDInPlace(uuid);
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
return RequestMetricsPromise::CreateAndReject(rv, __func__); return RequestMetricsPromise::CreateAndReject(rv, __func__);
} }