Title: [107149] trunk/Source/WebCore
- Revision
- 107149
- Author
- [email protected]
- Date
- 2012-02-08 16:24:07 -0800 (Wed, 08 Feb 2012)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (107148 => 107149)
--- trunk/Source/WebCore/ChangeLog 2012-02-09 00:21:20 UTC (rev 107148)
+++ trunk/Source/WebCore/ChangeLog 2012-02-09 00:24:07 UTC (rev 107149)
@@ -1,3 +1,29 @@
+2012-02-08 Adam Klein <[email protected]>
+
+ 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):
+
2012-02-08 Kentaro Hara <[email protected]>
Remove [ConvertToString] from CodeGeneratorCPP.pm and rename
Modified: trunk/Source/WebCore/bindings/js/JSMainThreadExecState.cpp (107148 => 107149)
--- trunk/Source/WebCore/bindings/js/JSMainThreadExecState.cpp 2012-02-09 00:21:20 UTC (rev 107148)
+++ trunk/Source/WebCore/bindings/js/JSMainThreadExecState.cpp 2012-02-09 00:24:07 UTC (rev 107149)
@@ -32,8 +32,6 @@
JSC::ExecState* JSMainThreadExecState::s_mainThreadState = 0;
#if ENABLE(MUTATION_OBSERVERS)
-int JSMainThreadExecState::s_recursionLevel = 0;
-
void JSMainThreadExecState::didLeaveScriptContext()
{
WebKitMutationObserver::deliverAllMutations();
Modified: trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h (107148 => 107149)
--- trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h 2012-02-09 00:21:20 UTC (rev 107148)
+++ trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h 2012-02-09 00:24:07 UTC (rev 107149)
@@ -91,21 +91,20 @@
{
ASSERT(isMainThread());
s_mainThreadState = exec;
-
-#if ENABLE(MUTATION_OBSERVERS)
- ASSERT(s_recursionLevel >= 0);
- ++s_recursionLevel;
-#endif
};
~JSMainThreadExecState()
{
ASSERT(isMainThread());
+
+#if ENABLE(MUTATION_OBSERVERS)
+ bool didExitJavaScript = s_mainThreadState && !m_previousState;
+#endif
+
s_mainThreadState = m_previousState;
#if ENABLE(MUTATION_OBSERVERS)
- ASSERT(s_recursionLevel > 0);
- if (!--s_recursionLevel)
+ if (didExitJavaScript)
didLeaveScriptContext();
#endif
}
@@ -116,11 +115,11 @@
#if ENABLE(MUTATION_OBSERVERS)
static void didLeaveScriptContext();
- static int s_recursionLevel;
#endif
};
// Null state prevents origin security checks.
+// Used by non-_javascript_ bindings (ObjC, GObject).
class JSMainThreadNullState : private JSMainThreadExecState {
public:
explicit JSMainThreadNullState() : JSMainThreadExecState(0) {};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes