diff options
Diffstat (limited to 'dom/ipc')
32 files changed, 255 insertions, 207 deletions
diff --git a/dom/ipc/BrowserChild.cpp b/dom/ipc/BrowserChild.cpp index 830ad8579a..bdd10fdcb2 100644 --- a/dom/ipc/BrowserChild.cpp +++ b/dom/ipc/BrowserChild.cpp @@ -463,7 +463,7 @@ nsresult BrowserChild::Init(mozIDOMWindowProxy* aParent, mIPCOpen = true; - if (StaticPrefs::browser_sessionstore_platform_collection_AtStartup()) { + if (SessionStorePlatformCollection()) { mSessionStoreChild = SessionStoreChild::GetOrCreate(mBrowsingContext); } @@ -814,7 +814,8 @@ mozilla::ipc::IPCResult BrowserChild::RecvLoadURL( } docShell->LoadURI(aLoadState, true); - CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::URL, spec); + CrashReporter::RecordAnnotationNSCString(CrashReporter::Annotation::URL, + spec); return IPC_OK(); } @@ -2529,6 +2530,8 @@ mozilla::ipc::IPCResult BrowserChild::RecvNavigateByKey( aForward ? (aForDocumentNavigation ? static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_FIRSTDOC) + : StaticPrefs::dom_disable_tab_focus_to_root_element() + ? static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_FIRST) : static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_ROOT)) : (aForDocumentNavigation ? static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_LASTDOC) @@ -3481,8 +3484,8 @@ NS_IMETHODIMP BrowserChild::OnLocationChange(nsIWebProgress* aWebProgress, annotationURI = aLocation; } - CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::URL, - annotationURI->GetSpecOrDefault()); + CrashReporter::RecordAnnotationNSCString( + CrashReporter::Annotation::URL, annotationURI->GetSpecOrDefault()); } #endif } diff --git a/dom/ipc/BrowserParent.cpp b/dom/ipc/BrowserParent.cpp index d369556588..5d13d2e814 100644 --- a/dom/ipc/BrowserParent.cpp +++ b/dom/ipc/BrowserParent.cpp @@ -1322,8 +1322,20 @@ mozilla::ipc::IPCResult BrowserParent::RecvPDocAccessibleConstructor( #endif already_AddRefed<PFilePickerParent> BrowserParent::AllocPFilePickerParent( - const nsString& aTitle, const nsIFilePicker::Mode& aMode) { - return MakeAndAddRef<FilePickerParent>(aTitle, aMode); + const nsString& aTitle, const nsIFilePicker::Mode& aMode, + const MaybeDiscarded<BrowsingContext>& aBrowsingContext) { + RefPtr<CanonicalBrowsingContext> browsingContext = + [&]() -> CanonicalBrowsingContext* { + if (aBrowsingContext.IsNullOrDiscarded()) { + return nullptr; + } + if (!aBrowsingContext.get_canonical()->IsOwnedByProcess( + Manager()->ChildID())) { + return nullptr; + } + return aBrowsingContext.get_canonical(); + }(); + return MakeAndAddRef<FilePickerParent>(aTitle, aMode, browsingContext); } already_AddRefed<PSessionStoreParent> diff --git a/dom/ipc/BrowserParent.h b/dom/ipc/BrowserParent.h index 4d4ae287b4..63a52c6ac4 100644 --- a/dom/ipc/BrowserParent.h +++ b/dom/ipc/BrowserParent.h @@ -595,7 +595,8 @@ class BrowserParent final : public PBrowserParent, const Maybe<DoubleTapToZoomMetrics>& aDoubleTapToZoomMetrics); already_AddRefed<PFilePickerParent> AllocPFilePickerParent( - const nsString& aTitle, const nsIFilePicker::Mode& aMode); + const nsString& aTitle, const nsIFilePicker::Mode& aMode, + const MaybeDiscarded<BrowsingContext>& aBrowsingContext); bool GetGlobalJSObject(JSContext* cx, JSObject** globalp); diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index e3b0ebd795..7507d88fe0 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -1714,12 +1714,12 @@ mozilla::ipc::IPCResult ContentChild::RecvSetProcessSandbox( DisconnectWindowServer(sandboxEnabled); # endif - CrashReporter::AnnotateCrashReport( + CrashReporter::RecordAnnotationBool( CrashReporter::Annotation::ContentSandboxEnabled, sandboxEnabled); # if defined(XP_LINUX) && !defined(ANDROID) - CrashReporter::AnnotateCrashReport( + CrashReporter::RecordAnnotationU32( CrashReporter::Annotation::ContentSandboxCapabilities, - static_cast<int>(SandboxInfo::Get().AsInteger())); + SandboxInfo::Get().AsInteger()); # endif /* XP_LINUX && !ANDROID */ #endif /* MOZ_SANDBOX */ @@ -1984,12 +1984,6 @@ PRemotePrintJobChild* ContentChild::AllocPRemotePrintJobChild() { #endif } -already_AddRefed<PClipboardReadRequestChild> -ContentChild::AllocPClipboardReadRequestChild( - const nsTArray<nsCString>& aTypes) { - return MakeAndAddRef<ClipboardReadRequestChild>(aTypes); -} - media::PMediaChild* ContentChild::AllocPMediaChild() { return media::AllocPMediaChild(); } @@ -2223,9 +2217,8 @@ void ContentChild::ProcessingError(Result aCode, const char* aReason) { MOZ_CRASH("not reached"); } - nsDependentCString reason(aReason); - CrashReporter::AnnotateCrashReport( - CrashReporter::Annotation::ipc_channel_error, reason); + CrashReporter::RecordAnnotationCString( + CrashReporter::Annotation::ipc_channel_error, aReason); MOZ_CRASH("Content child abort due to IPC error"); } @@ -2677,8 +2670,8 @@ mozilla::ipc::IPCResult ContentChild::RecvRemoteType( } // Use the prefix to avoid URIs from Fission isolated processes. - CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::RemoteType, - remoteTypePrefix); + CrashReporter::RecordAnnotationNSCString( + CrashReporter::Annotation::RemoteType, remoteTypePrefix); // Defer RemoteWorkerService initialization until the child process does // receive its specific remoteType and can become actionable for the @@ -2951,8 +2944,7 @@ void ContentChild::ForceKillTimerCallback(nsITimer* aTimer, void* aClosure) { } mozilla::ipc::IPCResult ContentChild::RecvShutdownConfirmedHP() { - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, + ProcessChild::AppendToIPCShutdownStateAnnotation( "RecvShutdownConfirmedHP entry"_ns); // Bug 1755376: If we see "RecvShutdownConfirmedHP entry" often in @@ -2963,8 +2955,7 @@ mozilla::ipc::IPCResult ContentChild::RecvShutdownConfirmedHP() { } mozilla::ipc::IPCResult ContentChild::RecvShutdown() { - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, "RecvShutdown entry"_ns); + ProcessChild::AppendToIPCShutdownStateAnnotation("RecvShutdown entry"_ns); // Signal the ongoing shutdown to AppShutdown, this // will make abort nested SpinEventLoopUntilOrQuit loops @@ -2973,8 +2964,7 @@ mozilla::ipc::IPCResult ContentChild::RecvShutdown() { nsCOMPtr<nsIObserverService> os = services::GetObserverService(); if (os) { - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, + ProcessChild::AppendToIPCShutdownStateAnnotation( "content-child-will-shutdown started"_ns); os->NotifyObservers(ToSupports(this), "content-child-will-shutdown", @@ -2986,8 +2976,7 @@ mozilla::ipc::IPCResult ContentChild::RecvShutdown() { } void ContentChild::ShutdownInternal() { - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, "ShutdownInternal entry"_ns); + ProcessChild::AppendToIPCShutdownStateAnnotation("ShutdownInternal entry"_ns); // If we receive the shutdown message from within a nested event loop, we want // to wait for that event loop to finish. Otherwise we could prematurely @@ -3025,8 +3014,7 @@ void ContentChild::ShutdownInternal() { nsCOMPtr<nsIObserverService> os = services::GetObserverService(); if (os) { - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, + ProcessChild::AppendToIPCShutdownStateAnnotation( "content-child-shutdown started"_ns); os->NotifyObservers(ToSupports(this), "content-child-shutdown", nullptr); } @@ -3035,21 +3023,21 @@ void ContentChild::ShutdownInternal() { if (mProfilerController) { const bool isProfiling = profiler_is_active(); - CrashReporter::AnnotateCrashReport( + CrashReporter::RecordAnnotationCString( CrashReporter::Annotation::ProfilerChildShutdownPhase, - isProfiling ? "Profiling - GrabShutdownProfileAndShutdown"_ns - : "Not profiling - GrabShutdownProfileAndShutdown"_ns); + isProfiling ? "Profiling - GrabShutdownProfileAndShutdown" + : "Not profiling - GrabShutdownProfileAndShutdown"); ProfileAndAdditionalInformation shutdownProfileAndAdditionalInformation = mProfilerController->GrabShutdownProfileAndShutdown(); - CrashReporter::AnnotateCrashReport( + CrashReporter::RecordAnnotationCString( CrashReporter::Annotation::ProfilerChildShutdownPhase, - isProfiling ? "Profiling - Destroying ChildProfilerController"_ns - : "Not profiling - Destroying ChildProfilerController"_ns); + isProfiling ? "Profiling - Destroying ChildProfilerController" + : "Not profiling - Destroying ChildProfilerController"); mProfilerController = nullptr; - CrashReporter::AnnotateCrashReport( + CrashReporter::RecordAnnotationCString( CrashReporter::Annotation::ProfilerChildShutdownPhase, - isProfiling ? "Profiling - SendShutdownProfile (sending)"_ns - : "Not profiling - SendShutdownProfile (sending)"_ns); + isProfiling ? "Profiling - SendShutdownProfile (sending)" + : "Not profiling - SendShutdownProfile (sending)"); if (const size_t len = shutdownProfileAndAdditionalInformation.SizeOf(); len >= size_t(IPC::Channel::kMaximumMessageSize)) { shutdownProfileAndAdditionalInformation.mProfile = nsPrintfCString( @@ -3061,13 +3049,12 @@ void ContentChild::ShutdownInternal() { // message channel, which we know will survive for long enough. bool sent = SendShutdownProfile(shutdownProfileAndAdditionalInformation.mProfile); - CrashReporter::AnnotateCrashReport( + CrashReporter::RecordAnnotationCString( CrashReporter::Annotation::ProfilerChildShutdownPhase, - sent ? (isProfiling ? "Profiling - SendShutdownProfile (sent)"_ns - : "Not profiling - SendShutdownProfile (sent)"_ns) - : (isProfiling - ? "Profiling - SendShutdownProfile (failed)"_ns - : "Not profiling - SendShutdownProfile (failed)"_ns)); + sent ? (isProfiling ? "Profiling - SendShutdownProfile (sent)" + : "Not profiling - SendShutdownProfile (sent)") + : (isProfiling ? "Profiling - SendShutdownProfile (failed)" + : "Not profiling - SendShutdownProfile (failed)")); } if (PerfStats::GetCollectionMask() != 0) { @@ -3077,12 +3064,10 @@ void ContentChild::ShutdownInternal() { // Start a timer that will ensure we quickly exit after a reasonable period // of time. Prevents shutdown hangs after our connection to the parent // closes or when the parent is too busy to ever kill us. - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, "StartForceKillTimer"_ns); + ProcessChild::AppendToIPCShutdownStateAnnotation("StartForceKillTimer"_ns); StartForceKillTimer(); - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, + ProcessChild::AppendToIPCShutdownStateAnnotation( "SendFinishShutdown (sending)"_ns); // Notify the parent that we are done with shutdown. This is sent with high @@ -3094,8 +3079,7 @@ void ContentChild::ShutdownInternal() { // ever process for this ContentChild. bool sent = SendFinishShutdown(); - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, + ProcessChild::AppendToIPCShutdownStateAnnotation( sent ? "SendFinishShutdown (sent)"_ns : "SendFinishShutdown (failed)"_ns); } @@ -4345,8 +4329,8 @@ mozilla::ipc::IPCResult ContentChild::RecvLoadURI( annotationURI = aLoadState->URI(); } - CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::URL, - annotationURI->GetSpecOrDefault()); + CrashReporter::RecordAnnotationNSCString(CrashReporter::Annotation::URL, + annotationURI->GetSpecOrDefault()); } #endif @@ -4379,8 +4363,8 @@ mozilla::ipc::IPCResult ContentChild::RecvInternalLoad( annotationURI = aLoadState->URI(); } - CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::URL, - annotationURI->GetSpecOrDefault()); + CrashReporter::RecordAnnotationNSCString(CrashReporter::Annotation::URL, + annotationURI->GetSpecOrDefault()); } #endif diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 4cd1e0771c..b9ab77ef5b 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -227,9 +227,6 @@ class ContentChild final : public PContentChild, PRemotePrintJobChild* AllocPRemotePrintJobChild(); - already_AddRefed<PClipboardReadRequestChild> AllocPClipboardReadRequestChild( - const nsTArray<nsCString>& aTypes); - PMediaChild* AllocPMediaChild(); bool DeallocPMediaChild(PMediaChild* aActor); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 13206216f3..2dbdb662ff 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -78,6 +78,7 @@ #include "mozilla/StaticPrefs_fission.h" #include "mozilla/StaticPrefs_media.h" #include "mozilla/StaticPrefs_network.h" +#include "mozilla/StaticPrefs_threads.h" #include "mozilla/StaticPrefs_widget.h" #include "mozilla/StorageAccessAPIHelper.h" #include "mozilla/StyleSheet.h" @@ -213,7 +214,6 @@ #include "nsILocalStorageManager.h" #include "nsIMemoryInfoDumper.h" #include "nsIMemoryReporter.h" -#include "nsIMozBrowserFrame.h" #include "nsINetworkLinkService.h" #include "nsIObserverService.h" #include "nsIParentChannel.h" @@ -1601,27 +1601,24 @@ void ContentParent::BroadcastThemeUpdate(widget::ThemeChangeKind aKind) { /*static */ void ContentParent::BroadcastMediaCodecsSupportedUpdate( RemoteDecodeIn aLocation, const media::MediaCodecsSupported& aSupported) { - // Merge incoming codec support with existing support list - media::MCSInfo::AddSupport(aSupported); - auto support = media::MCSInfo::GetSupport(); - - // Update processes - sCodecsSupported[aLocation] = support; + // Update processes and print the support info from the given location. + sCodecsSupported[aLocation] = aSupported; for (auto* cp : AllProcesses(eAll)) { - Unused << cp->SendUpdateMediaCodecsSupported(aLocation, support); + Unused << cp->SendUpdateMediaCodecsSupported(aLocation, aSupported); } - - // Generate + save support string for display in about:support nsCString supportString; - media::MCSInfo::GetMediaCodecsSupportedString(supportString, support); - gfx::gfxVars::SetCodecSupportInfo(supportString); - - // Print the support info only from the given location for debug purpose. - supportString.Truncate(); media::MCSInfo::GetMediaCodecsSupportedString(supportString, aSupported); - supportString.ReplaceSubstring("\n"_ns, ", "_ns); LOGPDM("Broadcast support from '%s', support=%s", RemoteDecodeInToStr(aLocation), supportString.get()); + + // Merge incoming support with existing support list from other locations + media::MCSInfo::AddSupport(aSupported); + auto fullSupport = media::MCSInfo::GetSupport(); + + // Generate + save FULL support string for display in about:support + supportString.Truncate(); + media::MCSInfo::GetMediaCodecsSupportedString(supportString, fullSupport); + gfx::gfxVars::SetCodecSupportInfo(supportString); } const nsACString& ContentParent::GetRemoteType() const { return mRemoteType; } @@ -1798,6 +1795,14 @@ bool ContentParent::ShutDownProcess(ShutDownMethod aMethod) { SetInputPriorityEventEnabled(false); // If we did not earlier, let's signal the shutdown to JS now. SignalImpendingShutdownToContentJS(); + + // Adjust the QoS priorities for shutdown, if they exist. + if (StaticPrefs::threads_use_low_power_enabled() && + StaticPrefs:: + threads_lower_mainthread_priority_in_background_enabled()) { + SetMainThreadQoSPriority(nsIThread::QOS_PRIORITY_NORMAL); + } + // Send a high priority announcement first. If this fails, SendShutdown // will also fail. Unused << SendShutdownConfirmedHP(); @@ -3524,17 +3529,30 @@ mozilla::ipc::IPCResult ContentParent::RecvClipboardHasType( return IPC_OK(); } -mozilla::ipc::IPCResult ContentParent::RecvGetExternalClipboardFormats( - const int32_t& aWhichClipboard, const bool& aPlainTextOnly, - nsTArray<nsCString>* aTypes) { - MOZ_ASSERT(aTypes); - DataTransfer::GetExternalClipboardFormats(aWhichClipboard, aPlainTextOnly, - aTypes); - return IPC_OK(); -} - namespace { +static Result<ClipboardReadRequest, nsresult> CreateClipboardReadRequest( + ContentParent& aContentParent, + nsIAsyncGetClipboardData& aAsyncGetClipboardData) { + nsTArray<nsCString> flavors; + nsresult rv = aAsyncGetClipboardData.GetFlavorList(flavors); + if (NS_FAILED(rv)) { + return Err(rv); + } + + auto requestParent = MakeNotNull<RefPtr<ClipboardReadRequestParent>>( + &aContentParent, &aAsyncGetClipboardData); + + // Open a remote endpoint for our PClipboardReadRequest actor. + ManagedEndpoint<PClipboardReadRequestChild> childEndpoint = + aContentParent.OpenPClipboardReadRequestEndpoint(requestParent); + if (NS_WARN_IF(!childEndpoint.IsValid())) { + return Err(NS_ERROR_FAILURE); + } + + return ClipboardReadRequest(std::move(childEndpoint), std::move(flavors)); +} + class ClipboardGetCallback final : public nsIAsyncClipboardGetCallback { public: ClipboardGetCallback(ContentParent* aContentParent, @@ -3548,20 +3566,16 @@ class ClipboardGetCallback final : public nsIAsyncClipboardGetCallback { // nsIAsyncClipboardGetCallback NS_IMETHOD OnSuccess( nsIAsyncGetClipboardData* aAsyncGetClipboardData) override { - nsTArray<nsCString> flavors; - nsresult rv = aAsyncGetClipboardData->GetFlavorList(flavors); - if (NS_FAILED(rv)) { - return OnError(rv); - } + MOZ_ASSERT(mContentParent); + MOZ_ASSERT(aAsyncGetClipboardData); - auto requestParent = MakeNotNull<RefPtr<ClipboardReadRequestParent>>( - mContentParent, aAsyncGetClipboardData); - if (!mContentParent->SendPClipboardReadRequestConstructor( - requestParent, std::move(flavors))) { - return OnError(NS_ERROR_FAILURE); + auto result = + CreateClipboardReadRequest(*mContentParent, *aAsyncGetClipboardData); + if (result.isErr()) { + return OnError(result.unwrapErr()); } - mResolver(PClipboardReadRequestOrError(requestParent)); + mResolver(result.unwrap()); return NS_OK; } @@ -3624,6 +3638,48 @@ mozilla::ipc::IPCResult ContentParent::RecvGetClipboardAsync( return IPC_OK(); } +mozilla::ipc::IPCResult ContentParent::RecvGetClipboardDataSnapshotSync( + nsTArray<nsCString>&& aTypes, const int32_t& aWhichClipboard, + const MaybeDiscarded<WindowContext>& aRequestingWindowContext, + ClipboardReadRequestOrError* aRequestOrError) { + // If the requesting context has been discarded, cancel the paste. + if (aRequestingWindowContext.IsDiscarded()) { + *aRequestOrError = NS_ERROR_FAILURE; + return IPC_OK(); + } + + RefPtr<WindowGlobalParent> requestingWindow = + aRequestingWindowContext.get_canonical(); + if (requestingWindow && requestingWindow->GetContentParent() != this) { + return IPC_FAIL( + this, "attempt to paste into WindowContext loaded in another process"); + } + + nsCOMPtr<nsIClipboard> clipboard(do_GetService(kCClipboardCID)); + if (!clipboard) { + *aRequestOrError = NS_ERROR_FAILURE; + return IPC_OK(); + } + + nsCOMPtr<nsIAsyncGetClipboardData> asyncGetClipboardData; + nsresult rv = + clipboard->GetDataSnapshotSync(aTypes, aWhichClipboard, requestingWindow, + getter_AddRefs(asyncGetClipboardData)); + if (NS_FAILED(rv)) { + *aRequestOrError = rv; + return IPC_OK(); + } + + auto result = CreateClipboardReadRequest(*this, *asyncGetClipboardData); + if (result.isErr()) { + *aRequestOrError = result.unwrapErr(); + return IPC_OK(); + } + + *aRequestOrError = result.unwrap(); + return IPC_OK(); +} + already_AddRefed<PClipboardWriteRequestParent> ContentParent::AllocPClipboardWriteRequestParent( const int32_t& aClipboardType) { @@ -4444,11 +4500,11 @@ void ContentParent::GeneratePairedMinidump(const char* aReason) { // minidump tagging along, so we have to tell the crash reporter that // it exists and is being appended. nsAutoCString additionalDumps("browser"); - mCrashReporter->AddAnnotation( + mCrashReporter->AddAnnotationNSCString( CrashReporter::Annotation::additional_minidumps, additionalDumps); nsDependentCString reason(aReason); - mCrashReporter->AddAnnotation(CrashReporter::Annotation::ipc_channel_error, - reason); + mCrashReporter->AddAnnotationNSCString( + CrashReporter::Annotation::ipc_channel_error, reason); // Generate the report and insert into the queue for submittal. if (mCrashReporter->GenerateMinidumpAndPair(this, "browser"_ns)) { @@ -7084,7 +7140,7 @@ mozilla::ipc::IPCResult ContentParent::RecvNotifyMediaFullScreenState( mozilla::ipc::IPCResult ContentParent::RecvNotifyPositionStateChanged( const MaybeDiscarded<BrowsingContext>& aContext, - const PositionState& aState) { + const Maybe<PositionState>& aState) { if (aContext.IsNullOrDiscarded()) { return IPC_OK(); } diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 53994e45e7..15139a93f1 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -964,16 +964,17 @@ class ContentParent final : public PContentParent, const int32_t& aWhichClipboard, bool* aHasType); - mozilla::ipc::IPCResult RecvGetExternalClipboardFormats( - const int32_t& aWhichClipboard, const bool& aPlainTextOnly, - nsTArray<nsCString>* aTypes); - mozilla::ipc::IPCResult RecvGetClipboardAsync( nsTArray<nsCString>&& aTypes, const int32_t& aWhichClipboard, const MaybeDiscarded<WindowContext>& aRequestingWindowContext, mozilla::NotNull<nsIPrincipal*> aRequestingPrincipal, GetClipboardAsyncResolver&& aResolver); + mozilla::ipc::IPCResult RecvGetClipboardDataSnapshotSync( + nsTArray<nsCString>&& aTypes, const int32_t& aWhichClipboard, + const MaybeDiscarded<WindowContext>& aRequestingWindowContext, + ClipboardReadRequestOrError* aRequestOrError); + already_AddRefed<PClipboardWriteRequestParent> AllocPClipboardWriteRequestParent(const int32_t& aClipboardType); @@ -1270,7 +1271,7 @@ class ContentParent final : public PContentParent, mozilla::ipc::IPCResult RecvNotifyPositionStateChanged( const MaybeDiscarded<BrowsingContext>& aContext, - const PositionState& aState); + const Maybe<PositionState>& aState); mozilla::ipc::IPCResult RecvAddOrRemovePageAwakeRequest( const MaybeDiscarded<BrowsingContext>& aContext, diff --git a/dom/ipc/FilePickerParent.cpp b/dom/ipc/FilePickerParent.cpp index ebd24cb0d3..ea65f79c23 100644 --- a/dom/ipc/FilePickerParent.cpp +++ b/dom/ipc/FilePickerParent.cpp @@ -219,25 +219,17 @@ void FilePickerParent::Done(nsIFilePicker::ResultCode aResult) { } bool FilePickerParent::CreateFilePicker() { - mFilePicker = do_CreateInstance("@mozilla.org/filepicker;1"); - if (!mFilePicker) { + if (!mBrowsingContext) { return false; } - auto* browserParent = BrowserParent::GetFrom(Manager()); - auto* browsingContext = browserParent->GetBrowsingContext(); - Element* element = browserParent->GetOwnerElement(); - if (!element) { - return false; - } + mFilePicker = do_CreateInstance("@mozilla.org/filepicker;1"); - nsCOMPtr<mozIDOMWindowProxy> window = element->OwnerDoc()->GetWindow(); - if (!window) { + if (!mFilePicker) { return false; } - return NS_SUCCEEDED( - mFilePicker->Init(window, mTitle, mMode, browsingContext)); + return NS_SUCCEEDED(mFilePicker->Init(mBrowsingContext, mTitle, mMode)); } mozilla::ipc::IPCResult FilePickerParent::RecvOpen( diff --git a/dom/ipc/FilePickerParent.h b/dom/ipc/FilePickerParent.h index f0fe0dc2d0..3cdb5ab912 100644 --- a/dom/ipc/FilePickerParent.h +++ b/dom/ipc/FilePickerParent.h @@ -12,6 +12,7 @@ #include "nsCOMArray.h" #include "nsThreadUtils.h" #include "mozilla/dom/File.h" +#include "mozilla/dom/BrowsingContext.h" #include "mozilla/dom/PFilePickerParent.h" class nsIFile; @@ -20,8 +21,12 @@ namespace mozilla::dom { class FilePickerParent : public PFilePickerParent { public: - FilePickerParent(const nsString& aTitle, const nsIFilePicker::Mode& aMode) - : mTitle(aTitle), mMode(aMode), mResult(nsIFilePicker::returnOK) {} + FilePickerParent(const nsString& aTitle, const nsIFilePicker::Mode& aMode, + BrowsingContext* aBrowsingContext) + : mTitle(aTitle), + mMode(aMode), + mBrowsingContext(aBrowsingContext), + mResult(nsIFilePicker::returnOK) {} private: virtual ~FilePickerParent(); @@ -93,6 +98,7 @@ class FilePickerParent : public PFilePickerParent { nsString mTitle; nsIFilePicker::Mode mMode; + RefPtr<mozilla::dom::BrowsingContext> mBrowsingContext; nsIFilePicker::ResultCode mResult; }; diff --git a/dom/ipc/JSValidatorChild.cpp b/dom/ipc/JSValidatorChild.cpp index 5070a46492..86ddeb3434 100644 --- a/dom/ipc/JSValidatorChild.cpp +++ b/dom/ipc/JSValidatorChild.cpp @@ -179,7 +179,12 @@ JSValidatorChild::GetUTF8EncodedContent( JSValidatorChild::ValidatorResult JSValidatorChild::ShouldAllowJS( const mozilla::Span<const char>& aSpan) const { - MOZ_ASSERT(!aSpan.IsEmpty()); + // It's possible that the data we get is not valid UTF-8, so aSpan + // ends empty here. We should treat it as a failure because this + // is not valid JS. + if (aSpan.IsEmpty()) { + return ValidatorResult::Failure; + } MOZ_DIAGNOSTIC_ASSERT(IsUtf8(aSpan)); @@ -202,9 +207,8 @@ JSValidatorChild::ValidatorResult JSValidatorChild::ShouldAllowJS( prefableOptions.setAsmJSOption(JS::AsmJSOption::DisabledByAsmJSPref); JS::CompileOptions options(prefableOptions); - JS::CompilationStorage storage; RefPtr<JS::Stencil> stencil = - JS::CompileGlobalScriptToStencil(fc, options, srcBuf, storage); + JS::CompileGlobalScriptToStencil(fc, options, srcBuf); if (!stencil) { JS::ClearFrontendErrors(fc); diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index bc126724f4..caef472ec2 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -428,7 +428,7 @@ parent: */ async PColorPicker(nsString title, nsString initialColor, nsString[] defaultColors); - async PFilePicker(nsString aTitle, Mode aMode); + async PFilePicker(nsString aTitle, Mode aMode, MaybeDiscardedBrowsingContext aBrowsingContext); /** * Tells the containing widget whether the given input block results in a diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index b8155fd375..3789c046c8 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -188,7 +188,7 @@ struct SystemFontListEntry { uint8_t index; FontVisibility visibility; }; -#elif defined(XP_MACOSX) +#elif defined(XP_MACOSX) || defined(XP_IOS) // Used on Mac OS X to pass the list of font families (not faces) // from chrome to content processes. // The entryType field distinguishes several types of font family @@ -470,8 +470,13 @@ struct IPCImage { ImageIntSize size; }; -union PClipboardReadRequestOrError { - PClipboardReadRequest; +struct ClipboardReadRequest { + ManagedEndpoint<PClipboardReadRequestChild> childEndpoint; + nsCString[] availableTypes; +}; + +union ClipboardReadRequestOrError { + ClipboardReadRequest; nsresult; }; @@ -1057,8 +1062,6 @@ child: async PRemotePrintJob(); - async PClipboardReadRequest(nsCString[] aTypes); - parent: async SynchronizeLayoutHistoryState(MaybeDiscardedBrowsingContext aContext, nullable nsILayoutHistoryState aState); @@ -1226,14 +1229,16 @@ parent: MaybeDiscardedWindowContext aRequestingWindowContext) returns (IPCTransferableData transferableData); - // Returns a list of formats supported by the clipboard - sync GetExternalClipboardFormats(int32_t aWhichClipboard, bool aPlainTextOnly) returns (nsCString[] aTypes); - // Requests getting data from clipboard. async GetClipboardAsync(nsCString[] aTypes, int32_t aWhichClipboard, MaybeDiscardedWindowContext aRequestingWindowContext, nsIPrincipal aRequestingPrincipal) - returns (PClipboardReadRequestOrError aClipboardReadRequest); + returns (ClipboardReadRequestOrError aClipboardReadRequestOrError); + + // Requests getting data from clipboard. + sync GetClipboardDataSnapshotSync(nsCString[] aTypes, int32_t aWhichClipboard, + MaybeDiscardedWindowContext aRequestingWindowContext) + returns (ClipboardReadRequestOrError aClipboardReadRequestOrError); // Clears the clipboard. async EmptyClipboard(int32_t aWhichClipboard); @@ -1733,7 +1738,7 @@ parent: */ async NotifyPositionStateChanged( MaybeDiscardedBrowsingContext aContext, - PositionState aState); + PositionState? aState); /** * This method will make canonical browsing context to update the count of diff --git a/dom/ipc/ProcessHangMonitor.cpp b/dom/ipc/ProcessHangMonitor.cpp index 1dcba24406..7b0f45598c 100644 --- a/dom/ipc/ProcessHangMonitor.cpp +++ b/dom/ipc/ProcessHangMonitor.cpp @@ -86,6 +86,8 @@ using namespace mozilla::ipc; namespace { +LazyLogModule gQoSLog("QoSPriority"); // For RecvSetMainThreadQoSPriority. + /* Child process objects */ class HangMonitorChild : public PProcessHangMonitorChild, @@ -560,12 +562,10 @@ mozilla::ipc::IPCResult HangMonitorChild::RecvRequestContentJSInterrupt() { // In order to cancel JS execution on shutdown, we expect that // ProcessChild::NotifiedImpendingShutdown has been called before. if (mozilla::ipc::ProcessChild::ExpectingShutdown()) { - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, + ProcessChild::AppendToIPCShutdownStateAnnotation( "HangMonitorChild::RecvRequestContentJSInterrupt (expected)"_ns); } else { - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, + ProcessChild::AppendToIPCShutdownStateAnnotation( "HangMonitorChild::RecvRequestContentJSInterrupt (unexpected)"_ns); } JS_RequestInterruptCallback(mContext); @@ -651,9 +651,21 @@ mozilla::ipc::IPCResult HangMonitorChild::RecvCancelContentJSExecutionIfRunning( return IPC_OK(); } +const char* DefineQoS(const nsIThread::QoSPriority& aQoSPriority) { + if (aQoSPriority == nsIThread::QOS_PRIORITY_LOW) { + return "BACKGROUND"; + } + // As of right now, all non-low QoS priorities default to the thread's normal + // priority. + return "NORMAL"; +} + mozilla::ipc::IPCResult HangMonitorChild::RecvSetMainThreadQoSPriority( const nsIThread::QoSPriority& aQoSPriority) { MOZ_RELEASE_ASSERT(IsOnThread()); + MOZ_LOG(gQoSLog, LogLevel::Debug, + ("Priority change %s recieved by content process.", + DefineQoS(aQoSPriority))); #ifdef XP_MACOSX // If the new priority is the background (low) priority, we can tell the OS to @@ -672,14 +684,22 @@ mozilla::ipc::IPCResult HangMonitorChild::RecvSetMainThreadQoSPriority( pthread_override_qos_class_start_np(mMainPThread, qosClass, 0); if (NS_FAILED(NS_DispatchToMainThread(NS_NewRunnableFunction( "HangMonitorChild::RecvSetMainThreadQoSPriority", - [qosClass, qosOverride] { + [qosClass, qosOverride, aQoSPriority] { + MOZ_LOG( + gQoSLog, LogLevel::Debug, + ("Override %s sent to main thread.", DefineQoS(aQoSPriority))); pthread_set_qos_class_self_np(qosClass, 0); if (qosOverride) { pthread_override_qos_class_end_np(qosOverride); + MOZ_LOG(gQoSLog, LogLevel::Debug, + ("Override %s removed from main thread.", + DefineQoS(aQoSPriority))); } })))) { // If we fail to dispatch, go ahead and end the override anyway. pthread_override_qos_class_end_np(qosOverride); + MOZ_LOG(gQoSLog, LogLevel::Debug, + ("Override %s removed from main thread.", DefineQoS(aQoSPriority))); } #endif diff --git a/dom/ipc/ProcessPriorityManager.cpp b/dom/ipc/ProcessPriorityManager.cpp index 2c54b43295..10fca879a6 100644 --- a/dom/ipc/ProcessPriorityManager.cpp +++ b/dom/ipc/ProcessPriorityManager.cpp @@ -203,8 +203,6 @@ class ProcessPriorityManagerImpl final : public nsIObserver, void BrowserPriorityChanged(CanonicalBrowsingContext* aBC, bool aPriority); void BrowserPriorityChanged(BrowserParent* aBrowserParent, bool aPriority); - void ResetPriority(ContentParent* aContentParent); - private: static bool sPrefListenersRegistered; static bool sInitialized; @@ -559,12 +557,6 @@ void ProcessPriorityManagerImpl::BrowserPriorityChanged( } } -void ProcessPriorityManagerImpl::ResetPriority(ContentParent* aContentParent) { - if (RefPtr pppm = GetParticularProcessPriorityManager(aContentParent)) { - pppm->ResetPriority(); - } -} - NS_IMPL_ISUPPORTS(ParticularProcessPriorityManager, nsITimerCallback, nsISupportsWeakReference, nsINamed); @@ -839,11 +831,14 @@ void ParticularProcessPriorityManager::SetPriorityNow( // thread on low-power cores. Alternately, if we are changing from the // background to a higher priority, we change the main thread back to its // normal state. + // During shutdown, we will manually set the priority to the highest + // possible and disallow any additional priority changes. // // The messages for this will be relayed using the ProcessHangMonitor such // that the priority can be raised even if the main thread is unresponsive. - if (PriorityUsesLowPowerMainThread(mPriority) != - (PriorityUsesLowPowerMainThread(oldPriority))) { + if (!mContentParent->IsShuttingDown() && + PriorityUsesLowPowerMainThread(mPriority) != + PriorityUsesLowPowerMainThread(oldPriority)) { if (PriorityUsesLowPowerMainThread(mPriority) && PrefsUseLowPriorityThreads()) { mContentParent->SetMainThreadQoSPriority(nsIThread::QOS_PRIORITY_LOW); @@ -1042,26 +1037,4 @@ void ProcessPriorityManager::BrowserPriorityChanged( singleton->BrowserPriorityChanged(aBrowserParent, aPriority); } -/* static */ -void ProcessPriorityManager::RemoteBrowserFrameShown( - nsFrameLoader* aFrameLoader) { - ProcessPriorityManagerImpl* singleton = - ProcessPriorityManagerImpl::GetSingleton(); - if (!singleton) { - return; - } - - BrowserParent* bp = BrowserParent::GetFrom(aFrameLoader); - NS_ENSURE_TRUE_VOID(bp); - - MOZ_ASSERT(XRE_IsParentProcess()); - - // Ignore calls that aren't from a Browser. - if (!aFrameLoader->OwnerIsMozBrowserFrame()) { - return; - } - - singleton->ResetPriority(bp->Manager()); -} - } // namespace mozilla diff --git a/dom/ipc/ProcessPriorityManager.h b/dom/ipc/ProcessPriorityManager.h index 8153a60993..be1508bfbd 100644 --- a/dom/ipc/ProcessPriorityManager.h +++ b/dom/ipc/ProcessPriorityManager.h @@ -80,8 +80,6 @@ class ProcessPriorityManager final { static void BrowserPriorityChanged(dom::BrowserParent* aBrowserParent, bool aPriority); - static void RemoteBrowserFrameShown(nsFrameLoader* aFrameLoader); - private: ProcessPriorityManager(); ProcessPriorityManager(const ProcessPriorityManager&) = delete; diff --git a/dom/ipc/jar.mn b/dom/ipc/jar.mn deleted file mode 100644 index 6c43857aea..0000000000 --- a/dom/ipc/jar.mn +++ /dev/null @@ -1,7 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# 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/. - -toolkit.jar: - content/global/BrowserElementChild.js (../browser-element/BrowserElementChild.js) - content/global/BrowserElementChildPreload.js (../browser-element/BrowserElementChildPreload.js) diff --git a/dom/ipc/jsactor/JSActorManager.cpp b/dom/ipc/jsactor/JSActorManager.cpp index b8791570d6..c6be8488b5 100644 --- a/dom/ipc/jsactor/JSActorManager.cpp +++ b/dom/ipc/jsactor/JSActorManager.cpp @@ -63,19 +63,21 @@ already_AddRefed<JSActor> JSActorManager::GetActor(JSContext* aCx, // If the JSActor uses `loadInDevToolsLoader`, force loading in the DevTools // specific's loader. RefPtr loader = protocol->mLoadInDevToolsLoader - ? mozJSModuleLoader::GetOrCreateDevToolsLoader() + ? mozJSModuleLoader::GetOrCreateDevToolsLoader(aCx) : mozJSModuleLoader::Get(); MOZ_ASSERT(loader); // We're about to construct the actor, so make sure we're in the loader realm // while importing etc. - JSAutoRealm ar(aCx, loader->GetSharedGlobal(aCx)); + JSAutoRealm ar(aCx, loader->GetSharedGlobal()); // If a module URI was provided, use it to construct an instance of the actor. JS::Rooted<JSObject*> actorObj(aCx); if (side.mModuleURI || side.mESModuleURI) { JS::Rooted<JSObject*> exports(aCx); if (side.mModuleURI) { + // TODO: Remove this once m-c, c-c, and out-of-tree code migrations finish + // (bug 1866732). JS::Rooted<JSObject*> global(aCx); aRv = loader->Import(aCx, side.mModuleURI.ref(), &global, &exports); if (aRv.Failed()) { @@ -143,9 +145,9 @@ void JSActorManager::ReceiveRawMessage( Maybe<ipc::StructuredCloneData>&& aStack) { MOZ_ASSERT(nsContentUtils::IsSafeToRunScript()); - CrashReporter::AutoAnnotateCrashReport autoActorName( + CrashReporter::AutoRecordAnnotation autoActorName( CrashReporter::Annotation::JSActorName, aMetadata.actorName()); - CrashReporter::AutoAnnotateCrashReport autoMessageName( + CrashReporter::AutoRecordAnnotation autoMessageName( CrashReporter::Annotation::JSActorMessage, NS_LossyConvertUTF16toASCII(aMetadata.messageName())); @@ -237,7 +239,7 @@ void JSActorManager::JSActorWillDestroy() { void JSActorManager::JSActorDidDestroy() { MOZ_ASSERT(nsContentUtils::IsSafeToRunScript()); - CrashReporter::AutoAnnotateCrashReport autoMessageName( + CrashReporter::AutoRecordAnnotation autoMessageName( CrashReporter::Annotation::JSActorMessage, "<DidDestroy>"_ns); // Swap the table with `mJSActors` so that we don't invalidate it while @@ -245,7 +247,7 @@ void JSActorManager::JSActorDidDestroy() { const nsRefPtrHashtable<nsCStringHashKey, JSActor> actors = std::move(mJSActors); for (const auto& entry : actors.Values()) { - CrashReporter::AutoAnnotateCrashReport autoActorName( + CrashReporter::AutoRecordAnnotation autoActorName( CrashReporter::Annotation::JSActorName, entry->Name()); // Do not risk to run script very late in shutdown if (!AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownFinal)) { diff --git a/dom/ipc/jsactor/JSActorService.cpp b/dom/ipc/jsactor/JSActorService.cpp index 3fde76a206..5b6c63d2a4 100644 --- a/dom/ipc/jsactor/JSActorService.cpp +++ b/dom/ipc/jsactor/JSActorService.cpp @@ -106,9 +106,9 @@ void JSActorService::RegisterWindowActor(const nsACString& aName, void JSActorService::UnregisterWindowActor(const nsACString& aName) { MOZ_ASSERT(nsContentUtils::IsSafeToRunScript()); - CrashReporter::AutoAnnotateCrashReport autoActorName( + CrashReporter::AutoRecordAnnotation autoActorName( CrashReporter::Annotation::JSActorName, aName); - CrashReporter::AutoAnnotateCrashReport autoMessageName( + CrashReporter::AutoRecordAnnotation autoMessageName( CrashReporter::Annotation::JSActorMessage, "<Unregister>"_ns); nsAutoCString name(aName); @@ -268,9 +268,9 @@ void JSActorService::RegisterProcessActor(const nsACString& aName, void JSActorService::UnregisterProcessActor(const nsACString& aName) { MOZ_ASSERT(nsContentUtils::IsSafeToRunScript()); - CrashReporter::AutoAnnotateCrashReport autoActorName( + CrashReporter::AutoRecordAnnotation autoActorName( CrashReporter::Annotation::JSActorName, aName); - CrashReporter::AutoAnnotateCrashReport autoMessageName( + CrashReporter::AutoRecordAnnotation autoMessageName( CrashReporter::Annotation::JSActorMessage, "<Unregister>"_ns); nsAutoCString name(aName); diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index 68f82f5a38..3f10b9fbab 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -257,8 +257,6 @@ DEFINES["MOZ_APP_NAME"] = '"%s"' % CONFIG["MOZ_APP_NAME"] if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": DEFINES["MOZ_ENABLE_FREETYPE"] = True -JAR_MANIFESTS += ["jar.mn"] - BROWSER_CHROME_MANIFESTS += [ "tests/browser.toml", "tests/JSProcessActor/browser.toml", diff --git a/dom/ipc/tests/JSWindowActor/browser.toml b/dom/ipc/tests/JSWindowActor/browser.toml index a9dc7e8b8f..5f406464f4 100644 --- a/dom/ipc/tests/JSWindowActor/browser.toml +++ b/dom/ipc/tests/JSWindowActor/browser.toml @@ -6,7 +6,10 @@ support-files = ["head.js"] ["browser_crash_report.js"] ["browser_destroy_callbacks.js"] -skip-if = ["!debug && os == 'mac'"] #Bug 1604538 +skip-if = [ + "apple_catalina && !debug", #Bug 1604538 + "apple_silicon && !debug", #Bug 1604538 +] ["browser_event_listener.js"] support-files = ["file_dummyChromePage.html"] diff --git a/dom/ipc/tests/JSWindowActor/browser_crash_report.js b/dom/ipc/tests/JSWindowActor/browser_crash_report.js index f029f1a85a..d2b2b3a694 100644 --- a/dom/ipc/tests/JSWindowActor/browser_crash_report.js +++ b/dom/ipc/tests/JSWindowActor/browser_crash_report.js @@ -5,7 +5,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ declTest("crash actor", { allFrames: true, - async test(browser) { + async test() { if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) { ok(true, "Cannot test crash annotations without a crash reporter"); return; diff --git a/dom/ipc/tests/JSWindowActor/browser_destroy_callbacks.js b/dom/ipc/tests/JSWindowActor/browser_destroy_callbacks.js index 74cbae9415..e92de1b82f 100644 --- a/dom/ipc/tests/JSWindowActor/browser_destroy_callbacks.js +++ b/dom/ipc/tests/JSWindowActor/browser_destroy_callbacks.js @@ -142,7 +142,7 @@ declTest("destroy actor by page navigates", { declTest("destroy actor by tab being closed", { allFrames: true, - async test(browser) { + async test() { info("creating a new tab"); let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL); let newTabBrowser = newTab.linkedBrowser; @@ -158,7 +158,7 @@ declTest("destroy actor by tab being closed", { let didDestroyPromise = new Promise(resolve => { Services.ppmm.addMessageListener( "test-jswindowactor-diddestroy", - function onmessage(msg) { + function onmessage() { Services.ppmm.removeMessageListener( "test-jswindowactor-diddestroy", onmessage diff --git a/dom/ipc/tests/JSWindowActor/browser_getActor_filter.js b/dom/ipc/tests/JSWindowActor/browser_getActor_filter.js index a10697c989..691cffe603 100644 --- a/dom/ipc/tests/JSWindowActor/browser_getActor_filter.js +++ b/dom/ipc/tests/JSWindowActor/browser_getActor_filter.js @@ -169,7 +169,7 @@ declTest("getActor with iframe messageManagerGroups match", { let parent = browser.browsingContext.currentWindowGlobal; ok(parent.getActor("TestWindow"), "JSWindowActorParent should have value."); - await SpecialPowers.spawn(browser, [TEST_URL], async function (url) { + await SpecialPowers.spawn(browser, [TEST_URL], async function () { let child = content.windowGlobalChild; ok(child, "WindowGlobalChild should have value."); ok(child.getActor("TestWindow"), "JSWindowActorChild should have value."); @@ -189,7 +189,7 @@ declTest("getActor with iframe messageManagerGroups mismatch", { "Should throw if its messageManagerGroups doesn't match." ); - await SpecialPowers.spawn(browser, [TEST_URL], async function (url) { + await SpecialPowers.spawn(browser, [TEST_URL], async function () { let child = content.windowGlobalChild; ok(child, "WindowGlobalChild should have value."); Assert.throws( diff --git a/dom/ipc/tests/browser_child_clipboard_restricted.js b/dom/ipc/tests/browser_child_clipboard_restricted.js index be2d1bca9c..6fd062d559 100644 --- a/dom/ipc/tests/browser_child_clipboard_restricted.js +++ b/dom/ipc/tests/browser_child_clipboard_restricted.js @@ -9,7 +9,7 @@ add_task(async function () { ); let browser = tab.linkedBrowser; - await SpecialPowers.spawn(browser, [], async function (arg) { + await SpecialPowers.spawn(browser, [], async function () { const trans = Cc["@mozilla.org/widget/transferable;1"].createInstance( Ci.nsITransferable ); diff --git a/dom/ipc/tests/browser_gc_schedule.js b/dom/ipc/tests/browser_gc_schedule.js index 8b44c98eae..e1381f82c0 100644 --- a/dom/ipc/tests/browser_gc_schedule.js +++ b/dom/ipc/tests/browser_gc_schedule.js @@ -15,7 +15,7 @@ async function waitForGCBegin() { // This fixes a ReferenceError for Date, it's weird. ok(Date.now(), "Date.now()"); var when = await new Promise(resolve => { - observer.observe = function (subject, topic, data) { + observer.observe = function () { resolve(Date.now()); }; @@ -40,7 +40,7 @@ async function waitForGCEnd() { // This fixes a ReferenceError for Date, it's weird. ok(Date.now(), "Date.now()"); let when = await new Promise(resolve => { - observer.observe = function (subject, topic, data) { + observer.observe = function () { resolve(Date.now()); }; diff --git a/dom/ipc/tests/browser_wpi_base.js b/dom/ipc/tests/browser_wpi_base.js index 7a01c9a161..f09255a99c 100644 --- a/dom/ipc/tests/browser_wpi_base.js +++ b/dom/ipc/tests/browser_wpi_base.js @@ -183,7 +183,7 @@ const heuristics = [ }, { name: "hasSavedLogin", - setup_com: async expected => { + setup_com: async () => { // add .com to the password manager let LoginInfo = new Components.Constructor( "@mozilla.org/login-manager/loginInfo;1", @@ -208,7 +208,7 @@ const heuristics = [ }, { name: "isLoggedIn", - setup_com: async expected => { + setup_com: async () => { let p = new Promise(resolve => { Services.obs.addObserver(function obs() { Services.obs.removeObserver( diff --git a/dom/ipc/tests/file_broadcast_currenturi_onload.html b/dom/ipc/tests/file_broadcast_currenturi_onload.html index b92c46c944..e258fbdf83 100644 --- a/dom/ipc/tests/file_broadcast_currenturi_onload.html +++ b/dom/ipc/tests/file_broadcast_currenturi_onload.html @@ -33,7 +33,7 @@ async function getURIs() { return { location: location.href, docURI, curURI }; } -addEventListener("load", async e => { +addEventListener("load", async () => { // If a payload parameter was included, just send the message. const payloadStr = url.searchParams.get("payload"); if (payloadStr) { diff --git a/dom/ipc/tests/file_endless_js.html b/dom/ipc/tests/file_endless_js.html index 926fb1d8ab..338cea5e57 100644 --- a/dom/ipc/tests/file_endless_js.html +++ b/dom/ipc/tests/file_endless_js.html @@ -2,7 +2,7 @@ <html> <head><meta charset="utf-8"></head> <script> - function hang(m) { + function hang() { let i = 1; while (i > 0) { i = Date.now(); diff --git a/dom/ipc/tests/process_error.xhtml b/dom/ipc/tests/process_error.xhtml index 3d57a3f456..8dea882c78 100644 --- a/dom/ipc/tests/process_error.xhtml +++ b/dom/ipc/tests/process_error.xhtml @@ -25,7 +25,7 @@ let browser = document.getElementById('thebrowser'); let observerPromise = new Promise(resolve => { - let crashObserver = (subject, topic, data) => { + let crashObserver = (subject, topic) => { is(topic, 'ipc:content-shutdown', 'Received correct observer topic.'); ok(subject instanceof Ci.nsIPropertyBag2, 'Subject implements nsIPropertyBag2.'); diff --git a/dom/ipc/tests/test_bug1086684.js b/dom/ipc/tests/test_bug1086684.js index 8a34906686..218d2b14a6 100644 --- a/dom/ipc/tests/test_bug1086684.js +++ b/dom/ipc/tests/test_bug1086684.js @@ -37,7 +37,7 @@ function childFrameScript() { ); function parentReady(message) { - MockFilePicker.init(content); + MockFilePicker.init(content.browsingContext); MockFilePicker.setFiles([message.data.file]); MockFilePicker.returnValue = MockFilePicker.returnOK; diff --git a/dom/ipc/tests/test_temporaryfile_stream.html b/dom/ipc/tests/test_temporaryfile_stream.html index 9fa76a2155..1a0cfcaef4 100644 --- a/dom/ipc/tests/test_temporaryfile_stream.html +++ b/dom/ipc/tests/test_temporaryfile_stream.html @@ -54,7 +54,7 @@ function startTest() { video.id = "recorded-video"; video.src = URL.createObjectURL(xhr.response); video.play(); - video.onerror = err => { + video.onerror = () => { ok(false, "Should be able to play the recording. Got error. code=" + video.error.code); SimpleTest.finish(); }; diff --git a/dom/ipc/tests/test_window_open_discarded_bc.html b/dom/ipc/tests/test_window_open_discarded_bc.html index 4cd81463e0..fae731d068 100644 --- a/dom/ipc/tests/test_window_open_discarded_bc.html +++ b/dom/ipc/tests/test_window_open_discarded_bc.html @@ -11,7 +11,7 @@ add_task(async function() { const TOPIC = "dangerous:test-only:new-browser-child-ready"; let found = false; - function observer(subject, topic, data) { + function observer(subject) { let win = SpecialPowers.wrap(subject); if (SpecialPowers.compare(win.opener, window)) { found = true; |