Bug 73472

Summary: [MutationObservers] Make WebKitMutationObserver::deliverAllMutations() tolerant of re-entrant calls
Product: WebKit Reporter: Rafael Weinstein <rafaelw>
Component: DOMAssignee: Rafael Weinstein <rafaelw>
Status: RESOLVED FIXED    
Severity: Normal CC: adamk, ojan, rniwa, sam, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 68729    
Attachments:
Description Flags
Patch none

Description Rafael Weinstein 2011-11-30 11:01:54 PST
In effect, deliverAllMutations() needs to prevent each delivery from, itself, causing deliverAllMutations().

The code happens to be structured right now in such a way that it's behavior is still semantically correct, but we should avoid having multiple calls on this static on the stack.
Comment 1 Rafael Weinstein 2011-11-30 11:06:27 PST
Created attachment 117228 [details]
Patch
Comment 2 Ojan Vafai 2011-11-30 11:10:15 PST
Comment on attachment 117228 [details]
Patch

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

> Source/WebCore/dom/WebKitMutationObserver.cpp:139
> +        return;

Should we have an ASSERT_NOT_REACHED() before the return here? It's a bug in the C++ code if we ever hit this, right?
Comment 3 Rafael Weinstein 2011-11-30 11:19:35 PST
No. We probably will reach it. deliveryAllMutations is likely going to invoke script for each observer. The easiest thing is for each embedder to simply hook ALL outer-most script invocations. This guard just means that for each delivery, the embedder will *try* and quietly fail to re-start delivery (which is already underway).
Comment 4 WebKit Review Bot 2011-11-30 21:00:16 PST
Comment on attachment 117228 [details]
Patch

Clearing flags on attachment: 117228

Committed r101597: <http://trac.webkit.org/changeset/101597>
Comment 5 WebKit Review Bot 2011-11-30 21:00:20 PST
All reviewed patches have been landed.  Closing bug.