Skip to content

Commit

Permalink
Bug 1848771 part 2 - Remove unused INIT_JS_STANDARD_CLASSES flag. r=p…
Browse files Browse the repository at this point in the history
…eterv

Similar to part 1, but `INIT_JS_STANDARD_CLASSES` isn't used anymore so this shouldn't
affect behavior.

Differential Revision: https://phabricator.services.mozilla.com/D186217
  • Loading branch information
jandem committed Jan 23, 2024
1 parent 5656ba3 commit a61fca9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
6 changes: 0 additions & 6 deletions js/xpconnect/src/XPCWrappedNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ static nsresult FinishCreate(JSContext* cx, XPCWrappedNativeScope* Scope,
nsresult XPCWrappedNative::WrapNewGlobal(JSContext* cx,
xpcObjectHelper& nativeHelper,
nsIPrincipal* principal,
bool initStandardClasses,
JS::RealmOptions& aOptions,
XPCWrappedNative** wrappedGlobal) {
nsCOMPtr<nsISupports> identity = do_QueryInterface(nativeHelper.Object());
Expand Down Expand Up @@ -194,11 +193,6 @@ nsresult XPCWrappedNative::WrapNewGlobal(JSContext* cx,
// create ends up there.
JSAutoRealm ar(cx, global);

// If requested, initialize the standard classes on the global.
if (initStandardClasses && !JS::InitRealmStandardClasses(cx)) {
return NS_ERROR_FAILURE;
}

// Make a proto.
XPCWrappedNativeProto* proto = XPCWrappedNativeProto::GetNewOrUsed(
cx, scope, nativeHelper.GetClassInfo(), scrProto);
Expand Down
3 changes: 1 addition & 2 deletions js/xpconnect/src/nsXPConnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,7 @@ nsresult InitClassesWithNewWrappedGlobal(JSContext* aJSContext,
MOZ_ASSERT(helper.GetScriptableFlags() & XPC_SCRIPTABLE_IS_GLOBAL_OBJECT);
RefPtr<XPCWrappedNative> wrappedGlobal;
nsresult rv = XPCWrappedNative::WrapNewGlobal(
aJSContext, helper, aPrincipal, aFlags & xpc::INIT_JS_STANDARD_CLASSES,
aOptions, getter_AddRefs(wrappedGlobal));
aJSContext, helper, aPrincipal, aOptions, getter_AddRefs(wrappedGlobal));
NS_ENSURE_SUCCESS(rv, rv);

// Grab a copy of the global and enter its compartment.
Expand Down
1 change: 0 additions & 1 deletion js/xpconnect/src/xpcprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,6 @@ class XPCWrappedNative final : public nsIXPConnectWrappedNative {

static nsresult WrapNewGlobal(JSContext* cx, xpcObjectHelper& nativeHelper,
nsIPrincipal* principal,
bool initStandardClasses,
JS::RealmOptions& aOptions,
XPCWrappedNative** wrappedGlobal);

Expand Down
12 changes: 5 additions & 7 deletions js/xpconnect/src/xpcpublic.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,9 @@ JSObject* XrayAwareCalleeGlobal(JSObject* fun);
void TraceXPCGlobal(JSTracer* trc, JSObject* obj);

/**
* Creates a new global object using the given aCOMObj as the global
* object. The object will be set up according to the flags (defined
* below). If you do not pass INIT_JS_STANDARD_CLASSES, then aCOMObj
* must implement nsIXPCScriptable so it can resolve the standard
* Creates a new global object using the given aCOMObj as the global object.
* The object will be set up according to the flags (defined below).
* aCOMObj must implement nsIXPCScriptable so it can resolve the standard
* classes when asked by the JS engine.
*
* @param aJSContext the context to use while creating the global object.
Expand All @@ -186,9 +185,8 @@ nsresult InitClassesWithNewWrappedGlobal(
JS::MutableHandle<JSObject*> aNewGlobal);

enum InitClassesFlag {
INIT_JS_STANDARD_CLASSES = 1 << 0,
DONT_FIRE_ONNEWGLOBALHOOK = 1 << 1,
OMIT_COMPONENTS_OBJECT = 1 << 2,
DONT_FIRE_ONNEWGLOBALHOOK = 1 << 0,
OMIT_COMPONENTS_OBJECT = 1 << 1,
};

} /* namespace xpc */
Expand Down

0 comments on commit a61fca9

Please sign in to comment.