12012-01-24 Adam Klein <adamk@chromium.org>
2
3 Add JSC support for delivering mutations when the outermost script context exits
4 https://bugs.webkit.org/show_bug.cgi?id=70289
5
6 Reviewed by NOBODY (OOPS!).
7
8 The meat of this change is in JSMainThreadExecState, where a counter
9 is incremented every time WebCore calls into JSC and decremented every
10 time it returns. When the counter reaches zero, any pending mutations
11 are delivered (this mirrors very similar code in V8Proxy and V8RecursionScope).
12
13 The rest of the changes are of two sorts: compilation/logic fixes for
14 JSC code when ENABLE(MUTATION_OBSERVERS) is true, and additional
15 usages of JSMainThreadExecState so as to trigger the above
16 increment/decrements at the appropriate times.
17
18 * bindings/js/JSCustomXPathNSResolver.cpp:
19 (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
20 Use JSMainThreadExecState instead of JSC::call.
21 * bindings/js/JSDictionary.cpp:
22 (WebCore::JSDictionary::convertValue): Add support
23 for tryGetProperty with a HashMap<AtomicString>.
24 * bindings/js/JSDictionary.h:
25 * bindings/js/JSErrorHandler.cpp:
26 (WebCore::JSErrorHandler::handleEvent):
27 Use JSMainThreadExecState instead of JSC::call.
28 * bindings/js/JSHTMLDocumentCustom.cpp:
29 (WebCore::JSHTMLDocument::open):
30 Use JSMainThreadExecState instead of JSC::call.
31 * bindings/js/JSMainThreadExecState.cpp:
32 (WebCore::JSMainThreadExecState::didLeaveScriptContext):
33 * bindings/js/JSMainThreadExecState.h:
34 (WebCore::JSMainThreadExecState::JSMainThreadExecState):
35 Increment a static recursion level counter.
36 (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
37 Decrement a static recursion level counter and, if we are
38 at zero (the outermost script invocation), deliver any
39 outstanding mutation records.
40 * bindings/js/JSNodeFilterCondition.cpp:
41 (WebCore::JSNodeFilterCondition::acceptNode):
42 Use JSMainThreadExecState instead of JSC::call.
43 * bindings/js/JSWebKitMutationObserverCustom.cpp:
44 (WebCore::JSWebKitMutationObserver::observe):
45 Fix JSDictionary logic, add support for attributeFilter.
46