Skip to content
  • adamk@chromium.org's avatar
    Add JSC support for delivering mutations when the outermost script context exits · 82abc774
    adamk@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=70289
    
    Reviewed by Eric Seidel.
    
    Source/WebCore:
    
    The meat of this change is in JSMainThreadExecState, where a counter
    is incremented every time WebCore calls into JSC and decremented every
    time it returns. When the counter reaches zero, any pending mutations
    are delivered (this mirrors very similar code in V8Proxy and V8RecursionScope).
    
    The rest of the changes are of two sorts: compilation/logic fixes for
    JSC code when ENABLE(MUTATION_OBSERVERS) is true, and additional
    usages of JSMainThreadExecState so as to trigger the above
    increment/decrements at the appropriate times.
    
    * bindings/js/JSCustomXPathNSResolver.cpp:
    (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
    Use JSMainThreadExecState instead of JSC::call.
    * bindings/js/JSDictionary.cpp:
    (WebCore::JSDictionary::convertValue): Add support
    for tryGetProperty with a HashMap<AtomicString>.
    * bindings/js/JSDictionary.h:
    * bindings/js/JSErrorHandler.cpp:
    (WebCore::JSErrorHandler::handleEvent):
    Use JSMainThreadExecState instead of JSC::call.
    * bindings/js/JSHTMLDocumentCustom.cpp:
    (WebCore::JSHTMLDocument::open):
    Use JSMainThreadExecState instead of JSC::call.
    * bindings/js/JSMainThreadExecState.cpp:
    (WebCore::JSMainThreadExecState::didLeaveScriptContext):
    * bindings/js/JSMainThreadExecState.h:
    (WebCore::JSMainThreadExecState::JSMainThreadExecState):
    Increment a static recursion level counter.
    (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
    Decrement a static recursion level counter and, if we are
    at zero (the outermost script invocation), deliver any
    outstanding mutation records.
    * bindings/js/JSNodeFilterCondition.cpp:
    (WebCore::JSNodeFilterCondition::acceptNode):
    Use JSMainThreadExecState instead of JSC::call.
    * bindings/js/JSWebKitMutationObserverCustom.cpp:
    (WebCore::JSWebKitMutationObserver::observe):
    Fix JSDictionary logic, add support for attributeFilter.
    
    Tools:
    
    * DumpRenderTree/mac/EventSendingController.mm: Add support for
    eventSender.scheduleAsynchronousKeyDown.
    (+[EventSendingController isSelectorExcludedFromWebScript:]):
    (+[EventSendingController webScriptNameForSelector:]):
    (-[EventSendingController keyDownWrapper:withModifiers:withLocation:]):
    (-[EventSendingController scheduleAsynchronousKeyDown:withModifiers:withLocation:]):
    * Scripts/build-webkit: Properly alphabetize --mutation-observers in the --help output.
    
    LayoutTests:
    
    With the various fixes in this change, 8/10 tests in fast/mutation
    pass under WebKit/Mac. Of the failing tests, only one is due to
    a deficiency in the Mac port's code (end-of-task-delivery.html);
    the other is due to lack of support for a feature (FILE_SYSTEM)
    exercised by the test (non-event-delivery.html).
    
    * fast/mutation/non-event-delivery.html: Made it fail fast if FileSystem support isn't available.
    * fast/mutation/observe-attributes.html: Fixed calls to removeEventListener.
    * fast/mutation/observe-characterdata.html: ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    82abc774