Bug 749739 - New email sound notification file cannot contain spaces (Linux - Thunderbird 12). r=karlt
authorWolfgang Rosenauer <wr@rosenauer.org>
Wed, 09 May 2012 13:27:02 +0200
changeset 93595 7944b9f572136c57c33b7d80eaedcff22368137e
parent 93594 24084a8197f2b149be82607adbdf4eb7a532d930
child 93596 a5f65e97ed90db5b1ba2c6eb39355df20f1ac468
child 93610 8789a1dc555dc9806f897221dcd4f108a2838d2c
push id22646
push useremorley@mozilla.com
push dateWed, 09 May 2012 14:40:08 +0000
treeherdermozilla-central@d3f81d81f664 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs749739
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 749739 - New email sound notification file cannot contain spaces (Linux - Thunderbird 12). r=karlt
widget/gtk2/nsSound.cpp
--- a/widget/gtk2/nsSound.cpp
+++ b/widget/gtk2/nsSound.cpp
@@ -354,23 +354,28 @@ NS_METHOD nsSound::Play(nsIURL *aURL)
     bool isFile;
     nsresult rv = aURL->SchemeIs("file", &isFile);
     if (NS_SUCCEEDED(rv) && isFile) {
         ca_context* ctx = ca_context_get_default();
         if (!ctx) {
             return NS_ERROR_OUT_OF_MEMORY;
         }
 
-        nsCAutoString path;
-        rv = aURL->GetPath(path);
+        nsCAutoString spec;
+        rv = aURL->GetSpec(spec);
         if (NS_FAILED(rv)) {
             return rv;
         }
+        gchar *path = g_filename_from_uri(spec.get(), NULL, NULL);
+        if (!path) {
+            return NS_ERROR_FILE_UNRECOGNIZED_PATH;
+        }
 
-        ca_context_play(ctx, 0, "media.filename", path.get(), NULL);
+        ca_context_play(ctx, 0, "media.filename", path, NULL);
+        g_free(path);
     } else {
         nsCOMPtr<nsIStreamLoader> loader;
         rv = NS_NewStreamLoader(getter_AddRefs(loader), aURL, this);
     }
 
     return rv;
 }