Changes by Darin. Layout tests by me. Reviewed by me.
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jun 2005 18:20:04 +0000 (18:20 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jun 2005 18:20:04 +0000 (18:20 +0000)
Fixed <rdar://problem/4152454> crash in KJS::ExprStatementNode::execute(KJS::ExecState*) in World Clock widget with TOT.

        Test cases added:
        * layout-tests/fast/dom/gc-4-expected.txt: Added.
        * layout-tests/fast/dom/gc-4.html: Added.

        * khtml/ecma/kjs_html.cpp:
        (KJS::Context2D::mark): mark now (1) checks for NULL pointers and (2)
calls mark on its parent class (DOMObject::mark).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9440 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/fast/dom/gc-4-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/gc-4.html [new file with mode: 0644]
WebCore/ChangeLog-2005-08-23
WebCore/khtml/ecma/kjs_html.cpp

diff --git a/LayoutTests/fast/dom/gc-4-expected.txt b/LayoutTests/fast/dom/gc-4-expected.txt
new file mode 100644 (file)
index 0000000..a600092
--- /dev/null
@@ -0,0 +1,6 @@
+This test checks for a regression against rdar://problem/4152454 crash in KJS::ExprStatementNode::execute(KJS::ExecState*) in World Clock widget with TOT. The original bug occurred because some objects did not properly mark themselves, and so the garbage collector prematurely destroyed them.
+
+If the test passes, you will see the word "passed" below. Otherwise, it will crash.
+
+
+passed
diff --git a/LayoutTests/fast/dom/gc-4.html b/LayoutTests/fast/dom/gc-4.html
new file mode 100644 (file)
index 0000000..5f16b54
--- /dev/null
@@ -0,0 +1,33 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<script type='text/javascript' charset='utf-8'>
+function print(message) {
+       var paragraph = document.createElement("p");
+       paragraph.appendChild(document.createTextNode(message));
+       document.getElementById("console").appendChild(paragraph);
+}
+
+function test() {
+       if (window.layoutTestController) {
+               layoutTestController.dumpAsText();
+       }
+
+       for (x = 0; x < 1000; x++) {
+               var canvas = document.getElementById("canvas");
+               var context = canvas.getContext("2d");
+               context.save();
+       }
+       
+       print("passed");
+}
+</script>
+</head>
+<body onload="test();">
+<p>This test checks for a regression against <i>rdar://problem/4152454 crash in KJS::ExprStatementNode::execute(KJS::ExecState*) in World Clock widget with TOT</i>. The original bug occurred because some objects did not properly mark themselves, and so the garbage collector prematurely destroyed them.</p>
+<p>If the test passes, you will see the word "passed" below. Otherwise, it will crash.</p>
+<hr>
+<canvas id='canvas' width='172' height='172'/>
+<div id='console'/>
+</body>
+</html>
index 5b8029969dcfaf82a7697d5e209bf5a1aa78ba62..5291676683eb8dc21241d9db1c79fafca10c5131 100644 (file)
@@ -1,3 +1,17 @@
+2005-06-20  Geoffrey Garen  <ggaren@apple.com>
+
+        Changes by Darin. Layout tests by me. Reviewed by me.
+
+       Fixed <rdar://problem/4152454> crash in KJS::ExprStatementNode::execute(KJS::ExecState*) in World Clock widget with TOT.
+
+        Test cases added: 
+        * layout-tests/fast/dom/gc-4-expected.txt: Added.
+        * layout-tests/fast/dom/gc-4.html: Added.
+
+        * khtml/ecma/kjs_html.cpp: 
+        (KJS::Context2D::mark): mark now (1) checks for NULL pointers and (2) 
+       calls mark on its parent class (DOMObject::mark).
+
 2005-06-19  Darin Adler  <darin@apple.com>
 
         Changes by both Anders Carlsson and me.
index 155066ce8c8ad8d5d06824b3097b7695ee51e9fc..bc278bf6d25ed85981d35784ee10d59ad3f5f37c 100644 (file)
@@ -4806,51 +4806,51 @@ void Context2D::mark()
     ValueImp *v;
 
     v = _strokeStyle;
-    if (!v->marked())
+    if (v && !v->marked())
         v->mark();
 
     v = _fillStyle;
-    if (!v->marked())
+    if (v && !v->marked())
         v->mark();
 
     v = _lineWidth;
-    if (!v->marked())
+    if (v && !v->marked())
         v->mark();
 
     v = _lineCap;
-    if (!v->marked())
+    if (v && !v->marked())
         v->mark();
 
     v = _lineJoin;
-    if (!v->marked())
+    if (v && !v->marked())
         v->mark();
 
     v = _miterLimit;
-    if (!v->marked())
+    if (v && !v->marked())
         v->mark();
 
     v = _shadowOffsetX;
-    if (!v->marked())
+    if (v && !v->marked())
         v->mark();
 
     v = _shadowOffsetY;
-    if (!v->marked())
+    if (v && !v->marked())
         v->mark();
 
     v = _shadowBlur;
-    if (!v->marked())
+    if (v && !v->marked())
         v->mark();
 
     v = _shadowColor;
-    if (!v->marked())
+    if (v && !v->marked())
         v->mark();
 
     v = _globalAlpha;
-    if (!v->marked())
+    if (v && !v->marked())
         v->mark();
 
-    v = _globalComposite;;
-    if (!v->marked())
+    v = _globalComposite;
+    if (v && !v->marked())
         v->mark();
 
     QPtrListIterator<List> it(stateStack);
@@ -4859,6 +4859,8 @@ void Context2D::mark()
         list->mark();
         ++it;
     }
+    
+    DOMObject::mark();
 }
 
 const ClassInfo KJS::Gradient::info = { "Gradient", 0, &GradientTable, 0 };