GNOME Bugzilla – Bug 650298
messageTray: improve bad-markup handling
Last modified: 2011-07-27 13:32:55 UTC
split out from bug 649385 since this is a good fix to have in even if the other stuff there isn't ready/isn't wanted.
Created attachment 187897 [details] [review] messageTray: improve bad-markup handling _fixMarkup() was supposed to be ensuring that the markup we passed to clutter was correct, but it was validating the syntax incorrectly, and wasn't checking that the markup was valid (or even well-formed). This is bad because if you pass bad pango markup to clutter_text_set_markup(), it will g_warn and drop the string on the floor. Fix by fixing up the regexps, and then calling Pango.parse_markup() on the result, and just xml-escaping everything if parse_markup() fails.
Review of attachment 187897 [details] [review]: Urgh. Can we get some example test cases for this? We don't really have a good way to run js unit tests right now I guess, but a few commented examples of what _fixMarkup is supposed to take as input and return as output would be *really* helpful for review and future bugfixes.
Created attachment 188108 [details] [review] tests: fix up typelib include paths The js modules have so many imports back and forth that it's pretty much guaranteed that if you import even one of them, you'll end up importing all of them, including ui.status.bluetooth and ui.status.network. So fix up the typelib include paths the same way gnome-shell-jhbuild does, so we can find everything.
Created attachment 188109 [details] [review] tests: add a test for MessageTray._fixMarkup
Review of attachment 188108 [details] [review]: ::: tests/run-test.sh.in @@ -31,3 @@ srcdir=`cd $srcdir && pwd` -GI_TYPELIB_PATH="@MUTTER_TYPELIB_DIR@:$builddir/../src" UPowerGlib was removed from gnome-shell.modules in favour to system one. /usr/{lib64,lib}/girepository-1.0 should be in GI_TYPELIB_PATH.
Review of attachment 188109 [details] [review]: looks good ::: tests/unit/markup.js @@ +86,3 @@ + +// stray '&'; this is really a bug, but it's easier to do it this way +assertConverts('<b>this</b> & <i>that</i>', '<b>this</b> & <i>that</i>'); trailing whitespace
Created attachment 192667 [details] [review] tests: fix up typelib include paths The UPowerGLib change shouldn't affect anything; g-i looks in the system dirs anyway. But the code was failing to use the existing value of GI_TYPE_LIB_PATH, so fix that.
Created attachment 192668 [details] [review] tests: add a test for MessageTray._fixMarkup fix trailing whitespace
Attachment 187897 [details] pushed as 7542e68 - messageTray: improve bad-markup handling Attachment 192667 [details] pushed as 0907f03 - tests: fix up typelib include paths Attachment 192668 [details] pushed as f03793b - tests: add a test for MessageTray._fixMarkup