Open Bug 1917343 Opened 1 year ago Updated 11 months ago

active browsing context is not set when process is reused immediately after window is lowered

Categories

(Core :: DOM: Navigation, defect)

defect

Tracking

()

People

(Reporter: sefeng211, Unassigned)

Details

I stumbled this bug while investigating bug 1889406.

STR:

  1. Load https://sefeng211.github.io/testfiles/pageA.html (site A)
  2. After 1 second, it'll navigate to pageB.html (site B). Notices that b embeds an iframe which is has the same-origin as pageA.
  3. Click the back button to navigate back to pageA.html
  4. Click the forward button to navigate back to pageB.html
  5. Try click focus the <input> element in the embedded iframe.

Notice clicking the <input> element doesn't work. After some investigation, I think this is what happened.

At step 4, since we are lowering the window, the active bc for that content process will be set to null. In the meantime, pageB is restored from session history, but it doesn't set the active bc to the process that site A belongs to.

I see we have two options here.

  1. We could get the ContentParent for site A, and then call SendSetupFocusedAndActive to here at where we select processes for session history restored pages.
  2. We could ask pageB to set it descendants, maybe at nsFocusManager::WindowRaised for pageB? Right now we exit early at https://searchfox.org/mozilla-central/rev/90dc3743ea284c258148124dc54dfd123e82586f/dom/base/nsFocusManager.cpp#720-724

Since this relates to Focusing and SH...henri, peter, thoughts on this?

Flags: needinfo?(peterv)
Flags: needinfo?(hsivonen)

Disclaimer: It's been long enough since I worked on this code that I don't really remember things on the level of detail that's required for an informed answer.

My feeling is that as an architectural matter, we're supposed to prefer option 2: I.e. a content process that has an iframe element is responsible for asking for what's inside the iframe to get its status right.

However, SHIP happened after I worked on this code, and there may well be valid reasons to prefer option 1 now.

Flags: needinfo?(hsivonen)

Thans Henri, I am investigating to see if there's a solution that can fix this one and also bug 1889406.

Flags: needinfo?(peterv)
You need to log in before you can comment on or make changes to this bug.