⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 107149 in webkit


Ignore:
Timestamp:
Feb 8, 2012, 4:24:07 PM (15 years ago)
Author:
adamk@chromium.org
Message:

Simplify and correct mutation delivery timing for JSC
https://bugs.webkit.org/show_bug.cgi?id=78172

Reviewed by Adam Barth.

Instead of keeping a static recursion counter in JSMainThreadExecState,
simply wait for a state change from non-null ExecState to null ExecState.
Because s_mainThreadState is initially null, this equivalent to
waiting for s_recursionLevel to rewind to zero.

This also properly handles the usage of JSMainThreadNullState (and
does not do mutation delivery), since that class is only used by
non-JS bindings. Now fast/mutation/end-of-task-delivery.html properly
fails, whereas it was passing before due to usage of the ObjC DOM API
from DumpRenderTree.

  • bindings/js/JSMainThreadExecState.cpp:

(WebCore):

  • bindings/js/JSMainThreadExecState.h: Added a comment explaining the purpose of JSMainThreadNullState.

(WebCore::JSMainThreadExecState::JSMainThreadExecState):
(WebCore::JSMainThreadExecState::~JSMainThreadExecState):
(JSMainThreadExecState):
(WebCore):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107148 r107149  
     12012-02-08  Adam Klein  <adamk@chromium.org>
     2
     3        Simplify and correct mutation delivery timing for JSC
     4        https://bugs.webkit.org/show_bug.cgi?id=78172
     5
     6        Reviewed by Adam Barth.
     7
     8        Instead of keeping a static recursion counter in JSMainThreadExecState,
     9        simply wait for a state change from non-null ExecState to null ExecState.
     10        Because s_mainThreadState is initially null, this equivalent to
     11        waiting for s_recursionLevel to rewind to zero.
     12
     13        This also properly handles the usage of JSMainThreadNullState (and
     14        does not do mutation delivery), since that class is only used by
     15        non-JS bindings. Now fast/mutation/end-of-task-delivery.html properly
     16        fails, whereas it was passing before due to usage of the ObjC DOM API
     17        from DumpRenderTree.
     18
     19        * bindings/js/JSMainThreadExecState.cpp:
     20        (WebCore):
     21        * bindings/js/JSMainThreadExecState.h: Added a comment explaining the purpose of JSMainThreadNullState.
     22        (WebCore::JSMainThreadExecState::JSMainThreadExecState):
     23        (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
     24        (JSMainThreadExecState):
     25        (WebCore):
     26
    1272012-02-08  Kentaro Hara  <haraken@chromium.org>
    228
  • trunk/Source/WebCore/bindings/js/JSMainThreadExecState.cpp

    r107008 r107149  
    3333
    3434#if ENABLE(MUTATION_OBSERVERS)
    35 int JSMainThreadExecState::s_recursionLevel = 0;
    36 
    3735void JSMainThreadExecState::didLeaveScriptContext()
    3836{
  • trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h

    r107008 r107149  
    9292        ASSERT(isMainThread());
    9393        s_mainThreadState = exec;
    94 
    95 #if ENABLE(MUTATION_OBSERVERS)
    96         ASSERT(s_recursionLevel >= 0);
    97         ++s_recursionLevel;
    98 #endif
    9994    };
    10095
     
    10297    {
    10398        ASSERT(isMainThread());
     99
     100#if ENABLE(MUTATION_OBSERVERS)
     101        bool didExitJavaScript = s_mainThreadState && !m_previousState;
     102#endif
     103
    104104        s_mainThreadState = m_previousState;
    105105
    106106#if ENABLE(MUTATION_OBSERVERS)
    107         ASSERT(s_recursionLevel > 0);
    108         if (!--s_recursionLevel)
     107        if (didExitJavaScript)
    109108            didLeaveScriptContext();
    110109#endif
     
    117116#if ENABLE(MUTATION_OBSERVERS)
    118117    static void didLeaveScriptContext();
    119     static int s_recursionLevel;
    120118#endif
    121119};
    122120
    123121// Null state prevents origin security checks.
     122// Used by non-JavaScript bindings (ObjC, GObject).
    124123class JSMainThreadNullState : private JSMainThreadExecState {
    125124public:
Note: See TracChangeset for help on using the changeset viewer.