Closed Bug 1628279 Opened 6 years ago Closed 4 years ago

JS shell module loader is not initialized for additional globals

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox77 --- affected

People

(Reporter: decoder, Assigned: decoder)

Details

Attachments

(1 obsolete file)

The JS shell module loader is only initialized once for the main global by an InitModuleLoader call. Any additional globals created e.g. with newGlobal() lack the module loader and this seems to cause leaks/lifetime issues when running code in another global that would require the module loader.

This can be fixed easily by adding a global to the InitModuleLoader parameters and calling it again in NewGlobal. I have a patch for this coming up later.

Priority: -- → P1

(In reply to Christian Holler (:decoder) from comment #0)

Any additional globals created e.g. with newGlobal() lack the module loader and this seems to cause leaks/lifetime issues when running code in another global that would require the module loader.

We can add the module loader for new globals but I don't think this will address the root case of the leak.

(In reply to Jon Coppeard (:jonco) from comment #2)

(In reply to Christian Holler (:decoder) from comment #0)

Any additional globals created e.g. with newGlobal() lack the module loader and this seems to cause leaks/lifetime issues when running code in another global that would require the module loader.

We can add the module loader for new globals but I don't think this will address the root case of the leak.

I totally agree, but so far, the module loader seems to be the only source causing this to happen at all. This also means that the root cause might be shell-only, making it even less likely to be tracked down in a timely manner. With the attached patch, testing is unblocked.

Pushed by choller@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/928ee6869299 Initialize the JS shell module loader for each new global. r=jonco

Jon, I don't understand exactly what these failures mean or how these tests interact with my newGlobal change. Could you take a look and let me know how I should fix these? Thanks!

Flags: needinfo?(choller) → needinfo?(jcoppeard)

Looks like this is falling foul of a script filename validation check that Jan added. I think you can add options.setSkipFilenameValidation(true) when setting the compile options in InitModuleLoader to fix this.

Flags: needinfo?(jcoppeard)

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:decoder, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(choller)

Jon, I saw that you made significant changes to the module loader a while ago already in bug 1637529. With these new changes, do we still need this bug or is the module loader now working in all globals in the JS shell? If not, is it easy for me to make the change using the new C++ module loader?

Flags: needinfo?(choller) → needinfo?(jcoppeard)

Oh, I forgot to comment here. Yes, with the changes the module loader should now work in all globals. Can you check it's working as you expect?

Flags: needinfo?(jcoppeard)
Attachment #9140484 - Attachment is obsolete: true

Wanted to see if we could close this bug out, have we confirmed that with Jon's rewrite fixed the globals issue?

Flags: needinfo?(choller)

Yes, so far I think everything is working as expected, I'll open a new bug if anything related becomes visible again in parser fuzzing. Thanks!

Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(choller)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: