Closed Bug 1340337 Opened 7 years ago Closed 7 years ago

Can't make process go away during test

Categories

(Core :: DOM: Content Processes, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1337730

People

(Reporter: billm, Unassigned)

Details

I'm writing a test where I want to have only one content process (so that I can guarantee that two tabs will be in the same process even though there's no window.opener relationship).

I tried setting dom.ipc.processCount to 1 from the test, but that doesn't work. Here's what seems to happen:

- Test harness starts and creates a content process for something (not sure what).
- Then it creates another process for something else.
- The first process is no longer needed, but we don't shut it down because of dom.ipc.keepProcessesAlive.
- Now my test starts and sets processCount to 1. That doesn't seem to have any effect.
- When I open my two tabs, they use the two existing content processes.

I think maybe we should have a pref observer in ContentParent.cpp that shuts down any processes left open because of dom.ipc.keepProcessesAlive if processCount decreases. Or something like that.

I eventually realized I could use the sameProcessAsFrameLoader property to get my test to work. But there are other tests that set dom.ipc.processCount, and I suspect they're only working somewhat by accident.
(In reply to Bill McCloskey (:billm) from comment #0)
> I think maybe we should have a pref observer in ContentParent.cpp that shuts
> down any processes left open because of dom.ipc.keepProcessesAlive if
> processCount decreases. Or something like that.


Before each test we open up a new tab, switch to it and close the old one, that's where the extra process comes from. I had a patch that prevented that code to launch a new process, but since we keep processes alive I removed it. Anyway, this came up in other situations as well, sorry for the inconvenience, I've added an API for that in bug 1337730. It's not yet landed because I still have an issue with the test. But once it lands you can do ppmm.releaseCachedProcesses() which should shut down all ("web") content processes without any related tabs, and remove them from the mm as well right away, which is usually used to count processes in tests. I dupe this bug over that one, but if you had something else in mind feel free to reopen and I will look into it (or do some follow up work on the API).
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.