зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1282150 part 1. Add a mozilla::dom::danger::GetJSContext API. r=bholley
This commit is contained in:
Родитель
bcb0a973fb
Коммит
6542e6c3f0
|
@ -7,6 +7,7 @@
|
|||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/ThreadLocal.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/CycleCollectedJSRuntime.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "xpcpublic.h"
|
||||
|
@ -284,6 +285,14 @@ IsJSAPIActive()
|
|||
return topEntry && !topEntry->NoJSAPI();
|
||||
}
|
||||
|
||||
namespace danger {
|
||||
JSContext*
|
||||
GetJSContext()
|
||||
{
|
||||
return CycleCollectedJSRuntime::Get()->Context();
|
||||
}
|
||||
} // namespace danger
|
||||
|
||||
AutoJSAPI::AutoJSAPI()
|
||||
: ScriptSettingsStackEntry(nullptr, eJSAPI)
|
||||
, mCx(nullptr)
|
||||
|
|
|
@ -127,6 +127,15 @@ inline JSObject& IncumbentJSGlobal()
|
|||
// AutoJSAPI or AutoEntryScript to get yourself a properly set up JSContext.
|
||||
bool IsJSAPIActive();
|
||||
|
||||
namespace danger {
|
||||
|
||||
// Get the JSContext for this thread. This is in the "danger" namespace because
|
||||
// we generally want people using AutoJSAPI instead, unless they really know
|
||||
// what they're doing.
|
||||
JSContext* GetJSContext();
|
||||
|
||||
} // namespace danger
|
||||
|
||||
class ScriptSettingsStack;
|
||||
class ScriptSettingsStackEntry {
|
||||
friend class ScriptSettingsStack;
|
||||
|
|
Загрузка…
Ссылка в новой задаче