本文整理汇总了C++中NS_NAMED_LITERAL_CSTRING函数的典型用法代码示例。如果您正苦于以下问题:C++ NS_NAMED_LITERAL_CSTRING函数的具体用法?C++ NS_NAMED_LITERAL_CSTRING怎么用?C++ NS_NAMED_LITERAL_CSTRING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NS_NAMED_LITERAL_CSTRING函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: NS_PRECONDITION
bool
IDBTransaction::StartSavepoint()
{
NS_PRECONDITION(!NS_IsMainThread(), "Wrong thread!");
NS_PRECONDITION(mConnection, "No connection!");
nsresult rv;
if (!mHasInitialSavepoint) {
NS_NAMED_LITERAL_CSTRING(beginSavepoint,
"SAVEPOINT " SAVEPOINT_INITIAL);
rv = mConnection->ExecuteSimpleSQL(beginSavepoint);
NS_ENSURE_SUCCESS(rv, false);
mHasInitialSavepoint = true;
}
NS_ASSERTION(!mSavepointCount, "Mismatch!");
mSavepointCount = 1;
// TODO try to cache this statement
NS_NAMED_LITERAL_CSTRING(savepoint, "SAVEPOINT " SAVEPOINT_INTERMEDIATE);
rv = mConnection->ExecuteSimpleSQL(savepoint);
NS_ENSURE_SUCCESS(rv, false);
return true;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:27,代码来源:IDBTransaction.cpp
示例2: NS_NAMED_LITERAL_CSTRING
bool nsPluginsDir::IsPluginFile(nsIFile* file)
{
nsAutoCString filename;
if (NS_FAILED(file->GetNativeLeafName(filename)))
return false;
#ifdef ANDROID
// It appears that if you load
// 'libstagefright_honeycomb.so' on froyo, or
// 'libstagefright_froyo.so' on honeycomb, we will abort.
// Since these are just helper libs, we can ignore.
const char *cFile = filename.get();
if (strstr(cFile, "libstagefright") != NULL)
return false;
#endif
NS_NAMED_LITERAL_CSTRING(dllSuffix, LOCAL_PLUGIN_DLL_SUFFIX);
if (filename.Length() > dllSuffix.Length() &&
StringEndsWith(filename, dllSuffix))
return true;
#ifdef LOCAL_PLUGIN_DLL_ALT_SUFFIX
NS_NAMED_LITERAL_CSTRING(dllAltSuffix, LOCAL_PLUGIN_DLL_ALT_SUFFIX);
if (filename.Length() > dllAltSuffix.Length() &&
StringEndsWith(filename, dllAltSuffix))
return true;
#endif
return false;
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:29,代码来源:nsPluginsDirUnix.cpp
示例3: NS_NAMED_LITERAL_CSTRING
nsresult
CountHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
{
nsCString table;
if (mIndex->IsUnique()) {
table.AssignLiteral("unique_index_data");
}
else {
table.AssignLiteral("index_data");
}
NS_NAMED_LITERAL_CSTRING(lowerKeyName, "lower_key");
NS_NAMED_LITERAL_CSTRING(upperKeyName, "upper_key");
NS_NAMED_LITERAL_CSTRING(value, "value");
nsCAutoString keyRangeClause;
if (mKeyRange) {
if (!mKeyRange->Lower().IsUnset()) {
AppendConditionClause(value, lowerKeyName, false,
!mKeyRange->IsLowerOpen(), keyRangeClause);
}
if (!mKeyRange->Upper().IsUnset()) {
AppendConditionClause(value, upperKeyName, true,
!mKeyRange->IsUpperOpen(), keyRangeClause);
}
}
nsCString query = NS_LITERAL_CSTRING("SELECT count(*) FROM ") + table +
NS_LITERAL_CSTRING(" WHERE index_id = :id") +
keyRangeClause;
nsCOMPtr<mozIStorageStatement> stmt = mTransaction->GetCachedStatement(query);
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
mozStorageStatementScoper scoper(stmt);
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"), mIndex->Id());
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
if (mKeyRange) {
if (!mKeyRange->Lower().IsUnset()) {
rv = mKeyRange->Lower().BindToStatement(stmt, lowerKeyName);
NS_ENSURE_SUCCESS(rv, rv);
}
if (!mKeyRange->Upper().IsUnset()) {
rv = mKeyRange->Upper().BindToStatement(stmt, upperKeyName);
NS_ENSURE_SUCCESS(rv, rv);
}
}
bool hasResult;
rv = stmt->ExecuteStep(&hasResult);
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
NS_ENSURE_TRUE(hasResult, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
mCount = stmt->AsInt64(0);
return NS_OK;
}
开发者ID:b2gautomation,项目名称:mozilla-central,代码行数:58,代码来源:IDBIndex.cpp
示例4: TestNativeXMLHttpRequest
nsresult TestNativeXMLHttpRequest()
{
nsresult rv;
nsCOMPtr<nsIXMLHttpRequest> xhr =
do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
TEST_ENSURE_SUCCESS(rv, "Couldn't create nsIXMLHttpRequest instance!");
NS_NAMED_LITERAL_CSTRING(getString, "GET");
NS_NAMED_LITERAL_CSTRING(testURL, TEST_URL);
const nsAString& empty = EmptyString();
printf("*** About to see an expected warning about mPrincipal:\n");
rv = xhr->OpenRequest(getString, testURL, PR_FALSE, empty, empty);
printf("*** End of expected warning output.\n");
TEST_ENSURE_FAILED(rv, "OpenRequest should have failed!");
nsCOMPtr<nsIScriptSecurityManager> secman =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
TEST_ENSURE_SUCCESS(rv, "Couldn't get script security manager!");
nsCOMPtr<nsIPrincipal> systemPrincipal;
rv = secman->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
TEST_ENSURE_SUCCESS(rv, "Couldn't get system principal!");
rv = xhr->Init(systemPrincipal, nsnull, nsnull, nsnull);
TEST_ENSURE_SUCCESS(rv, "Couldn't initialize the XHR!");
rv = xhr->OpenRequest(getString, testURL, PR_FALSE, empty, empty);
TEST_ENSURE_SUCCESS(rv, "OpenRequest failed!");
rv = xhr->Send(nsnull);
TEST_ENSURE_SUCCESS(rv, "Send failed!");
nsAutoString response;
rv = xhr->GetResponseText(response);
TEST_ENSURE_SUCCESS(rv, "GetResponse failed!");
if (!response.EqualsLiteral(TEST_URL_CONTENT)) {
fail("Response text does not match!");
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIDOMDocument> dom;
rv = xhr->GetResponseXML(getter_AddRefs(dom));
TEST_ENSURE_SUCCESS(rv, "GetResponseXML failed!");
if (!dom) {
fail("No DOM document constructed!");
return NS_ERROR_FAILURE;
}
passed("Native XMLHttpRequest");
return NS_OK;
}
开发者ID:AllenDou,项目名称:firefox,代码行数:55,代码来源:TestNativeXMLHttpRequest.cpp
示例5: do_GetIOService
nsresult
nsResProtocolHandler::Init()
{
if (!mSubstitutions.Init(32))
return NS_ERROR_UNEXPECTED;
nsresult rv;
mIOService = do_GetIOService(&rv);
NS_ENSURE_SUCCESS(rv, rv);
#ifdef MOZ_OMNIJAR
nsCOMPtr<nsIFile> omniJar(mozilla::OmnijarPath());
if (omniJar)
return Init(omniJar);
#endif
// these entries should be kept in sync with the omnijar Init function
//
// make resource:/// point to the application directory
//
rv = AddSpecialDir(NS_OS_CURRENT_PROCESS_DIR, EmptyCString());
NS_ENSURE_SUCCESS(rv, rv);
//
// make resource://gre/ point to the GRE directory
//
rv = AddSpecialDir(NS_GRE_DIR, kGRE);
NS_ENSURE_SUCCESS(rv, rv);
// make resource://gre-resources/ point to gre toolkit[.jar]/res
nsCOMPtr<nsIURI> greURI;
nsCOMPtr<nsIURI> greResURI;
GetSubstitution(kGRE, getter_AddRefs(greURI));
#ifdef MOZ_CHROME_FILE_FORMAT_JAR
NS_NAMED_LITERAL_CSTRING(strGRE_RES_URL, "jar:chrome/toolkit.jar!/res/");
#else
NS_NAMED_LITERAL_CSTRING(strGRE_RES_URL, "chrome/toolkit/res/");
#endif
rv = mIOService->NewURI(strGRE_RES_URL, nsnull, greURI,
getter_AddRefs(greResURI));
SetSubstitution(kGRE_RESOURCES, greResURI);
//XXXbsmedberg Neil wants a resource://pchrome/ for the profile chrome dir...
// but once I finish multiple chrome registration I'm not sure that it is needed
// XXX dveditz: resource://pchrome/ defeats profile directory salting
// if web content can load it. Tread carefully.
return rv;
}
开发者ID:mmmulani,项目名称:v8monkey,代码行数:51,代码来源:nsResProtocolHandler.cpp
示例6: NS_ASSERTION
NS_IMETHODIMP
CommitHelper::Run()
{
if (NS_IsMainThread()) {
NS_ASSERTION(mDoomedObjects.IsEmpty(), "Didn't release doomed objects!");
nsCOMPtr<nsIDOMEvent> event;
if (mAborted) {
event = IDBEvent::CreateGenericEvent(NS_LITERAL_STRING(ABORT_EVT_STR));
}
else {
event = IDBEvent::CreateGenericEvent(NS_LITERAL_STRING(COMPLETE_EVT_STR));
}
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
PRBool dummy;
if (NS_FAILED(mTransaction->DispatchEvent(event, &dummy))) {
NS_WARNING("Dispatch failed!");
}
mTransaction = nsnull;
return NS_OK;
}
if (mAborted) {
NS_ASSERTION(mConnection, "This had better not be null!");
NS_NAMED_LITERAL_CSTRING(rollback, "ROLLBACK TRANSACTION");
if (NS_FAILED(mConnection->ExecuteSimpleSQL(rollback))) {
NS_WARNING("Failed to rollback transaction!");
}
}
else if (mHasInitialSavepoint) {
NS_ASSERTION(mConnection, "This had better not be null!");
NS_NAMED_LITERAL_CSTRING(release, "RELEASE " SAVEPOINT_INITIAL);
if (NS_FAILED(mConnection->ExecuteSimpleSQL(release))) {
NS_WARNING("Failed to release transaction!");
}
}
mDoomedObjects.Clear();
mConnection->Close();
mConnection = nsnull;
return NS_OK;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:48,代码来源:IDBTransaction.cpp
示例7: IsVideoContentType
bool IsVideoContentType(const nsCString& aContentType) {
NS_NAMED_LITERAL_CSTRING(video, "video");
if (FindInReadable(video, aContentType)) {
return true;
}
return false;
}
开发者ID:jld,项目名称:gecko-dev,代码行数:7,代码来源:VideoUtils.cpp
示例8: NS_NAMED_LITERAL_CSTRING
/* static */
nsresult
sbURIChecker::FixupPath( const nsACString& aPath,
nsACString& _retval )
{
// aPath may be empty
if ( aPath.IsEmpty() ) {
_retval.Truncate();
return NS_OK;
}
NS_NAMED_LITERAL_CSTRING( slashString, "/" );
// Construct a dummy URL that incorporates the path that the user passed in.
nsCString dummyURL("http://dummy.com");
// Make sure that aPath begins with a slash. Otherwise we could end up with
// something like "foo.combar" rather than "foo.com/bar".
if ( !StringBeginsWith( aPath, slashString ) ) {
dummyURL.Append(slashString);
}
dummyURL.Append(aPath);
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI( getter_AddRefs(uri), dummyURL );
NS_ENSURE_SUCCESS( rv, rv );
// Hand off.
return sbURIChecker::FixupPath( uri, _retval );
}
开发者ID:AntoineTurmel,项目名称:nightingale-hacking,代码行数:31,代码来源:sbURIChecker.cpp
示例9: NS_PRECONDITION
PRUint16
RemoveHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
{
NS_PRECONDITION(aConnection, "Passed a null connection!");
nsCOMPtr<mozIStorageStatement> stmt =
mTransaction->RemoveStatement(mAutoIncrement);
NS_ENSURE_TRUE(stmt, nsIIDBDatabaseException::UNKNOWN_ERR);
mozStorageStatementScoper scoper(stmt);
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mOSID);
NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
NS_ASSERTION(!mKey.IsUnset() && !mKey.IsNull(), "Must have a key here!");
NS_NAMED_LITERAL_CSTRING(key_value, "key_value");
if (mKey.IsInt()) {
rv = stmt->BindInt64ByName(key_value, mKey.IntValue());
}
else if (mKey.IsString()) {
rv = stmt->BindStringByName(key_value, mKey.StringValue());
}
else {
NS_NOTREACHED("Unknown key type!");
}
NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
// Search for it!
rv = stmt->Execute();
NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);
return OK;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:34,代码来源:IDBCursor.cpp
示例10: NS_NAMED_LITERAL_CSTRING
nsresult
nsDirIndexParser::Init() {
mLineStart = 0;
mHasDescription = PR_FALSE;
mFormat = nsnull;
// get default charset to be used for directory listings (fallback to
// ISO-8859-1 if pref is unavailable).
NS_NAMED_LITERAL_CSTRING(kFallbackEncoding, "ISO-8859-1");
nsXPIDLString defCharset;
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
nsCOMPtr<nsIPrefLocalizedString> prefVal;
prefs->GetComplexValue("intl.charset.default",
NS_GET_IID(nsIPrefLocalizedString),
getter_AddRefs(prefVal));
if (prefVal)
prefVal->ToString(getter_Copies(defCharset));
}
if (!defCharset.IsEmpty())
LossyCopyUTF16toASCII(defCharset, mEncoding); // charset labels are always ASCII
else
mEncoding.Assign(kFallbackEncoding);
nsresult rv;
// XXX not threadsafe
if (gRefCntParser++ == 0)
rv = CallGetService(NS_ITEXTTOSUBURI_CONTRACTID, &gTextToSubURI);
else
rv = NS_OK;
return rv;
}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:33,代码来源:nsDirIndexParser.cpp
示例11: MOZ_ASSERT
nsresult
IDBKeyRange::BindToStatement(mozIStorageStatement* aStatement) const
{
MOZ_ASSERT(aStatement);
NS_NAMED_LITERAL_CSTRING(lowerKey, "lower_key");
if (IsOnly()) {
return Lower().BindToStatement(aStatement, lowerKey);
}
nsresult rv;
if (!Lower().IsUnset()) {
rv = Lower().BindToStatement(aStatement, lowerKey);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
if (!Upper().IsUnset()) {
rv = Upper().BindToStatement(aStatement, NS_LITERAL_CSTRING("upper_key"));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
return NS_OK;
}
开发者ID:bitwiseworks,项目名称:mozilla-os2,代码行数:29,代码来源:IDBKeyRange.cpp
示例12: getConnections
void
Service::minimizeMemory()
{
nsTArray<nsRefPtr<Connection> > connections;
getConnections(connections);
for (uint32_t i = 0; i < connections.Length(); i++) {
nsRefPtr<Connection> conn = connections[i];
if (conn->connectionReady()) {
NS_NAMED_LITERAL_CSTRING(shrinkPragma, "PRAGMA shrink_memory");
nsCOMPtr<mozIStorageConnection> syncConn = do_QueryInterface(
NS_ISUPPORTS_CAST(mozIStorageAsyncConnection*, conn));
DebugOnly<nsresult> rv;
if (!syncConn) {
nsCOMPtr<mozIStoragePendingStatement> ps;
rv = connections[i]->ExecuteSimpleSQLAsync(shrinkPragma, nullptr,
getter_AddRefs(ps));
} else {
rv = connections[i]->ExecuteSimpleSQL(shrinkPragma);
}
MOZ_ASSERT(NS_SUCCEEDED(rv),
"Should have been able to purge sqlite caches");
}
}
开发者ID:mxOBS,项目名称:deb-pkg_icedove,代码行数:26,代码来源:mozStorageService.cpp
示例13: net_GetURLSpecFromActualFile
nsresult
net_GetURLSpecFromActualFile(nsIFile *aFile, nsACString &result)
{
nsresult rv;
nsAutoString path;
// construct URL spec from file path
rv = aFile->GetPath(path);
if (NS_FAILED(rv)) return rv;
// Replace \ with / to convert to an url
path.ReplaceChar(char16_t(0x5Cu), char16_t(0x2Fu));
nsAutoCString escPath;
// Windows Desktop paths begin with a drive letter, so need an 'extra'
// slash at the begining
// C:\Windows => file:///C:/Windows
NS_NAMED_LITERAL_CSTRING(prefix, "file:///");
// Escape the path with the directory mask
NS_ConvertUTF16toUTF8 ePath(path);
if (NS_EscapeURL(ePath.get(), -1, esc_Directory+esc_Forced, escPath))
escPath.Insert(prefix, 0);
else
escPath.Assign(prefix + ePath);
// esc_Directory does not escape the semicolons, so if a filename
// contains semicolons we need to manually escape them.
// This replacement should be removed in bug #473280
escPath.ReplaceSubstring(";", "%3b");
result = escPath;
return NS_OK;
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:35,代码来源:nsURLHelperWin.cpp
示例14: nsMsgI18NConvertRawBytesToUTF8
void nsMsgI18NConvertRawBytesToUTF8(const nsCString& inString,
const char* charset,
nsACString& outString)
{
if (MsgIsUTF8(inString))
{
outString.Assign(inString);
return;
}
nsAutoString utf16Text;
nsresult rv = ConvertToUnicode(charset, inString, utf16Text);
if (NS_SUCCEEDED(rv))
{
CopyUTF16toUTF8(utf16Text, outString);
return;
}
// EF BF BD (UTF-8 encoding of U+FFFD)
NS_NAMED_LITERAL_CSTRING(utf8ReplacementChar, "\357\277\275");
const char* cur = inString.BeginReading();
const char* end = inString.EndReading();
outString.Truncate();
while (cur < end) {
char c = *cur++;
if (c & char(0x80))
outString.Append(utf8ReplacementChar);
else
outString.Append(c);
}
}
开发者ID:cmotc,项目名称:spacehamster,代码行数:31,代码来源:nsMsgI18N.cpp
示例15: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP sbScriptableFilterResult::GetClassName(char * *aClassName)
{
NS_ENSURE_ARG_POINTER(aClassName);
NS_NAMED_LITERAL_CSTRING( kClassName, "sbScriptableFilterResult" );
*aClassName = ToNewCString(kClassName);
return aClassName ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
开发者ID:AntoineTurmel,项目名称:nightingale-hacking,代码行数:8,代码来源:sbScriptableFilterResult.cpp
示例16: NS_NAMED_LITERAL_CSTRING
bool
nsCoreUtils::IsErrorPage(nsIDocument *aDocument)
{
nsIURI *uri = aDocument->GetDocumentURI();
bool isAboutScheme = false;
uri->SchemeIs("about", &isAboutScheme);
if (!isAboutScheme)
return false;
nsAutoCString path;
uri->GetPath(path);
NS_NAMED_LITERAL_CSTRING(neterror, "neterror");
NS_NAMED_LITERAL_CSTRING(certerror, "certerror");
return StringBeginsWith(path, neterror) || StringBeginsWith(path, certerror);
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:17,代码来源:nsCoreUtils.cpp
示例17: NS_ASSERTION
nsresult
GetKeyHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
{
NS_ASSERTION(aConnection, "Passed a null connection!");
nsCOMPtr<mozIStorageStatement> stmt =
mTransaction->IndexGetStatement(mIndex->IsUnique(),
mIndex->IsAutoIncrement());
NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
mozStorageStatementScoper scoper(stmt);
nsresult rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("index_id"),
mIndex->Id());
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
NS_NAMED_LITERAL_CSTRING(value, "value");
if (mKey.IsInt()) {
rv = stmt->BindInt64ByName(value, mKey.IntValue());
}
else if (mKey.IsString()) {
rv = stmt->BindStringByName(value, mKey.StringValue());
}
else {
NS_NOTREACHED("Bad key type!");
}
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
mKey = Key::UNSETKEY;
PRBool hasResult;
rv = stmt->ExecuteStep(&hasResult);
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
if (hasResult) {
PRInt32 keyType;
rv = stmt->GetTypeOfIndex(0, &keyType);
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
NS_ASSERTION(keyType == mozIStorageStatement::VALUE_TYPE_INTEGER ||
keyType == mozIStorageStatement::VALUE_TYPE_TEXT,
"Bad key type!");
if (keyType == mozIStorageStatement::VALUE_TYPE_INTEGER) {
mKey = stmt->AsInt64(0);
}
else if (keyType == mozIStorageStatement::VALUE_TYPE_TEXT) {
rv = stmt->GetString(0, mKey.ToString());
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
}
else {
NS_NOTREACHED("Bad SQLite type!");
}
}
return NS_OK;
}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:58,代码来源:IDBIndex.cpp
示例18: NS_NAMED_LITERAL_CSTRING
nsresult
nsAboutCacheEntry::WriteCacheEntryUnavailable()
{
uint32_t n;
NS_NAMED_LITERAL_CSTRING(buffer,
"The cache entry you selected is not available.");
mOutputStream->Write(buffer.get(), buffer.Length(), &n);
return NS_OK;
}
开发者ID:mikeaich,项目名称:releases-mozilla-central,代码行数:9,代码来源:nsAboutCacheEntry.cpp
示例19: do_QueryInterface
NS_IMETHODIMP
nsIncrementalDownload::AsyncOnChannelRedirect(nsIChannel *oldChannel,
nsIChannel *newChannel,
uint32_t flags,
nsIAsyncVerifyRedirectCallback *cb)
{
// In response to a redirect, we need to propagate the Range header. See bug
// 311595. Any failure code returned from this function aborts the redirect.
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(oldChannel);
NS_ENSURE_STATE(http);
nsCOMPtr<nsIHttpChannel> newHttpChannel = do_QueryInterface(newChannel);
NS_ENSURE_STATE(newHttpChannel);
NS_NAMED_LITERAL_CSTRING(rangeHdr, "Range");
nsresult rv = ClearRequestHeader(newHttpChannel);
if (NS_FAILED(rv))
return rv;
// If we didn't have a Range header, then we must be doing a full download.
nsAutoCString rangeVal;
http->GetRequestHeader(rangeHdr, rangeVal);
if (!rangeVal.IsEmpty()) {
rv = newHttpChannel->SetRequestHeader(rangeHdr, rangeVal, false);
NS_ENSURE_SUCCESS(rv, rv);
}
// A redirection changes the validator
mPartialValidator.Truncate();
if (mCacheBust) {
newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Cache-Control"),
NS_LITERAL_CSTRING("no-cache"), false);
newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Pragma"),
NS_LITERAL_CSTRING("no-cache"), false);
}
// Prepare to receive callback
mRedirectCallback = cb;
mNewRedirectChannel = newChannel;
// Give the observer a chance to see this redirect notification.
nsCOMPtr<nsIChannelEventSink> sink = do_GetInterface(mObserver);
if (sink) {
rv = sink->AsyncOnChannelRedirect(oldChannel, newChannel, flags, this);
if (NS_FAILED(rv)) {
mRedirectCallback = nullptr;
mNewRedirectChannel = nullptr;
}
return rv;
}
(void) OnRedirectVerifyCallback(NS_OK);
return NS_OK;
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:56,代码来源:nsIncrementalDownload.cpp
示例20: NS_NAMED_LITERAL_CSTRING
PRBool nsPluginsDir::IsPluginFile(nsIFile* file)
{
nsCAutoString filename;
if (NS_FAILED(file->GetNativeLeafName(filename)))
return PR_FALSE;
NS_NAMED_LITERAL_CSTRING(dllSuffix, LOCAL_PLUGIN_DLL_SUFFIX);
if (filename.Length() > dllSuffix.Length() &&
StringEndsWith(filename, dllSuffix))
return PR_TRUE;
#ifdef LOCAL_PLUGIN_DLL_ALT_SUFFIX
NS_NAMED_LITERAL_CSTRING(dllAltSuffix, LOCAL_PLUGIN_DLL_ALT_SUFFIX);
if (filename.Length() > dllAltSuffix.Length() &&
StringEndsWith(filename, dllAltSuffix))
return PR_TRUE;
#endif
return PR_FALSE;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:19,代码来源:nsPluginsDirUnix.cpp
注:本文中的NS_NAMED_LITERAL_CSTRING函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论