diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp index fb4c6e80b5a0..c9c7ae20f3ff 100644 --- a/widget/windows/nsFilePicker.cpp +++ b/widget/windows/nsFilePicker.cpp @@ -840,7 +840,7 @@ nsresult nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) { auto promise = mMode == modeGetFolder ? ShowFolderPicker(initialDir) : ShowFilePicker(initialDir); - auto p2 = promise->Then( + promise->Then( mozilla::GetMainThreadSerialEventTarget(), __PRETTY_FUNCTION__, [self = RefPtr(this), callback = RefPtr(aCallback)](bool selectionMade) -> void { diff --git a/xpcom/threads/MozPromise.h b/xpcom/threads/MozPromise.h index 612a9ca236bb..c53037e11917 100644 --- a/xpcom/threads/MozPromise.h +++ b/xpcom/threads/MozPromise.h @@ -10,6 +10,7 @@ #include #include +#include "mozilla/Attributes.h" #include "mozilla/ErrorNames.h" #include "mozilla/Logging.h" #include "mozilla/Maybe.h" @@ -1049,17 +1050,21 @@ class MozPromise : public MozPromiseBase { protected: /* - * A command object to store all information needed to make a request to - * the promise. This allows us to delay the request until further use is - * known (whether it is ->Then() again for more promise chaining or ->Track() - * to terminate chaining and issue the request). + * A command object to store all information needed to make a request to the + * promise. This allows us to delay the request until further use is known + * (whether it is ->Then() again for more promise chaining or ->Track() to + * terminate chaining and issue the request). * - * This allows a unified syntax for promise chaining and disconnection - * and feels more like its JS counterpart. + * This allows a unified syntax for promise chaining and disconnection, and + * feels more like its JS counterpart. + * + * Note that a ThenCommand is always exclusive, even if its source or result + * promises are not. To attach multiple continuations, explicitly convert it + * to a promise first. */ template - class ThenCommand { - // Allow Promise1::ThenCommand to access the private constructor, + class MOZ_TEMPORARY_CLASS ThenCommand { + // Allow Promise1::ThenCommand to access the private constructor // Promise2::ThenCommand(ThenCommand&&). template friend class MozPromise;