Version: 3.5.9 (using KDE 3.5.9) Installed from: Debian testing/unstable Packages Compiler: gcc version 4.3.1 (Debian 4.3.1-2) Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-2' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu OS: Linux In the test case below, the alert('done') does not occur due to a javascript crash of some sort. Although the insertRule is useless with a blank rule body, it shouldn't die completely. Including a comment between the {/*comme ca*/} also fails, as does an {;}, so I assume it is just if there isn't a valid rule there. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>insertRule test</title> <style type="text/css">/*empty stylesheet*/</style> </head> <!-- <body onload="document.styleSheets[0].insertRule('body {font-weight: bold;}',0);alert('done');"> --> <body onload="document.styleSheets[0].insertRule('body {}',0);alert('done');">--> Minimal test </html>
A bunch of things wrong here here: 1) ruleset: parsing returns 0 for {}, not an empty CSSStyleRuleImpl. I don't think that's correct CSS OM-wise, really. 2) We can't tell an empty parse from a parse error. Of course, given the forward compat stuff, one would have to tell the recoverable errors from non-recoverable... Don't know about CSS parser enough to do it myself. More detailed testcase, also shows a seeming IceWeasel 3 bug (which might not be a bug based on details of forward-compatible parsing rule): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>insertRule test</title> <style type="text/css">/*empty stylesheet*/</style> </head> <script> function tryAdd(css) { try { document.styleSheets[0].insertRule(css, 0); alert("Add of " + css + " ok, length now:" + document.styleSheets[0].cssRules.length); } catch (e) { alert("Add of " + css + " failed with exception:" + e); } } function test() { tryAdd("body {font-weight: bold; }"); tryAdd("body {}"); tryAdd("xyz"); tryAdd("{"); tryAdd("foo{"); tryAdd("@export"); } </script> <body onload="test()"> Minimal test </html>
Thank you for the bug report. As this report hasn't seen any changes in 10 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved.
Dear user, KHTML (and KJS) was a long time more or less unmaintained and got removed in KF6. Please migrate to use a QWebEngine based HTML component. We will do no further fixes or improvements to the KF5 branches of these components beside important security fixes. For security issues, please see: https://kde.org/info/security/ Sorry that we did not fix this issue during the life-time of KHTML. Greetings Christoph Cullmann