Skip to content

Commit c1ae685

Browse files
author
Molnar Sandor
committed
Backed out 9 changesets (bug 1769002, bug 1768870, bug 1771097, bug 1771092, bug 1768819) for causing lint failures. CLOSED TREE
Backed out changeset 829df1dfad70 (bug 1769002) Backed out changeset f0537d333adc (bug 1771092) Backed out changeset 25b43856bc00 (bug 1771092) Backed out changeset a49f754ca73f (bug 1771092) Backed out changeset 164f85686a32 (bug 1769002) Backed out changeset ef5cf9ceb915 (bug 1768819) Backed out changeset c64e6c1fbfe7 (bug 1771097) Backed out changeset f85393f988a8 (bug 1768870) Backed out changeset fe708d13cc1d (bug 1768870)
1 parent 482eccf commit c1ae685

File tree

58 files changed

+142
-1396
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+142
-1396
lines changed

browser/base/content/test/static/browser_all_files_referenced.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,6 @@ add_task(async function checkAllTheFiles() {
832832
".mjs",
833833
".js",
834834
".jsm",
835-
".mjs",
836835
".json",
837836
".html",
838837
".xhtml",
@@ -881,9 +880,6 @@ add_task(async function checkAllTheFiles() {
881880
for (let jsm of Components.manager.getComponentJSMs()) {
882881
gReferencesFromCode.set(jsm, null);
883882
}
884-
for (let esModule of Components.manager.getComponentESModules()) {
885-
gReferencesFromCode.set(esModule, null);
886-
}
887883

888884
// manifest.json is a common name, it is used for WebExtension manifests
889885
// but also for other things. To tell them apart, we have to actually

docs/code-quality/lint/linters/eslint-plugin-mozilla.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ The plugin implements the following rules:
3333
eslint-plugin-mozilla/import-globals
3434
eslint-plugin-mozilla/import-globals-from
3535
eslint-plugin-mozilla/import-headjs-globals
36-
eslint-plugin-mozilla/lazy-getter-object-name
3736
eslint-plugin-mozilla/mark-exported-symbols-as-used
3837
eslint-plugin-mozilla/mark-test-function-used
3938
eslint-plugin-mozilla/no-aArgs

docs/code-quality/lint/linters/eslint-plugin-mozilla/lazy-getter-object-name.rst

Lines changed: 0 additions & 25 deletions
This file was deleted.

dom/base/ChromeUtils.cpp

Lines changed: 18 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88

99
#include "js/CharacterEncoding.h"
1010
#include "js/Object.h" // JS::GetClass
11-
#include "js/PropertyAndElement.h" // JS_DefineProperty, JS_DefinePropertyById, JS_Enumerate, JS_GetProperty, JS_GetPropertyById, JS_SetProperty, JS_SetPropertyById, JS::IdVector
11+
#include "js/PropertyAndElement.h" // JS_DefineProperty, JS_DefinePropertyById, JS_Enumerate, JS_GetProperty, JS_GetPropertyById, JS_SetProperty, JS_SetPropertyById
1212
#include "js/PropertyDescriptor.h" // JS::PropertyDescriptor, JS_GetOwnPropertyDescriptorById
1313
#include "js/SavedFrameAPI.h"
14-
#include "js/Value.h" // JS::Value, JS::StringValue
1514
#include "jsfriendapi.h"
1615
#include "WrapperFactory.h"
1716

@@ -627,10 +626,7 @@ static bool ExtractArgs(JSContext* aCx, JS::CallArgs& aArgs,
627626
return true;
628627
}
629628

630-
enum class ModuleType { JSM, ESM };
631-
632-
static bool ModuleGetterImpl(JSContext* aCx, unsigned aArgc, JS::Value* aVp,
633-
ModuleType aType) {
629+
static bool ModuleGetter(JSContext* aCx, unsigned aArgc, JS::Value* aVp) {
634630
JS::CallArgs args = JS::CallArgsFromVp(aArgc, aVp);
635631

636632
JS::Rooted<JSObject*> callee(aCx);
@@ -651,38 +647,17 @@ static bool ModuleGetterImpl(JSContext* aCx, unsigned aArgc, JS::Value* aVp,
651647
RefPtr<mozJSComponentLoader> moduleloader = mozJSComponentLoader::Get();
652648
MOZ_ASSERT(moduleloader);
653649

654-
JS::Rooted<JS::Value> value(aCx);
655-
if (aType == ModuleType::JSM) {
656-
JS::Rooted<JSObject*> moduleGlobal(aCx);
657-
JS::Rooted<JSObject*> moduleExports(aCx);
658-
nsresult rv = moduleloader->Import(aCx, uri, &moduleGlobal, &moduleExports);
659-
if (NS_FAILED(rv)) {
660-
Throw(aCx, rv);
661-
return false;
662-
}
663-
664-
// JSM's exports is from the same realm.
665-
if (!JS_GetPropertyById(aCx, moduleExports, id, &value)) {
666-
return false;
667-
}
668-
} else {
669-
JS::Rooted<JSObject*> moduleNamespace(aCx);
670-
nsresult rv = moduleloader->ImportESModule(aCx, uri, &moduleNamespace);
671-
if (NS_FAILED(rv)) {
672-
Throw(aCx, rv);
673-
return false;
674-
}
650+
JS::Rooted<JSObject*> moduleGlobal(aCx);
651+
JS::Rooted<JSObject*> moduleExports(aCx);
652+
nsresult rv = moduleloader->Import(aCx, uri, &moduleGlobal, &moduleExports);
653+
if (NS_FAILED(rv)) {
654+
Throw(aCx, rv);
655+
return false;
656+
}
675657

676-
// ESM's namespace is from the module's realm.
677-
{
678-
JSAutoRealm ar(aCx, moduleNamespace);
679-
if (!JS_GetPropertyById(aCx, moduleNamespace, id, &value)) {
680-
return false;
681-
}
682-
}
683-
if (!JS_WrapValue(aCx, &value)) {
684-
return false;
685-
}
658+
JS::Rooted<JS::Value> value(aCx);
659+
if (!JS_GetPropertyById(aCx, moduleExports, id, &value)) {
660+
return false;
686661
}
687662

688663
if (!JS_DefinePropertyById(aCx, thisObj, id, value, JSPROP_ENUMERATE)) {
@@ -693,15 +668,7 @@ static bool ModuleGetterImpl(JSContext* aCx, unsigned aArgc, JS::Value* aVp,
693668
return true;
694669
}
695670

696-
static bool JSModuleGetter(JSContext* aCx, unsigned aArgc, JS::Value* aVp) {
697-
return ModuleGetterImpl(aCx, aArgc, aVp, ModuleType::JSM);
698-
}
699-
700-
static bool ESModuleGetter(JSContext* aCx, unsigned aArgc, JS::Value* aVp) {
701-
return ModuleGetterImpl(aCx, aArgc, aVp, ModuleType::ESM);
702-
}
703-
704-
static bool ModuleSetterImpl(JSContext* aCx, unsigned aArgc, JS::Value* aVp) {
671+
static bool ModuleSetter(JSContext* aCx, unsigned aArgc, JS::Value* aVp) {
705672
JS::CallArgs args = JS::CallArgsFromVp(aArgc, aVp);
706673

707674
JS::Rooted<JSObject*> callee(aCx);
@@ -714,17 +681,8 @@ static bool ModuleSetterImpl(JSContext* aCx, unsigned aArgc, JS::Value* aVp) {
714681
return JS_DefinePropertyById(aCx, thisObj, id, args.get(0), JSPROP_ENUMERATE);
715682
}
716683

717-
static bool JSModuleSetter(JSContext* aCx, unsigned aArgc, JS::Value* aVp) {
718-
return ModuleSetterImpl(aCx, aArgc, aVp);
719-
}
720-
721-
static bool ESModuleSetter(JSContext* aCx, unsigned aArgc, JS::Value* aVp) {
722-
return ModuleSetterImpl(aCx, aArgc, aVp);
723-
}
724-
725-
static bool DefineJSModuleGetter(JSContext* aCx, JS::Handle<JSObject*> aTarget,
726-
const nsAString& aId,
727-
const nsAString& aResourceURI) {
684+
static bool DefineGetter(JSContext* aCx, JS::Handle<JSObject*> aTarget,
685+
const nsAString& aId, const nsAString& aResourceURI) {
728686
JS::Rooted<JS::Value> uri(aCx);
729687
JS::Rooted<JS::Value> idValue(aCx);
730688
JS::Rooted<jsid> id(aCx);
@@ -737,11 +695,11 @@ static bool DefineJSModuleGetter(JSContext* aCx, JS::Handle<JSObject*> aTarget,
737695

738696
JS::Rooted<JSObject*> getter(
739697
aCx, JS_GetFunctionObject(
740-
js::NewFunctionByIdWithReserved(aCx, JSModuleGetter, 0, 0, id)));
698+
js::NewFunctionByIdWithReserved(aCx, ModuleGetter, 0, 0, id)));
741699

742700
JS::Rooted<JSObject*> setter(
743701
aCx, JS_GetFunctionObject(
744-
js::NewFunctionByIdWithReserved(aCx, JSModuleSetter, 0, 0, id)));
702+
js::NewFunctionByIdWithReserved(aCx, ModuleSetter, 0, 0, id)));
745703

746704
if (!getter || !setter) {
747705
JS_ReportOutOfMemory(aCx);
@@ -756,33 +714,6 @@ static bool DefineJSModuleGetter(JSContext* aCx, JS::Handle<JSObject*> aTarget,
756714
return JS_DefinePropertyById(aCx, aTarget, id, getter, setter,
757715
JSPROP_ENUMERATE);
758716
}
759-
760-
static bool DefineESModuleGetter(JSContext* aCx, JS::Handle<JSObject*> aTarget,
761-
JS::Handle<JS::PropertyKey> aId,
762-
JS::Handle<JS::Value> aResourceURI) {
763-
JS::Rooted<JS::Value> idVal(aCx, JS::StringValue(aId.toString()));
764-
765-
JS::Rooted<JSObject*> getter(
766-
aCx, JS_GetFunctionObject(js::NewFunctionByIdWithReserved(
767-
aCx, ESModuleGetter, 0, 0, aId)));
768-
769-
JS::Rooted<JSObject*> setter(
770-
aCx, JS_GetFunctionObject(js::NewFunctionByIdWithReserved(
771-
aCx, ESModuleSetter, 0, 0, aId)));
772-
773-
if (!getter || !setter) {
774-
JS_ReportOutOfMemory(aCx);
775-
return false;
776-
}
777-
778-
js::SetFunctionNativeReserved(getter, SLOT_ID, idVal);
779-
js::SetFunctionNativeReserved(setter, SLOT_ID, idVal);
780-
781-
js::SetFunctionNativeReserved(getter, SLOT_URI, aResourceURI);
782-
783-
return JS_DefinePropertyById(aCx, aTarget, aId, getter, setter,
784-
JSPROP_ENUMERATE);
785-
}
786717
} // namespace module_getter
787718

788719
/* static */
@@ -791,48 +722,11 @@ void ChromeUtils::DefineModuleGetter(const GlobalObject& global,
791722
const nsAString& id,
792723
const nsAString& resourceURI,
793724
ErrorResult& aRv) {
794-
if (!module_getter::DefineJSModuleGetter(global.Context(), target, id,
795-
resourceURI)) {
725+
if (!module_getter::DefineGetter(global.Context(), target, id, resourceURI)) {
796726
aRv.NoteJSContextException(global.Context());
797727
}
798728
}
799729

800-
/* static */
801-
void ChromeUtils::DefineESModuleGetters(const GlobalObject& global,
802-
JS::Handle<JSObject*> target,
803-
JS::Handle<JSObject*> modules,
804-
ErrorResult& aRv) {
805-
auto cx = global.Context();
806-
807-
JS::Rooted<JS::IdVector> props(cx, JS::IdVector(cx));
808-
if (!JS_Enumerate(cx, modules, &props)) {
809-
aRv.NoteJSContextException(cx);
810-
return;
811-
}
812-
813-
JS::Rooted<JS::PropertyKey> prop(cx);
814-
JS::Rooted<JS::Value> resourceURIVal(cx);
815-
for (JS::PropertyKey tmp : props) {
816-
prop = tmp;
817-
818-
if (!prop.isString()) {
819-
aRv.Throw(NS_ERROR_FAILURE);
820-
return;
821-
}
822-
823-
if (!JS_GetPropertyById(cx, modules, prop, &resourceURIVal)) {
824-
aRv.NoteJSContextException(cx);
825-
return;
826-
}
827-
828-
if (!module_getter::DefineESModuleGetter(cx, target, prop,
829-
resourceURIVal)) {
830-
aRv.NoteJSContextException(cx);
831-
return;
832-
}
833-
}
834-
}
835-
836730
/* static */
837731
void ChromeUtils::OriginAttributesToSuffix(
838732
dom::GlobalObject& aGlobal, const dom::OriginAttributesDictionary& aAttrs,

dom/base/ChromeUtils.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,6 @@ class ChromeUtils {
211211
const nsAString& resourceURI,
212212
ErrorResult& aRv);
213213

214-
static void DefineESModuleGetters(const GlobalObject& global,
215-
JS::Handle<JSObject*> target,
216-
JS::Handle<JSObject*> modules,
217-
ErrorResult& aRv);
218-
219214
static void GetCallerLocation(const GlobalObject& global,
220215
nsIPrincipal* principal,
221216
JS::MutableHandle<JSObject*> aRetval);

dom/chrome-webidl/ChromeUtils.webidl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -475,18 +475,6 @@ partial namespace ChromeUtils {
475475
[Throws]
476476
void defineModuleGetter(object target, DOMString id, DOMString resourceURI);
477477

478-
/**
479-
* Defines propertys on the given target which lazily imports a ES module
480-
* when accessed.
481-
*
482-
* @param target The target object on which to define the property.
483-
* @param modules An object with a property for each module property to be
484-
* imported, where the property name is the name of the
485-
* imported symbol and the value is the module URI.
486-
*/
487-
[Throws]
488-
void defineESModuleGetters(object target, object modules);
489-
490478
/**
491479
* Returns the scripted location of the first ancestor stack frame with a
492480
* principal which is subsumed by the given principal. If no such frame

dom/chrome-webidl/JSProcessActor.webidl

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,10 @@ dictionary ProcessActorOptions {
6262
dictionary ProcessActorSidedOptions {
6363
/**
6464
* The JSM path which should be loaded for the actor on this side.
65-
*
66-
* Mutually exclusive with `esModuleURI`.
67-
*
68-
* If neither this nor `esModuleURI` is passed, the specified side cannot receive
69-
* messages, but may send them using `sendAsyncMessage` or `sendQuery`.
70-
*/
71-
ByteString moduleURI;
72-
73-
/**
74-
* The ESM path which should be loaded for the actor on this side.
75-
*
76-
* Mutually exclusive with `moduleURI`.
77-
*
78-
* If neither this nor `moduleURI` is passed, the specified side cannot
79-
* receive messages, but may send them using `sendAsyncMessage` or
80-
* `sendQuery`.
65+
* If not passed, the specified side cannot receive messages, but may send
66+
* them using `sendAsyncMessage` or `sendQuery`.
8167
*/
82-
ByteString esModuleURI;
68+
required ByteString moduleURI;
8369
};
8470

8571
dictionary ProcessActorChildOptions : ProcessActorSidedOptions {

dom/chrome-webidl/JSWindowActor.webidl

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,24 +127,10 @@ dictionary WindowActorOptions {
127127
dictionary WindowActorSidedOptions {
128128
/**
129129
* The JSM path which should be loaded for the actor on this side.
130-
*
131-
* Mutually exclusive with `esModuleURI`.
132-
*
133-
* If neither this nor `esModuleURI` is passed, the specified side cannot receive
134-
* messages, but may send them using `sendAsyncMessage` or `sendQuery`.
135-
*/
136-
ByteString moduleURI;
137-
138-
/**
139-
* The ESM path which should be loaded for the actor on this side.
140-
*
141-
* Mutually exclusive with `moduleURI`.
142-
*
143-
* If neither this nor `moduleURI` is passed, the specified side cannot
144-
* receive messages, but may send them using `sendAsyncMessage` or
145-
* `sendQuery`.
130+
* If not passed, the specified side cannot receive messages, but may send
131+
* them using `sendAsyncMessage` or `sendQuery`.
146132
*/
147-
ByteString esModuleURI;
133+
required ByteString moduleURI;
148134
};
149135

150136
dictionary WindowActorEventListenerOptions : AddEventListenerOptions {

dom/ipc/PContent.ipdl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,6 @@ struct JSWindowActorInfo
294294
nsCString name;
295295
bool allFrames;
296296

297-
// True if `url` is for ESM.
298-
// False if `url` is for JSM or nothing.
299-
bool isESModule;
300-
301297
// The module of the url.
302298
nsCString? url;
303299

@@ -314,11 +310,6 @@ struct JSProcessActorInfo
314310
{
315311
// The name of the actor.
316312
nsCString name;
317-
318-
// True if `url` is for ESM.
319-
// False if `url` is for JSM or nothing.
320-
bool isESModule;
321-
322313
// The module of the url.
323314
nsCString? url;
324315

0 commit comments

Comments
 (0)