nsCOMPtr<nsIPrefBranch> prefs = do_QueryInterface(subject, &rv);
nsCOMPtr<nsIPref> prefs = do_QueryInterface(subject, &rv);
nsCachePrefObserver::Observe(nsISupports *     subject,                             const PRUnichar * topic,                             const PRUnichar * data){    nsresult rv;    if (NS_LITERAL_STRING("nsPref:changed").Equals(topic)) {        nsCOMPtr<nsIPrefBranch> prefs = do_QueryInterface(subject, &rv);        if (NS_FAILED(rv)) return rv;        // which preference changed?        if (NS_LITERAL_STRING(ENABLE_DISK_CACHE_PREF).Equals(data)) {            rv = prefs->GetBoolPref(ENABLE_DISK_CACHE_PREF, &mDiskCacheEnabled);        } else if (NS_LITERAL_STRING(ENABLE_MEMORY_CACHE_PREF).Equals(data)) {            rv = prefs->GetBoolPref(ENABLE_MEMORY_CACHE_PREF, &mMemoryCacheEnabled);        }        if (NS_FAILED(rv)) return rv;        nsCacheService::GlobalInstance()->SetCacheDevicesEnabled(mDiskCacheEnabled,                                                                 mMemoryCacheEnabled);    }        return NS_OK;}