本文整理汇总了C++中nsAString::SetIsVoid方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAString::SetIsVoid方法的具体用法?C++ nsAString::SetIsVoid怎么用?C++ nsAString::SetIsVoid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAString
的用法示例。
在下文中一共展示了nsAString::SetIsVoid方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cManufacturer
nsresult
GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
int32_t *aStatus,
nsAString & aSuggestedDriverVersion,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS /* = nullptr */)
{
NS_ENSURE_ARG_POINTER(aStatus);
aSuggestedDriverVersion.SetIsVoid(true);
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
OperatingSystem os = mOS;
if (aOS)
*aOS = os;
EnsureInitializedFromGfxInfoData();
if (!mError.IsEmpty()) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
// Don't evaluate special cases when evaluating the downloaded blocklist.
if (aDriverInfo.IsEmpty()) {
if (aFeature == FEATURE_WEBGL_OPENGL) {
if (mRenderer.Find("Adreno 200") != -1 ||
mRenderer.Find("Adreno 205") != -1)
{
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
if (mHardware.Equals(NS_LITERAL_STRING("ville"))) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
}
if (aFeature == FEATURE_STAGEFRIGHT) {
NS_LossyConvertUTF16toASCII cManufacturer(mManufacturer);
NS_LossyConvertUTF16toASCII cModel(mModel);
if (CompareVersions(mOSVersion.get(), "2.2.0") >= 0 &&
CompareVersions(mOSVersion.get(), "2.3.0") < 0)
{
// Froyo LG devices are whitelisted.
// All other Froyo
bool isWhitelisted =
cManufacturer.Equals("lge", nsCaseInsensitiveCStringComparator());
if (!isWhitelisted) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
}
else if (CompareVersions(mOSVersion.get(), "2.3.0") >= 0 &&
CompareVersions(mOSVersion.get(), "2.4.0") < 0)
{
// Gingerbread HTC devices are whitelisted.
// Gingerbread Samsung devices are whitelisted.
// All other Gingerbread devices are blacklisted.
bool isWhitelisted =
cManufacturer.Equals("htc", nsCaseInsensitiveCStringComparator()) ||
cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator());
if (!isWhitelisted) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
}
else if (CompareVersions(mOSVersion.get(), "3.0.0") >= 0 &&
CompareVersions(mOSVersion.get(), "4.0.0") < 0)
{
// Honeycomb Samsung devices are whitelisted.
// All other Honeycomb devices are blacklisted.
bool isWhitelisted =
cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator());
if (!isWhitelisted) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
}
else if (CompareVersions(mOSVersion.get(), "4.0.0") < 0)
{
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
return NS_OK;
}
else if (CompareVersions(mOSVersion.get(), "4.1.0") < 0)
{
bool isWhitelisted =
cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator()) ||
cModel.Equals("galaxy nexus", nsCaseInsensitiveCStringComparator()); // some Galaxy Nexus have manufacturer=amazon
if (!isWhitelisted) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
}
}
}
//.........这里部分代码省略.........
示例2: cManufacturer
nsresult
GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
int32_t *aStatus,
nsAString &aSuggestedDriverVersion,
const nsTArray<GfxDriverInfo>& aDriverInfo,
nsACString &aFailureId,
OperatingSystem* aOS /* = nullptr */)
{
NS_ENSURE_ARG_POINTER(aStatus);
aSuggestedDriverVersion.SetIsVoid(true);
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
OperatingSystem os = mOS;
if (aOS)
*aOS = os;
// OpenGL layers are never blacklisted on Android.
// This early return is so we avoid potentially slow
// GLStrings initialization on startup when we initialize GL layers.
if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS) {
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
return NS_OK;
}
EnsureInitialized();
if (mGLStrings->Vendor().IsEmpty() || mGLStrings->Renderer().IsEmpty()) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
// Don't evaluate special cases when evaluating the downloaded blocklist.
if (aDriverInfo.IsEmpty()) {
if (aFeature == nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION) {
if (mSDKVersion < 11) {
// It's slower than software due to not having a compositing fast path
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
aFailureId = "FEATURE_FAILURE_CANVAS_2D_SDK";
} else if (mGLStrings->Renderer().Find("Vivante GC1000") != -1) {
// Blocklist Vivante GC1000. See bug 1248183.
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
aFailureId = "FEATURE_FAILED_CANVAS_2D_HW";
} else {
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
}
return NS_OK;
}
if (aFeature == FEATURE_WEBGL_OPENGL) {
if (mGLStrings->Renderer().Find("Adreno 200") != -1 ||
mGLStrings->Renderer().Find("Adreno 205") != -1)
{
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
aFailureId = "FEATURE_FAILURE_ADRENO_20x";
return NS_OK;
}
if (mHardware.EqualsLiteral("ville")) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
aFailureId = "FEATURE_FAILURE_VILLE";
return NS_OK;
}
}
if (aFeature == FEATURE_STAGEFRIGHT) {
NS_LossyConvertUTF16toASCII cManufacturer(mManufacturer);
NS_LossyConvertUTF16toASCII cModel(mModel);
NS_LossyConvertUTF16toASCII cHardware(mHardware);
if (cHardware.EqualsLiteral("antares") ||
cHardware.EqualsLiteral("harmony") ||
cHardware.EqualsLiteral("picasso") ||
cHardware.EqualsLiteral("picasso_e") ||
cHardware.EqualsLiteral("ventana") ||
cHardware.EqualsLiteral("rk30board"))
{
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
aFailureId = "FEATURE_FAILURE_STAGE_HW";
return NS_OK;
}
if (CompareVersions(mOSVersion.get(), "4.1.0") < 0)
{
// Whitelist:
// All Samsung ICS devices, except for:
// Samsung SGH-I717 (Bug 845729)
// Samsung SGH-I727 (Bug 845729)
// Samsung SGH-I757 (Bug 845729)
// All Galaxy nexus ICS devices
// Sony Xperia Ion (LT28) ICS devices
bool isWhitelisted =
cModel.Equals("LT28h", nsCaseInsensitiveCStringComparator()) ||
cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator()) ||
cModel.Equals("galaxy nexus", nsCaseInsensitiveCStringComparator()); // some Galaxy Nexus have manufacturer=amazon
if (cModel.Find("SGH-I717", true) != -1 ||
cModel.Find("SGH-I727", true) != -1 ||
cModel.Find("SGH-I757", true) != -1)
{
isWhitelisted = false;
}
//.........这里部分代码省略.........
示例3: url
/**
* Validates a custom content security policy string for use by an add-on.
* In particular, ensures that:
*
* - Both object-src and script-src directives are present, and meet
* the policies required by the CSPValidator class
*
* - The script-src directive includes the source 'self'
*/
NS_IMETHODIMP
AddonContentPolicy::ValidateAddonCSP(const nsAString& aPolicyString,
nsAString& aResult)
{
nsresult rv;
// Validate against a randomly-generated extension origin.
// There is no add-on-specific behavior in the CSP code, beyond the ability
// for add-ons to specify a custom policy, but the parser requires a valid
// origin in order to operate correctly.
nsAutoString url(u"moz-extension://");
{
nsCOMPtr<nsIUUIDGenerator> uuidgen = services::GetUUIDGenerator();
NS_ENSURE_TRUE(uuidgen, NS_ERROR_FAILURE);
nsID id;
rv = uuidgen->GenerateUUIDInPlace(&id);
NS_ENSURE_SUCCESS(rv, rv);
char idString[NSID_LENGTH];
id.ToProvidedString(idString);
MOZ_RELEASE_ASSERT(idString[0] == '{' && idString[NSID_LENGTH - 2] == '}',
"UUID generator did not return a valid UUID");
url.AppendASCII(idString + 1, NSID_LENGTH - 3);
}
RefPtr<BasePrincipal> principal =
BasePrincipal::CreateCodebasePrincipal(NS_ConvertUTF16toUTF8(url));
nsCOMPtr<nsIContentSecurityPolicy> csp;
rv = principal->EnsureCSP(nullptr, getter_AddRefs(csp));
NS_ENSURE_SUCCESS(rv, rv);
csp->AppendPolicy(aPolicyString, false, false);
const nsCSPPolicy* policy = csp->GetPolicy(0);
if (!policy) {
CSPValidator validator(url, nsIContentSecurityPolicy::SCRIPT_SRC_DIRECTIVE);
aResult.Assign(validator.GetError());
return NS_OK;
}
bool haveValidDefaultSrc = false;
{
CSPDirective directive = nsIContentSecurityPolicy::DEFAULT_SRC_DIRECTIVE;
CSPValidator validator(url, directive);
haveValidDefaultSrc = policy->visitDirectiveSrcs(directive, &validator);
}
aResult.SetIsVoid(true);
{
CSPDirective directive = nsIContentSecurityPolicy::SCRIPT_SRC_DIRECTIVE;
CSPValidator validator(url, directive, !haveValidDefaultSrc);
if (!policy->visitDirectiveSrcs(directive, &validator)) {
aResult.Assign(validator.GetError());
} else if (!validator.FoundSelf()) {
validator.FormatError("csp.error.missing-source", NS_LITERAL_STRING("'self'"));
aResult.Assign(validator.GetError());
}
}
if (aResult.IsVoid()) {
CSPDirective directive = nsIContentSecurityPolicy::OBJECT_SRC_DIRECTIVE;
CSPValidator validator(url, directive, !haveValidDefaultSrc);
if (!policy->visitDirectiveSrcs(directive, &validator)) {
aResult.Assign(validator.GetError());
}
}
return NS_OK;
}
示例4: cManufacturer
nsresult
GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
int32_t *aStatus,
nsAString & aSuggestedDriverVersion,
const nsTArray<GfxDriverInfo>& aDriverInfo,
OperatingSystem* aOS /* = nullptr */)
{
NS_ENSURE_ARG_POINTER(aStatus);
aSuggestedDriverVersion.SetIsVoid(true);
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
OperatingSystem os = mOS;
if (aOS)
*aOS = os;
// OpenGL layers are never blacklisted on Android.
// This early return is so we avoid potentially slow
// GLStrings initialization on startup when we initialize GL layers.
if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS) {
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
return NS_OK;
}
EnsureInitialized();
if (mGLStrings->Vendor().IsEmpty() || mGLStrings->Renderer().IsEmpty()) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
// Don't evaluate special cases when evaluating the downloaded blocklist.
if (aDriverInfo.IsEmpty()) {
if (aFeature == FEATURE_WEBGL_OPENGL) {
if (mGLStrings->Renderer().Find("Adreno 200") != -1 ||
mGLStrings->Renderer().Find("Adreno 205") != -1)
{
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
if (mHardware.EqualsLiteral("ville")) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
}
if (aFeature == FEATURE_STAGEFRIGHT) {
NS_LossyConvertUTF16toASCII cManufacturer(mManufacturer);
NS_LossyConvertUTF16toASCII cModel(mModel);
NS_LossyConvertUTF16toASCII cHardware(mHardware);
if (cHardware.EqualsLiteral("antares") ||
cHardware.EqualsLiteral("harmony") ||
cHardware.EqualsLiteral("picasso") ||
cHardware.EqualsLiteral("picasso_e") ||
cHardware.EqualsLiteral("ventana") ||
cHardware.EqualsLiteral("rk30board"))
{
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
if (CompareVersions(mOSVersion.get(), "2.2.0") >= 0 &&
CompareVersions(mOSVersion.get(), "2.3.0") < 0)
{
// Froyo LG devices are whitelisted.
// All other Froyo
bool isWhitelisted =
cManufacturer.Equals("lge", nsCaseInsensitiveCStringComparator());
if (!isWhitelisted) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
}
else if (CompareVersions(mOSVersion.get(), "2.3.0") >= 0 &&
CompareVersions(mOSVersion.get(), "2.4.0") < 0)
{
// Gingerbread HTC devices are whitelisted.
// Gingerbread Samsung devices are whitelisted except for:
// Samsung devices identified in Bug 847837
// Gingerbread Sony devices are whitelisted.
// All other Gingerbread devices are blacklisted.
bool isWhitelisted =
cManufacturer.Equals("htc", nsCaseInsensitiveCStringComparator()) ||
(cManufacturer.Find("sony", true) != -1) ||
cManufacturer.Equals("samsung", nsCaseInsensitiveCStringComparator());
if (cModel.Equals("GT-I8160", nsCaseInsensitiveCStringComparator()) ||
cModel.Equals("GT-I8160L", nsCaseInsensitiveCStringComparator()) ||
cModel.Equals("GT-I8530", nsCaseInsensitiveCStringComparator()) ||
cModel.Equals("GT-I9070", nsCaseInsensitiveCStringComparator()) ||
cModel.Equals("GT-I9070P", nsCaseInsensitiveCStringComparator()) ||
cModel.Equals("GT-I8160P", nsCaseInsensitiveCStringComparator()) ||
cModel.Equals("GT-S7500", nsCaseInsensitiveCStringComparator()) ||
cModel.Equals("GT-S7500T", nsCaseInsensitiveCStringComparator()) ||
cModel.Equals("GT-S7500L", nsCaseInsensitiveCStringComparator()) ||
cModel.Equals("GT-S6500T", nsCaseInsensitiveCStringComparator()) ||
cHardware.Equals("smdkc110", nsCaseInsensitiveCStringComparator()) ||
cHardware.Equals("smdkc210", nsCaseInsensitiveCStringComparator()) ||
cHardware.Equals("herring", nsCaseInsensitiveCStringComparator()) ||
//.........这里部分代码省略.........
示例5:
NS_StringSetIsVoid(nsAString &aStr, const bool aIsVoid)
{
aStr.SetIsVoid(aIsVoid);
}
示例6: WindowsVersionToOperatingSystem
nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion, GfxDriverInfo* aDriverInfo /* = nsnull */)
{
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
aSuggestedDriverVersion.SetIsVoid(PR_TRUE);
PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO;
PRUint32 adapterVendor = 0;
PRUint32 adapterDeviceID = 0;
nsAutoString adapterDriverVersionString;
if (NS_FAILED(GetAdapterVendorID(&adapterVendor)) ||
NS_FAILED(GetAdapterDeviceID(&adapterDeviceID)) ||
NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString)))
{
return NS_ERROR_FAILURE;
}
if (adapterVendor != vendorIntel &&
adapterVendor != vendorNVIDIA &&
adapterVendor != vendorAMD &&
adapterVendor != vendorATI &&
// FIXME - these special hex values are currently used in xpcshell tests introduced by
// bug 625160 patch 8/8. Maybe these tests need to be adjusted now that we're only whitelisting
// intel/ati/nvidia.
adapterVendor != 0xabcd &&
adapterVendor != 0xdcba &&
adapterVendor != 0xabab &&
adapterVendor != 0xdcdc)
{
*aStatus = FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
PRUint64 driverVersion;
if (!ParseDriverVersion(adapterDriverVersionString, &driverVersion)) {
return NS_ERROR_FAILURE;
}
if (aFeature == FEATURE_DIRECT3D_9_LAYERS &&
mWindowsVersion < gfxWindowsPlatform::kWindowsXP)
{
*aStatus = FEATURE_BLOCKED_OS_VERSION;
return NS_OK;
}
// ANGLE currently uses D3D10 <-> D3D9 interop, which crashes on Optimus
// machines.
if (aFeature == FEATURE_WEBGL_ANGLE &&
gfxWindowsPlatform::IsOptimus())
{
*aStatus = FEATURE_BLOCKED_DEVICE;
return NS_OK;
}
OperatingSystem os = WindowsVersionToOperatingSystem(mWindowsVersion);
// Windows Server 2003 should be just like Windows XP for present purpose, but still has a different version number.
// OTOH Windows Server 2008 R1 and R2 already have the same version numbers as Vista and Seven respectively
if (os == DRIVER_OS_WINDOWS_SERVER_2003)
os = DRIVER_OS_WINDOWS_XP;
const GfxDriverInfo *info;
if (aDriverInfo)
info = aDriverInfo;
else
info = &gDriverInfo[0];
if (mHasDriverVersionMismatch) {
if (aFeature == nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS ||
aFeature == nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS ||
aFeature == nsIGfxInfo::FEATURE_DIRECT2D)
{
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
return NS_OK;
}
}
// special-case the WinXP test slaves: they have out-of-date drivers, but we still want to
// whitelist them, actually we do know that this combination of device and driver version
// works well.
if (os == DRIVER_OS_WINDOWS_XP &&
adapterVendor == vendorNVIDIA &&
adapterDeviceID == 0x0861 && // GeForce 9400
driverVersion == V(6,14,11,7756))
{
return NS_OK;
}
while (info->mOperatingSystem) {
if (info->mOperatingSystem != DRIVER_OS_ALL &&
info->mOperatingSystem != os)
{
info++;
continue;
}
if (info->mAdapterVendor != GfxDriverInfo::allAdapterVendors &&
info->mAdapterVendor != adapterVendor) {
//.........这里部分代码省略.........
示例7: GetFeatureStatusImpl
nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32 *aStatus,
nsAString & aSuggestedDriverVersion,
GfxDriverInfo* aDriverInfo /* = nsnull */,
OperatingSystem* aOS /* = nsnull */)
{
GetData();
*aStatus = nsIGfxInfo::FEATURE_NO_INFO;
aSuggestedDriverVersion.SetIsVoid(true);
#ifdef MOZ_PLATFORM_MAEMO
// on Maemo, the glxtest probe doesn't build, and we don't really need GfxInfo anyway
return NS_OK;
#endif
OperatingSystem os = DRIVER_OS_LINUX;
// Disable OpenGL layers when we don't have texture_from_pixmap because it regresses performance.
if (aFeature == nsIGfxInfo::FEATURE_OPENGL_LAYERS && !mHasTextureFromPixmap) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
aSuggestedDriverVersion.AssignLiteral("<Anything with EXT_texture_from_pixmap support>");
return NS_OK;
}
// whitelist the linux test slaves' current configuration.
// this is necessary as they're still using the slightly outdated 190.42 driver.
// this isn't a huge risk, as at least this is the exact setting in which we do continuous testing,
// and this only affects GeForce 9400 cards on linux on this precise driver version, which is very few users.
// We do the same thing on Windows XP, see in widget/src/windows/GfxInfo.cpp
if (mIsNVIDIA &&
!strcmp(mRenderer.get(), "GeForce 9400/PCI/SSE2") &&
!strcmp(mVersion.get(), "3.2.0 NVIDIA 190.42"))
{
return NS_OK;
}
if (mIsMesa) {
if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(7,10,3)) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
aSuggestedDriverVersion.AssignLiteral("Mesa 7.10.3");
}
} else if (mIsNVIDIA) {
if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(257,21)) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
aSuggestedDriverVersion.AssignLiteral("NVIDIA 257.21");
}
} else if (mIsFGLRX) {
// FGLRX does not report a driver version number, so we have the OpenGL version instead.
// by requiring OpenGL 3, we effectively require recent drivers.
if (version(mMajorVersion, mMinorVersion, mRevisionVersion) < version(3, 0)) {
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
}
} else {
// like on windows, let's block unknown vendors. Think of virtual machines.
// Also, this case is hit whenever the GLXtest probe failed to get driver info or crashed.
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
}
if (aOS)
*aOS = os;
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
}