After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 636975 - Fix crash when using url in inline styles
Fix crash when using url in inline styles
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-12-10 16:31 UTC by Ray Strode [halfline]
Modified: 2010-12-13 16:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
StThemeNode: handle url() in inline styles better (3.57 KB, patch)
2010-12-10 16:31 UTC, Ray Strode [halfline]
committed Details | Review
StThemeNode: handle url() in inline styles better (3.57 KB, patch)
2010-12-13 16:54 UTC, Ray Strode [halfline]
committed Details | Review

Description Ray Strode [halfline] 2010-12-10 16:31:27 UTC
Right now if you use background-image: url(...) inside an
inline style in the javascript code it causes a crash.
Comment 1 Ray Strode [halfline] 2010-12-10 16:31:29 UTC
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.
Comment 2 Ray Strode [halfline] 2010-12-10 16:35:15 UTC
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" ?
Comment 3 Jason Clinton 2010-12-10 17:22:51 UTC
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
Comment 4 Owen Taylor 2010-12-13 16:36:53 UTC
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.
Comment 5 Ray Strode [halfline] 2010-12-13 16:54:11 UTC
The following fix has been pushed:
c648a5f StThemeNode: handle url() in inline styles better
Comment 6 Ray Strode [halfline] 2010-12-13 16:54:19 UTC
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.