Window.open doesn't open a process with e10s

RESOLVED WORKSFORME

Status

()

--
major
RESOLVED WORKSFORME
2 years ago
2 years ago

People

(Reporter: alain.menoud, Unassigned)

Tracking

({multiprocess})

49 Branch
multiprocess
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
Build ID: 20161019084923

Steps to reproduce:

1. Open a new window with e10s
2. in the Console of Firefox (F12): execute window.open("http://www.google.ch", 'test', 'location=no')
3. the new window is opened and started with a new process --> OK
4. from this window, open the console and execute the command: window.open("http://www.google.ch", 'test2', 'location=no')
5. A new window is opened but started in the same process of the parent --> NOK 


Actual results:

with the secon command, the new window won't be opened in a new process


Expected results:

We expect a new process for every child.
(Reporter)

Updated

2 years ago
Severity: normal → major
Keywords: multiprocess

Updated

2 years ago
Component: Untriaged → DOM
Product: Firefox → Core

Updated

2 years ago
Component: DOM → DOM: Core & HTML
I'm pretty sure this is expected behaviour. Right, Blake?
Component: DOM: Core & HTML → DOM: Content Processes
Flags: needinfo?(mrbkap)
(Reporter)

Comment 2

2 years ago
Why is this an expected behaviour?
Do you know another way to do it?

Thanks in advance
(In reply to menouda from comment #0)
> 1. Open a new window with e10s
> 2. in the Console of Firefox (F12): execute
> window.open("http://www.google.ch", 'test', 'location=no')

First question: What is your homepage for new windows? In particular, is the window that you're starting this already a remote window? This must be in the same process as the first window.

> 3. the new window is opened and started with a new process --> OK
> 4. from this window, open the console and execute the command:
> window.open("http://www.google.ch", 'test2', 'location=no')

When I tried this, the popup blocker stopped me. When I worked around that, I got a window whose content was correctly remote. Note that this popup must be in the same process as both the first and second processes (since window.open returns a reference to the newly-opened window to the caller and there could therefore be synchronous communication between the two).

> 5. A new window is opened but started in the same process of the parent -->

When you say "parent" here, what do you mean exactly? The parent process (chrome process)? Or simply the process of the popup's parent. If you mean the latter, then this is, in fact, working as expected.

> We expect a new process for every child.

What are you actually trying to accomplish? It seems like you might also have to set dom.ipc.processCount to be greater than 1 in addition to opening the new windows in ways that don't force them to be in the same process.
Flags: needinfo?(mrbkap)
(Reporter)

Comment 4

2 years ago
Hello Blake,

Thank you for your reply.

First of all we already set the parameter dom.ipc.processCount to 6 and when I open new window manually, a new process is created --> OK

Concerning the popup blocker, we deactivate it to accept open new windows.

Here is a schema of what we try to do:

1.I just started Firefox (FF1) and use the command window.open. The FF2 will open and it will start a new process. We have also 2 processes.

Firefox Window FF1 (Process 1)
     |
     --------- Firefox Window FF2 (Process 2)


2. Then I want to open other windows from the FF2. Here for example we tried to open FF3 and FF4.
We want that the FF3 and FF4 open in new process but it's still in the same process as FF2.

Firefox Window FF1 (Process 1)
     |
     --------- Firefox Window FF2 (Process 2)
                      |
                      ------------ Firefox Window FF3 (Process 2)
                      ------------ Firefox Window FF4 (Process 2)


What we expect is a new process for every window we open.
Firefox Window FF1 (Process 1)
     |
     --------- Firefox Window FF2 (Process 2)
                      |
                      ------------ Firefox Window FF3 (Process 3)
                      ------------ Firefox Window FF4 (Process 4)

Is there a way to do that?
(In reply to menouda from comment #4)
> Is there a way to do that?

Hello again,

From a web page, it doesn't look like what you want to do is possible. For the reasons I mentioned in comment 3, a page opened via window.open will be in the same process as the opener (there have been a few talks to add parameters to window.open which would cause us to return a null new window and open the new page in a possibly different remote process, but that doesn't exist for real yet).

Also, our IPC layer currently doesn't permit for nested content processes. We have a chrome (also called parent) process that is responsible for (among other things) everything in the UI, doing privileged things (such as network requests), and managing the list of content processes and then zero or more content processes that load web pages. That hopefully should matter too much in practice.

I haven't looked at all deeply into it, but it seems like you might be able to do something like this with webextensions. There would ideally be some code in the "parent" part of the webextension that loads some page in a few tabs and manages those and a content script to communicate with the parent as needed to pass messages between the sibling child processes. You might also consider using a service worker as the "broker" but I don't know how much control you would have over having a certain number of tabs loaded.

I'm going to close this bug as WFM since things are actually working as intended.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WORKSFORME
(Reporter)

Comment 6

2 years ago
Hello Blake,

Thank you very much for the reply.
I found a way to force to open a new process for each windows of my application.

We realized a small add-on to create new windows and the application will discuss with this add-on.
The code is simple to open a new window with a new process:

var windows = require("sdk/windows").browserWindows;
windows.open("http://www.google.ch");

Best Regards
You need to log in before you can comment on or make changes to this bug.