2006-10-20 Anders Carlsson <acarlsson@apple.com>
Reviewed by Geoff.
* bindings/js/kjs_window.cpp:
(KJS::Window::timerFired):
Check if the timeout id is still in the table before trying to access it. If it isn't in the table
it has been deleted inside of the execute method.
LayoutTests:
2006-10-20 Anders Carlsson <acarlsson@apple.com>
Reviewed by Goeff.
Add test case for timer crash.
* fast/dom/timer-clear-interval-in-handler-expected.txt: Added.
* fast/dom/timer-clear-interval-in-handler.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17173
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-10-20 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Gøff.
+
+ Add test case for timer crash.
+
+ * fast/dom/timer-clear-interval-in-handler-expected.txt: Added.
+ * fast/dom/timer-clear-interval-in-handler.html: Added.
+
2006-10-20 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth, approved in principle by Adele, who couldn't be troubled
--- /dev/null
+This tests that removing an interval timer inside of its timeout handler does not cause a crash. Success, didn't crash!
--- /dev/null
+<html>
+<head>
+<script>
+ function timeoutHandler() {
+ // Invoke it a few times so that we get the nesting
+ count++;
+
+ if (count > 10) {
+ clearInterval(intervalID);
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ }
+
+ var intervalID;
+ var count = 0;
+
+ function runTests() {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText()
+ layoutTestController.waitUntilDone();
+ }
+
+ intervalID = setInterval(timeoutHandler, 1);
+ }
+ </script>
+</head>
+<body onload="runTests()">
+ This tests that removing an interval timer inside of its timeout handler does not cause a crash. Success, didn't crash!
+</body>
+</html>
+2006-10-20 Anders Carlsson <acarlsson@apple.com>
+
+ Reviewed by Geoff.
+
+ * bindings/js/kjs_window.cpp:
+ (KJS::Window::timerFired):
+ Check if the timeout id is still in the table before trying to access it. If it isn't in the table
+ it has been deleted inside of the execute method.
+
2006-10-20 Anders Carlsson <acarlsson@apple.com>
Reviewed by Darin and Geoff.
{
// Simple case for non-one-shot timers.
if (timer->isActive()) {
+ int timeoutId = timer->timeoutId();
+
timer->action()->execute(this);
- if (timer->repeatInterval() && timer->repeatInterval() < cMinimumTimerInterval) {
+ if (m_timeouts.contains(timeoutId) && timer->repeatInterval() && timer->repeatInterval() < cMinimumTimerInterval) {
timer->setNestingLevel(timer->nestingLevel() + 1);
if (timer->nestingLevel() >= cMaxTimerNestingLevel)
timer->augmentRepeatInterval(cMinimumTimerInterval - timer->repeatInterval());