GNOME Bugzilla – Bug 636975
Fix crash when using url in inline styles
Last modified: 2010-12-13 16:54:19 UTC
Right now if you use background-image: url(...) inside an inline style in the javascript code it causes a crash.
Created attachment 176189 [details] [review] StThemeNode: handle url() in inline styles better non-absolute paths specified as url()'s in stylesheets are resolved to be relative to the location of the stylesheets they are in. Inline styles don't have physical styleshseets sitting on disk, which leads to a crash in the url resolving code. This commit ensures that we don't try to use the stylesheet associated with a url, if there isn't one to use. This commit doesn't try to handle relative paths in inline styles. It only prevents crashes when absolute paths are used.
one open question is how we should handle relative urls for inline styles. relative to the javascript file? to the current working directory? or do we just say "don't do that" ?
In HTML, JavaScript modifies the DOM and then the computed styles take in to account the properties of DOM objects. Relative URL's are computed relative to the absolute path of the DOM. In this analogy, the DOM is the Shell scene. And the entire Shell scene, like a DOM, should share an absolute path against which relative URL's are computed. It seems like that absolute path should be $PREFIX/share/gnome-shell
Review of attachment 176189 [details] [review]: Patch looks good. I think we should just leave it this way with a g_warning ("Can't get base to resolve url '%s'", url); warning. We could add a st_theme_set_base() but it's not clear to me that resolving image URI's agaist some default URI for all of GNOME Shell actually is that useful.
The following fix has been pushed: c648a5f StThemeNode: handle url() in inline styles better
Created attachment 176347 [details] [review] StThemeNode: handle url() in inline styles better non-absolute paths specified as url()'s in stylesheets are resolved to be relative to the location of the stylesheets they are in. Inline styles don't have physical styleshseets sitting on disk, which leads to a crash in the url resolving code. This commit ensures that we don't try to use the stylesheet associated with a url, if there isn't one to use. This commit doesn't try to handle relative paths in inline styles. It only prevents crashes when absolute paths are used.