summaryrefslogtreecommitdiff
path: root/Base
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-09-11 18:37:18 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-11 18:42:43 +0200
commitb62043dbca047cb83aa6acd3d9b6bd65c54ef15e (patch)
treec78822c27572e683ea90b10cab0441d87335ba56 /Base
parent71092226bd0f705e499146aa3ffde166762c2e87 (diff)
downloadserenity-b62043dbca047cb83aa6acd3d9b6bd65c54ef15e.zip
LibWeb: Protect LayoutCheckBox against crashes after event dispatch
After dispatching a "change" event due to the checked state being modified, we may have been removed from the layout tree. Make LayoutCheckBox protect itself to prevent this from crashing. Also, add a little test page for checkboxes. :^)
Diffstat (limited to 'Base')
-rw-r--r--Base/res/html/misc/checkbox.html11
-rw-r--r--Base/res/html/misc/welcome.html1
2 files changed, 12 insertions, 0 deletions
diff --git a/Base/res/html/misc/checkbox.html b/Base/res/html/misc/checkbox.html
new file mode 100644
index 0000000000..86b8198b0c
--- /dev/null
+++ b/Base/res/html/misc/checkbox.html
@@ -0,0 +1,11 @@
+<html>
+ <input id=foo type=checkbox> This is a checkbox
+ <pre id=bar></pre>
+ <script>
+ var foo = document.getElementById("foo");
+ var bar = document.getElementById("bar");
+ foo.addEventListener("change", function() {
+ bar.innerHTML += foo.checked + "\n";
+ });
+ </script>
+</html>
diff --git a/Base/res/html/misc/welcome.html b/Base/res/html/misc/welcome.html
index 3d5046bb30..3016ccb2f7 100644
--- a/Base/res/html/misc/welcome.html
+++ b/Base/res/html/misc/welcome.html
@@ -31,6 +31,7 @@ span#ua {
<p>Your user agent is: <b><span id="ua"></span></b></p>
<p>Some small test pages:</p>
<ul>
+ <li><a href="checkbox.html">checkbox</a></li>
<li><a href="canvas-rotate.html">canvas rotate()</a></li>
<li><a href="margin-collapse-2.html">margin collapsing 2</a></li>
<li><a href="margin-collapse-1.html">margin collapsing 1</a></li>