From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- dom/base/nsGlobalWindowInner.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'dom/base/nsGlobalWindowInner.cpp') diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index 8b69389790..5337e1588f 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -167,6 +167,7 @@ #include "mozilla/dom/TimeoutHandler.h" #include "mozilla/dom/TimeoutManager.h" #include "mozilla/dom/ToJSValue.h" +#include "mozilla/dom/TrustedTypePolicyFactory.h" #include "mozilla/dom/VRDisplay.h" #include "mozilla/dom/VRDisplayEvent.h" #include "mozilla/dom/VRDisplayEventBinding.h" @@ -224,6 +225,7 @@ #include "nsIBrowserChild.h" #include "nsICancelableRunnable.h" #include "nsIChannel.h" +#include "nsIClipboard.h" #include "nsIContentSecurityPolicy.h" #include "nsIControllers.h" #include "nsICookieJarSettings.h" @@ -1283,6 +1285,8 @@ void nsGlobalWindowInner::FreeInnerObjects() { mWebTaskScheduler = nullptr; } + mTrustedTypePolicyFactory = nullptr; + mSharedWorkers.Clear(); #ifdef MOZ_WEBSPEECH @@ -1378,6 +1382,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWebTaskScheduler) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTrustedTypePolicyFactory) + #ifdef MOZ_WEBSPEECH NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSpeechSynthesis) #endif @@ -1446,6 +1452,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInstallTrigger) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIntlUtils) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVisualViewport) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCurrentPasteDataTransfer) tmp->TraverseObjectsInGlobal(cb); @@ -1481,6 +1488,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner) NS_IMPL_CYCLE_COLLECTION_UNLINK(mWebTaskScheduler) } + NS_IMPL_CYCLE_COLLECTION_UNLINK(mTrustedTypePolicyFactory) + #ifdef MOZ_WEBSPEECH NS_IMPL_CYCLE_COLLECTION_UNLINK(mSpeechSynthesis) #endif @@ -1554,6 +1563,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner) NS_IMPL_CYCLE_COLLECTION_UNLINK(mInstallTrigger) NS_IMPL_CYCLE_COLLECTION_UNLINK(mIntlUtils) NS_IMPL_CYCLE_COLLECTION_UNLINK(mVisualViewport) + NS_IMPL_CYCLE_COLLECTION_UNLINK(mCurrentPasteDataTransfer) tmp->UnlinkObjectsInGlobal(); @@ -5082,7 +5092,7 @@ nsGlobalWindowInner::ShowSlowScriptDialog(JSContext* aCx, } // Reached only on non-e10s - once per slow script dialog. - // On e10s - we probe once at ProcessHangsMonitor.jsm + // On e10s - we probe once at ProcessHangsMonitor.sys.mjs Telemetry::Accumulate(Telemetry::SLOW_SCRIPT_NOTICE_COUNT, 1); // Get the nsIPrompt interface from the docshell @@ -7603,6 +7613,27 @@ JS::loader::ModuleLoaderBase* nsGlobalWindowInner::GetModuleLoader( return loader->GetModuleLoader(); } +void nsGlobalWindowInner::SetCurrentPasteDataTransfer( + DataTransfer* aDataTransfer) { + MOZ_ASSERT_IF(aDataTransfer, aDataTransfer->GetEventMessage() == ePaste); + MOZ_ASSERT_IF(aDataTransfer, aDataTransfer->ClipboardType() == + nsIClipboard::kGlobalClipboard); + MOZ_ASSERT_IF(aDataTransfer, aDataTransfer->GetAsyncGetClipboardData()); + mCurrentPasteDataTransfer = aDataTransfer; +} + +DataTransfer* nsGlobalWindowInner::GetCurrentPasteDataTransfer() const { + return mCurrentPasteDataTransfer; +} + +TrustedTypePolicyFactory* nsGlobalWindowInner::TrustedTypes() { + if (!mTrustedTypePolicyFactory) { + mTrustedTypePolicyFactory = MakeRefPtr(this); + } + + return mTrustedTypePolicyFactory; +} + nsIURI* nsPIDOMWindowInner::GetDocumentURI() const { return mDoc ? mDoc->GetDocumentURI() : mDocumentURI.get(); } -- cgit v1.2.3