Closed Bug 974127 Opened 10 years ago Closed 10 years ago

nsContentUtils::IsUserFocusIgnored can loop infinitely

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30
blocking-b2g 1.3T+
Tracking Status
b2g-v1.3T --- fixed

People

(Reporter: jrmuizel, Assigned: smaug)

References

Details

Attachments

(1 file)

I ran into this running reftests. aNode is an HTML element, QueryInterface(aNode) to nsIMozBrowserFrame returns null, and aNode->OwnerDoc()->GetWindow() also returns null and so we loop forever.
Which reftest was that?  This could manifest itself as an intermittent test timeout.
This was during one of the bmp refrests. I don't remember which one. Afaik the tests are not really interesting from a browser point of view.
Attached patch patchSplinter Review
Attachment #8378579 - Flags: review?(ehsan)
Comment on attachment 8378579 [details] [diff] [review]
patch

Review of attachment 8378579 [details] [diff] [review]:
-----------------------------------------------------------------

Can you please document what the loop termination condition here is?  It's not very clear what this code is trying to do, but the fix makes sense.  Thanks!
Attachment #8378579 - Flags: review?(ehsan) → review+
It is not clear? Just a document which doesn't have a window (anymore).
(In reply to comment #5)
> It is not clear? Just a document which doesn't have a window (anymore).

Yes, well, I was talking about a higher level description.  What you said is basically converting the code to English.  :-)
Ok, still don't understand what kind of comment you want.
(In reply to comment #7)
> Ok, still don't understand what kind of comment you want.

So here is my understanding of this code.

We try to see if the current node is a mozbrowser iframe.  If not, we try to get it from the window object of the node's owner document.  Now, it's not clear to me what exactly happens if the window's frame is not a mozbrowser iframe.  According to the code we should try to get the window again.  Does that mean that we're walking up the chain of the hosting frames until we find a mozbrowser iframe?  Or do we stop after checking at that point and bail out of the loop?

(Note that even though the purpose of this loop may be completely clear to you, it's not to me, and comments are meant to make things like this clear to the readers of the code who are not necessarily as familiar with the code as others.)
https://hg.mozilla.org/mozilla-central/rev/d3b246449a75
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Assignee: nobody → bugs
blocking-b2g: --- → 1.3T?
Blocking as this is needed by 1005391 and Ni :fabrice to help with uplift on 1.3T branch.
blocking-b2g: 1.3T? → 1.3T+
Flags: needinfo?(fabrice)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: