mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changesets 5b1a3161f614, 17a9673ed782, and a9b8c346d295 (bug 1052052) for B2G non-unified bustage.
This commit is contained in:
parent
8c5804deeb
commit
7c3098f03b
@ -19,9 +19,9 @@
|
||||
#include "nsIClassInfoImpl.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "jswrapper.h"
|
||||
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/HashFunctions.h"
|
||||
|
||||
|
@ -61,10 +61,10 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include <stdint.h>
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsILoadInfo.h"
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
#include "Units.h"
|
||||
#include "mozilla/dom/AutocompleteInfoBinding.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
// Undefine LoadImage to prevent naming conflict with Windows.
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "prprf.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "DecoderTraits.h"
|
||||
#include "harfbuzz/hb.h"
|
||||
#include "imgICache.h"
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "AppProcessChecker.h"
|
||||
#include "ContentChild.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "jsapi.h"
|
||||
@ -32,7 +33,6 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/nsIContentParent.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/StructuredCloneUtils.h"
|
||||
#include "mozilla/dom/PBlobChild.h"
|
||||
#include "mozilla/dom/PBlobParent.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "nsIDOMHTMLScriptElement.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "nsIStreamConverterService.h"
|
||||
#include "nsICachingChannel.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIAudioManager.h"
|
||||
#include "SpeakerManagerService.h"
|
||||
#define NS_AUDIOMANAGER_CONTRACTID "@mozilla.org/telephony/audiomanager;1"
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "DOMRequest.h"
|
||||
|
||||
#include "DOMError.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "DOMCursor.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "xpcprivate.h" // For AutoCxPusher guts
|
||||
#include "xpcpublic.h"
|
||||
#include "nsIGlobalObject.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
@ -19,8 +18,6 @@
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -376,153 +373,5 @@ AutoNoJSAPI::AutoNoJSAPI(bool aIsMainThread)
|
||||
}
|
||||
}
|
||||
|
||||
danger::AutoCxPusher::AutoCxPusher(JSContext* cx, bool allowNull)
|
||||
{
|
||||
MOZ_ASSERT_IF(!allowNull, cx);
|
||||
|
||||
// Hold a strong ref to the nsIScriptContext, if any. This ensures that we
|
||||
// only destroy the mContext of an nsJSContext when it is not on the cx stack
|
||||
// (and therefore not in use). See nsJSContext::DestroyJSContext().
|
||||
if (cx)
|
||||
mScx = GetScriptContextFromJSContext(cx);
|
||||
|
||||
XPCJSContextStack *stack = XPCJSRuntime::Get()->GetJSContextStack();
|
||||
if (!stack->Push(cx)) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
mStackDepthAfterPush = stack->Count();
|
||||
|
||||
#ifdef DEBUG
|
||||
mPushedContext = cx;
|
||||
mCompartmentDepthOnEntry = cx ? js::GetEnterCompartmentDepth(cx) : 0;
|
||||
#endif
|
||||
|
||||
// Enter a request and a compartment for the duration that the cx is on the
|
||||
// stack if non-null.
|
||||
if (cx) {
|
||||
mAutoRequest.emplace(cx);
|
||||
|
||||
// DOM JSContexts don't store their default compartment object on the cx.
|
||||
JSObject *compartmentObject = mScx ? mScx->GetWindowProxy()
|
||||
: js::DefaultObjectForContextOrNull(cx);
|
||||
if (compartmentObject)
|
||||
mAutoCompartment.emplace(cx, compartmentObject);
|
||||
}
|
||||
}
|
||||
|
||||
danger::AutoCxPusher::~AutoCxPusher()
|
||||
{
|
||||
// Leave the compartment and request before popping.
|
||||
mAutoCompartment.reset();
|
||||
mAutoRequest.reset();
|
||||
|
||||
// When we push a context, we may save the frame chain and pretend like we
|
||||
// haven't entered any compartment. This gets restored on Pop(), but we can
|
||||
// run into trouble if a Push/Pop are interleaved with a
|
||||
// JSAutoEnterCompartment. Make sure the compartment depth right before we
|
||||
// pop is the same as it was right after we pushed.
|
||||
MOZ_ASSERT_IF(mPushedContext, mCompartmentDepthOnEntry ==
|
||||
js::GetEnterCompartmentDepth(mPushedContext));
|
||||
DebugOnly<JSContext*> stackTop;
|
||||
MOZ_ASSERT(mPushedContext == nsXPConnect::XPConnect()->GetCurrentJSContext());
|
||||
XPCJSRuntime::Get()->GetJSContextStack()->Pop();
|
||||
mScx = nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
danger::AutoCxPusher::IsStackTop() const
|
||||
{
|
||||
uint32_t currentDepth = XPCJSRuntime::Get()->GetJSContextStack()->Count();
|
||||
MOZ_ASSERT(currentDepth >= mStackDepthAfterPush);
|
||||
return currentDepth == mStackDepthAfterPush;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
||||
AutoJSContext::AutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
|
||||
: mCx(nullptr)
|
||||
{
|
||||
Init(false MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT);
|
||||
}
|
||||
|
||||
AutoJSContext::AutoJSContext(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
|
||||
: mCx(nullptr)
|
||||
{
|
||||
Init(aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT);
|
||||
}
|
||||
|
||||
void
|
||||
AutoJSContext::Init(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
|
||||
{
|
||||
JS::AutoSuppressGCAnalysis nogc;
|
||||
MOZ_ASSERT(!mCx, "mCx should not be initialized!");
|
||||
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
|
||||
nsXPConnect *xpc = nsXPConnect::XPConnect();
|
||||
if (!aSafe) {
|
||||
mCx = xpc->GetCurrentJSContext();
|
||||
}
|
||||
|
||||
if (!mCx) {
|
||||
mJSAPI.Init();
|
||||
mCx = mJSAPI.cx();
|
||||
}
|
||||
}
|
||||
|
||||
AutoJSContext::operator JSContext*() const
|
||||
{
|
||||
return mCx;
|
||||
}
|
||||
|
||||
ThreadsafeAutoJSContext::ThreadsafeAutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
mCx = nullptr;
|
||||
mAutoJSContext.emplace();
|
||||
} else {
|
||||
mCx = mozilla::dom::workers::GetCurrentThreadJSContext();
|
||||
mRequest.emplace(mCx);
|
||||
}
|
||||
}
|
||||
|
||||
ThreadsafeAutoJSContext::operator JSContext*() const
|
||||
{
|
||||
if (mCx) {
|
||||
return mCx;
|
||||
} else {
|
||||
return *mAutoJSContext;
|
||||
}
|
||||
}
|
||||
|
||||
AutoSafeJSContext::AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
|
||||
: AutoJSContext(true MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
|
||||
, mAc(mCx, XPCJSRuntime::Get()->GetJSContextStack()->GetSafeJSContextGlobal())
|
||||
{
|
||||
}
|
||||
|
||||
ThreadsafeAutoSafeJSContext::ThreadsafeAutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
mCx = nullptr;
|
||||
mAutoSafeJSContext.emplace();
|
||||
} else {
|
||||
mCx = mozilla::dom::workers::GetCurrentThreadJSContext();
|
||||
mRequest.emplace(mCx);
|
||||
}
|
||||
}
|
||||
|
||||
ThreadsafeAutoSafeJSContext::operator JSContext*() const
|
||||
{
|
||||
if (mCx) {
|
||||
return mCx;
|
||||
} else {
|
||||
return *mAutoSafeJSContext;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -9,53 +9,19 @@
|
||||
#ifndef mozilla_dom_ScriptSettings_h
|
||||
#define mozilla_dom_ScriptSettings_h
|
||||
|
||||
#include "nsCxPusher.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "nsIGlobalObject.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
||||
#include "mozilla/Maybe.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
class nsGlobalWindow;
|
||||
class nsIScriptContext;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
// For internal use only - use AutoJSAPI instead.
|
||||
namespace danger {
|
||||
|
||||
/**
|
||||
* Fundamental cx pushing class. All other cx pushing classes are implemented
|
||||
* in terms of this class.
|
||||
*/
|
||||
class MOZ_STACK_CLASS AutoCxPusher
|
||||
{
|
||||
public:
|
||||
explicit AutoCxPusher(JSContext *aCx, bool aAllowNull = false);
|
||||
~AutoCxPusher();
|
||||
|
||||
nsIScriptContext* GetScriptContext() { return mScx; }
|
||||
|
||||
// Returns true if this AutoCxPusher performed the push that is currently at
|
||||
// the top of the cx stack.
|
||||
bool IsStackTop() const;
|
||||
|
||||
private:
|
||||
mozilla::Maybe<JSAutoRequest> mAutoRequest;
|
||||
mozilla::Maybe<JSAutoCompartment> mAutoCompartment;
|
||||
nsCOMPtr<nsIScriptContext> mScx;
|
||||
uint32_t mStackDepthAfterPush;
|
||||
#ifdef DEBUG
|
||||
JSContext* mPushedContext;
|
||||
unsigned mCompartmentDepthOnEntry;
|
||||
#endif
|
||||
};
|
||||
|
||||
} /* namespace danger */
|
||||
|
||||
/*
|
||||
* System-wide setup/teardown routines. Init and Destroy should be invoked
|
||||
* once each, at startup and shutdown (respectively).
|
||||
@ -217,7 +183,7 @@ protected:
|
||||
AutoJSAPI(nsIGlobalObject* aGlobalObject, bool aIsMainThread, JSContext* aCx);
|
||||
|
||||
private:
|
||||
mozilla::Maybe<danger::AutoCxPusher> mCxPusher;
|
||||
mozilla::Maybe<AutoCxPusher> mCxPusher;
|
||||
mozilla::Maybe<JSAutoNullableCompartment> mAutoNullableCompartment;
|
||||
JSContext *mCx;
|
||||
|
||||
@ -275,79 +241,10 @@ class AutoNoJSAPI : protected ScriptSettingsStackEntry {
|
||||
public:
|
||||
explicit AutoNoJSAPI(bool aIsMainThread = NS_IsMainThread());
|
||||
private:
|
||||
mozilla::Maybe<danger::AutoCxPusher> mCxPusher;
|
||||
mozilla::Maybe<AutoCxPusher> mCxPusher;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
/**
|
||||
* Use AutoJSContext when you need a JS context on the stack but don't have one
|
||||
* passed as a parameter. AutoJSContext will take care of finding the most
|
||||
* appropriate JS context and release it when leaving the stack.
|
||||
*/
|
||||
class MOZ_STACK_CLASS AutoJSContext {
|
||||
public:
|
||||
explicit AutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
|
||||
operator JSContext*() const;
|
||||
|
||||
protected:
|
||||
explicit AutoJSContext(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
|
||||
|
||||
// We need this Init() method because we can't use delegating constructor for
|
||||
// the moment. It is a C++11 feature and we do not require C++11 to be
|
||||
// supported to be able to compile Gecko.
|
||||
void Init(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
|
||||
|
||||
JSContext* mCx;
|
||||
dom::AutoJSAPI mJSAPI;
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
/**
|
||||
* Use ThreadsafeAutoJSContext when you want an AutoJSContext but might be
|
||||
* running on a worker thread.
|
||||
*/
|
||||
class MOZ_STACK_CLASS ThreadsafeAutoJSContext {
|
||||
public:
|
||||
explicit ThreadsafeAutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
|
||||
operator JSContext*() const;
|
||||
|
||||
private:
|
||||
JSContext* mCx; // Used on workers. Null means mainthread.
|
||||
Maybe<JSAutoRequest> mRequest; // Used on workers.
|
||||
Maybe<AutoJSContext> mAutoJSContext; // Used on main thread.
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
/**
|
||||
* AutoSafeJSContext is similar to AutoJSContext but will only return the safe
|
||||
* JS context. That means it will never call nsContentUtils::GetCurrentJSContext().
|
||||
*
|
||||
* Note - This is deprecated. Please use AutoJSAPI instead.
|
||||
*/
|
||||
class MOZ_STACK_CLASS AutoSafeJSContext : public AutoJSContext {
|
||||
public:
|
||||
explicit AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
|
||||
private:
|
||||
JSAutoCompartment mAc;
|
||||
};
|
||||
|
||||
/**
|
||||
* Like AutoSafeJSContext but can be used safely on worker threads.
|
||||
*/
|
||||
class MOZ_STACK_CLASS ThreadsafeAutoSafeJSContext {
|
||||
public:
|
||||
explicit ThreadsafeAutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
|
||||
operator JSContext*() const;
|
||||
|
||||
private:
|
||||
JSContext* mCx; // Used on workers. Null means mainthread.
|
||||
Maybe<JSAutoRequest> mRequest; // Used on workers.
|
||||
Maybe<AutoSafeJSContext> mAutoSafeJSContext; // Used on main thread.
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_ScriptSettings_h
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsContentPermissionHelper.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIDOMGlobalPropertyInitializer.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
@ -119,6 +119,7 @@
|
||||
#include "nsGlobalWindowCommands.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIDOMFileList.h"
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "nsITimer.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCycleCollector.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "xpcprivate.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
@ -11831,6 +11831,7 @@ class CGBindingRoot(CGThing):
|
||||
bindingHeaders["nsThreadUtils.h"] = hasWorkerStuff
|
||||
|
||||
dictionaries = config.getDictionaries(webIDLFile=webIDLFile)
|
||||
bindingHeaders["nsCxPusher.h"] = dictionaries
|
||||
hasNonEmptyDictionaries = any(
|
||||
len(dict.members) > 0 for dict in dictionaries)
|
||||
mainCallbacks = config.getCallbacks(webIDLFile=webIDLFile,
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "base/basictypes.h"
|
||||
#include "BluetoothReplyRunnable.h"
|
||||
#include "DOMRequest.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/ipc/UnixSocket.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISettingsService.h"
|
||||
#include "nsISystemMessagesInternal.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsISystemMessagesInternal.h"
|
||||
#include "nsString.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsISystemMessagesInternal.h"
|
||||
#include "nsString.h"
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "base/basictypes.h"
|
||||
#include "BluetoothReplyRunnable.h"
|
||||
#include "DOMRequest.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISettingsService.h"
|
||||
#include "nsISystemMessagesInternal.h"
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include "BluetoothUtils.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsISystemMessagesInternal.h"
|
||||
#include "nsString.h"
|
||||
|
@ -11,9 +11,9 @@
|
||||
#include "BluetoothUtils.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Scoped.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsISystemMessagesInternal.h"
|
||||
#include "nsString.h"
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsVariant.h"
|
||||
#include "mozilla/dom/BrowserElementDictionariesBinding.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "mozilla/dom/CustomEvent.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "GLContext.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIDOMDataContainerEvent.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
@ -23,8 +24,6 @@
|
||||
#include "WebGLTexture.h"
|
||||
#include "WebGLVertexArray.h"
|
||||
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
using namespace gl;
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "DeviceStorageFileDescriptor.h"
|
||||
#include "DeviceStorageRequestChild.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "mozilla/JSEventHandler.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsJSUtils.h"
|
||||
|
@ -12,10 +12,10 @@
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/FMRadioChild.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISettingsService.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#define BAND_87500_108000_kHz 1
|
||||
#define BAND_76000_108000_kHz 2
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsHashKeys.h"
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "mozilla/dom/ProgressEvent.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsString.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "mozilla/dom/ipc/Blob.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#include "AsyncConnectionHelper.h"
|
||||
#include "DatabaseInfo.h"
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsIPropertyBag2.h"
|
||||
#include "ProcessPriorityManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
#include "ipc/Nuwa.h"
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozIApplication.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsEmbedCID.h"
|
||||
#include <algorithm>
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "mozilla/dom/GetUserMediaRequestBinding.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "MediaPermissionGonk.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIContentPermissionPrompt.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMNavigatorUserMedia.h"
|
||||
|
@ -6,9 +6,8 @@
|
||||
|
||||
#include "MobileConnectionInfo.h"
|
||||
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#define CONVERT_STRING_TO_NULLABLE_ENUM(_string, _enumType, _enum) \
|
||||
{ \
|
||||
|
@ -14,9 +14,9 @@
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/mobilemessage/Constants.h" // For MessageType
|
||||
#include "mozilla/dom/mobilemessage/SmsTypes.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
using namespace mozilla::dom::mobilemessage;
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "MobileMessageCallback.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIDOMMozSmsMessage.h"
|
||||
#include "nsIDOMMozMmsMessage.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "SmsMessage.h"
|
||||
#include "SmsFilter.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "mozilla/dom/MozMobileMessageManagerBinding.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "mozilla/dom/mobilemessage/Constants.h" // For MessageType
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsTArrayHelpers.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "DeletedMessageInfo.h"
|
||||
|
@ -7,12 +7,12 @@
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsIDOMTCPSocket.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/AppProcessChecker.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#include "mozilla/net/PNeckoParent.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/dom/RootedDictionary.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "NfcOptions.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIJSRuntimeService.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsWildCard.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
#include "nsIXPConnect.h"
|
||||
|
@ -10,7 +10,8 @@
|
||||
#include "npfunctions.h"
|
||||
#include "nsPluginHost.h"
|
||||
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#include "mozilla/PluginLibrary.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsNPAPIPlugin.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "PluginScriptableObjectUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
using namespace mozilla::plugins::parent;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/plugins/PluginIdentifierParent.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsNPAPIPlugin.h"
|
||||
#include "PluginScriptableObjectUtils.h"
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIScriptChannel.h"
|
||||
|
@ -30,13 +30,13 @@
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "base/message_loop.h"
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
#include "BluetoothHfpManagerBase.h"
|
||||
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsISettingsService.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
@ -18,7 +19,6 @@
|
||||
#include "nsString.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#undef LOG
|
||||
|
@ -7,9 +7,9 @@
|
||||
#include <nsThreadUtils.h>
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#define NS_NETWORKWORKER_CID \
|
||||
{ 0x6df093e1, 0x8127, 0x4fa7, {0x90, 0x13, 0xa3, 0xaa, 0xa7, 0x79, 0xbb, 0xdd} }
|
||||
|
@ -27,12 +27,12 @@
|
||||
#include "AutoMounter.h"
|
||||
#include "TimeZoneSettingObserver.h"
|
||||
#include "AudioManager.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "mozilla/ipc/Ril.h"
|
||||
#endif
|
||||
#include "mozilla/ipc/KeyStore.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsRadioInterfaceLayer.h"
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include "base/message_loop.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/Hal.h"
|
||||
@ -21,6 +20,7 @@
|
||||
#include "TimeZoneSettingObserver.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
#undef LOG
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -6,10 +6,10 @@
|
||||
#include "DateCacheCleaner.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
using namespace mozilla::hal;
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "cert.h"
|
||||
#include "certdb.h"
|
||||
#include "CryptoTask.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIWifiService.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "WifiUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
#include "GeckoTaskTracer.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "mozilla/dom/WifiOptionsBinding.h"
|
||||
#include "mozilla/dom/network/NetUtils.h"
|
||||
#include "WifiHotspotUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
// Needed to add a copy constructor to WifiCommandOptions.
|
||||
struct CommandOptions
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsTArray.h"
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsError.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsHostObjectProtocolHandler.h"
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "mozilla/dom/ProgressEvent.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsJSPrincipals.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "xpcpublic.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "nsXBLProtoImplMethod.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "xpcpublic.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsIContent.h"
|
||||
#include "nsXBLProtoImplProperty.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsXBLPrototypeHandler.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsJSPrincipals.h"
|
||||
#include "jswrapper.h"
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIXPCScriptable.h"
|
||||
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsJSPrincipals.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "xpcprivate.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "AccessCheck.h"
|
||||
|
||||
using namespace JS;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "xpcprivate.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
using namespace JS;
|
||||
using namespace mozilla;
|
||||
|
@ -7,7 +7,6 @@
|
||||
#ifndef mozJSComponentLoader_h
|
||||
#define mozJSComponentLoader_h
|
||||
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/ModuleLoader.h"
|
||||
#include "nsISupports.h"
|
||||
@ -15,6 +14,7 @@
|
||||
#include "nsIURI.h"
|
||||
#include "xpcIJSModuleLoader.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "js/OldDebugAPI.h"
|
||||
#include "js/StructuredClone.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
#include "nsCycleCollectionNoteRootCallback.h"
|
||||
#include "nsScriptLoader.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mozilla/Range.h"
|
||||
|
||||
#include "xpcprivate.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
#include "jsprf.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "xpcprivate.h"
|
||||
#include "jsprf.h"
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "JavaScriptParent.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "XrayWrapper.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mozilla/Likely.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "xpcprivate.h"
|
||||
#include "jswrapper.h"
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/XPTInterfaceInfoManager.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
/* Shared proto object for XPCWrappedNative. */
|
||||
|
||||
#include "xpcprivate.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "pratom.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
EXPORTS += [
|
||||
'BackstagePass.h',
|
||||
'nsCxPusher.h',
|
||||
'qsObjectHelper.h',
|
||||
'XPCJSMemoryReporter.h',
|
||||
'xpcObjectHelper.h',
|
||||
@ -14,6 +15,7 @@ EXPORTS += [
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'ExportHelpers.cpp',
|
||||
'nsCxPusher.cpp',
|
||||
'nsScriptError.cpp',
|
||||
'nsXPConnect.cpp',
|
||||
'Sandbox.cpp',
|
||||
|
165
js/xpconnect/src/nsCxPusher.cpp
Normal file
165
js/xpconnect/src/nsCxPusher.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsCxPusher.h"
|
||||
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "xpcprivate.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
using mozilla::DebugOnly;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
AutoCxPusher::AutoCxPusher(JSContext* cx, bool allowNull)
|
||||
{
|
||||
MOZ_ASSERT_IF(!allowNull, cx);
|
||||
|
||||
// Hold a strong ref to the nsIScriptContext, if any. This ensures that we
|
||||
// only destroy the mContext of an nsJSContext when it is not on the cx stack
|
||||
// (and therefore not in use). See nsJSContext::DestroyJSContext().
|
||||
if (cx)
|
||||
mScx = GetScriptContextFromJSContext(cx);
|
||||
|
||||
XPCJSContextStack *stack = XPCJSRuntime::Get()->GetJSContextStack();
|
||||
if (!stack->Push(cx)) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
mStackDepthAfterPush = stack->Count();
|
||||
|
||||
#ifdef DEBUG
|
||||
mPushedContext = cx;
|
||||
mCompartmentDepthOnEntry = cx ? js::GetEnterCompartmentDepth(cx) : 0;
|
||||
#endif
|
||||
|
||||
// Enter a request and a compartment for the duration that the cx is on the
|
||||
// stack if non-null.
|
||||
if (cx) {
|
||||
mAutoRequest.emplace(cx);
|
||||
|
||||
// DOM JSContexts don't store their default compartment object on the cx.
|
||||
JSObject *compartmentObject = mScx ? mScx->GetWindowProxy()
|
||||
: js::DefaultObjectForContextOrNull(cx);
|
||||
if (compartmentObject)
|
||||
mAutoCompartment.emplace(cx, compartmentObject);
|
||||
}
|
||||
}
|
||||
|
||||
AutoCxPusher::~AutoCxPusher()
|
||||
{
|
||||
// Leave the compartment and request before popping.
|
||||
mAutoCompartment.reset();
|
||||
mAutoRequest.reset();
|
||||
|
||||
// When we push a context, we may save the frame chain and pretend like we
|
||||
// haven't entered any compartment. This gets restored on Pop(), but we can
|
||||
// run into trouble if a Push/Pop are interleaved with a
|
||||
// JSAutoEnterCompartment. Make sure the compartment depth right before we
|
||||
// pop is the same as it was right after we pushed.
|
||||
MOZ_ASSERT_IF(mPushedContext, mCompartmentDepthOnEntry ==
|
||||
js::GetEnterCompartmentDepth(mPushedContext));
|
||||
DebugOnly<JSContext*> stackTop;
|
||||
MOZ_ASSERT(mPushedContext == nsXPConnect::XPConnect()->GetCurrentJSContext());
|
||||
XPCJSRuntime::Get()->GetJSContextStack()->Pop();
|
||||
mScx = nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
AutoCxPusher::IsStackTop() const
|
||||
{
|
||||
uint32_t currentDepth = XPCJSRuntime::Get()->GetJSContextStack()->Count();
|
||||
MOZ_ASSERT(currentDepth >= mStackDepthAfterPush);
|
||||
return currentDepth == mStackDepthAfterPush;
|
||||
}
|
||||
|
||||
AutoJSContext::AutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
|
||||
: mCx(nullptr)
|
||||
{
|
||||
Init(false MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT);
|
||||
}
|
||||
|
||||
AutoJSContext::AutoJSContext(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
|
||||
: mCx(nullptr)
|
||||
{
|
||||
Init(aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT);
|
||||
}
|
||||
|
||||
void
|
||||
AutoJSContext::Init(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
|
||||
{
|
||||
JS::AutoSuppressGCAnalysis nogc;
|
||||
MOZ_ASSERT(!mCx, "mCx should not be initialized!");
|
||||
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
|
||||
nsXPConnect *xpc = nsXPConnect::XPConnect();
|
||||
if (!aSafe) {
|
||||
mCx = xpc->GetCurrentJSContext();
|
||||
}
|
||||
|
||||
if (!mCx) {
|
||||
mCx = xpc->GetSafeJSContext();
|
||||
mPusher.emplace(mCx);
|
||||
}
|
||||
}
|
||||
|
||||
AutoJSContext::operator JSContext*() const
|
||||
{
|
||||
return mCx;
|
||||
}
|
||||
|
||||
ThreadsafeAutoJSContext::ThreadsafeAutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
mCx = nullptr;
|
||||
mAutoJSContext.emplace();
|
||||
} else {
|
||||
mCx = mozilla::dom::workers::GetCurrentThreadJSContext();
|
||||
mRequest.emplace(mCx);
|
||||
}
|
||||
}
|
||||
|
||||
ThreadsafeAutoJSContext::operator JSContext*() const
|
||||
{
|
||||
if (mCx) {
|
||||
return mCx;
|
||||
} else {
|
||||
return *mAutoJSContext;
|
||||
}
|
||||
}
|
||||
|
||||
AutoSafeJSContext::AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
|
||||
: AutoJSContext(true MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
|
||||
, mAc(mCx, XPCJSRuntime::Get()->GetJSContextStack()->GetSafeJSContextGlobal())
|
||||
{
|
||||
}
|
||||
|
||||
ThreadsafeAutoSafeJSContext::ThreadsafeAutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
mCx = nullptr;
|
||||
mAutoSafeJSContext.emplace();
|
||||
} else {
|
||||
mCx = mozilla::dom::workers::GetCurrentThreadJSContext();
|
||||
mRequest.emplace(mCx);
|
||||
}
|
||||
}
|
||||
|
||||
ThreadsafeAutoSafeJSContext::operator JSContext*() const
|
||||
{
|
||||
if (mCx) {
|
||||
return mCx;
|
||||
} else {
|
||||
return *mAutoSafeJSContext;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
112
js/xpconnect/src/nsCxPusher.h
Normal file
112
js/xpconnect/src/nsCxPusher.h
Normal file
@ -0,0 +1,112 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef nsCxPusher_h
|
||||
#define nsCxPusher_h
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsIScriptContext;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* Fundamental cx pushing class. All other cx pushing classes are implemented
|
||||
* in terms of this class.
|
||||
*/
|
||||
class MOZ_STACK_CLASS AutoCxPusher
|
||||
{
|
||||
public:
|
||||
explicit AutoCxPusher(JSContext *aCx, bool aAllowNull = false);
|
||||
~AutoCxPusher();
|
||||
|
||||
nsIScriptContext* GetScriptContext() { return mScx; }
|
||||
|
||||
// Returns true if this AutoCxPusher performed the push that is currently at
|
||||
// the top of the cx stack.
|
||||
bool IsStackTop() const;
|
||||
|
||||
private:
|
||||
mozilla::Maybe<JSAutoRequest> mAutoRequest;
|
||||
mozilla::Maybe<JSAutoCompartment> mAutoCompartment;
|
||||
nsCOMPtr<nsIScriptContext> mScx;
|
||||
uint32_t mStackDepthAfterPush;
|
||||
#ifdef DEBUG
|
||||
JSContext* mPushedContext;
|
||||
unsigned mCompartmentDepthOnEntry;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* Use AutoJSContext when you need a JS context on the stack but don't have one
|
||||
* passed as a parameter. AutoJSContext will take care of finding the most
|
||||
* appropriate JS context and release it when leaving the stack.
|
||||
*/
|
||||
class MOZ_STACK_CLASS AutoJSContext {
|
||||
public:
|
||||
explicit AutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
|
||||
operator JSContext*() const;
|
||||
|
||||
protected:
|
||||
explicit AutoJSContext(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
|
||||
|
||||
// We need this Init() method because we can't use delegating constructor for
|
||||
// the moment. It is a C++11 feature and we do not require C++11 to be
|
||||
// supported to be able to compile Gecko.
|
||||
void Init(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
|
||||
|
||||
JSContext* mCx;
|
||||
Maybe<AutoCxPusher> mPusher;
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
/**
|
||||
* Use ThreadsafeAutoJSContext when you want an AutoJSContext but might be
|
||||
* running on a worker thread.
|
||||
*/
|
||||
class MOZ_STACK_CLASS ThreadsafeAutoJSContext {
|
||||
public:
|
||||
explicit ThreadsafeAutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
|
||||
operator JSContext*() const;
|
||||
|
||||
private:
|
||||
JSContext* mCx; // Used on workers. Null means mainthread.
|
||||
Maybe<JSAutoRequest> mRequest; // Used on workers.
|
||||
Maybe<AutoJSContext> mAutoJSContext; // Used on main thread.
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
/**
|
||||
* AutoSafeJSContext is similar to AutoJSContext but will only return the safe
|
||||
* JS context. That means it will never call ::GetCurrentJSContext().
|
||||
*/
|
||||
class MOZ_STACK_CLASS AutoSafeJSContext : public AutoJSContext {
|
||||
public:
|
||||
explicit AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
|
||||
private:
|
||||
JSAutoCompartment mAc;
|
||||
};
|
||||
|
||||
/**
|
||||
* Like AutoSafeJSContext but can be used safely on worker threads.
|
||||
*/
|
||||
class MOZ_STACK_CLASS ThreadsafeAutoSafeJSContext {
|
||||
public:
|
||||
explicit ThreadsafeAutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
|
||||
operator JSContext*() const;
|
||||
|
||||
private:
|
||||
JSContext* mCx; // Used on workers. Null means mainthread.
|
||||
Maybe<JSAutoRequest> mRequest; // Used on workers.
|
||||
Maybe<AutoSafeJSContext> mAutoSafeJSContext; // Used on main thread.
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* nsCxPusher_h */
|
@ -85,8 +85,6 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@ -159,6 +157,7 @@
|
||||
|
||||
#include "SandboxPrivate.h"
|
||||
#include "BackstagePass.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsAXPCNativeCallContext.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
@ -2834,14 +2833,6 @@ void PopJSContextNoScriptContext();
|
||||
|
||||
} /* namespace xpc */
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace danger {
|
||||
class AutoCxPusher;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class XPCJSContextStack
|
||||
{
|
||||
public:
|
||||
@ -2872,7 +2863,7 @@ public:
|
||||
{ return &mStack; }
|
||||
|
||||
private:
|
||||
friend class mozilla::dom::danger::AutoCxPusher;
|
||||
friend class mozilla::AutoCxPusher;
|
||||
friend bool xpc::PushJSContextNoScriptContext(JSContext *aCx);;
|
||||
friend void xpc::PopJSContextNoScriptContext();
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/net/Dashboard.h"
|
||||
#include "mozilla/net/HttpInfo.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsHttp.h"
|
||||
#include "nsICancelable.h"
|
||||
#include "nsIDNSService.h"
|
||||
|
@ -10,10 +10,9 @@
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsILoadInfo.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
/**
|
||||
* This dummy channel implementation only provides enough functionality
|
||||
* to return a fake 404 error when the caller asks for an app:// URL
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsIURI.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "jsapi.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsLiteralString.h"
|
||||
#include "nsThreadUtils.h"
|
||||
@ -18,7 +19,6 @@
|
||||
#include "nsIChromeRegistry.h"
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/AddonPathService.h"
|
||||
#include "mozilla/Omnijar.h"
|
||||
|
||||
|
@ -6,10 +6,10 @@
|
||||
/* Implementation of xptiInterfaceEntry and xptiInterfaceInfo. */
|
||||
|
||||
#include "xptiprivate.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/XPTInterfaceInfoManager.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
#include "nsCxPusher.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
Loading…
Reference in New Issue
Block a user