Bug 122143 - Document::dispatchFullScreenChangeOrErrorEvent repeats the same loop twice
Summary: Document::dispatchFullScreenChangeOrErrorEvent repeats the same loop twice
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks: 122144
  Show dependency treegraph
 
Reported: 2013-10-01 00:59 PDT by Ryosuke Niwa
Modified: 2013-10-01 14:10 PDT (History)
9 users (show)

See Also:


Attachments
Cleanup (4.31 KB, patch)
2013-10-01 00:59 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Updated per comments (4.22 KB, patch)
2013-10-01 11:46 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2013-10-01 00:59:18 PDT
Cleanup Document::dispatchFullScreenChangeOrErrorEvent
Comment 1 Ryosuke Niwa 2013-10-01 00:59:55 PDT
Created attachment 213063 [details]
Cleanup
Comment 2 Darin Adler 2013-10-01 01:16:44 PDT
Comment on attachment 213063 [details]
Cleanup

View in context: https://bugs.webkit.org/attachment.cgi?id=213063&action=review

> Source/WebCore/dom/Document.cpp:5405
> -        if (!contains(node.get()) && !node->inDocument())
> +        if (!node->inDocument() && &node->document() == this)

This new code is very different from the old. I don’t understand this change at all.
Comment 3 Ryosuke Niwa 2013-10-01 01:42:10 PDT
(In reply to comment #2)
> (From update of attachment 213063 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=213063&action=review
> 
> > Source/WebCore/dom/Document.cpp:5405
> > -        if (!contains(node.get()) && !node->inDocument())
> > +        if (!node->inDocument() && &node->document() == this)
> 
> This new code is very different from the old. I don’t understand this change at all.

Not really. We're looking for a node that is detached from a document that hasn't been inserted into any other document yet.
Comment 4 Andrei Bucur 2013-10-01 04:42:17 PDT
Comment on attachment 213063 [details]
Cleanup

View in context: https://bugs.webkit.org/attachment.cgi?id=213063&action=review

>>> Source/WebCore/dom/Document.cpp:5405
>>> +        if (!node->inDocument() && &node->document() == this)
>> 
>> This new code is very different from the old. I don’t understand this change at all.
> 
> Not really. We're looking for a node that is detached from a document that hasn't been inserted into any other document yet.

Not convinced it's the same. Correct me if I'm wrong (I'm not familiar with the spec):
Before the change, the code was taking a snapshot of the change queue, a snapshot of the error queue and then it dispatched the events to the change queue and then to the error queue.
After the change, you snapshot the change queue, dispatch the events, snapshot the error queue and dispatch the events. Is it possible to change the error queue while dispatching the change events?
If true, with the initial code this was invisible to the error queue because it was copied before any dispatch took place.
Comment 5 Ryosuke Niwa 2013-10-01 11:41:03 PDT
(In reply to comment #4)
> Not convinced it's the same. Correct me if I'm wrong (I'm not familiar with the spec):
> Before the change, the code was taking a snapshot of the change queue, a snapshot of the error queue and then it dispatched the events to the change queue and then to the error queue.
> After the change, you snapshot the change queue, dispatch the events, snapshot the error queue and dispatch the events. Is it possible to change the error queue while dispatching the change events?
> If true, with the initial code this was invisible to the error queue because it was copied before any dispatch took place.

That's a separate concern than the one Darin pointed out but it's a valid one.  Will fix.
Comment 6 Ryosuke Niwa 2013-10-01 11:46:08 PDT
Created attachment 213103 [details]
Updated per comments
Comment 7 WebKit Commit Bot 2013-10-01 14:10:47 PDT
Comment on attachment 213103 [details]
Updated per comments

Clearing flags on attachment: 213103

Committed r156733: <http://trac.webkit.org/changeset/156733>
Comment 8 WebKit Commit Bot 2013-10-01 14:10:51 PDT
All reviewed patches have been landed.  Closing bug.