Open Bug 1573625 Opened 5 months ago Updated 2 months ago

Fix usage of nsIDocShellTreeItem in nsCoreUtils::IsRootDocument

Categories

(Core :: Disability Access APIs, enhancement, P2)

enhancement

Tracking

()

Fission Milestone M6

People

(Reporter: djvj, Unassigned)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [rm-docshell-tree-item:simple])

In the function nsCoreUtils::IsRootDocument (https://searchfox.org/mozilla-central/source/accessible/base/nsCoreUtils.cpp#341):

This function checks if a document is a root document by getting its docshell tree-item, then obtaining its in-process parent, and checking if the parent is null.

Post-fission, this will return true incorrectly when the parent is out of process. This function should be modified as follows:

  1. Obtain the parent.
  2. If the parent is non-null, return false, as this document cannot be the root.
  3. If the parent is null, then use the associated BrowsingContext to determine whether there is an out-of-process parent, and return true if so, otherwise false.
Component: DOM: Core & HTML → Disability Access APIs
Fission Milestone: --- → M5
Priority: -- → P2
See Also: → 1582946

I was also thinking that returning true for the out-of-process document is wrong, but after some more reading the code around its call site, now I think returning true looks correct.

There is only one call site of nsCoreUtils::IsRootDocument, which is in DocManager::CreateDocOrRootAccessible. If we consider a given document is not root, we try to get the parent accessible document, then we call BindChildDocument. Apparently it won't work in fission.

So, I think we should rename nsCoreUtils::IsRootDocument to nsCoreUtils::IsRootDocumentInProcess, and make the function return true in the case where the given document is the root document of the out-of-process document tree.

Whiteboard: [rm-docshell-tree-item:simple]
Fission Milestone: M5 → Future

Kannan says replacing nsIDocShellTreeItem calls should block enabling Fission in Nightly (M6).

Fission Milestone: Future → M6
You need to log in before you can comment on or make changes to this bug.