Bug 1673931 - Remove avoidable includes from dom/Promise.h. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D96557

Depends on D96556
This commit is contained in:
Simon Giesecke 2020-11-23 16:10:47 +00:00
Родитель d10d03d076
Коммит a9c5ce4b94
2 изменённых файлов: 25 добавлений и 15 удалений

Просмотреть файл

@ -851,5 +851,13 @@ Promise::PromiseState Promise::State() const {
return PromiseState::Pending;
}
void Promise::SetSettledPromiseIsHandled() {
AutoAllowLegacyScriptExecution exemption;
AutoEntryScript aes(mGlobal, "Set settled promise handled");
JSContext* cx = aes.cx();
JS::RootedObject promiseObj(cx, mPromiseObj);
JS::SetSettledPromiseIsHandled(cx, promiseObj);
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -7,24 +7,32 @@
#ifndef mozilla_dom_Promise_h
#define mozilla_dom_Promise_h
#include <functional>
#include <type_traits>
#include <utility>
#include "js/Promise.h"
#include "ErrorList.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "jspubtd.h"
#include "mozilla/Attributes.h"
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Assertions.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/RefPtr.h"
#include "mozilla/Result.h"
#include "mozilla/WeakPtr.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/PromiseBinding.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/ToJSValue.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "nsError.h"
#include "nsISupports.h"
#include "nsString.h"
class nsCycleCollectionTraversalCallback;
class nsIGlobalObject;
namespace JS {
class Value;
}
namespace mozilla {
namespace dom {
@ -173,13 +181,7 @@ class Promise : public SupportsWeakPtr {
// Mark a settled promise as already handled so that rejections will not
// be reported as unhandled.
void SetSettledPromiseIsHandled() {
AutoAllowLegacyScriptExecution exemption;
AutoEntryScript aes(mGlobal, "Set settled promise handled");
JSContext* cx = aes.cx();
JS::RootedObject promiseObj(cx, mPromiseObj);
JS::SetSettledPromiseIsHandled(cx, promiseObj);
}
void SetSettledPromiseIsHandled();
// WebIDL