Bug 1478955 part 1 - Rename JSAutoRealm to JSAutoRealmAllowCCW. r=luke

This commit is contained in:
Jan de Mooij 2018-07-28 12:12:26 +02:00
Родитель f4733cbe3d
Коммит 80adc67aba
127 изменённых файлов: 345 добавлений и 345 удалений

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

@ -94,7 +94,7 @@ struct DevTools : public ::testing::Test {
if (!newGlobal)
return nullptr;
JSAutoRealm ar(cx, newGlobal);
JSAutoRealmAllowCCW ar(cx, newGlobal);
/* Populate the global object with the standard globals, like Object and
Array. */

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

@ -18,7 +18,7 @@ DEF_TEST(DoesCrossCompartmentBoundaries, {
ASSERT_TRUE(newGlobal);
JS::Compartment* newCompartment = nullptr;
{
JSAutoRealm ar(cx, newGlobal);
JSAutoRealmAllowCCW ar(cx, newGlobal);
ASSERT_TRUE(JS::InitRealmStandardClasses(cx));
newCompartment = js::GetContextCompartment(cx);
}

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

@ -18,7 +18,7 @@ DEF_TEST(DoesntCrossCompartmentBoundaries, {
ASSERT_TRUE(newGlobal);
JS::Compartment* newCompartment = nullptr;
{
JSAutoRealm ar(cx, newGlobal);
JSAutoRealmAllowCCW ar(cx, newGlobal);
ASSERT_TRUE(JS::InitRealmStandardClasses(cx));
newCompartment = js::GetContextCompartment(cx);
}

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

@ -217,7 +217,7 @@ ChromeUtils::ShallowClone(GlobalObject& aGlobal,
return;
}
JSAutoRealm ar(cx, obj);
JSAutoRealmAllowCCW ar(cx, obj);
if (!JS_Enumerate(cx, obj, &ids) ||
!values.reserve(ids.length())) {
@ -240,7 +240,7 @@ ChromeUtils::ShallowClone(GlobalObject& aGlobal,
JS::RootedObject obj(cx);
{
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
if (aTarget) {
JS::RootedObject target(cx, js::CheckedUnwrap(aTarget));
if (!target) {
@ -483,7 +483,7 @@ namespace module_getter {
JS::RootedValue value(aCx);
{
JSAutoRealm ar(aCx, moduleExports);
JSAutoRealmAllowCCW ar(aCx, moduleExports);
if (!JS_GetPropertyById(aCx, moduleExports, id, &value)) {
return false;
@ -726,7 +726,7 @@ ChromeUtils::CreateError(const GlobalObject& aGlobal, const nsAString& aMessage,
uint32_t line = 0;
uint32_t column = 0;
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
JS::RootedObject stack(cx);
if (aStack) {
stack = UncheckedUnwrap(aStack);

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

@ -3747,7 +3747,7 @@ Element::Animate(const Nullable<ElementOrCSSPseudoElement>& aTarget,
// Animation constructor follows the standard Xray calling convention and
// needs to be called in the target element's realm.
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
if (js::GetContextCompartment(aContext) !=
js::GetObjectCompartment(ownerGlobal->GetGlobalJSObject())) {
ar.emplace(aContext, ownerGlobal->GetGlobalJSObject());

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

@ -88,7 +88,7 @@ IntlUtils::GetDisplayNames(const Sequence<nsString>& aLocales,
}
// Return the result as DisplayNameResult.
JSAutoRealm ar(cx, &retVal.toObject());
JSAutoRealmAllowCCW ar(cx, &retVal.toObject());
if (!aResult.Init(cx, retVal)) {
aError.Throw(NS_ERROR_FAILURE);
}
@ -135,7 +135,7 @@ IntlUtils::GetLocaleInfo(const Sequence<nsString>& aLocales,
}
// Return the result as LocaleInfo.
JSAutoRealm ar(cx, &retVal.toObject());
JSAutoRealmAllowCCW ar(cx, &retVal.toObject());
if (!aResult.Init(cx, retVal)) {
aError.Throw(NS_ERROR_FAILURE);
}

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

@ -77,7 +77,7 @@ PostMessageEvent::Run()
targetWindow->IsDying())
return NS_OK;
JSAutoRealm ar(cx, targetWindow->GetWrapper());
JSAutoRealmAllowCCW ar(cx, targetWindow->GetWrapper());
// Ensure that any origin which might have been provided is the origin of this
// window's document. Note that we do this *now* instead of when postMessage

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

@ -38,7 +38,7 @@ StructuredCloneBlob::Constructor(GlobalObject& aGlobal, JS::HandleValue aValue,
RefPtr<StructuredCloneBlob> holder = StructuredCloneBlob::Create();
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
JS::RootedValue value(cx, aValue);
if (aTargetGlobal) {
@ -87,7 +87,7 @@ StructuredCloneBlob::Deserialize(JSContext* aCx, JS::HandleObject aTargetScope,
}
{
JSAutoRealm ar(aCx, scope);
JSAutoRealmAllowCCW ar(aCx, scope);
Read(xpc::NativeGlobal(scope), aCx, aResult, aRv);
if (aRv.Failed()) {

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

@ -713,7 +713,7 @@ nsContentPermissionRequestProxy::Allow(JS::HandleValue aChoices)
JSContext* cx = jsapi.cx();
JS::Rooted<JSObject*> obj(cx, &aChoices.toObject());
JSAutoRealm ar(cx, obj);
JSAutoRealmAllowCCW ar(cx, obj);
JS::Rooted<JS::Value> val(cx);

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

@ -7028,7 +7028,7 @@ nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
// We can use the junk scope here, because we're just using it for
// regexp evaluation, not actual script execution.
JSAutoRealm ar(cx, xpc::UnprivilegedJunkScope());
JSAutoRealmAllowCCW ar(cx, xpc::UnprivilegedJunkScope());
// The pattern has to match the entire value.
aPattern.InsertLiteral(u"^(?:", 0);

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

@ -6970,7 +6970,7 @@ nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
// It's kind of irrelevant, given that we're passing aAllowWrapping =
// false, and documents should always insist on being wrapped in an
// canonical scope. But we try to pass something sane anyway.
JSAutoRealm ar(cx, GetScopeObject()->GetGlobalJSObject());
JSAutoRealmAllowCCW ar(cx, GetScopeObject()->GetGlobalJSObject());
JS::Rooted<JS::Value> v(cx);
rv = nsContentUtils::WrapNative(cx, this, this, &v,
/* aAllowWrapping = */ false);
@ -9615,7 +9615,7 @@ nsIDocument::GetStateObject(nsIVariant** aState)
NS_ENSURE_TRUE(sgo, NS_ERROR_UNEXPECTED);
JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject());
NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED);
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
mStateObjectContainer->
DeserializeToVariant(cx, getter_AddRefs(mStateObjectCached));

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

@ -1895,7 +1895,7 @@ nsFrameLoader::SetOwnerContent(Element* aContent)
JS::RootedObject wrapper(jsapi.cx(), GetWrapper());
if (wrapper) {
JSAutoRealm ar(jsapi.cx(), wrapper);
JSAutoRealmAllowCCW ar(jsapi.cx(), wrapper);
IgnoredErrorResult rv;
ReparentWrapper(jsapi.cx(), wrapper, rv);
Unused << NS_WARN_IF(rv.Failed());

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

@ -755,7 +755,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
// enter the (maybe wrapper) object's realm. We will have to revisit this
// later because CCWs are not associated with a single realm so this
// doesn't make much sense. See bug 1477923.
JSAutoRealm ar(cx, object);
JSAutoRealmAllowCCW ar(cx, object);
RootedDictionary<ReceiveMessageArgument> argument(cx);
@ -1001,7 +1001,7 @@ nsFrameMessageManager::GetInitialProcessData(JSContext* aCx,
// We create the initial object in the junk scope. If we created it in a
// normal realm, that realm would leak until shutdown.
JS::RootedObject global(aCx, xpc::PrivilegedJunkScope());
JSAutoRealm ar(aCx, global);
JSAutoRealmAllowCCW ar(aCx, global);
JS::RootedObject obj(aCx, JS_NewPlainObject(aCx));
if (!obj) {

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

@ -4163,7 +4163,7 @@ nsGlobalWindowInner::CallerInnerWindow()
// sandboxPrototype. This used to work incidentally for unrelated reasons, but
// now we need to do some special handling to support it.
if (xpc::IsSandbox(scope)) {
JSAutoRealm ar(cx, scope);
JSAutoRealmAllowCCW ar(cx, scope);
JS::Rooted<JSObject*> scopeProto(cx);
bool ok = JS_GetPrototype(cx, scope, &scopeProto);
NS_ENSURE_TRUE(ok, nullptr);

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

@ -796,7 +796,7 @@ NewOuterWindowProxy(JSContext *cx, JS::Handle<JSObject*> global, bool isChrome)
{
MOZ_ASSERT(JS_IsGlobalObject(global));
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
js::WrapperOptions options;
options.setClass(&OuterWindowProxyClass);
@ -1531,7 +1531,7 @@ static const JSFunctionSpec EnablePrivilegeSpec[] = {
static bool
InitializeLegacyNetscapeObject(JSContext* aCx, JS::Handle<JSObject*> aGlobal)
{
JSAutoRealm ar(aCx, aGlobal);
JSAutoRealmAllowCCW ar(aCx, aGlobal);
// Note: MathJax depends on window.netscape being exposed. See bug 791526.
JS::Rooted<JSObject*> obj(aCx);
@ -1868,7 +1868,7 @@ nsGlobalWindowOuter::SetNewDocument(nsIDocument* aDocument,
}
// Enter the new global's realm.
JSAutoRealm ar(cx, GetWrapperPreserveColor());
JSAutoRealmAllowCCW ar(cx, GetWrapperPreserveColor());
{
JS::Rooted<JSObject*> outer(cx, GetWrapperPreserveColor());
@ -1900,7 +1900,7 @@ nsGlobalWindowOuter::SetNewDocument(nsIDocument* aDocument,
}
}
JSAutoRealm ar(cx, GetWrapperPreserveColor());
JSAutoRealmAllowCCW ar(cx, GetWrapperPreserveColor());
if (!aState && !reUseInnerWindow) {
// Loading a new page and creating a new inner window, *not*
@ -3797,7 +3797,7 @@ nsGlobalWindowOuter::DispatchResizeEvent(const CSSIntSize& aSize)
AutoJSAPI jsapi;
jsapi.Init();
JSContext* cx = jsapi.cx();
JSAutoRealm ar(cx, GetWrapperPreserveColor());
JSAutoRealmAllowCCW ar(cx, GetWrapperPreserveColor());
DOMWindowResizeEventDetail detail;
detail.mWidth = aSize.width;
@ -5664,7 +5664,7 @@ nsGlobalWindowOuter::CallerInnerWindow()
// sandboxPrototype. This used to work incidentally for unrelated reasons, but
// now we need to do some special handling to support it.
if (xpc::IsSandbox(scope)) {
JSAutoRealm ar(cx, scope);
JSAutoRealmAllowCCW ar(cx, scope);
JS::Rooted<JSObject*> scopeProto(cx);
bool ok = JS_GetPrototype(cx, scope, &scopeProto);
NS_ENSURE_TRUE(ok, nullptr);
@ -7215,7 +7215,7 @@ nsGlobalWindowOuter::SecurityCheckURL(const char *aURL, nsIURI** aURI)
}
AutoJSContext cx;
nsGlobalWindowInner* sourceWin = nsGlobalWindowInner::Cast(sourceWindow);
JSAutoRealm ar(cx, sourceWin->GetGlobalJSObject());
JSAutoRealmAllowCCW ar(cx, sourceWin->GetGlobalJSObject());
// Resolve the baseURI, which could be relative to the calling window.
//

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

@ -1296,7 +1296,7 @@ CheckForOutdatedParent(nsINode* aParent, nsINode* aNode, ErrorResult& aError)
if (JS::GetNonCCWObjectGlobal(existingObj) !=
global->GetGlobalJSObject()) {
JSAutoRealm ar(cx, existingObj);
JSAutoRealmAllowCCW ar(cx, existingObj);
ReparentWrapper(cx, existingObj, aError);
}
}
@ -1316,7 +1316,7 @@ ReparentWrappersInSubtree(nsIContent* aRoot)
JS::Rooted<JSObject*> reflector(cx);
for (nsIContent* cur = aRoot; cur; cur = cur->GetNextNode(aRoot)) {
if ((reflector = cur->GetWrapper())) {
JSAutoRealm ar(cx, reflector);
JSAutoRealmAllowCCW ar(cx, reflector);
ReparentWrapper(cx, reflector, rv);
rv.WouldReportJSException();
if (rv.Failed()) {

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

@ -813,7 +813,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports* aArgs,
NS_ASSERTION(prim == nullptr,
"Don't pass nsISupportsPrimitives - use nsIVariant!");
#endif
JSAutoRealm ar(cx, aScope);
JSAutoRealmAllowCCW ar(cx, aScope);
rv = nsContentUtils::WrapNative(cx, arg, thisVal);
}
}
@ -1004,7 +1004,7 @@ nsJSContext::AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv)
JS::Rooted<JSObject*> scope(cx, GetWindowProxy());
JS::Rooted<JS::Value> v(cx);
JSAutoRealm ar(cx, scope);
JSAutoRealmAllowCCW ar(cx, scope);
nsresult rv = nsContentUtils::WrapNative(cx, data, iid, &v);
NS_ENSURE_SUCCESS(rv, rv);
@ -1139,7 +1139,7 @@ nsJSContext::InitClasses(JS::Handle<JSObject*> aGlobalObj)
AutoJSAPI jsapi;
jsapi.Init();
JSContext* cx = jsapi.cx();
JSAutoRealm ar(cx, aGlobalObj);
JSAutoRealmAllowCCW ar(cx, aGlobalObj);
// Attempt to initialize profiling functions
::JS_DefineProfilingFunctions(cx, aGlobalObj);

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

@ -74,7 +74,7 @@ public:
JSContext* mCx;
// Handles switching to our global's realm.
JSAutoRealm mRealm;
JSAutoRealmAllowCCW mRealm;
// Set to a valid handle if a return value is expected.
JS::Rooted<JS::Value> mRetValue;

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

@ -562,7 +562,7 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
JS::Rooted<JSObject*> wrapper(cx);
if ((wrapper = aNode->GetWrapper())) {
MOZ_ASSERT(IsDOMObject(wrapper));
JSAutoRealm ar(cx, wrapper);
JSAutoRealmAllowCCW ar(cx, wrapper);
ReparentWrapper(cx, wrapper, aError);
if (aError.Failed()) {
if (wasRegistered) {

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

@ -3569,7 +3569,7 @@ nsObjectLoadingContent::SetupProtoChain(JSContext* aCx,
// so make sure to enter the realm of aObject.
MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
JSAutoRealm ar(aCx, aObject);
JSAutoRealmAllowCCW ar(aCx, aObject);
RefPtr<nsNPAPIPluginInstance> pi;
nsresult rv = ScriptRequestPluginInstance(aCx, getter_AddRefs(pi));
@ -3702,7 +3702,7 @@ nsObjectLoadingContent::TeardownProtoChain()
MOZ_ASSERT(obj);
JS::Rooted<JSObject*> proto(cx);
JSAutoRealm ar(cx, obj);
JSAutoRealmAllowCCW ar(cx, obj);
// Loop over the DOM element's JS object prototype chain and remove
// all JS objects of the class sNPObjectJSWrapperClass

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

@ -1652,7 +1652,7 @@ ResolvePrototypeOrConstructor(JSContext* cx, JS::Handle<JSObject*> wrapper,
{
JS::Rooted<JSObject*> global(cx, JS::GetNonCCWObjectGlobal(obj));
{
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
ProtoAndIfaceCache& protoAndIfaceCache = *GetProtoAndIfaceCache(global);
// This function is called when resolving the "constructor" and "prototype"
// properties of Xrays for DOM prototypes and constructors respectively.
@ -2297,7 +2297,7 @@ ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObjArg, ErrorResult& aErr
domClass->mGetAssociatedGlobal(aCx, aObj));
MOZ_ASSERT(JS_IsGlobalObject(newParent));
JSAutoRealm oldAr(aCx, oldParent);
JSAutoRealmAllowCCW oldAr(aCx, oldParent);
JS::Compartment* oldCompartment = js::GetObjectCompartment(oldParent);
JS::Compartment* newCompartment = js::GetObjectCompartment(newParent);
@ -2317,7 +2317,7 @@ ReparentWrapper(JSContext* aCx, JS::Handle<JSObject*> aObjArg, ErrorResult& aErr
expandoObject = DOMProxyHandler::GetAndClearExpandoObject(aObj);
}
JSAutoRealm newAr(aCx, newParent);
JSAutoRealmAllowCCW newAr(aCx, newParent);
// First we clone the reflector. We get a copy of its properties and clone its
// expando chain.
@ -3564,7 +3564,7 @@ GetMaplikeSetlikeBackingObject(JSContext* aCx, JS::Handle<JSObject*> aObj,
// Since backing object access can happen in non-originating realms,
// make sure to create the backing object in reflector realm.
{
JSAutoRealm ar(aCx, reflector);
JSAutoRealmAllowCCW ar(aCx, reflector);
JS::Rooted<JSObject*> newBackingObj(aCx);
newBackingObj.set(Method(aCx));
if (NS_WARN_IF(!newBackingObj)) {
@ -3787,7 +3787,7 @@ HTMLConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp,
// objects as constructors? Of course it's not clear that the spec check
// makes sense to start with: https://github.com/whatwg/html/issues/3575
{
JSAutoRealm ar(aCx, newTarget);
JSAutoRealmAllowCCW ar(aCx, newTarget);
JS::Handle<JSObject*> constructor =
GetPerInterfaceObjectHandle(aCx, aConstructorId, aCreator,
true);
@ -3822,7 +3822,7 @@ HTMLConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp,
// function should be HTMLElement or XULElement. We want to get the actual
// functions to compare to from our global's realm, not the caller
// realm.
JSAutoRealm ar(aCx, global.Get());
JSAutoRealmAllowCCW ar(aCx, global.Get());
JS::Rooted<JSObject*> constructor(aCx);
if (ns == kNameSpaceID_XUL) {
@ -3877,7 +3877,7 @@ HTMLConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp,
// We want to get the constructor from our global's realm, not the
// caller realm.
JSAutoRealm ar(aCx, global.Get());
JSAutoRealmAllowCCW ar(aCx, global.Get());
JS::Rooted<JSObject*> constructor(aCx, cb(aCx));
if (!constructor) {
return false;
@ -3904,7 +3904,7 @@ HTMLConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp,
// whose target is not same-realm with the proxy, or bound functions, etc).
// https://bugzilla.mozilla.org/show_bug.cgi?id=1317658
{
JSAutoRealm ar(aCx, newTarget);
JSAutoRealmAllowCCW ar(aCx, newTarget);
desiredProto = GetPerInterfaceObjectHandle(aCx, aProtoId, aCreator, true);
if (!desiredProto) {
return false;
@ -3929,7 +3929,7 @@ HTMLConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp,
// Now we go to construct an element. We want to do this in global's
// realm, not caller realm (the normal constructor behavior),
// just in case those elements create JS things.
JSAutoRealm ar(aCx, global.Get());
JSAutoRealmAllowCCW ar(aCx, global.Get());
RefPtr<NodeInfo> nodeInfo =
doc->NodeInfoManager()->GetNodeInfo(definition->mLocalName,
@ -3972,7 +3972,7 @@ HTMLConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp,
JS::Rooted<JSObject*> reflector(aCx, element->GetWrapper());
if (reflector) {
// reflector might be in different realm.
JSAutoRealm ar(aCx, reflector);
JSAutoRealmAllowCCW ar(aCx, reflector);
JS::Rooted<JSObject*> givenProto(aCx, desiredProto);
if (!JS_WrapObject(aCx, &givenProto) ||
!JS_SetPrototype(aCx, reflector, givenProto)) {
@ -3987,7 +3987,7 @@ HTMLConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp,
// Tail end of step 8 and step 13: returning the element. We want to do this
// part in the global's realm, though in practice it won't matter much
// because Element always knows which realm it should be created in.
JSAutoRealm ar(aCx, global.Get());
JSAutoRealmAllowCCW ar(aCx, global.Get());
if (!js::IsObjectInContextCompartment(desiredProto, aCx) &&
!JS_WrapObject(aCx, &desiredProto)) {
return false;
@ -4009,7 +4009,7 @@ AssertReflectorHasGivenProto(JSContext* aCx, JSObject* aReflector,
}
JS::Rooted<JSObject*> reflector(aCx, aReflector);
JSAutoRealm ar(aCx, reflector);
JSAutoRealmAllowCCW ar(aCx, reflector);
JS::Rooted<JSObject*> reflectorProto(aCx);
bool ok = JS_GetPrototype(aCx, reflector, &reflectorProto);
MOZ_ASSERT(ok);

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

@ -1117,7 +1117,7 @@ DoGetOrCreateDOMReflector(JSContext* cx, T* value,
if (wrapBehavior == eDontWrapIntoContextCompartment) {
if (TypeNeedsOuterization<T>::value) {
JSAutoRealm ar(cx, obj);
JSAutoRealmAllowCCW ar(cx, obj);
return TryToOuterize(rval);
}
@ -1181,9 +1181,9 @@ WrapNewBindingNonWrapperCachedObject(JSContext* cx,
// We try to wrap in the realm of the underlying object of "scope"
JS::Rooted<JSObject*> obj(cx);
{
// scope for the JSAutoRealm so that we restore the realm
// scope for the JSAutoRealmAllowCCW so that we restore the realm
// before we call JS_WrapValue.
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
// Maybe<Handle> doesn't so much work, and in any case, adding
// more Maybe (one for a Rooted and one for a Handle) adds more
// code (and branches!) than just adding a single rooted.
@ -1234,9 +1234,9 @@ WrapNewBindingNonWrapperCachedObject(JSContext* cx,
// We try to wrap in the realm of the underlying object of "scope"
JS::Rooted<JSObject*> obj(cx);
{
// scope for the JSAutoRealm so that we restore the realm
// scope for the JSAutoRealmAllowCCW so that we restore the realm
// before we call JS_WrapValue.
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
// Maybe<Handle> doesn't so much work, and in any case, adding
// more Maybe (one for a Rooted and one for a Handle) adds more
// code (and branches!) than just adding a single rooted.
@ -2416,7 +2416,7 @@ XrayGetNativeProto(JSContext* cx, JS::Handle<JSObject*> obj,
{
JS::Rooted<JSObject*> global(cx, JS::GetNonCCWObjectGlobal(obj));
{
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
const DOMJSClass* domClass = GetDOMClass(obj);
if (domClass) {
ProtoHandleGetter protoGetter = domClass->mGetProto;
@ -3087,7 +3087,7 @@ CreateGlobal(JSContext* aCx, T* aNative, nsWrapperCache* aCache,
return false;
}
JSAutoRealm ar(aCx, aGlobal);
JSAutoRealmAllowCCW ar(aCx, aGlobal);
{
js::SetReservedSlot(aGlobal, DOM_OBJECT_SLOT, JS::PrivateValue(aNative));
@ -3276,7 +3276,7 @@ WrappedJSToDictionary(JSContext* aCx, nsISupports* aObject, T& aDictionary)
return false;
}
JSAutoRealm ar(aCx, obj);
JSAutoRealmAllowCCW ar(aCx, obj);
JS::Rooted<JS::Value> v(aCx, JS::ObjectValue(*obj));
return aDictionary.Init(aCx, v);
}

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

@ -376,7 +376,7 @@ CallbackObjectHolderBase::ToXPCOMCallback(CallbackObject* aCallback,
return nullptr;
}
JSAutoRealm ar(cx, callback);
JSAutoRealmAllowCCW ar(cx, callback);
RefPtr<nsXPCWrappedJS> wrappedJS;
nsresult rv =
nsXPCWrappedJS::GetNewOrUsed(callback, aIID, getter_AddRefs(wrappedJS));

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

@ -340,7 +340,7 @@ protected:
// Put mAr after mAutoEntryScript so that we exit the realm before we
// pop the script settings stack. Though in practice we'll often manually
// order those two things.
Maybe<JSAutoRealm> mAr;
Maybe<JSAutoRealmAllowCCW> mAr;
// An ErrorResult to possibly re-throw exceptions on and whether
// we should re-throw them.

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

@ -3769,7 +3769,7 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
return true;
}
JSAutoRealm ar(aCx, global);
JSAutoRealmAllowCCW ar(aCx, global);
$*{declareProto}
$*{createObject}
@ -3933,7 +3933,7 @@ class CGWrapGlobalMethod(CGAbstractMethod):
// aReflector is a new global, so has a new realm. Enter it
// before doing anything with it.
JSAutoRealm ar(aCx, aReflector);
JSAutoRealmAllowCCW ar(aCx, aReflector);
if (!DefineProperties(aCx, aReflector, ${properties}, ${chromeProperties})) {
$*{failureCode}
@ -4018,7 +4018,7 @@ class CGClearCachedValueMethod(CGAbstractMethod):
"""
JS::Rooted<JS::Value> temp(aCx);
JSJitGetterCallArgs args(&temp);
JSAutoRealm ar(aCx, obj);
JSAutoRealmAllowCCW ar(aCx, obj);
if (!get_${name}(aCx, obj, aObject, args)) {
js::SetReservedSlot(obj, ${slotIndex}, oldValue);
return false;
@ -5418,7 +5418,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
JS::Rooted<JSObject*> globalObj(cx);
$*{getPromiseGlobal}
JSAutoRealm ar(cx, globalObj);
JSAutoRealmAllowCCW ar(cx, globalObj);
GlobalObject promiseGlobal(cx, globalObj);
if (promiseGlobal.Failed()) {
$*{exceptionCode}
@ -7661,7 +7661,7 @@ class CGPerSignatureCall(CGThing):
# JSAPI types, present. Effectively, we're emulating a
# CrossCompartmentWrapper, but working with the C++ types, not the
# original list of JS::Values.
cgThings.append(CGGeneric("Maybe<JSAutoRealm> ar;\n"))
cgThings.append(CGGeneric("Maybe<JSAutoRealmAllowCCW> ar;\n"))
xraySteps.append(CGGeneric("ar.emplace(cx, obj);\n"))
xraySteps.append(CGGeneric(dedent(
"""
@ -7872,14 +7872,14 @@ class CGPerSignatureCall(CGThing):
"""
{
JS::Rooted<JSObject*> conversionScope(cx, ${conversionScope});
JSAutoRealm ar(cx, conversionScope);
JSAutoRealmAllowCCW ar(cx, conversionScope);
do { // block we break out of when done wrapping
$*{wrapCode}
} while (false);
$*{postConversionSteps}
}
{ // And now store things in the realm of our slotStorage.
JSAutoRealm ar(cx, slotStorage);
JSAutoRealmAllowCCW ar(cx, slotStorage);
$*{slotStorageSteps}
}
// And now make sure args.rval() is in the caller realm.
@ -10866,7 +10866,7 @@ class CGResolveOwnPropertyViaResolve(CGAbstractBindingMethod):
// then use the fact that it created the objects as a flag
// to avoid re-resolving the properties if someone deletes
// them.
JSAutoRealm ar(cx, obj);
JSAutoRealmAllowCCW ar(cx, obj);
JS_MarkCrossZoneId(cx, id);
JS::Rooted<JS::PropertyDescriptor> objDesc(cx);
if (!self->DoResolve(cx, obj, id, &objDesc)) {
@ -11561,7 +11561,7 @@ class CGDeleteNamedProperty(CGAbstractStaticMethod):
MOZ_ASSERT(xpc::WrapperFactory::IsXrayWrapper(xray));
MOZ_ASSERT(js::IsProxy(proxy));
MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy));
JSAutoRealm ar(cx, proxy);
JSAutoRealmAllowCCW ar(cx, proxy);
bool deleteSucceeded = false;
bool found = false;
$*{namedBody}
@ -12756,7 +12756,7 @@ class CGDictionary(CGThing):
// side-effects, followed by a call to JS::ToJSONMaybeSafely,
// which likewise guarantees no side-effects for the sorts of
// things we will pass it.
JSAutoRealm ar(cx, UnprivilegedJunkScopeOrWorkerGlobal());
JSAutoRealmAllowCCW ar(cx, UnprivilegedJunkScopeOrWorkerGlobal());
JS::Rooted<JS::Value> val(cx);
if (!ToObjectInternal(cx, &val)) {
return false;
@ -15276,7 +15276,7 @@ class CGJSImplClass(CGBindingImplClass):
}
// Now define it on our chrome object
JSAutoRealm ar(aCx, mImpl->CallbackOrNull());
JSAutoRealmAllowCCW ar(aCx, mImpl->CallbackOrNull());
if (!JS_WrapObject(aCx, &obj)) {
return nullptr;
}
@ -16654,7 +16654,7 @@ class CGMaplikeOrSetlikeHelperFunctionGenerator(CallbackMember):
// It's safe to use UnprivilegedJunkScopeOrWorkerGlobal here because
// all we want is to wrap into _some_ scope and then unwrap to find
// the reflector, and wrapping has no side-effects.
JSAutoRealm tempRealm(cx, UnprivilegedJunkScopeOrWorkerGlobal());
JSAutoRealmAllowCCW tempRealm(cx, UnprivilegedJunkScopeOrWorkerGlobal());
JS::Rooted<JS::Value> v(cx);
if(!ToJSValue(cx, self, &v)) {
aRv.Throw(NS_ERROR_UNEXPECTED);
@ -16664,7 +16664,7 @@ class CGMaplikeOrSetlikeHelperFunctionGenerator(CallbackMember):
// similarly across method generators, it's called obj here.
JS::Rooted<JSObject*> obj(cx);
obj = js::UncheckedUnwrap(&v.toObject(), /* stopAtWindowProxy = */ false);
JSAutoRealm reflectorRealm(cx, obj);
JSAutoRealmAllowCCW reflectorRealm(cx, obj);
""" % self.getDefaultRetval())
def getArgs(self, returnType, argList):

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

@ -134,7 +134,7 @@ SimpleGlobalObject::Create(GlobalType globalType, JS::Handle<JS::Value> proto)
return nullptr;
}
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
// It's important to create the nsIGlobalObject for our new global before we
// start trying to wrap things like the prototype into its compartment,

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

@ -47,7 +47,7 @@ WriteStructuredCloneImageData(JSContext* aCx, JSStructuredCloneWriter* aWriter,
uint32_t height = aImageData->Height();
JS::Rooted<JSObject*> dataArray(aCx, aImageData->GetDataObject());
JSAutoRealm ar(aCx, dataArray);
JSAutoRealmAllowCCW ar(aCx, dataArray);
JS::Rooted<JS::Value> arrayValue(aCx, JS::ObjectValue(*dataArray));
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_IMAGEDATA, 0) &&
JS_WriteUint32Pair(aWriter, width, height) &&

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

@ -172,7 +172,7 @@ public:
Create(JSContext* cx, nsWrapperCache* creator, uint32_t length,
const T* data = nullptr) {
JS::Rooted<JSObject*> creatorWrapper(cx);
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
if (creator && (creatorWrapper = creator->GetWrapperPreserveColor())) {
ar.emplace(cx, creatorWrapper);
}

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

@ -309,7 +309,7 @@ WebIDLGlobalNameHash::DefineIfEnabled(JSContext* aCx,
if (xpc::WrapperFactory::IsXrayWrapper(aObj)) {
JS::Rooted<JSObject*> constructor(aCx);
{
JSAutoRealm ar(aCx, global);
JSAutoRealmAllowCCW ar(aCx, global);
constructor = FindNamedConstructorForXray(aCx, aId, entry);
}
if (NS_WARN_IF(!constructor)) {

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

@ -146,7 +146,7 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
}
JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject());
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
if (!ToJSValue(cx, detail, &val)) {
MOZ_CRASH("Failed to convert dictionary to JS::Value due to OOM.");
return BrowserElementParent::OPEN_WINDOW_IGNORED;

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

@ -67,7 +67,7 @@ WebGLContext::WebGLObjectAsJSValue(JSContext* cx, const WebGLObjectType* object,
MOZ_ASSERT(this == object->mContext);
JS::Rooted<JS::Value> v(cx);
JS::Rooted<JSObject*> wrapper(cx, GetWrapper());
JSAutoRealm ar(cx, wrapper);
JSAutoRealmAllowCCW ar(cx, wrapper);
if (!dom::GetOrCreateDOMReflector(cx, const_cast<WebGLObjectType*>(object), &v)) {
rv.Throw(NS_ERROR_FAILURE);
return JS::NullValue();

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

@ -198,7 +198,7 @@ OpenWindow(const ClientOpenWindowArgs& aArgs,
return NS_ERROR_TYPE_ERR;
}
JSAutoRealm ar(cx, sandbox);
JSAutoRealmAllowCCW ar(cx, sandbox);
// ContentProcess
nsCOMPtr<nsIWindowWatcher> wwatch =

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

@ -644,7 +644,7 @@ private:
// don't need a proxy here.
global = js::UncheckedUnwrap(global);
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
// We don't need to set a parent object in mCallData bacause there are not
// DOM objects exposed to worklet.
@ -762,7 +762,7 @@ protected:
// We don't need a proxy here.
global = js::UncheckedUnwrap(global);
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
RunConsole(cx, aWorkerPrivate, nullptr, nullptr);
}
@ -928,7 +928,7 @@ private:
// don't need a proxy here.
global = js::UncheckedUnwrap(global);
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
// We don't need to set a parent object in mCallData bacause there are not
// DOM objects exposed to worklet.
@ -1927,7 +1927,7 @@ Console::PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
aData->mCountValue);
}
JSAutoRealm ar2(aCx, targetScope);
JSAutoRealmAllowCCW ar2(aCx, targetScope);
if (NS_WARN_IF(!ToJSValue(aCx, event, aEventValue))) {
return false;
@ -2726,7 +2726,7 @@ Console::RetrieveConsoleEvents(JSContext* aCx, nsTArray<JS::Value>& aEvents,
JS::Rooted<JS::Value> value(aCx);
JS::Rooted<JSObject*> sequenceScope(aCx, mCallDataStorage[i]->mGlobal);
JSAutoRealm ar(aCx, sequenceScope);
JSAutoRealmAllowCCW ar(aCx, sequenceScope);
Sequence<JS::Value> sequence;
SequenceRooter<JS::Value> arguments(aCx, &sequence);

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

@ -80,7 +80,7 @@ ConsoleUtils::ReportForServiceWorkerScopeInternal(const nsAString& aScope,
// We don't need a proxy here.
global = js::UncheckedUnwrap(global);
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
RootedDictionary<ConsoleEvent> event(cx);

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

@ -31,7 +31,7 @@ TextEncoder::Encode(JSContext* aCx,
return;
}
JSAutoRealm ar(aCx, aObj);
JSAutoRealmAllowCCW ar(aCx, aObj);
JSObject* outView = Uint8Array::Create(
aCx, utf8.Length(), reinterpret_cast<const uint8_t*>(utf8.BeginReading()));
if (!outView) {

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

@ -1006,7 +1006,7 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
JS::Rooted<JSObject*> wrapScope(cx, global->GetGlobalJSObject());
JS::Rooted<JS::Value> v(cx);
{
JSAutoRealm ar(cx, wrapScope);
JSAutoRealmAllowCCW ar(cx, wrapScope);
nsresult rv = nsContentUtils::WrapNative(cx, mTarget, &v,
/* aAllowWrapping = */ false);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -1015,7 +1015,7 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
}
JS::Rooted<JSObject*> target(cx, &v.toObject());
JSAutoRealm ar(cx, target);
JSAutoRealmAllowCCW ar(cx, target);
// Now that we've entered the realm we actually care about, create our
// scope chain. Note that we start with |element|, not aElement, because

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

@ -152,7 +152,7 @@ NS_IMETHODIMP
EventListenerInfo::GetListenerObject(JSContext* aCx,
JS::MutableHandle<JS::Value> aObject)
{
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
GetJSVal(aCx, ar, aObject);
return NS_OK;
}
@ -165,7 +165,7 @@ NS_IMPL_ISUPPORTS(EventListenerService, nsIEventListenerService)
bool
EventListenerInfo::GetJSVal(JSContext* aCx,
Maybe<JSAutoRealm>& aAr,
Maybe<JSAutoRealmAllowCCW>& aAr,
JS::MutableHandle<JS::Value> aJSVal)
{
if (mScriptedListener) {
@ -184,7 +184,7 @@ EventListenerInfo::ToSource(nsAString& aResult)
aResult.SetIsVoid(true);
AutoSafeJSContext cx;
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
JS::Rooted<JS::Value> v(cx);
if (GetJSVal(cx, ar, &v)) {
JSString* str = JS_ValueToSource(cx, v);

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

@ -61,7 +61,7 @@ protected:
virtual ~EventListenerInfo();
bool GetJSVal(JSContext* aCx,
Maybe<JSAutoRealm>& aAr,
Maybe<JSAutoRealmAllowCCW>& aAr,
JS::MutableHandle<JS::Value> aJSVal);
nsString mType;

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

@ -1520,7 +1520,7 @@ nsHTMLDocument::Open(JSContext* cx,
nsCOMPtr<nsIScriptGlobalObject> newScope(do_QueryReferent(mScopeObject));
JS::Rooted<JSObject*> wrapper(cx, GetWrapper());
if (oldScope && newScope != oldScope && wrapper) {
JSAutoRealm ar(cx, wrapper);
JSAutoRealmAllowCCW ar(cx, wrapper);
mozilla::dom::ReparentWrapper(cx, wrapper, aError);
if (aError.Failed()) {
return nullptr;

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

@ -1663,7 +1663,7 @@ public:
return NS_OK;
}
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
JS::Rooted<JS::Value> value(cx);
nsresult rv = DeserializeIndexValue(cx, &value);
@ -1785,7 +1785,7 @@ public:
return NS_OK;
}
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
JS::Rooted<JS::Value> value(cx);
nsresult rv = DeserializeUpgradeValue(cx, &value);

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

@ -316,7 +316,7 @@ IDBRequest::SetResultCallback(ResultCallback* aCallback)
}
AutoJSAPI autoJS;
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
if (GetScriptOwner()) {
// If we have a script owner we want the SafeJSContext and then to enter the

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

@ -478,7 +478,7 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage)
NS_ENSURE_SUCCESS(rv, rv);
if (stack.isObject()) {
JSAutoRealm ar(cx, &stack.toObject());
JSAutoRealmAllowCCW ar(cx, &stack.toObject());
StructuredCloneData data;
ErrorResult err;

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

@ -588,7 +588,7 @@ AudioContext::DecodeAudioData(const ArrayBuffer& aBuffer,
AutoJSAPI jsapi;
jsapi.Init();
JSContext* cx = jsapi.cx();
JSAutoRealm ar(cx, aBuffer.Obj());
JSAutoRealmAllowCCW ar(cx, aBuffer.Obj());
promise = Promise::Create(parentObject, aRv);
if (aRv.Failed()) {

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

@ -859,7 +859,7 @@ TCPSocket::Send(JSContext* aCx,
}
} else {
JS::Rooted<JSObject*> obj(aCx, aData.Obj());
JSAutoRealm ar(aCx, obj);
JSAutoRealmAllowCCW ar(aCx, obj);
JS::Rooted<JS::Value> value(aCx, JS::ObjectValue(*obj));
stream = do_CreateInstance("@mozilla.org/io/arraybuffer-input-stream;1");

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

@ -738,7 +738,7 @@ nsJSObjWrapper::NP_HasMethod(NPObject *npobj, NPIdentifier id)
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
JSAutoRealm ar(cx, npjsobj->mJSObj);
JSAutoRealmAllowCCW ar(cx, npjsobj->mJSObj);
MarkCrossZoneNPIdentifier(cx, id);
AutoJSExceptionSuppressor suppressor(aes, npjsobj);
@ -778,7 +778,7 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args,
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
JS::Rooted<JSObject*> jsobj(cx, npjsobj->mJSObj);
JSAutoRealm ar(cx, jsobj);
JSAutoRealmAllowCCW ar(cx, jsobj);
MarkCrossZoneNPIdentifier(cx, method);
JS::Rooted<JS::Value> fv(cx);
@ -871,7 +871,7 @@ nsJSObjWrapper::NP_HasProperty(NPObject *npobj, NPIdentifier npid)
AutoJSExceptionSuppressor suppressor(aes, npjsobj);
JS::Rooted<JSObject*> jsobj(cx, npjsobj->mJSObj);
JSAutoRealm ar(cx, jsobj);
JSAutoRealmAllowCCW ar(cx, jsobj);
MarkCrossZoneNPIdentifier(cx, npid);
NS_ASSERTION(NPIdentifierIsInt(npid) || NPIdentifierIsString(npid),
@ -908,7 +908,7 @@ nsJSObjWrapper::NP_GetProperty(NPObject *npobj, NPIdentifier id,
nsJSObjWrapper *npjsobj = (nsJSObjWrapper *)npobj;
AutoJSExceptionSuppressor suppressor(aes, npjsobj);
JSAutoRealm ar(cx, npjsobj->mJSObj);
JSAutoRealmAllowCCW ar(cx, npjsobj->mJSObj);
MarkCrossZoneNPIdentifier(cx, id);
JS::Rooted<JS::Value> v(cx);
@ -945,7 +945,7 @@ nsJSObjWrapper::NP_SetProperty(NPObject *npobj, NPIdentifier npid,
AutoJSExceptionSuppressor suppressor(aes, npjsobj);
JS::Rooted<JSObject*> jsObj(cx, npjsobj->mJSObj);
JSAutoRealm ar(cx, jsObj);
JSAutoRealmAllowCCW ar(cx, jsObj);
MarkCrossZoneNPIdentifier(cx, npid);
JS::Rooted<JS::Value> v(cx, NPVariantToJSVal(npp, cx, value));
@ -983,7 +983,7 @@ nsJSObjWrapper::NP_RemoveProperty(NPObject *npobj, NPIdentifier npid)
AutoJSExceptionSuppressor suppressor(aes, npjsobj);
JS::ObjectOpResult result;
JS::Rooted<JSObject*> obj(cx, npjsobj->mJSObj);
JSAutoRealm ar(cx, obj);
JSAutoRealmAllowCCW ar(cx, obj);
MarkCrossZoneNPIdentifier(cx, npid);
NS_ASSERTION(NPIdentifierIsInt(npid) || NPIdentifierIsString(npid),
@ -1037,7 +1037,7 @@ nsJSObjWrapper::NP_Enumerate(NPObject *npobj, NPIdentifier **idarray,
AutoJSExceptionSuppressor suppressor(aes, npjsobj);
JS::Rooted<JSObject*> jsobj(cx, npjsobj->mJSObj);
JSAutoRealm ar(cx, jsobj);
JSAutoRealmAllowCCW ar(cx, jsobj);
JS::Rooted<JS::IdVector> ida(cx, JS::IdVector(cx));
if (!JS_Enumerate(cx, jsobj, &ida)) {
@ -1179,7 +1179,7 @@ GetNPObjectWrapper(JSContext *cx, JS::Handle<JSObject*> aObj, bool wrapResult =
return obj;
}
JSAutoRealm ar(cx, obj);
JSAutoRealmAllowCCW ar(cx, obj);
if (!::JS_GetPrototype(cx, obj, &obj)) {
return nullptr;
}

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

@ -106,7 +106,7 @@ already_AddRefed<Promise>
Promise::Resolve(nsIGlobalObject* aGlobal, JSContext* aCx,
JS::Handle<JS::Value> aValue, ErrorResult& aRv)
{
JSAutoRealm ar(aCx, aGlobal->GetGlobalJSObject());
JSAutoRealmAllowCCW ar(aCx, aGlobal->GetGlobalJSObject());
JS::Rooted<JSObject*> p(aCx,
JS::CallOriginalPromiseResolve(aCx, aValue));
if (!p) {
@ -122,7 +122,7 @@ already_AddRefed<Promise>
Promise::Reject(nsIGlobalObject* aGlobal, JSContext* aCx,
JS::Handle<JS::Value> aValue, ErrorResult& aRv)
{
JSAutoRealm ar(aCx, aGlobal->GetGlobalJSObject());
JSAutoRealmAllowCCW ar(aCx, aGlobal->GetGlobalJSObject());
JS::Rooted<JSObject*> p(aCx,
JS::CallOriginalPromiseReject(aCx, aValue));
if (!p) {

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

@ -279,7 +279,7 @@ PromiseDebugging::FlushUncaughtRejectionsInternal()
obs->OnLeftUncaught(promise, IgnoreErrors());
}
JSAutoRealm ar(cx, promise);
JSAutoRealmAllowCCW ar(cx, promise);
Promise::ReportRejectedPromise(cx, promise);
}
storage->mUncaughtRejections.clear();

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

@ -379,7 +379,7 @@ AutoJSAPI::InitInternal(nsIGlobalObject* aGlobalObject, JSObject* aGlobal,
// particular, we do not expose this data to anyone, which is very
// important; otherwise it could be a cross-origin information leak.
exnObj = js::UncheckedUnwrap(exnObj);
JSAutoRealm ar(aCx, exnObj);
JSAutoRealmAllowCCW ar(aCx, exnObj);
nsAutoJSString stack, filename, name, message;
int32_t line;
@ -570,7 +570,7 @@ AutoJSAPI::ReportException()
}
}
MOZ_ASSERT(JS_IsGlobalObject(errorGlobal));
JSAutoRealm ar(cx(), errorGlobal);
JSAutoRealmAllowCCW ar(cx(), errorGlobal);
JS::Rooted<JS::Value> exn(cx());
js::ErrorReport jsReport(cx());
if (StealException(&exn) &&
@ -826,7 +826,7 @@ AutoSlowOperation::CheckForInterrupt()
// For now we support only main thread!
if (mIsMainThread) {
// JS_CheckForInterrupt expects us to be in a realm.
JSAutoRealm ar(cx(), xpc::UnprivilegedJunkScope());
JSAutoRealmAllowCCW ar(cx(), xpc::UnprivilegedJunkScope());
JS_CheckForInterrupt(cx());
}
}

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

@ -103,7 +103,7 @@ private:
JS::Rooted<JSObject*> global(aCx, globalScope->GetWrapper());
ErrorResult rv;
JSAutoRealm ar(aCx, global);
JSAutoRealmAllowCCW ar(aCx, global);
workerinternals::LoadMainScript(aWorkerPrivate, mScriptURL,
DebuggerScript, rv);
rv.WouldReportJSException();

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

@ -405,7 +405,7 @@ private:
// that point yet. So we need to enter the realm of our global,
// because setting a pending exception on aCx involves wrapping into its
// current compartment. Luckily we have a global now.
JSAutoRealm ar(aCx, globalScope->GetGlobalJSObject());
JSAutoRealmAllowCCW ar(aCx, globalScope->GetGlobalJSObject());
if (rv.MaybeSetPendingException(aCx)) {
return false;
}
@ -3178,7 +3178,7 @@ WorkerPrivate::DoRunLoop(JSContext* aCx)
InitializeGCTimers();
Maybe<JSAutoRealm> workerCompartment;
Maybe<JSAutoRealmAllowCCW> workerCompartment;
for (;;) {
WorkerStatus currentStatus;
@ -3291,7 +3291,7 @@ WorkerPrivate::DoRunLoop(JSContext* aCx)
MOZ_ASSERT(globalScope);
// Now *might* be a good time to GC. Let the JS engine make the decision.
JSAutoRealm ar(aCx, globalScope->GetGlobalJSObject());
JSAutoRealmAllowCCW ar(aCx, globalScope->GetGlobalJSObject());
JS_MaybeGC(aCx);
}
} else if (normalRunnablesPending) {
@ -3301,7 +3301,7 @@ WorkerPrivate::DoRunLoop(JSContext* aCx)
normalRunnablesPending = NS_HasPendingEvents(mThread);
if (normalRunnablesPending && GlobalScope()) {
// Now *might* be a good time to GC. Let the JS engine make the decision.
JSAutoRealm ar(aCx, GlobalScope()->GetGlobalJSObject());
JSAutoRealmAllowCCW ar(aCx, GlobalScope()->GetGlobalJSObject());
JS_MaybeGC(aCx);
}
}
@ -5297,7 +5297,7 @@ WorkerPrivate::GetOrCreateGlobalScope(JSContext* aCx)
JS::Rooted<JSObject*> global(aCx);
NS_ENSURE_TRUE(globalScope->WrapGlobalObject(aCx, &global), nullptr);
JSAutoRealm ar(aCx, global);
JSAutoRealmAllowCCW ar(aCx, global);
// RegisterBindings() can spin a nested event loop so we have to set mScope
// before calling it, and we have to make sure to unset mScope if it fails.
@ -5327,7 +5327,7 @@ WorkerPrivate::CreateDebuggerGlobalScope(JSContext* aCx)
JS::Rooted<JSObject*> global(aCx);
NS_ENSURE_TRUE(globalScope->WrapGlobalObject(aCx, &global), nullptr);
JSAutoRealm ar(aCx, global);
JSAutoRealmAllowCCW ar(aCx, global);
// RegisterDebuggerBindings() can spin a nested event loop so we have to set
// mDebuggerScope before calling it, and we have to make sure to unset

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

@ -348,7 +348,7 @@ WorkerRunnable::Run()
// situation described above when globalObject is null. Make sure to enter
// the realm of the worker's reflector if there is one. There might
// not be one if we're just starting to compile the script for this worker.
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
if (!targetIsWorkerThread &&
mWorkerPrivate->IsDedicatedWorker() &&
mWorkerPrivate->ParentEventTargetRef()->GetWrapper()) {

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

@ -1019,7 +1019,7 @@ WorkerDebuggerGlobalScope::LoadSubScript(JSContext* aCx,
{
mWorkerPrivate->AssertIsOnWorkerThread();
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
if (aSandbox.WasPassed()) {
JS::Rooted<JSObject*> sandbox(aCx, js::CheckedUnwrap(aSandbox.Value()));
if (!IsWorkerDebuggerSandbox(sandbox)) {

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

@ -402,7 +402,7 @@ ExecutionRunnable::RunOnWorkletThread()
compileOptions.setIsRunOnce(true);
compileOptions.setNoScriptRval(true);
JSAutoRealm ar(cx, globalObj);
JSAutoRealmAllowCCW ar(cx, globalObj);
JS::SourceBufferHolder buffer(mScriptBuffer.release(), mScriptLength,
JS::SourceBufferHolder::GiveOwnership);
@ -540,7 +540,7 @@ Worklet::CreateGlobalScope(JSContext* aCx, WorkletType aWorkletType)
JS::Rooted<JSObject*> global(aCx);
NS_ENSURE_TRUE(scope->WrapGlobalObject(aCx, &global), nullptr);
JSAutoRealm ar(aCx, global);
JSAutoRealmAllowCCW ar(aCx, global);
// Init Web IDL bindings
if (!RegisterWorkletBindings(aCx, global)) {

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

@ -640,7 +640,7 @@ nsBindingManager::GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
// the XBL scope, we'll end up with the global of the reflector.
JS::Rooted<JSObject*> xblScope(cx, xpc::GetXBLScopeOrGlobal(cx, jsobj));
NS_ENSURE_TRUE(xblScope, NS_ERROR_UNEXPECTED);
JSAutoRealm ar(cx, xblScope);
JSAutoRealmAllowCCW ar(cx, xblScope);
bool ok = JS_WrapObject(cx, &jsobj);
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
MOZ_ASSERT_IF(js::IsWrapper(jsobj), xpc::IsXrayWrapper(jsobj));

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

@ -739,7 +739,7 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
// that was...
// Find the right prototype.
JSAutoRealm ar(cx, scriptObject);
JSAutoRealmAllowCCW ar(cx, scriptObject);
JS::Rooted<JSObject*> base(cx, scriptObject);
JS::Rooted<JSObject*> proto(cx);
@ -898,7 +898,7 @@ GetOrCreateMapEntryForPrototype(JSContext *cx, JS::Handle<JSObject*> proto)
MOZ_ASSERT(JS_IsGlobalObject(scope));
JS::Rooted<JSObject*> wrappedProto(cx, proto);
JSAutoRealm ar(cx, scope);
JSAutoRealmAllowCCW ar(cx, scope);
if (!JS_WrapObject(cx, &wrappedProto)) {
return nullptr;
}
@ -971,7 +971,7 @@ nsXBLBinding::DoInitJSClass(JSContext *cx,
JS::Rooted<JSObject*> parent_proto(cx);
{
JS::RootedObject wrapped(cx, obj);
JSAutoRealm ar(cx, xblScope);
JSAutoRealmAllowCCW ar(cx, xblScope);
if (!JS_WrapObject(cx, &wrapped)) {
return NS_ERROR_FAILURE;
}
@ -990,14 +990,14 @@ nsXBLBinding::DoInitJSClass(JSContext *cx,
if (parent_proto) {
holder = GetOrCreateMapEntryForPrototype(cx, parent_proto);
} else {
JSAutoRealm innerAR(cx, xblScope);
JSAutoRealmAllowCCW innerAR(cx, xblScope);
holder = GetOrCreateClassObjectMap(cx, xblScope, "__ContentClassObjectMap__");
}
if (NS_WARN_IF(!holder)) {
return NS_ERROR_FAILURE;
}
js::AssertSameCompartment(holder, xblScope);
JSAutoRealm ar(cx, holder);
JSAutoRealmAllowCCW ar(cx, holder);
// Look up the class on the property holder. The only properties on the
// holder should be class objects. If we don't find the class object, we need
@ -1017,7 +1017,7 @@ nsXBLBinding::DoInitJSClass(JSContext *cx,
// We need to create the prototype. First, enter the realm where it's
// going to live, and create it.
JSAutoRealm ar2(cx, global);
JSAutoRealmAllowCCW ar2(cx, global);
proto = JS_NewObjectWithGivenProto(cx, &gPrototypeJSClass, parent_proto);
if (!proto) {
return NS_ERROR_OUT_OF_MEMORY;
@ -1037,7 +1037,7 @@ nsXBLBinding::DoInitJSClass(JSContext *cx,
// Next, enter the realm of the property holder, wrap the proto, and
// stick it on.
JSAutoRealm ar3(cx, holder);
JSAutoRealmAllowCCW ar3(cx, holder);
if (!JS_WrapObject(cx, &proto) ||
!JS_DefineUCProperty(cx, holder, aClassName.get(), -1, proto,
JSPROP_READONLY | JSPROP_PERMANENT))
@ -1048,7 +1048,7 @@ nsXBLBinding::DoInitJSClass(JSContext *cx,
// Whew. We have the proto. Wrap it back into the realm of |obj|,
// splice it in, and return it.
JSAutoRealm ar4(cx, obj);
JSAutoRealmAllowCCW ar4(cx, obj);
if (!JS_WrapObject(cx, &proto) || !JS_SetPrototype(cx, obj, proto)) {
return NS_ERROR_FAILURE;
}
@ -1127,7 +1127,7 @@ nsXBLBinding::LookupMember(JSContext* aCx, JS::Handle<jsid> aId,
// Enter the xbl scope and invoke the internal version.
{
JSAutoRealm ar(aCx, xblScope);
JSAutoRealmAllowCCW ar(aCx, xblScope);
JS::Rooted<jsid> id(aCx, aId);
if (!LookupMemberInternal(aCx, name, id, aDesc, xblScope)) {
return false;

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

@ -85,7 +85,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
JS::Rooted<JSObject*> scopeObject(cx, xpc::GetXBLScopeOrGlobal(cx, globalObject));
NS_ENSURE_TRUE(scopeObject, NS_ERROR_OUT_OF_MEMORY);
MOZ_ASSERT(JS_IsGlobalObject(scopeObject));
JSAutoRealm ar(cx, scopeObject);
JSAutoRealmAllowCCW ar(cx, scopeObject);
// Determine the appropriate property holder.
//
@ -162,7 +162,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
}
// From here on out, work in the scope of the bound element.
JSAutoRealm ar2(cx, targetClassObject);
JSAutoRealmAllowCCW ar2(cx, targetClassObject);
// Install all of our field accessors.
for (nsXBLProtoImplField* curr = mFields;
@ -204,7 +204,7 @@ nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject());
JS::Rooted<JS::Value> v(cx);
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
// Make sure the interface object is created before the prototype object
// so that XULElement is hidden from content. See bug 909340.
bool defineOnGlobal = dom::XULElement_Binding::ConstructorEnabled(cx, global);
@ -215,7 +215,7 @@ nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
NS_ENSURE_SUCCESS(rv, rv);
JS::Rooted<JSObject*> value(cx, &v.toObject());
JSAutoRealm ar2(cx, value);
JSAutoRealmAllowCCW ar2(cx, value);
// We passed aAllowWrapping = false to nsContentUtils::WrapNative so we
// should not have a wrapper.

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

@ -184,7 +184,7 @@ InstallXBLField(JSContext* cx,
nsXBLPrototypeBinding* protoBinding;
nsAutoJSString fieldName;
{
JSAutoRealm ar(cx, callee);
JSAutoRealmAllowCCW ar(cx, callee);
JS::Rooted<JSObject*> xblProto(cx);
xblProto = &js::GetFunctionNativeReserved(callee, XBLPROTO_SLOT).toObject();
@ -199,7 +199,7 @@ InstallXBLField(JSContext* cx,
// If a separate XBL scope is being used, the callee is not same-realm
// with the xbl prototype, and the object is a cross-compartment wrapper.
xblProto = js::UncheckedUnwrap(xblProto);
JSAutoRealm ar2(cx, xblProto);
JSAutoRealmAllowCCW ar2(cx, xblProto);
JS::Value slotVal = ::JS_GetReservedSlot(xblProto, 0);
protoBinding = static_cast<nsXBLPrototypeBinding*>(slotVal.toPrivate());
MOZ_ASSERT(protoBinding);
@ -329,7 +329,7 @@ nsXBLProtoImplField::InstallAccessors(JSContext* aCx,
// see through any SOWs on their targets.
// First, enter the XBL scope, and compile the functions there.
JSAutoRealm ar(aCx, scopeObject);
JSAutoRealmAllowCCW ar(aCx, scopeObject);
JS::Rooted<JS::Value> wrappedClassObj(aCx, JS::ObjectValue(*aTargetClassObject));
if (!JS_WrapValue(aCx, &wrappedClassObj))
return NS_ERROR_OUT_OF_MEMORY;
@ -356,7 +356,7 @@ nsXBLProtoImplField::InstallAccessors(JSContext* aCx,
// Now, re-enter the class object's scope, wrap the getters/setters, and define
// them there.
JSAutoRealm ar2(aCx, aTargetClassObject);
JSAutoRealmAllowCCW ar2(aCx, aTargetClassObject);
if (!JS_WrapObject(aCx, &get) || !JS_WrapObject(aCx, &set)) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -455,7 +455,7 @@ nsXBLProtoImplField::InstallField(JS::Handle<JSObject*> aBoundNode,
// Now, enter the node's realm, wrap the eval result, and define it on
// the bound node.
JSAutoRealm ar2(cx, aBoundNode);
JSAutoRealmAllowCCW ar2(cx, aBoundNode);
nsDependentString name(mName);
if (!JS_WrapValue(cx, &result) ||
!::JS_DefineUCProperty(cx, aBoundNode,

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

@ -188,7 +188,7 @@ nsXBLProtoImplMethod::CompileMember(AutoJSAPI& jsapi, const nsString& aClassStr,
}
JSContext *cx = jsapi.cx();
JSAutoRealm ar(cx, aClassObject);
JSAutoRealmAllowCCW ar(cx, aClassObject);
JS::CompileOptions options(cx);
options.setFileAndLine(functionUri.get(),
uncompiledMethod->mBodyText.GetLineNumber());

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

@ -188,7 +188,7 @@ nsXBLProtoImplProperty::CompileMember(AutoJSAPI& jsapi, const nsString& aClassSt
if (getterText && getterText->GetText()) {
nsDependentString getter(getterText->GetText());
if (!getter.IsEmpty()) {
JSAutoRealm ar(cx, aClassObject);
JSAutoRealmAllowCCW ar(cx, aClassObject);
JS::CompileOptions options(cx);
options.setFileAndLine(functionUri.get(), getterText->GetLineNumber());
nsCString name = NS_LITERAL_CSTRING("get_") + NS_ConvertUTF16toUTF8(mName);
@ -233,7 +233,7 @@ nsXBLProtoImplProperty::CompileMember(AutoJSAPI& jsapi, const nsString& aClassSt
if (setterText && setterText->GetText()) {
nsDependentString setter(setterText->GetText());
if (!setter.IsEmpty()) {
JSAutoRealm ar(cx, aClassObject);
JSAutoRealmAllowCCW ar(cx, aClassObject);
JS::CompileOptions options(cx);
options.setFileAndLine(functionUri.get(), setterText->GetLineNumber());
nsCString name = NS_LITERAL_CSTRING("set_") + NS_ConvertUTF16toUTF8(mName);

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

@ -359,7 +359,7 @@ nsXBLPrototypeHandler::ExecuteHandler(EventTarget* aTarget,
// First, enter our XBL scope. This is where the generic handler should have
// been compiled, above.
JSAutoRealm ar(cx, scopeObject);
JSAutoRealmAllowCCW ar(cx, scopeObject);
JS::Rooted<JSObject*> genericHandler(cx, handler.get());
bool ok = JS_WrapObject(cx, &genericHandler);
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
@ -430,7 +430,7 @@ nsXBLPrototypeHandler::EnsureEventHandler(AutoJSAPI& jsapi, nsAtom* aName,
&argNames);
// Compile the event handler in the xbl scope.
JSAutoRealm ar(cx, scopeObject);
JSAutoRealmAllowCCW ar(cx, scopeObject);
JS::CompileOptions options(cx);
options.setFileAndLine(bindingURI.get(), mLineNumber);
@ -445,7 +445,7 @@ nsXBLPrototypeHandler::EnsureEventHandler(AutoJSAPI& jsapi, nsAtom* aName,
// Wrap the handler into the content scope, since we're about to stash it
// on the DOM window and such.
JSAutoRealm ar2(cx, globalObject);
JSAutoRealmAllowCCW ar2(cx, globalObject);
bool ok = JS_WrapObject(cx, &handlerFun);
NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY);
aHandler.set(handlerFun);

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

@ -2391,7 +2391,7 @@ XULDocument::ExecuteScript(nsXULPrototypeScript *aScript)
NS_ENSURE_TRUE(xpc::Scriptability::Get(global).Allowed(), NS_OK);
JS::ExposeObjectToActiveJS(global);
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
// The script is in the compilation scope. Clone it into the target scope
// and execute it. On failure, ~AutoScriptEntry will handle exceptions, so

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

@ -75,7 +75,7 @@ nsresult CentralizedAdminPrefManagerInit(bool aSandboxEnabled)
// Define gSandbox on system sandbox.
JSAutoRealm ac(cx, autoconfigSystemSb);
JSAutoRealmAllowCCW ac(cx, autoconfigSystemSb);
JS::Rooted<JS::Value> value(cx, JS::ObjectValue(*sandbox));
@ -170,7 +170,7 @@ nsresult EvaluateAdminConfigScript(JS::HandleObject sandbox,
convertedScript = NS_ConvertASCIItoUTF16(script);
}
{
JSAutoRealm ac(cx, autoconfigSystemSb);
JSAutoRealmAllowCCW ac(cx, autoconfigSystemSb);
JS::Rooted<JS::Value> value(cx, JS::BooleanValue(isUTF8));
if (!JS_DefineProperty(cx, autoconfigSystemSb, "gIsUTF8", value, JSPROP_ENUMERATE)) {
return NS_ERROR_UNEXPECTED;

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

@ -387,7 +387,7 @@ XPCShellEnvironment::~XPCShellEnvironment()
Rooted<JSObject*> global(cx, GetGlobalObject());
{
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
JS_SetAllNonReservedSlotsToUndefined(cx, global);
}
mGlobalHolder.reset();
@ -448,7 +448,7 @@ XPCShellEnvironment::Init()
NS_ERROR("Failed to get global JSObject!");
return false;
}
JSAutoRealm ar(cx, globalObj);
JSAutoRealmAllowCCW ar(cx, globalObj);
backstagePass->SetGlobalObject(globalObj);

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

@ -54,7 +54,7 @@ JSDebugger::AddClass(JS::Handle<JS::Value> global, JSContext* cx)
return NS_ERROR_INVALID_ARG;
}
JSAutoRealm ar(cx, obj);
JSAutoRealmAllowCCW ar(cx, obj);
if (!JS_DefineDebuggerObject(cx, obj)) {
return NS_ERROR_FAILURE;
}

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

@ -106,7 +106,7 @@ class Logging
JS::RootedObject obj(cx);
obj = shared->objects_.find(id);
if (obj) {
JSAutoRealm ar(cx, obj);
JSAutoRealmAllowCCW ar(cx, obj);
objDesc = js::ObjectClassName(cx, obj);
} else {
objDesc = "<dead object>";

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

@ -85,7 +85,7 @@ JavaScriptParent::allowMessage(JSContext* cx)
nsIGlobalObject* global = dom::GetIncumbentGlobal();
JS::Rooted<JSObject*> jsGlobal(cx, global ? global->GetGlobalJSObject() : nullptr);
if (jsGlobal) {
JSAutoRealm ar(cx, jsGlobal);
JSAutoRealmAllowCCW ar(cx, jsGlobal);
if (!xpc::CompartmentPrivate::Get(jsGlobal)->allowCPOWs &&
ForbidUnsafeBrowserCPOWs())

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

@ -536,10 +536,10 @@ JavaScriptShared::findObjectById(JSContext* cx, const ObjectId& objId)
// from the other process point to objects in this scope. From there, they
// can access objects in other compartments using cross-compartment
// wrappers.
JSAutoRealm ar(cx, scopeForTargetObjects());
JSAutoRealmAllowCCW ar(cx, scopeForTargetObjects());
if (objId.hasXrayWaiver()) {
{
JSAutoRealm ar2(cx, obj);
JSAutoRealmAllowCCW ar2(cx, obj);
obj = js::ToWindowProxyIfWindow(obj);
MOZ_ASSERT(obj);
}

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

@ -1192,7 +1192,7 @@ WrapperOwner::fromRemoteObjectVariant(JSContext* cx, const RemoteObject& objVar)
// All CPOWs live in the privileged junk scope.
RootedObject junkScope(cx, xpc::PrivilegedJunkScope());
JSAutoRealm ar(cx, junkScope);
JSAutoRealmAllowCCW ar(cx, junkScope);
RootedValue v(cx, UndefinedValue());
// We need to setLazyProto for the getPrototype/getPrototypeIfOrdinary
// hooks.

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

@ -170,7 +170,7 @@ const WHITELIST_TYPES: &'static [&'static str] = &[
"JS::HandleValue",
"JS::HandleValueArray",
"JS::IsAcceptableThis",
"JSAutoRealm",
"JSAutoRealmAllowCCW",
"JSAutoStructuredCloneBuffer",
"JSClass",
"JSClassOps",

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

@ -3,7 +3,7 @@ use jsapi::root::*;
use std::ptr;
#[derive(Debug)]
pub struct AutoCompartment(JSAutoRealm);
pub struct AutoCompartment(JSAutoRealmAllowCCW);
impl AutoCompartment {
#[cfg(feature = "debugmozjs")]
@ -16,7 +16,7 @@ impl AutoCompartment {
};
AutoCompartment(
JSAutoRealm::new(
JSAutoRealmAllowCCW::new(
cx,
target,
&mut notifier as *mut _))
@ -27,7 +27,7 @@ impl AutoCompartment {
target: *mut JSObject)
-> AutoCompartment
{
AutoCompartment(JSAutoRealm::new(cx, target))
AutoCompartment(JSAutoRealmAllowCCW::new(cx, target))
}
#[cfg(feature = "debugmozjs")]
@ -40,7 +40,7 @@ impl AutoCompartment {
};
AutoCompartment(
JSAutoRealm::new1(
JSAutoRealmAllowCCW::new1(
cx,
target,
&mut notifier as *mut _))
@ -51,6 +51,6 @@ impl AutoCompartment {
target: *mut JSScript)
-> AutoCompartment
{
AutoCompartment(JSAutoRealm::new1(cx, target))
AutoCompartment(JSAutoRealmAllowCCW::new1(cx, target))
}
}

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

@ -615,7 +615,7 @@ impl GCMethods for JS::Value {
// ___________________________________________________________________________
// Implementations for various things in jsapi.rs
impl Drop for JSAutoRealm {
impl Drop for JSAutoRealmAllowCCW {
fn drop(&mut self) {
unsafe { JS::LeaveRealm(self.cx_, self.oldRealm_); }
}

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

@ -234,7 +234,7 @@ DataViewObject::constructWrapped(JSContext* cx, HandleObject bufobj, const CallA
RootedObject dv(cx);
{
JSAutoRealm ar(cx, unwrapped);
JSAutoRealmAllowCCW ar(cx, unwrapped);
Rooted<ArrayBufferObjectMaybeShared*> buffer(cx);
buffer = &unwrapped->as<ArrayBufferObjectMaybeShared>();

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

@ -1719,7 +1719,7 @@ CallObjFunc(RetT(*ObjFunc)(JSContext*, HandleObject), JSContext* cx, HandleObjec
// Enter the realm of the backing object before calling functions on
// it.
JSAutoRealm ar(cx, unwrappedObj);
JSAutoRealmAllowCCW ar(cx, unwrappedObj);
return ObjFunc(cx, unwrappedObj);
}
@ -1734,7 +1734,7 @@ CallObjFunc(bool(*ObjFunc)(JSContext *cx, HandleObject obj, HandleValue key, boo
// Always unwrap, in case this is an xray or cross-compartment wrapper.
RootedObject unwrappedObj(cx);
unwrappedObj = UncheckedUnwrap(obj);
JSAutoRealm ar(cx, unwrappedObj);
JSAutoRealmAllowCCW ar(cx, unwrappedObj);
// If we're working with a wrapped map/set, rewrap the key into the
// compartment of the unwrapped map/set.
@ -1762,7 +1762,7 @@ CallObjFunc(bool(*ObjFunc)(JSContext* cx, Iter kind,
{
// Retrieve the iterator while in the unwrapped map/set's compartment,
// otherwise we'll crash on a compartment assert.
JSAutoRealm ar(cx, unwrappedObj);
JSAutoRealmAllowCCW ar(cx, unwrappedObj);
if (!ObjFunc(cx, iterType, unwrappedObj, rval))
return false;
}
@ -1801,7 +1801,7 @@ JS::MapGet(JSContext* cx, HandleObject obj, HandleValue key, MutableHandleValue
RootedObject unwrappedObj(cx);
unwrappedObj = UncheckedUnwrap(obj);
{
JSAutoRealm ar(cx, unwrappedObj);
JSAutoRealmAllowCCW ar(cx, unwrappedObj);
RootedValue wrappedKey(cx, key);
// If we passed in a wrapper, wrap our key into its compartment now.
@ -1832,7 +1832,7 @@ JS::MapSet(JSContext *cx, HandleObject obj, HandleValue key, HandleValue val)
RootedObject unwrappedObj(cx);
unwrappedObj = UncheckedUnwrap(obj);
{
JSAutoRealm ar(cx, unwrappedObj);
JSAutoRealmAllowCCW ar(cx, unwrappedObj);
// If we passed in a wrapper, wrap both key and value before adding to
// the map
@ -1913,7 +1913,7 @@ JS::SetAdd(JSContext *cx, HandleObject obj, HandleValue key)
RootedObject unwrappedObj(cx);
unwrappedObj = UncheckedUnwrap(obj);
{
JSAutoRealm ar(cx, unwrappedObj);
JSAutoRealmAllowCCW ar(cx, unwrappedObj);
// If we passed in a wrapper, wrap key before adding to the set
RootedValue wrappedKey(cx, key);

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

@ -201,7 +201,7 @@ var ignoreFunctions = {
// These are a little overzealous -- these destructors *can* GC if they end
// up wrapping a pending exception. See bug 898815 for the heavyweight fix.
"void js::AutoRealm::~AutoRealm(int32)" : true,
"void JSAutoRealm::~JSAutoRealm(int32)" : true,
"void JSAutoRealmAllowCCW::~JSAutoRealmAllowCCW(int32)" : true,
// Similar to heap snapshot mock classes, and GTests below. This posts a
// synchronous runnable when a GTest fails, and we are pretty sure that the

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

@ -52,7 +52,7 @@ jsfuzz_createGlobal(JSContext* cx, JSPrincipals* principals)
if (!newGlobal)
return nullptr;
JSAutoRealm ar(cx, newGlobal);
JSAutoRealmAllowCCW ar(cx, newGlobal);
// Populate the global object with the standard globals like Object and
// Array.

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

@ -88,7 +88,7 @@ main(int argc, const char** argv)
JS::RealmOptions options;
RootedObject global(cx, checkPtr(JS_NewGlobalObject(cx, &global_class,
nullptr, JS::FireOnNewGlobalHook, options)));
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
/* Populate the global object with the standard globals,
like Object and Array. */

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

@ -19,7 +19,7 @@ const js::Class OuterWrapperClass = PROXY_CLASS_DEF(
static JSObject*
wrap(JSContext* cx, JS::HandleObject toWrap, JS::HandleObject target)
{
JSAutoRealm ar(cx, target);
JSAutoRealmAllowCCW ar(cx, target);
JS::RootedObject wrapper(cx, toWrap);
if (!JS_WrapObject(cx, &wrapper))
return nullptr;
@ -80,7 +80,7 @@ BEGIN_TEST(testBug604087)
JS::RootedObject next(cx);
{
JSAutoRealm ar(cx, compartment2);
JSAutoRealmAllowCCW ar(cx, compartment2);
next = js::Wrapper::New(cx, compartment2, &js::Wrapper::singleton, options);
CHECK(next);
}

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

@ -63,7 +63,7 @@ BEGIN_TEST(test_CallNonGenericMethodOnProxy)
CHECK(globalB);
// ...and enter it.
JSAutoRealm enter(cx, globalB);
JSAutoRealmAllowCCW enter(cx, globalB);
JS::RootedObject customB(cx, JS_NewObject(cx, &CustomClass));
CHECK(customB);
JS_SetReservedSlot(customB, CUSTOM_SLOT, Int32Value(42));

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

@ -38,7 +38,7 @@ CallTrusted(JSContext* cx, unsigned argc, JS::Value* vp)
bool ok = false;
{
JSAutoRealm ar(cx, trusted_glob);
JSAutoRealmAllowCCW ar(cx, trusted_glob);
JS::RootedValue funVal(cx, JS::ObjectValue(*trusted_fun));
ok = JS_CallFunctionValue(cx, nullptr, funVal, JS::HandleValueArray::empty(), args.rval());
}
@ -66,7 +66,7 @@ BEGIN_TEST(testChromeBuffer)
JS::ContextOptions oldOptions = JS::ContextOptionsRef(cx);
JS::ContextOptionsRef(cx).setIon(false).setBaseline(false);
{
JSAutoRealm ar(cx, trusted_glob);
JSAutoRealmAllowCCW ar(cx, trusted_glob);
const char* paramName = "x";
const char* bytes = "return x ? 1 + trusted(x-1) : 0";
JS::CompileOptions options(cx);
@ -110,7 +110,7 @@ BEGIN_TEST(testChromeBuffer)
*/
{
{
JSAutoRealm ar(cx, trusted_glob);
JSAutoRealmAllowCCW ar(cx, trusted_glob);
const char* paramName = "untrusted";
const char* bytes = "try { "
" untrusted(); "
@ -156,7 +156,7 @@ BEGIN_TEST(testChromeBuffer)
{
{
JSAutoRealm ar(cx, trusted_glob);
JSAutoRealmAllowCCW ar(cx, trusted_glob);
const char* bytes = "return 42";
JS::CompileOptions options(cx);
options.setFileAndLine("", 0);

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

@ -31,7 +31,7 @@ BEGIN_TEST(test_cloneScript)
// compile for A
{
JSAutoRealm a(cx, A);
JSAutoRealmAllowCCW a(cx, A);
JS::RootedFunction fun(cx);
JS::CompileOptions options(cx);
options.setFileAndLine(__FILE__, 1);
@ -43,7 +43,7 @@ BEGIN_TEST(test_cloneScript)
// clone into B
{
JSAutoRealm b(cx, B);
JSAutoRealmAllowCCW b(cx, B);
CHECK(JS::CloneFunctionObject(cx, obj));
}
@ -112,7 +112,7 @@ BEGIN_TEST(test_cloneScriptWithPrincipals)
// Compile in A
{
JSAutoRealm a(cx, A);
JSAutoRealmAllowCCW a(cx, A);
JS::CompileOptions options(cx);
options.setFileAndLine(__FILE__, 1);
JS::RootedFunction fun(cx);
@ -131,7 +131,7 @@ BEGIN_TEST(test_cloneScriptWithPrincipals)
// Clone into B
{
JSAutoRealm b(cx, B);
JSAutoRealmAllowCCW b(cx, B);
JS::RootedObject cloned(cx);
CHECK(cloned = JS::CloneFunctionObject(cx, obj));

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

@ -19,7 +19,7 @@ BEGIN_TEST(testDebugger_newScriptHook)
JS::FireOnNewGlobalHook, options));
CHECK(g);
{
JSAutoRealm ae(cx, g);
JSAutoRealmAllowCCW ae(cx, g);
CHECK(JS::InitRealmStandardClasses(cx));
}
@ -48,7 +48,7 @@ bool testIndirectEval(JS::HandleObject scope, const char* code)
EXEC("hits = 0;");
{
JSAutoRealm ae(cx, scope);
JSAutoRealmAllowCCW ae(cx, scope);
JSString* codestr = JS_NewStringCopyZ(cx, code);
CHECK(codestr);
JS::RootedValue arg(cx, JS::StringValue(codestr));

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

@ -38,7 +38,7 @@ eval(const char16_t* chars, size_t len, JS::MutableHandleValue rval)
JS::FireOnNewGlobalHook, globalOptions));
CHECK(global);
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
JS::CompileOptions options(cx);
return JS::Evaluate(cx, options, chars, len, rval);
}

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

@ -33,7 +33,7 @@ BEGIN_TEST(testRedefineGlobalEval)
if (!g)
return false;
JSAutoRealm ar(cx, g);
JSAutoRealmAllowCCW ar(cx, g);
JS::Rooted<JS::Value> v(cx);
CHECK(JS_GetProperty(cx, g, "Object", &v));

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

@ -56,7 +56,7 @@ BEGIN_TEST(testGCGrayMarking)
#endif /* JS_GC_ZEAL */
CHECK(InitGlobals());
JSAutoRealm ar(cx, global1);
JSAutoRealmAllowCCW ar(cx, global1);
InitGrayRootTracer();
@ -668,7 +668,7 @@ GetCrossCompartmentWrapper(JSObject* target)
{
MOZ_ASSERT(target->compartment() == global1->compartment());
JS::RootedObject obj(cx, target);
JSAutoRealm ar(cx, global2);
JSAutoRealmAllowCCW ar(cx, global2);
if (!JS_WrapObject(cx, &obj))
return nullptr;

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

@ -45,7 +45,7 @@ ConstructCCW(JSContext* cx, const JSClass* globalClasp,
// Define an object in compartment 2, that is wrapped by a CCW into compartment 1.
{
JSAutoRealm ar(cx, global2);
JSAutoRealmAllowCCW ar(cx, global2);
wrappee.set(JS_NewPlainObject(cx));
if (wrappee->compartment() != global2->compartment()) {
fprintf(stderr, "wrappee in wrong compartment");

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

@ -46,7 +46,7 @@ eval(const char* asciiChars, bool mutedErrors, JS::MutableHandleValue rval)
JS::RootedObject global(cx, JS_NewGlobalObject(cx, getGlobalClass(), nullptr,
JS::FireOnNewGlobalHook, globalOptions));
CHECK(global);
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
CHECK(JS::InitRealmStandardClasses(cx));

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

@ -43,7 +43,7 @@ testPreserveJitCode(bool preserveJitCode, unsigned remainingIonScripts)
RootedObject global(cx, createTestGlobal(preserveJitCode));
CHECK(global);
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
// The Ion JIT may be unavailable due to --disable-ion or lack of support
// for this platform.

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

@ -185,7 +185,7 @@ BEGIN_FIXTURE_TEST(ScriptObjectFixture, CloneAndExecuteScript)
{
JS::RootedObject global2(cx, createGlobal());
CHECK(global2);
JSAutoRealm ar(cx, global2);
JSAutoRealmAllowCCW ar(cx, global2);
CHECK(JS_WrapValue(cx, &fortyTwo));
CHECK(JS_SetProperty(cx, global, "val", fortyTwo));
JS::RootedValue value2(cx);

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

@ -19,7 +19,7 @@ BEGIN_TEST(testStructuredClone_object)
JS::RootedValue v1(cx);
{
JSAutoRealm ar(cx, g1);
JSAutoRealmAllowCCW ar(cx, g1);
JS::RootedValue prop(cx, JS::Int32Value(1337));
JS::RootedObject obj(cx, JS_NewPlainObject(cx));
@ -29,7 +29,7 @@ BEGIN_TEST(testStructuredClone_object)
}
{
JSAutoRealm ar(cx, g2);
JSAutoRealmAllowCCW ar(cx, g2);
JS::RootedValue v2(cx);
CHECK(JS_StructuredClone(cx, v1, &v2, nullptr, nullptr));
@ -57,7 +57,7 @@ BEGIN_TEST(testStructuredClone_string)
JS::RootedValue v1(cx);
{
JSAutoRealm ar(cx, g1);
JSAutoRealmAllowCCW ar(cx, g1);
JS::RootedValue prop(cx, JS::Int32Value(1337));
v1 = JS::StringValue(JS_NewStringCopyZ(cx, "Hello World!"));
@ -66,7 +66,7 @@ BEGIN_TEST(testStructuredClone_string)
}
{
JSAutoRealm ar(cx, g2);
JSAutoRealmAllowCCW ar(cx, g2);
JS::RootedValue v2(cx);
CHECK(JS_StructuredClone(cx, v1, &v2, nullptr, nullptr));
@ -93,7 +93,7 @@ BEGIN_TEST(testStructuredClone_externalArrayBuffer)
JS::RootedValue v1(cx);
{
JSAutoRealm ar(cx, g1);
JSAutoRealmAllowCCW ar(cx, g1);
JS::RootedObject obj(cx, JS_NewExternalArrayBuffer(cx, data.len(), data.contents(),
&ExternalData::freeCallback, &data));
@ -104,7 +104,7 @@ BEGIN_TEST(testStructuredClone_externalArrayBuffer)
}
{
JSAutoRealm ar(cx, g2);
JSAutoRealmAllowCCW ar(cx, g2);
JS::RootedValue v2(cx);
CHECK(JS_StructuredClone(cx, v1, &v2, nullptr, nullptr));
@ -269,7 +269,7 @@ BEGIN_TEST(testStructuredClone_SavedFrame)
JS::RootedObject g(cx, JS_NewGlobalObject(cx, getGlobalClass(), pp->principals,
JS::FireOnNewGlobalHook, options));
CHECK(g);
JSAutoRealm ar(cx, g);
JSAutoRealmAllowCCW ar(cx, g);
CHECK(js::DefineTestingFunctions(cx, g, false, false));

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

@ -97,7 +97,7 @@ BEGIN_TEST(test_ubiNodeZone)
{
// ... and then enter global2's zone and create a string and script
// there, too.
JSAutoRealm ar(cx, global2);
JSAutoRealmAllowCCW ar(cx, global2);
RootedString string2(cx, JS_NewStringCopyZ(cx, "A million household uses!"));
CHECK(string2);
@ -142,7 +142,7 @@ BEGIN_TEST(test_ubiNodeCompartment)
{
// ... and then enter global2's realm and create a script
// there, too.
JSAutoRealm ar(cx, global2);
JSAutoRealmAllowCCW ar(cx, global2);
RootedScript script2(cx);
CHECK(JS::Compile(cx, options, "", 0, &script2));

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

@ -86,7 +86,7 @@ BEGIN_TEST(testWeakMap_keyDelegates)
JS::RootedObject delegateRoot(cx);
{
JSAutoRealm ar(cx, delegate);
JSAutoRealmAllowCCW ar(cx, delegate);
delegateRoot = JS_NewPlainObject(cx);
CHECK(delegateRoot);
JS::RootedValue delegateValue(cx, JS::ObjectValue(*delegate));
@ -185,13 +185,13 @@ JSObject* newCCW(JS::HandleObject sourceZone, JS::HandleObject destZone)
*/
JS::RootedObject object(cx);
{
JSAutoRealm ar(cx, destZone);
JSAutoRealmAllowCCW ar(cx, destZone);
object = JS_NewPlainObject(cx);
if (!object)
return nullptr;
}
{
JSAutoRealm ar(cx, sourceZone);
JSAutoRealmAllowCCW ar(cx, sourceZone);
if (!JS_WrapObject(cx, &object))
return nullptr;
}

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

@ -88,7 +88,7 @@ JSObject* JSAPITest::createGlobal(JSPrincipals* principals)
if (!newGlobal)
return nullptr;
JSAutoRealm ar(cx, newGlobal);
JSAutoRealmAllowCCW ar(cx, newGlobal);
// Populate the global object with the standard globals like Object and
// Array.

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

@ -686,8 +686,8 @@ JS::LeaveRealm(JSContext* cx, JS::Realm* oldRealm)
cx->leaveRealm(oldRealm);
}
JSAutoRealm::JSAutoRealm(JSContext* cx, JSObject* target
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
JSAutoRealmAllowCCW::JSAutoRealmAllowCCW(JSContext* cx, JSObject* target
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx_(cx),
oldRealm_(cx->realm())
{
@ -696,8 +696,8 @@ JSAutoRealm::JSAutoRealm(JSContext* cx, JSObject* target
cx_->enterRealmOf(target);
}
JSAutoRealm::JSAutoRealm(JSContext* cx, JSScript* target
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
JSAutoRealmAllowCCW::JSAutoRealmAllowCCW(JSContext* cx, JSScript* target
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx_(cx),
oldRealm_(cx->realm())
{
@ -706,7 +706,7 @@ JSAutoRealm::JSAutoRealm(JSContext* cx, JSScript* target
cx_->enterRealmOf(target);
}
JSAutoRealm::~JSAutoRealm()
JSAutoRealmAllowCCW::~JSAutoRealmAllowCCW()
{
cx_->leaveRealm(oldRealm_);
}

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

@ -1037,14 +1037,14 @@ JS_RefreshCrossCompartmentWrappers(JSContext* cx, JS::Handle<JSObject*> obj);
* the JSAutoRealm.
*/
class MOZ_RAII JS_PUBLIC_API(JSAutoRealm)
class MOZ_RAII JS_PUBLIC_API(JSAutoRealmAllowCCW)
{
JSContext* cx_;
JS::Realm* oldRealm_;
public:
JSAutoRealm(JSContext* cx, JSObject* target MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
JSAutoRealm(JSContext* cx, JSScript* target MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~JSAutoRealm();
JSAutoRealmAllowCCW(JSContext* cx, JSObject* target MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
JSAutoRealmAllowCCW(JSContext* cx, JSScript* target MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~JSAutoRealmAllowCCW();
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};

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

@ -880,7 +880,7 @@ FormatFrame(JSContext* cx, const FrameIter& iter, JS::UniqueChars&& inBuf, int n
jsbytecode* pc = iter.pc();
RootedObject envChain(cx, iter.environmentChain(cx));
JSAutoRealm ar(cx, envChain);
JSAutoRealmAllowCCW ar(cx, envChain);
const char* filename = script->filename();
unsigned lineno = PCToLineNumber(script, pc);

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

@ -736,7 +736,7 @@ ShellInterruptCallback(JSContext* cx)
if (sc->haveInterruptFunc) {
bool wasAlreadyThrowing = cx->isExceptionPending();
JS::AutoSaveExceptionState savedExc(cx);
JSAutoRealm ar(cx, &sc->interruptFunc.toObject());
JSAutoRealmAllowCCW ar(cx, &sc->interruptFunc.toObject());
RootedValue rval(cx);
// Report any exceptions thrown by the JS interrupt callback, but do
@ -1964,7 +1964,7 @@ Evaluate(JSContext* cx, unsigned argc, Value* vp)
}
{
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
RootedScript script(cx);
{
@ -2033,7 +2033,7 @@ Evaluate(JSContext* cx, unsigned argc, Value* vp)
if (!JS_ExecuteScript(cx, envChain, script, args.rval())) {
if (catchTermination && !JS_IsExceptionPending(cx)) {
JSAutoRealm ar1(cx, callerGlobal);
JSAutoRealmAllowCCW ar1(cx, callerGlobal);
JSString* str = JS_NewStringCopyZ(cx, "terminated");
if (!str)
return false;
@ -3051,7 +3051,7 @@ DisassembleToSprinter(JSContext* cx, unsigned argc, Value* vp, Sprinter* sprinte
/* Without arguments, disassemble the current script. */
RootedScript script(cx, GetTopScript(cx));
if (script) {
JSAutoRealm ar(cx, script);
JSAutoRealmAllowCCW ar(cx, script);
if (!Disassemble(cx, script, p.lines, sprinter))
return false;
if (!SrcNotes(cx, script, sprinter))
@ -3314,7 +3314,7 @@ Clone(JSContext* cx, unsigned argc, Value* vp)
RootedObject funobj(cx);
{
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
RootedObject obj(cx, args[0].isPrimitive() ? nullptr : &args[0].toObject());
if (obj && obj->is<CrossCompartmentWrapperObject>()) {
@ -3467,7 +3467,7 @@ NewSandbox(JSContext* cx, bool lazy)
return nullptr;
{
JSAutoRealm ar(cx, obj);
JSAutoRealmAllowCCW ar(cx, obj);
if (!lazy && !JS::InitRealmStandardClasses(cx))
return nullptr;
@ -3533,7 +3533,7 @@ EvalInContext(JSContext* cx, unsigned argc, Value* vp)
DescribeScriptedCaller(cx, &filename, &lineno);
{
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
unsigned flags;
JSObject* unwrapped = UncheckedUnwrap(sobj, true, &flags);
if (flags & Wrapper::CROSS_COMPARTMENT) {
@ -3644,7 +3644,7 @@ WorkerMain(WorkerInput* input)
if (!global)
break;
JSAutoRealm ar(cx, global);
JSAutoRealmAllowCCW ar(cx, global);
JS::CompileOptions options(cx);
options.setFileAndLine("<string>", 1)
@ -5189,7 +5189,7 @@ DecompileThisScript(JSContext* cx, unsigned argc, Value* vp)
}
{
JSAutoRealm ar(cx, iter.script());
JSAutoRealmAllowCCW ar(cx, iter.script());
RootedScript script(cx, iter.script());
JSString* result = JS_DecompileScript(cx, script);
@ -7687,7 +7687,7 @@ PrintStackTrace(JSContext* cx, HandleValue exn)
if (!exn.isObject())
return false;
Maybe<JSAutoRealm> ar;
Maybe<JSAutoRealmAllowCCW> ar;
RootedObject exnObj(cx, &exn.toObject());
if (IsCrossCompartmentWrapper(exnObj)) {
exnObj = UncheckedUnwrap(exnObj);
@ -8392,7 +8392,7 @@ NewGlobalObject(JSContext* cx, JS::RealmOptions& options,
return nullptr;
{
JSAutoRealm ar(cx, glob);
JSAutoRealmAllowCCW ar(cx, glob);
#ifndef LAZY_STANDARD_CLASSES
if (!JS::InitRealmStandardClasses(cx))
@ -8997,7 +8997,7 @@ Shell(JSContext* cx, OptionParser* op, char** envp)
if (!glob)
return 1;
JSAutoRealm ar(cx, glob);
JSAutoRealmAllowCCW ar(cx, glob);
ShellContext* sc = GetShellContext(cx);
int result = EXIT_SUCCESS;

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

@ -9481,7 +9481,7 @@ DebuggerObject::promiseDependentPromisesGetter(JSContext* cx, unsigned argc, Val
Rooted<GCVector<Value>> values(cx, GCVector<Value>(cx));
{
JSAutoRealm ar(cx, promise);
JSAutoRealmAllowCCW ar(cx, promise);
if (!promise->dependentPromises(cx, &values))
return false;
}

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

@ -1156,7 +1156,7 @@ JS_CopyPropertyFrom(JSContext* cx, HandleId id, HandleObject target,
desc.attributesRef() &= ~JSPROP_PERMANENT;
}
JSAutoRealm ar(cx, target);
JSAutoRealmAllowCCW ar(cx, target);
cx->markId(id);
RootedId wrappedId(cx, id);
if (!cx->compartment()->wrap(cx, &desc))
@ -1168,7 +1168,7 @@ JS_CopyPropertyFrom(JSContext* cx, HandleId id, HandleObject target,
JS_FRIEND_API(bool)
JS_CopyPropertiesFrom(JSContext* cx, HandleObject target, HandleObject obj)
{
JSAutoRealm ar(cx, obj);
JSAutoRealmAllowCCW ar(cx, obj);
AutoIdVector props(cx);
if (!GetPropertyKeys(cx, obj, JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS, &props))

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

@ -4498,7 +4498,7 @@ JSScript::AutoDelazify::holdScript(JS::HandleFunction fun)
// to delazify.
script_ = fun->nonLazyScript();
} else {
JSAutoRealm ar(cx_, fun);
JSAutoRealmAllowCCW ar(cx_, fun);
script_ = JSFunction::getOrCreateScript(cx_, fun);
if (script_) {
oldDoNotRelazify_ = script_->bitFields_.doNotRelazify_;

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

@ -2920,7 +2920,7 @@ JSRuntime::initSelfHosting(JSContext* cx)
if (!shg)
return false;
JSAutoRealm ar(cx, shg);
JSAutoRealmAllowCCW ar(cx, shg);
/*
* Set a temporary error reporter printing to stderr because it is too

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше