Bug 1029981 - Observers should use MOZ_UTF16 to compare someData. r=nfroyd
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 27 Jun 2014 17:08:13 +0900
changeset 191149 a2f064eaa41ab2b495f6de2e15a8dda1e7e2ae6e
parent 191148 3a1f1bf7edb9003e1944d01592fa37f79ac2fb21
child 191150 607b665127e75417123dc69728f632769fb9d06d
push id27031
push usercbook@mozilla.com
push dateFri, 27 Jun 2014 13:34:56 +0000
treeherdermozilla-central@cc7244eea5d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnfroyd
bugs1029981
milestone33.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 1029981 - Observers should use MOZ_UTF16 to compare someData. r=nfroyd
dom/base/nsGlobalWindow.cpp
dom/devicestorage/nsDeviceStorage.cpp
image/src/imgLoader.cpp
rdf/datasource/src/nsLocalStore.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -11397,17 +11397,17 @@ nsGlobalWindow::Observe(nsISupports* aSu
     event->SetTrusted(true);
 
     bool dummy;
     return DispatchEvent(event, &dummy);
   }
 #endif // MOZ_B2G
 
   if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
-    MOZ_ASSERT(!nsCRT::strcmp(NS_ConvertUTF16toUTF8(aData).get(), "intl.accept_languages"));
+    MOZ_ASSERT(!NS_strcmp(aData, MOZ_UTF16("intl.accept_languages")));
     MOZ_ASSERT(IsInnerWindow());
 
     // The user preferred languages have changed, we need to fire an event on
     // Window object and invalidate the cache for navigator.languages. It is
     // done for every change which can be a waste of cycles but those should be
     // fairly rare.
     // We MUST invalidate navigator.languages before sending the event in the
     // very likely situation where an event handler will try to read its value.
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -4229,19 +4229,19 @@ nsDOMDeviceStorage::Observe(nsISupports 
   }
   if (!strcmp(aTopic, "disk-space-watcher")) {
     // 'disk-space-watcher' notifications are sent when there is a modification
     // of a file in a specific location while a low device storage situation
     // exists or after recovery of a low storage situation. For Firefox OS,
     // these notifications are specific for apps storage.
     nsRefPtr<DeviceStorageFile> file =
       new DeviceStorageFile(mStorageType, mStorageName);
-    if (!strcmp(NS_ConvertUTF16toUTF8(aData).get(), "full")) {
+    if (!NS_strcmp(aData, MOZ_UTF16("full"))) {
       Notify("low-disk-space", file);
-    } else if (!strcmp(NS_ConvertUTF16toUTF8(aData).get(), "free")) {
+    } else if (!NS_strcmp(aData, MOZ_UTF16("free"))) {
       Notify("available-disk-space", file);
     }
     return NS_OK;
   }
 
 #ifdef MOZ_WIDGET_GONK
   else if (!strcmp(aTopic, NS_VOLUME_STATE_CHANGED)) {
     // We invalidate the used space cache for the volume that actually changed
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -1071,17 +1071,17 @@ imgLoader::RespectPrivacyNotifications()
   return NS_OK;
 }
 
 NS_IMETHODIMP
 imgLoader::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData)
 {
   // We listen for pref change notifications...
   if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
-    if (!strcmp(NS_ConvertUTF16toUTF8(aData).get(), "image.http.accept")) {
+    if (!NS_strcmp(aData, MOZ_UTF16("image.http.accept"))) {
       ReadAcceptHeaderPref();
     }
 
   } else if (strcmp(aTopic, "memory-pressure") == 0) {
     MinimizeCaches();
   } else if (strcmp(aTopic, "chrome-flush-skin-caches") == 0 ||
              strcmp(aTopic, "chrome-flush-caches") == 0) {
     MinimizeCaches();
--- a/rdf/datasource/src/nsLocalStore.cpp
+++ b/rdf/datasource/src/nsLocalStore.cpp
@@ -470,17 +470,17 @@ LocalStoreImpl::Observe(nsISupports *aSu
             if (remote)
                 remote->Flush();
         }
 
         // Create an in-memory datasource for use while we're
         // profile-less.
         mInner = do_CreateInstance(NS_RDF_DATASOURCE_CONTRACTID_PREFIX "in-memory-datasource");
 
-        if (!nsCRT::strcmp(NS_ConvertUTF16toUTF8(someData).get(), "shutdown-cleanse")) {
+        if (!NS_strcmp(someData, MOZ_UTF16("shutdown-cleanse"))) {
             nsCOMPtr<nsIFile> aFile;
             rv = NS_GetSpecialDirectory(NS_APP_LOCALSTORE_50_FILE, getter_AddRefs(aFile));
             if (NS_SUCCEEDED(rv))
                 rv = aFile->Remove(false);
         }
     }
     else if (!nsCRT::strcmp(aTopic, "profile-do-change")) {
         rv = LoadData();