зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1648010 - Remove NS_NAMED_LITERAL_CSTRING and NS_NAMED_LITERAL_STRING macros. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80631
This commit is contained in:
Родитель
e3c223da3e
Коммит
9364b353d4
|
@ -377,8 +377,8 @@ bool nsCoreUtils::IsErrorPage(Document* aDocument) {
|
|||
nsAutoCString path;
|
||||
uri->GetPathQueryRef(path);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(neterror, "neterror");
|
||||
NS_NAMED_LITERAL_CSTRING(certerror, "certerror");
|
||||
constexpr auto neterror = "neterror"_ns;
|
||||
constexpr auto certerror = "certerror"_ns;
|
||||
|
||||
return StringBeginsWith(path, neterror) || StringBeginsWith(path, certerror);
|
||||
}
|
||||
|
|
|
@ -295,12 +295,12 @@ static bool IsSystemOleAcc(nsCOMPtr<nsIFile>& aFile) {
|
|||
static bool IsTypelibPreferred() {
|
||||
// If IAccessible's Proxy/Stub CLSID is kUniversalMarshalerClsid, then any
|
||||
// external a11y clients are expecting to use a typelib.
|
||||
NS_NAMED_LITERAL_STRING(kUniversalMarshalerClsid,
|
||||
"{00020424-0000-0000-C000-000000000046}");
|
||||
constexpr auto kUniversalMarshalerClsid =
|
||||
u"{00020424-0000-0000-C000-000000000046}"_ns;
|
||||
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
kIAccessiblePSClsidPath,
|
||||
"Interface\\{618736E0-3C3D-11CF-810C-00AA00389B71}\\ProxyStubClsid32");
|
||||
constexpr auto kIAccessiblePSClsidPath =
|
||||
"Interface\\{618736E0-3C3D-11CF-810C-00AA00389B71}"
|
||||
u"\\ProxyStubClsid32"_ns;
|
||||
|
||||
nsAutoString psClsid;
|
||||
if (!ReadCOMRegDefaultString(kIAccessiblePSClsidPath, psClsid)) {
|
||||
|
@ -314,9 +314,8 @@ static bool IsTypelibPreferred() {
|
|||
static bool IsIAccessibleTypelibRegistered() {
|
||||
// The system default IAccessible typelib is always registered with version
|
||||
// 1.1, under the neutral locale (LCID 0).
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
kIAccessibleTypelibRegPath,
|
||||
"TypeLib\\{1EA4DBF0-3C3B-11CF-810C-00AA00389B71}\\1.1\\0\\win32");
|
||||
constexpr auto kIAccessibleTypelibRegPath =
|
||||
u"TypeLib\\{1EA4DBF0-3C3B-11CF-810C-00AA00389B71}\\1.1\\0\\win32"_ns;
|
||||
|
||||
nsAutoString typelibPath;
|
||||
if (!ReadCOMRegDefaultString(kIAccessibleTypelibRegPath, typelibPath)) {
|
||||
|
@ -334,9 +333,8 @@ static bool IsIAccessibleTypelibRegistered() {
|
|||
}
|
||||
|
||||
static bool IsIAccessiblePSRegistered() {
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
kIAccessiblePSRegPath,
|
||||
"CLSID\\{03022430-ABC4-11D0-BDE2-00AA001A1953}\\InProcServer32");
|
||||
constexpr auto kIAccessiblePSRegPath =
|
||||
u"CLSID\\{03022430-ABC4-11D0-BDE2-00AA001A1953}\\InProcServer32"_ns;
|
||||
|
||||
nsAutoString proxyStubPath;
|
||||
if (!ReadCOMRegDefaultString(kIAccessiblePSRegPath, proxyStubPath)) {
|
||||
|
|
|
@ -161,7 +161,7 @@ Maybe<bool> Compatibility::OnUIAMessage(WPARAM aWParam, LPARAM aLParam) {
|
|||
Telemetry::AutoTimer<Telemetry::A11Y_UIA_DETECTION_TIMING_MS> timer;
|
||||
|
||||
// UIA creates a section containing the substring "HOOK_SHMEM_"
|
||||
NS_NAMED_LITERAL_STRING(kStrHookShmem, "HOOK_SHMEM_");
|
||||
constexpr auto kStrHookShmem = u"HOOK_SHMEM_"_ns;
|
||||
|
||||
// The section name always ends with this suffix, which is derived from the
|
||||
// current thread id and the UIA message's WPARAM and LPARAM.
|
||||
|
|
|
@ -284,7 +284,7 @@ static void AppendVersionInfo(nsIFile* aClientExe, nsAString& aStrToAppend) {
|
|||
|
||||
aStrToAppend.AppendLiteral(u"|");
|
||||
|
||||
NS_NAMED_LITERAL_STRING(dot, ".");
|
||||
constexpr auto dot = u"."_ns;
|
||||
|
||||
aStrToAppend.AppendInt(major);
|
||||
aStrToAppend.Append(dot);
|
||||
|
|
|
@ -667,7 +667,7 @@ NS_IMETHODIMP
|
|||
BasePrincipal::GetPrefLightCacheKey(nsIURI* aURI, bool aWithCredentials,
|
||||
nsACString& _retval) {
|
||||
_retval.Truncate();
|
||||
NS_NAMED_LITERAL_CSTRING(space, " ");
|
||||
constexpr auto space = " "_ns;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = GetURI(getter_AddRefs(uri));
|
||||
|
|
|
@ -110,10 +110,9 @@ TEST(OriginAttributes, NullPrincipal)
|
|||
bool oldSitePref = Preferences::GetBool(SITE_PREF);
|
||||
Preferences::SetBool(SITE_PREF, true);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
spec, "moz-nullprincipal:{9bebdabb-828a-4284-8b00-432a968c6e42}");
|
||||
NS_NAMED_LITERAL_STRING(expected,
|
||||
"9bebdabb-828a-4284-8b00-432a968c6e42.mozilla");
|
||||
constexpr auto spec =
|
||||
u"moz-nullprincipal:{9bebdabb-828a-4284-8b00-432a968c6e42}"_ns;
|
||||
constexpr auto expected = u"9bebdabb-828a-4284-8b00-432a968c6e42.mozilla"_ns;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), spec);
|
||||
|
|
|
@ -170,7 +170,7 @@ nsresult nsChromeRegistry::GetProviderAndPath(nsIURI* aChromeURL,
|
|||
}
|
||||
|
||||
nsresult nsChromeRegistry::Canonify(nsCOMPtr<nsIURI>& aChromeURL) {
|
||||
NS_NAMED_LITERAL_CSTRING(kSlash, "/");
|
||||
constexpr auto kSlash = "/"_ns;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ static void SendPing(void* aClosure, nsIContent* aContent, nsIURI* aURI,
|
|||
return;
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(uploadData, "PING");
|
||||
constexpr auto uploadData = "PING"_ns;
|
||||
|
||||
nsCOMPtr<nsIInputStream> uploadStream;
|
||||
rv = NS_NewCStringInputStream(getter_AddRefs(uploadStream), uploadData);
|
||||
|
|
|
@ -420,7 +420,7 @@ already_AddRefed<FormData> BodyUtil::ConsumeFormData(nsIGlobalObject* aParent,
|
|||
const nsCString& aMimeType,
|
||||
const nsCString& aStr,
|
||||
ErrorResult& aRv) {
|
||||
NS_NAMED_LITERAL_CSTRING(formDataMimeType, "multipart/form-data");
|
||||
constexpr auto formDataMimeType = "multipart/form-data"_ns;
|
||||
|
||||
// Allow semicolon separated boundary/encoding suffix like
|
||||
// multipart/form-data; boundary= but disallow multipart/form-datafoobar.
|
||||
|
@ -443,8 +443,7 @@ already_AddRefed<FormData> BodyUtil::ConsumeFormData(nsIGlobalObject* aParent,
|
|||
return fd.forget();
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(urlDataMimeType,
|
||||
"application/x-www-form-urlencoded");
|
||||
constexpr auto urlDataMimeType = "application/x-www-form-urlencoded"_ns;
|
||||
bool isValidUrlEncodedMimeType = StringBeginsWith(aMimeType, urlDataMimeType);
|
||||
|
||||
if (isValidUrlEncodedMimeType &&
|
||||
|
|
|
@ -9083,7 +9083,7 @@ void Document::WriteCommon(const nsAString& aText, bool aNewlineTerminate,
|
|||
}
|
||||
}
|
||||
|
||||
static NS_NAMED_LITERAL_STRING(new_line, "\n");
|
||||
static constexpr auto new_line = u"\n"_ns;
|
||||
|
||||
++mWriteLevel;
|
||||
|
||||
|
|
|
@ -650,7 +650,7 @@ class VibrateWindowListener : public nsIDOMEventListener {
|
|||
mWindow = do_GetWeakReference(aWindow);
|
||||
mDocument = do_GetWeakReference(aDocument);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange");
|
||||
constexpr auto visibilitychange = u"visibilitychange"_ns;
|
||||
aDocument->AddSystemEventListener(visibilitychange, this, /* listener */
|
||||
true, /* use capture */
|
||||
false /* wants untrusted */);
|
||||
|
@ -701,7 +701,7 @@ void VibrateWindowListener::RemoveListener() {
|
|||
if (!target) {
|
||||
return;
|
||||
}
|
||||
NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange");
|
||||
constexpr auto visibilitychange = u"visibilitychange"_ns;
|
||||
target->RemoveSystemEventListener(visibilitychange, this,
|
||||
true /* use capture */);
|
||||
}
|
||||
|
|
|
@ -3514,8 +3514,8 @@ void Selection::SetColors(const nsAString& aForegroundColor,
|
|||
|
||||
mCustomColors.reset(new SelectionCustomColors);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(currentColorStr, "currentColor");
|
||||
NS_NAMED_LITERAL_STRING(transparentStr, "transparent");
|
||||
constexpr auto currentColorStr = u"currentColor"_ns;
|
||||
constexpr auto transparentStr = u"transparent"_ns;
|
||||
|
||||
if (!aForegroundColor.Equals(currentColorStr)) {
|
||||
nscolor foregroundColor;
|
||||
|
|
|
@ -510,7 +510,7 @@ class ScriptErrorEvent : public Runnable {
|
|||
init.mFilename = mReport->mFileName;
|
||||
init.mBubbles = true;
|
||||
|
||||
NS_NAMED_LITERAL_STRING(xoriginMsg, "Script error.");
|
||||
constexpr auto xoriginMsg = u"Script error."_ns;
|
||||
if (!mReport->mIsMuted) {
|
||||
init.mMessage = mReport->mErrorMsg;
|
||||
init.mLineno = mReport->mLineNumber;
|
||||
|
|
|
@ -810,7 +810,7 @@ void nsObjectLoadingContent::GetNestedParams(
|
|||
do_QueryInterface(static_cast<nsIObjectLoadingContent*>(this));
|
||||
|
||||
nsCOMPtr<nsIHTMLCollection> allParams;
|
||||
NS_NAMED_LITERAL_STRING(xhtml_ns, "http://www.w3.org/1999/xhtml");
|
||||
constexpr auto xhtml_ns = u"http://www.w3.org/1999/xhtml"_ns;
|
||||
ErrorResult rv;
|
||||
allParams = ourElement->GetElementsByTagNameNS(xhtml_ns, u"param"_ns, rv);
|
||||
if (rv.Failed()) {
|
||||
|
|
|
@ -220,7 +220,7 @@ nsXMLContentSerializer::AppendCDATASection(nsIContent* aCDATASection,
|
|||
|
||||
nsresult rv;
|
||||
|
||||
NS_NAMED_LITERAL_STRING(cdata, "<![CDATA[");
|
||||
constexpr auto cdata = u"<![CDATA["_ns;
|
||||
|
||||
if (mDoRaw || PreLevel() > 0) {
|
||||
NS_ENSURE_TRUE(AppendToString(cdata, *mOutput), NS_ERROR_OUT_OF_MEMORY);
|
||||
|
@ -316,7 +316,7 @@ nsXMLContentSerializer::AppendComment(Comment* aComment, int32_t aStartOffset,
|
|||
|
||||
NS_ENSURE_TRUE(MaybeAddNewlineForRootNode(*mOutput), NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(startComment, "<!--");
|
||||
constexpr auto startComment = u"<!--"_ns;
|
||||
|
||||
if (mDoRaw || PreLevel() > 0) {
|
||||
NS_ENSURE_TRUE(AppendToString(startComment, *mOutput),
|
||||
|
@ -1090,7 +1090,7 @@ nsXMLContentSerializer::AppendDocumentStart(Document* aDocument) {
|
|||
if (version.IsEmpty())
|
||||
return NS_OK; // A declaration must have version, or there is no decl
|
||||
|
||||
NS_NAMED_LITERAL_STRING(endQuote, "\"");
|
||||
constexpr auto endQuote = u"\""_ns;
|
||||
|
||||
*mOutput += u"<?xml version=\""_ns + version + endQuote;
|
||||
|
||||
|
|
|
@ -18,11 +18,10 @@
|
|||
TEST(TestParser, TestParserMain)
|
||||
{
|
||||
bool allTestsPassed = false;
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
htmlInput,
|
||||
"<html><head>"
|
||||
constexpr auto htmlInput =
|
||||
u"<html><head>"
|
||||
"<meta http-equiv=\"content-type\" content=\"text/html; charset=\">"
|
||||
"</head><body>Hello <b>Thunderbird!</b></body></html>");
|
||||
"</head><body>Hello <b>Thunderbird!</b></body></html>"_ns;
|
||||
|
||||
do {
|
||||
// Parse the HTML source.
|
||||
|
|
|
@ -188,7 +188,7 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
namespace cache {
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kCachesSQLiteFilename, "caches.sqlite");
|
||||
const nsLiteralString kCachesSQLiteFilename = u"caches.sqlite"_ns;
|
||||
|
||||
CacheQuotaClient::CacheQuotaClient()
|
||||
: mDirPaddingFileMutex("DOMCacheQuotaClient.mDirPaddingFileMutex") {
|
||||
|
|
|
@ -3997,7 +3997,7 @@ gfxFontGroup* CanvasRenderingContext2D::GetCurrentFontStyle() {
|
|||
// use lazy initilization for the font group since it's rather expensive
|
||||
if (!CurrentState().fontGroup) {
|
||||
ErrorResult err;
|
||||
NS_NAMED_LITERAL_STRING(kDefaultFontStyle, "10px sans-serif");
|
||||
constexpr auto kDefaultFontStyle = u"10px sans-serif"_ns;
|
||||
static float kDefaultFontSize = 10.0;
|
||||
RefPtr<PresShell> presShell = GetPresShell();
|
||||
bool fontUpdated = SetFontInternal(kDefaultFontStyle, err);
|
||||
|
|
|
@ -265,7 +265,7 @@ nsresult CanvasRenderingContextHelper::ParseParams(
|
|||
// parse options string as is and pass it to the encoder.
|
||||
*outUsingCustomParseOptions = false;
|
||||
if (outParams.Length() == 0 && aEncoderOptions.isString()) {
|
||||
NS_NAMED_LITERAL_STRING(mozParseOptions, "-moz-parse-options:");
|
||||
constexpr auto mozParseOptions = u"-moz-parse-options:"_ns;
|
||||
nsAutoJSString paramString;
|
||||
if (!paramString.init(aCx, aEncoderOptions.toString())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -194,11 +194,10 @@ class BlobURLsReporter final : public nsIMemoryReporter {
|
|||
BlobImpl* blobImpl = iter.UserData()->mBlobImpl;
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(
|
||||
desc,
|
||||
constexpr auto desc =
|
||||
"A blob URL allocated with URL.createObjectURL; the referenced "
|
||||
"blob cannot be freed until all URLs for it have been explicitly "
|
||||
"invalidated with URL.revokeObjectURL.");
|
||||
"invalidated with URL.revokeObjectURL."_ns;
|
||||
nsAutoCString path, url, owner, specialDesc;
|
||||
uint64_t size = 0;
|
||||
uint32_t refCount = 1;
|
||||
|
@ -264,11 +263,10 @@ class BlobURLsReporter final : public nsIMemoryReporter {
|
|||
path = "media-source-urls/";
|
||||
BuildPath(path, key, info, aAnonymize);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(
|
||||
desc,
|
||||
constexpr auto desc =
|
||||
"An object URL allocated with URL.createObjectURL; the referenced "
|
||||
"data cannot be freed until all URLs for it have been explicitly "
|
||||
"invalidated with URL.revokeObjectURL.");
|
||||
"invalidated with URL.revokeObjectURL."_ns;
|
||||
|
||||
aCallback->Callback(EmptyCString(), path, KIND_OTHER, UNITS_COUNT, 1,
|
||||
desc, aData);
|
||||
|
|
|
@ -41,8 +41,8 @@ bool FileSystemUtils::IsValidRelativeDOMPath(const nsAString& aPath,
|
|||
return false;
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kCurrentDir, ".");
|
||||
NS_NAMED_LITERAL_STRING(kParentDir, "..");
|
||||
constexpr auto kCurrentDir = u"."_ns;
|
||||
constexpr auto kParentDir = u".."_ns;
|
||||
|
||||
// Split path and check each path component.
|
||||
nsCharSeparatedTokenizerTemplate<TokenizerIgnoreNothing> tokenizer(
|
||||
|
|
|
@ -1802,7 +1802,7 @@ class HTMLMediaElement::ChannelLoader final {
|
|||
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(aChannel);
|
||||
NS_ENSURE_STATE(http);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(rangeHdr, "Range");
|
||||
constexpr auto rangeHdr = "Range"_ns;
|
||||
|
||||
nsAutoCString rangeVal;
|
||||
if (NS_SUCCEEDED(http->GetRequestHeader(rangeHdr, rangeVal))) {
|
||||
|
|
|
@ -195,7 +195,7 @@ nsresult PluginDocument::CreateSyntheticPluginDocument() {
|
|||
}
|
||||
|
||||
// remove margins from body
|
||||
NS_NAMED_LITERAL_STRING(zero, "0");
|
||||
constexpr auto zero = u"0"_ns;
|
||||
body->SetAttr(kNameSpaceID_None, nsGkAtoms::marginwidth, zero, false);
|
||||
body->SetAttr(kNameSpaceID_None, nsGkAtoms::marginheight, zero, false);
|
||||
|
||||
|
@ -212,7 +212,7 @@ nsresult PluginDocument::CreateSyntheticPluginDocument() {
|
|||
false);
|
||||
|
||||
// fill viewport and auto-resize
|
||||
NS_NAMED_LITERAL_STRING(percent100, "100%");
|
||||
constexpr auto percent100 = u"100%"_ns;
|
||||
mPluginContent->SetAttr(kNameSpaceID_None, nsGkAtoms::width, percent100,
|
||||
false);
|
||||
mPluginContent->SetAttr(kNameSpaceID_None, nsGkAtoms::height, percent100,
|
||||
|
|
|
@ -256,19 +256,19 @@ const uint32_t kConnectionThreadIdleMS = 30 * 1000; // 30 seconds
|
|||
|
||||
const uint32_t kFileCopyBufferSize = 32768;
|
||||
|
||||
constexpr auto kJournalDirectoryName = NS_LITERAL_STRING("journals");
|
||||
constexpr auto kJournalDirectoryName = u"journals"_ns;
|
||||
|
||||
constexpr auto kFileManagerDirectoryNameSuffix = NS_LITERAL_STRING(".files");
|
||||
constexpr auto kSQLiteSuffix = NS_LITERAL_STRING(".sqlite");
|
||||
constexpr auto kSQLiteJournalSuffix = NS_LITERAL_STRING(".sqlite-journal");
|
||||
constexpr auto kSQLiteSHMSuffix = NS_LITERAL_STRING(".sqlite-shm");
|
||||
constexpr auto kSQLiteWALSuffix = NS_LITERAL_STRING(".sqlite-wal");
|
||||
constexpr auto kFileManagerDirectoryNameSuffix = u".files"_ns;
|
||||
constexpr auto kSQLiteSuffix = u".sqlite"_ns;
|
||||
constexpr auto kSQLiteJournalSuffix = u".sqlite-journal"_ns;
|
||||
constexpr auto kSQLiteSHMSuffix = u".sqlite-shm"_ns;
|
||||
constexpr auto kSQLiteWALSuffix = u".sqlite-wal"_ns;
|
||||
|
||||
const char kPrefFileHandleEnabled[] = "dom.fileHandle.enabled";
|
||||
|
||||
constexpr auto kPermissionStringBase = NS_LITERAL_CSTRING("indexedDB-chrome-");
|
||||
constexpr auto kPermissionReadSuffix = NS_LITERAL_CSTRING("-read");
|
||||
constexpr auto kPermissionWriteSuffix = NS_LITERAL_CSTRING("-write");
|
||||
constexpr auto kPermissionStringBase = "indexedDB-chrome-"_ns;
|
||||
constexpr auto kPermissionReadSuffix = "-read"_ns;
|
||||
constexpr auto kPermissionWriteSuffix = "-write"_ns;
|
||||
|
||||
// The following constants define all names of binding parameters in statements,
|
||||
// where they are bound by name. This should include all parameter names which
|
||||
|
@ -279,38 +279,34 @@ constexpr auto kPermissionWriteSuffix = NS_LITERAL_CSTRING("-write");
|
|||
// (literally vs. via these constants) nor the binding styles (by index vs. by
|
||||
// name) should not be mixed for the same statement. The decision must be made
|
||||
// for each statement based on the proximity of statement and binding calls.
|
||||
constexpr auto kStmtParamNameCurrentKey = NS_LITERAL_CSTRING("current_key");
|
||||
constexpr auto kStmtParamNameRangeBound = NS_LITERAL_CSTRING("range_bound");
|
||||
constexpr auto kStmtParamNameObjectStorePosition =
|
||||
NS_LITERAL_CSTRING("object_store_position");
|
||||
constexpr auto kStmtParamNameLowerKey = NS_LITERAL_CSTRING("lower_key");
|
||||
constexpr auto kStmtParamNameUpperKey = NS_LITERAL_CSTRING("upper_key");
|
||||
constexpr auto kStmtParamNameKey = NS_LITERAL_CSTRING("key");
|
||||
constexpr auto kStmtParamNameObjectStoreId =
|
||||
NS_LITERAL_CSTRING("object_store_id");
|
||||
constexpr auto kStmtParamNameIndexId = NS_LITERAL_CSTRING("index_id");
|
||||
constexpr auto kStmtParamNameCurrentKey = "current_key"_ns;
|
||||
constexpr auto kStmtParamNameRangeBound = "range_bound"_ns;
|
||||
constexpr auto kStmtParamNameObjectStorePosition = "object_store_position"_ns;
|
||||
constexpr auto kStmtParamNameLowerKey = "lower_key"_ns;
|
||||
constexpr auto kStmtParamNameUpperKey = "upper_key"_ns;
|
||||
constexpr auto kStmtParamNameKey = "key"_ns;
|
||||
constexpr auto kStmtParamNameObjectStoreId = "object_store_id"_ns;
|
||||
constexpr auto kStmtParamNameIndexId = "index_id"_ns;
|
||||
// TODO: Maybe the uses of kStmtParamNameId should be replaced by more
|
||||
// specific constants such as kStmtParamNameObjectStoreId.
|
||||
constexpr auto kStmtParamNameId = NS_LITERAL_CSTRING("id");
|
||||
constexpr auto kStmtParamNameValue = NS_LITERAL_CSTRING("value");
|
||||
constexpr auto kStmtParamNameObjectDataKey =
|
||||
NS_LITERAL_CSTRING("object_data_key");
|
||||
constexpr auto kStmtParamNameIndexDataValues =
|
||||
NS_LITERAL_CSTRING("index_data_values");
|
||||
constexpr auto kStmtParamNameData = NS_LITERAL_CSTRING("data");
|
||||
constexpr auto kStmtParamNameFileIds = NS_LITERAL_CSTRING("file_ids");
|
||||
constexpr auto kStmtParamNameValueLocale = NS_LITERAL_CSTRING("value_locale");
|
||||
constexpr auto kStmtParamNameLimit = NS_LITERAL_CSTRING("limit");
|
||||
constexpr auto kStmtParamNameId = "id"_ns;
|
||||
constexpr auto kStmtParamNameValue = "value"_ns;
|
||||
constexpr auto kStmtParamNameObjectDataKey = "object_data_key"_ns;
|
||||
constexpr auto kStmtParamNameIndexDataValues = "index_data_values"_ns;
|
||||
constexpr auto kStmtParamNameData = "data"_ns;
|
||||
constexpr auto kStmtParamNameFileIds = "file_ids"_ns;
|
||||
constexpr auto kStmtParamNameValueLocale = "value_locale"_ns;
|
||||
constexpr auto kStmtParamNameLimit = "limit"_ns;
|
||||
|
||||
// The following constants define some names of columns in tables, which are
|
||||
// referred to in remote locations, e.g. in calls to
|
||||
// GetBindingClauseForKeyRange.
|
||||
constexpr auto kColumnNameKey = NS_LITERAL_CSTRING("key");
|
||||
constexpr auto kColumnNameValue = NS_LITERAL_CSTRING("value");
|
||||
constexpr auto kColumnNameAliasSortKey = NS_LITERAL_CSTRING("sort_column");
|
||||
constexpr auto kColumnNameKey = "key"_ns;
|
||||
constexpr auto kColumnNameValue = "value"_ns;
|
||||
constexpr auto kColumnNameAliasSortKey = "sort_column"_ns;
|
||||
|
||||
// SQL fragments used at multiple locations.
|
||||
constexpr auto kOpenLimit = NS_LITERAL_CSTRING(" LIMIT ");
|
||||
constexpr auto kOpenLimit = " LIMIT "_ns;
|
||||
|
||||
// The deletion marker file is created before RemoveDatabaseFilesAndDirectory
|
||||
// begins deleting a database. It is removed as the last step of deletion. If a
|
||||
|
@ -319,8 +315,7 @@ constexpr auto kOpenLimit = NS_LITERAL_CSTRING(" LIMIT ");
|
|||
// are removed. The primary goal of this mechanism is to avoid situations where
|
||||
// a database has been partially deleted, leading to inconsistent state for the
|
||||
// origin.
|
||||
constexpr auto kIdbDeletionMarkerFilePrefix =
|
||||
NS_LITERAL_STRING("idb-deleting-");
|
||||
constexpr auto kIdbDeletionMarkerFilePrefix = u"idb-deleting-"_ns;
|
||||
|
||||
const uint32_t kDeleteTimeoutMs = 1000;
|
||||
|
||||
|
@ -1825,7 +1820,7 @@ nsresult UpgradeSchemaFrom8To9_0(mozIStorageConnection& aConnection) {
|
|||
|
||||
nsCOMPtr<mozIStorageFunction> compressor = new CompressDataBlobsFunction();
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(compressorName, "compress");
|
||||
constexpr auto compressorName = "compress"_ns;
|
||||
|
||||
rv = aConnection.CreateFunction(compressorName, 1, compressor);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
@ -2104,7 +2099,7 @@ nsresult UpgradeSchemaFrom11_0To12_0(mozIStorageConnection& aConnection) {
|
|||
|
||||
AUTO_PROFILER_LABEL("UpgradeSchemaFrom11_0To12_0", DOM);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(encoderName, "encode");
|
||||
constexpr auto encoderName = "encode"_ns;
|
||||
|
||||
nsCOMPtr<mozIStorageFunction> encoder = new EncodeKeysFunction();
|
||||
|
||||
|
@ -2748,7 +2743,7 @@ nsresult UpgradeSchemaFrom17_0To18_0Helper::DoUpgrade(
|
|||
// Register the |upgrade_key| function.
|
||||
RefPtr<UpgradeKeyFunction> updateFunction = new UpgradeKeyFunction();
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(upgradeKeyFunctionName, "upgrade_key");
|
||||
constexpr auto upgradeKeyFunctionName = "upgrade_key"_ns;
|
||||
|
||||
nsresult rv =
|
||||
aConnection.CreateFunction(upgradeKeyFunctionName, 1, updateFunction);
|
||||
|
@ -2760,7 +2755,7 @@ nsresult UpgradeSchemaFrom17_0To18_0Helper::DoUpgrade(
|
|||
RefPtr<InsertIndexDataValuesFunction> insertIDVFunction =
|
||||
new InsertIndexDataValuesFunction();
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(insertIDVFunctionName, "insert_idv");
|
||||
constexpr auto insertIDVFunctionName = "insert_idv"_ns;
|
||||
|
||||
rv = aConnection.CreateFunction(insertIDVFunctionName, 4, insertIDVFunction);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
@ -3384,7 +3379,7 @@ nsresult UpgradeSchemaFrom19_0To20_0(nsIFile* aFMDirectory,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(functionName, "upgrade");
|
||||
constexpr auto functionName = "upgrade"_ns;
|
||||
|
||||
rv = aConnection.CreateFunction(functionName, 2, function);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
@ -3587,7 +3582,7 @@ nsresult UpgradeSchemaFrom20_0To21_0(mozIStorageConnection& aConnection) {
|
|||
RefPtr<UpgradeIndexDataValuesFunction> function =
|
||||
new UpgradeIndexDataValuesFunction();
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(functionName, "upgrade_idv");
|
||||
constexpr auto functionName = "upgrade_idv"_ns;
|
||||
|
||||
nsresult rv = aConnection.CreateFunction(functionName, 1, function);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
@ -3746,7 +3741,7 @@ nsresult UpgradeSchemaFrom25_0To26_0(mozIStorageConnection& aConnection) {
|
|||
|
||||
AUTO_PROFILER_LABEL("UpgradeSchemaFrom25_0To26_0", DOM);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(functionName, "strip_obsolete_attributes");
|
||||
constexpr auto functionName = "strip_obsolete_attributes"_ns;
|
||||
|
||||
nsCOMPtr<mozIStorageFunction> stripObsoleteAttributes =
|
||||
new StripObsoleteOriginAttributesFunction();
|
||||
|
@ -3836,7 +3831,7 @@ Result<nsCOMPtr<nsIFileURL>, nsresult> GetDatabaseFileURL(
|
|||
nsresult SetDefaultPragmas(mozIStorageConnection& aConnection) {
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
static constexpr auto kBuiltInPragmas = NS_LITERAL_CSTRING(
|
||||
static constexpr auto kBuiltInPragmas =
|
||||
// We use foreign keys in DEBUG builds only because there is a performance
|
||||
// cost to using them.
|
||||
"PRAGMA foreign_keys = "
|
||||
|
@ -3856,7 +3851,7 @@ nsresult SetDefaultPragmas(mozIStorageConnection& aConnection) {
|
|||
|
||||
// We aggressively truncate the database file when idle so don't bother
|
||||
// overwriting the WAL with 0 during active periods.
|
||||
"PRAGMA secure_delete = OFF;");
|
||||
"PRAGMA secure_delete = OFF;"_ns;
|
||||
|
||||
nsresult rv = aConnection.ExecuteSimpleSQL(kBuiltInPragmas);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
@ -3897,8 +3892,8 @@ nsresult SetJournalMode(mozIStorageConnection& aConnection) {
|
|||
|
||||
// Try enabling WAL mode. This can fail in various circumstances so we have to
|
||||
// check the results here.
|
||||
NS_NAMED_LITERAL_CSTRING(journalModeQueryStart, "PRAGMA journal_mode = ");
|
||||
NS_NAMED_LITERAL_CSTRING(journalModeWAL, "wal");
|
||||
constexpr auto journalModeQueryStart = "PRAGMA journal_mode = "_ns;
|
||||
constexpr auto journalModeWAL = "wal"_ns;
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt;
|
||||
nsresult rv = aConnection.CreateStatement(
|
||||
|
@ -9743,7 +9738,7 @@ uint32_t TelemetryIdForFile(nsIFile* aFile) {
|
|||
nsString persistence;
|
||||
MOZ_ALWAYS_SUCCEEDS(persistenceDirectory->GetLeafName(persistence));
|
||||
|
||||
NS_NAMED_LITERAL_STRING(separator, "*");
|
||||
constexpr auto separator = u"*"_ns;
|
||||
|
||||
uint32_t hashValue =
|
||||
HashString(persistence + separator + origin + separator + filename);
|
||||
|
@ -19095,8 +19090,8 @@ nsAutoCString DatabaseOperationBase::GetBindingClauseForKeyRange(
|
|||
MOZ_ASSERT(!IsOnBackgroundThread());
|
||||
MOZ_ASSERT(!aKeyColumnName.IsEmpty());
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(andStr, " AND ");
|
||||
NS_NAMED_LITERAL_CSTRING(spacecolon, " :");
|
||||
constexpr auto andStr = " AND "_ns;
|
||||
constexpr auto spacecolon = " :"_ns;
|
||||
|
||||
nsAutoCString result;
|
||||
if (aKeyRange.isOnly()) {
|
||||
|
@ -23756,7 +23751,7 @@ nsresult CreateIndexOp::InsertDataFromObjectStore(
|
|||
RefPtr<UpdateIndexDataValuesFunction> updateFunction =
|
||||
new UpdateIndexDataValuesFunction(this, aConnection);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(updateFunctionName, "update_index_data_values");
|
||||
constexpr auto updateFunctionName = "update_index_data_values"_ns;
|
||||
|
||||
nsresult rv =
|
||||
storageConnection.CreateFunction(updateFunctionName, 4, updateFunction);
|
||||
|
|
|
@ -90,7 +90,7 @@ class MOZ_STACK_CLASS LoggingString final : public nsAutoCString {
|
|||
|
||||
explicit LoggingString(const IDBTransaction& aTransaction)
|
||||
: nsAutoCString(kOpenBracket) {
|
||||
NS_NAMED_LITERAL_CSTRING(kCommaSpace, ", ");
|
||||
constexpr auto kCommaSpace = ", "_ns;
|
||||
|
||||
const nsTArray<nsString>& stores = aTransaction.ObjectStoreNamesInternal();
|
||||
|
||||
|
|
|
@ -473,12 +473,11 @@ ContentParentsMemoryReporter::CollectReports(
|
|||
NS_ConvertUTF16toUTF8(friendlyName).get(), cp->Pid(), channelStr,
|
||||
static_cast<nsIObserver*>(cp), refcnt);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(
|
||||
desc,
|
||||
constexpr auto desc =
|
||||
"The number of unset IPC messages held in this ContentParent's "
|
||||
"channel. A large value here might indicate that we're leaking "
|
||||
"messages. Similarly, a ContentParent object for a process that's no "
|
||||
"longer running could indicate that we're leaking ContentParents.");
|
||||
"longer running could indicate that we're leaking ContentParents."_ns;
|
||||
|
||||
aHandleReport->Callback(/* process */ EmptyCString(), path, KIND_OTHER,
|
||||
UNITS_COUNT, numQueuedMessages, desc, aData);
|
||||
|
|
|
@ -317,8 +317,8 @@ nsresult nsJSThunk::EvaluateScript(
|
|||
|
||||
char* bytes;
|
||||
uint32_t bytesLen;
|
||||
NS_NAMED_LITERAL_CSTRING(isoCharset, "windows-1252");
|
||||
NS_NAMED_LITERAL_CSTRING(utf8Charset, "UTF-8");
|
||||
constexpr auto isoCharset = "windows-1252"_ns;
|
||||
constexpr auto utf8Charset = "UTF-8"_ns;
|
||||
const nsLiteralCString* charset;
|
||||
if (IsISO88591(result)) {
|
||||
// For compatibility, if the result is ISO-8859-1, we use
|
||||
|
|
|
@ -844,8 +844,8 @@ nsresult SetShadowJournalMode(mozIStorageConnection* aConnection) {
|
|||
|
||||
// Try enabling WAL mode. This can fail in various circumstances so we have to
|
||||
// check the results here.
|
||||
NS_NAMED_LITERAL_CSTRING(journalModeQueryStart, "PRAGMA journal_mode = ");
|
||||
NS_NAMED_LITERAL_CSTRING(journalModeWAL, "wal");
|
||||
constexpr auto journalModeQueryStart = "PRAGMA journal_mode = "_ns;
|
||||
constexpr auto journalModeWAL = "wal"_ns;
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt;
|
||||
nsresult rv = aConnection->CreateStatement(
|
||||
|
|
|
@ -178,7 +178,7 @@ bool IsDefaultPlaybackDeviceMono() {
|
|||
}
|
||||
|
||||
bool IsVideoContentType(const nsCString& aContentType) {
|
||||
NS_NAMED_LITERAL_CSTRING(video, "video");
|
||||
constexpr auto video = "video"_ns;
|
||||
if (FindInReadable(video, aContentType)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -145,13 +145,13 @@ MediaKeySystemStatus MediaKeySystemAccess::GetKeySystemStatus(
|
|||
|
||||
typedef nsCString EMECodecString;
|
||||
|
||||
static NS_NAMED_LITERAL_CSTRING(EME_CODEC_AAC, "aac");
|
||||
static NS_NAMED_LITERAL_CSTRING(EME_CODEC_OPUS, "opus");
|
||||
static NS_NAMED_LITERAL_CSTRING(EME_CODEC_VORBIS, "vorbis");
|
||||
static NS_NAMED_LITERAL_CSTRING(EME_CODEC_FLAC, "flac");
|
||||
static NS_NAMED_LITERAL_CSTRING(EME_CODEC_H264, "h264");
|
||||
static NS_NAMED_LITERAL_CSTRING(EME_CODEC_VP8, "vp8");
|
||||
static NS_NAMED_LITERAL_CSTRING(EME_CODEC_VP9, "vp9");
|
||||
static constexpr auto EME_CODEC_AAC = "aac"_ns;
|
||||
static constexpr auto EME_CODEC_OPUS = "opus"_ns;
|
||||
static constexpr auto EME_CODEC_VORBIS = "vorbis"_ns;
|
||||
static constexpr auto EME_CODEC_FLAC = "flac"_ns;
|
||||
static constexpr auto EME_CODEC_H264 = "h264"_ns;
|
||||
static constexpr auto EME_CODEC_VP8 = "vp8"_ns;
|
||||
static constexpr auto EME_CODEC_VP9 = "vp9"_ns;
|
||||
|
||||
EMECodecString ToEMEAPICodecString(const nsString& aCodec) {
|
||||
if (IsAACCodecString(aCodec)) {
|
||||
|
|
|
@ -329,8 +329,9 @@ void MediaDrmCDMProxy::OnKeyStatusesChange(const nsAString& aSessionId) {
|
|||
void MediaDrmCDMProxy::GetStatusForPolicy(PromiseId aPromiseId,
|
||||
const nsAString& aMinHdcpVersion) {
|
||||
// TODO: Implement GetStatusForPolicy.
|
||||
NS_NAMED_LITERAL_CSTRING(
|
||||
err, "Currently Fennec does not support GetStatusForPolicy");
|
||||
constexpr auto err =
|
||||
"Currently Fennec does not support GetStatusForPolicy"_ns;
|
||||
|
||||
ErrorResult rv;
|
||||
rv.ThrowNotSupportedError(err);
|
||||
RejectPromise(aPromiseId, std::move(rv), err);
|
||||
|
@ -359,7 +360,7 @@ void MediaDrmCDMProxy::OnCDMCreated(uint32_t aPromiseId) {
|
|||
}
|
||||
|
||||
// No CDM? Just reject the promise.
|
||||
NS_NAMED_LITERAL_CSTRING(err, "Null CDM in OnCDMCreated()");
|
||||
constexpr auto err = "Null CDM in OnCDMCreated()"_ns;
|
||||
ErrorResult rv;
|
||||
rv.ThrowInvalidStateError(err);
|
||||
mKeys->RejectPromise(aPromiseId, std::move(rv), err);
|
||||
|
|
|
@ -256,8 +256,8 @@ void ChromiumCDMParent::GetStatusForPolicy(uint32_t aPromiseId,
|
|||
// <https://github.com/WICG/hdcp-detection/blob/master/explainer.md>
|
||||
// does not define what exceptions get thrown. Let's assume
|
||||
// TypeError for invalid args, as usual.
|
||||
NS_NAMED_LITERAL_CSTRING(
|
||||
err, "getStatusForPolicy failed due to bad hdcp version argument");
|
||||
constexpr auto err =
|
||||
"getStatusForPolicy failed due to bad hdcp version argument"_ns;
|
||||
rv.ThrowTypeError(err);
|
||||
RejectPromise(aPromiseId, std::move(rv), err);
|
||||
return;
|
||||
|
|
|
@ -155,7 +155,7 @@ void ChromiumCDMProxy::OnCDMCreated(uint32_t aPromiseId) {
|
|||
mKeys->OnCDMCreated(aPromiseId, cdm->PluginId());
|
||||
} else {
|
||||
// No CDM? Shouldn't be possible, but reject the promise anyway...
|
||||
NS_NAMED_LITERAL_CSTRING(err, "Null CDM in OnCDMCreated()");
|
||||
constexpr auto err = "Null CDM in OnCDMCreated()"_ns;
|
||||
ErrorResult rv;
|
||||
rv.ThrowInvalidStateError(err);
|
||||
mKeys->RejectPromise(aPromiseId, std::move(rv), err);
|
||||
|
|
|
@ -832,41 +832,41 @@ class CDMStorageTest {
|
|||
#endif
|
||||
|
||||
void TestLongRecordNames() {
|
||||
NS_NAMED_LITERAL_CSTRING(longRecordName,
|
||||
"A_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"long_record_name");
|
||||
constexpr auto longRecordName =
|
||||
"A_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_very_very_very_"
|
||||
"very_very_very_very_very_very_"
|
||||
"long_record_name"_ns;
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(data, "Just_some_arbitrary_data.");
|
||||
constexpr auto data = "Just_some_arbitrary_data."_ns;
|
||||
|
||||
MOZ_ASSERT(longRecordName.Length() < GMP_MAX_RECORD_NAME_SIZE);
|
||||
MOZ_ASSERT(longRecordName.Length() > 260); // Windows MAX_PATH
|
||||
|
|
|
@ -34,10 +34,10 @@ mozilla::LazyLogModule sAndroidDecoderModuleLog("AndroidDecoderModule");
|
|||
|
||||
const nsCString TranslateMimeType(const nsACString& aMimeType) {
|
||||
if (VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP8)) {
|
||||
static NS_NAMED_LITERAL_CSTRING(vp8, "video/x-vnd.on2.vp8");
|
||||
static constexpr auto vp8 = "video/x-vnd.on2.vp8"_ns;
|
||||
return vp8;
|
||||
} else if (VPXDecoder::IsVPX(aMimeType, VPXDecoder::VP9)) {
|
||||
static NS_NAMED_LITERAL_CSTRING(vp9, "video/x-vnd.on2.vp9");
|
||||
static constexpr auto vp9 = "video/x-vnd.on2.vp9"_ns;
|
||||
return vp9;
|
||||
}
|
||||
return nsCString(aMimeType);
|
||||
|
|
|
@ -2192,8 +2192,8 @@ void nsPluginHost::RegisterWithCategoryManager(const nsCString& aMimeType,
|
|||
return;
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(
|
||||
contractId, "@mozilla.org/content/plugin/document-loader-factory;1");
|
||||
constexpr auto contractId =
|
||||
"@mozilla.org/content/plugin/document-loader-factory;1"_ns;
|
||||
|
||||
if (aType == ePluginRegister) {
|
||||
catMan->AddCategoryEntry("Gecko-Content-Viewers", aMimeType, contractId,
|
||||
|
|
|
@ -2871,7 +2871,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void) {
|
|||
|
||||
nsAutoCString description;
|
||||
GetPluginDescription(description);
|
||||
NS_NAMED_LITERAL_CSTRING(flash10Head, "Shockwave Flash 10.");
|
||||
constexpr auto flash10Head = "Shockwave Flash 10."_ns;
|
||||
mFlash10Quirks = StringBeginsWith(description, flash10Head);
|
||||
#endif
|
||||
} else if (mWidget) {
|
||||
|
|
|
@ -42,13 +42,13 @@ bool nsPluginsDir::IsPluginFile(nsIFile* file) {
|
|||
nsAutoCString filename;
|
||||
if (NS_FAILED(file->GetNativeLeafName(filename))) return false;
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(dllSuffix, LOCAL_PLUGIN_DLL_SUFFIX);
|
||||
constexpr auto dllSuffix = nsLiteralCString{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);
|
||||
constexpr auto dllAltSuffix = nsLiteralCString{LOCAL_PLUGIN_DLL_ALT_SUFFIX};
|
||||
if (filename.Length() > dllAltSuffix.Length() &&
|
||||
StringEndsWith(filename, dllAltSuffix))
|
||||
return true;
|
||||
|
|
|
@ -205,7 +205,7 @@ static HANDLE WINAPI CreateFileAHookFn(LPCSTR aFname, DWORD aAccess,
|
|||
}
|
||||
|
||||
static bool GetLocalLowTempPath(size_t aLen, LPWSTR aPath) {
|
||||
NS_NAMED_LITERAL_STRING(tempname, "\\Temp");
|
||||
constexpr auto tempname = u"\\Temp"_ns;
|
||||
LPWSTR path;
|
||||
if (SUCCEEDED(
|
||||
SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0, nullptr, &path))) {
|
||||
|
|
|
@ -255,7 +255,7 @@ bool PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
|
|||
mAsyncRenderSupport = info.fSupportsAsyncRender;
|
||||
#endif
|
||||
#if defined(MOZ_X11)
|
||||
NS_NAMED_LITERAL_CSTRING(flash10Head, "Shockwave Flash 10.");
|
||||
constexpr auto flash10Head = "Shockwave Flash 10."_ns;
|
||||
if (StringBeginsWith(nsDependentCString(info.fDescription), flash10Head)) {
|
||||
AddQuirk(QUIRK_FLASH_EXPOSE_COORD_TRANSLATION);
|
||||
}
|
||||
|
|
|
@ -2041,8 +2041,8 @@ class nsCaseInsensitiveUTF8StringArrayComparator {
|
|||
static void ForceWindowless(nsTArray<nsCString>& names,
|
||||
nsTArray<nsCString>& values) {
|
||||
nsCaseInsensitiveUTF8StringArrayComparator comparator;
|
||||
NS_NAMED_LITERAL_CSTRING(wmodeAttributeName, "wmode");
|
||||
NS_NAMED_LITERAL_CSTRING(opaqueAttributeValue, "opaque");
|
||||
constexpr auto wmodeAttributeName = "wmode"_ns;
|
||||
constexpr auto opaqueAttributeValue = "opaque"_ns;
|
||||
auto wmodeAttributeIndex = names.IndexOf(wmodeAttributeName, 0, comparator);
|
||||
if (wmodeAttributeIndex != names.NoIndex) {
|
||||
if (!values[wmodeAttributeIndex].EqualsLiteral("transparent")) {
|
||||
|
@ -2058,8 +2058,8 @@ static void ForceWindowless(nsTArray<nsCString>& names,
|
|||
static void ForceDirect(nsTArray<nsCString>& names,
|
||||
nsTArray<nsCString>& values) {
|
||||
nsCaseInsensitiveUTF8StringArrayComparator comparator;
|
||||
NS_NAMED_LITERAL_CSTRING(wmodeAttributeName, "wmode");
|
||||
NS_NAMED_LITERAL_CSTRING(directAttributeValue, "direct");
|
||||
constexpr auto wmodeAttributeName = "wmode"_ns;
|
||||
constexpr auto directAttributeValue = "direct"_ns;
|
||||
auto wmodeAttributeIndex = names.IndexOf(wmodeAttributeName, 0, comparator);
|
||||
if (wmodeAttributeIndex != names.NoIndex) {
|
||||
if ((!values[wmodeAttributeIndex].EqualsLiteral("transparent")) &&
|
||||
|
@ -2083,7 +2083,7 @@ nsresult PluginModuleParent::NPP_NewInternal(
|
|||
}
|
||||
|
||||
nsCaseInsensitiveUTF8StringArrayComparator comparator;
|
||||
NS_NAMED_LITERAL_CSTRING(srcAttributeName, "src");
|
||||
constexpr auto srcAttributeName = "src"_ns;
|
||||
auto srcAttributeIndex = names.IndexOf(srcAttributeName, 0, comparator);
|
||||
nsAutoCString srcAttribute;
|
||||
if (srcAttributeIndex != names.NoIndex) {
|
||||
|
|
|
@ -187,13 +187,11 @@ const char kAboutHomeOriginPrefix[] = "moz-safe-about:home";
|
|||
const char kIndexedDBOriginPrefix[] = "indexeddb://";
|
||||
const char kResourceOriginPrefix[] = "resource://";
|
||||
|
||||
constexpr auto kPersistentOriginTelemetryKey =
|
||||
NS_LITERAL_CSTRING("PersistentOrigin");
|
||||
constexpr auto kTemporaryOriginTelemetryKey =
|
||||
NS_LITERAL_CSTRING("TemporaryOrigin");
|
||||
constexpr auto kPersistentOriginTelemetryKey = "PersistentOrigin"_ns;
|
||||
constexpr auto kTemporaryOriginTelemetryKey = "TemporaryOrigin"_ns;
|
||||
|
||||
constexpr auto kStorageName = NS_LITERAL_STRING("storage");
|
||||
constexpr auto kSQLiteSuffix = NS_LITERAL_STRING(".sqlite");
|
||||
constexpr auto kStorageName = u"storage"_ns;
|
||||
constexpr auto kSQLiteSuffix = u".sqlite"_ns;
|
||||
|
||||
#define INDEXEDDB_DIRECTORY_NAME u"indexedDB"
|
||||
#define PERSISTENT_DIRECTORY_NAME u"persistent"
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace quota {
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr auto kPersistentCString = NS_LITERAL_CSTRING("persistent");
|
||||
constexpr auto kTemporaryCString = NS_LITERAL_CSTRING("temporary");
|
||||
constexpr auto kDefaultCString = NS_LITERAL_CSTRING("default");
|
||||
constexpr auto kPersistentCString = "persistent"_ns;
|
||||
constexpr auto kTemporaryCString = "temporary"_ns;
|
||||
constexpr auto kDefaultCString = "default"_ns;
|
||||
|
||||
static_assert(PERSISTENCE_TYPE_PERSISTENT == 0 &&
|
||||
PERSISTENCE_TYPE_TEMPORARY == 1 &&
|
||||
|
|
|
@ -61,8 +61,8 @@ void AnonymizeCString(nsACString& aCString, uint32_t aStart) {
|
|||
const char kQuotaGenericDelimiter = '|';
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
NS_NAMED_LITERAL_CSTRING(kQuotaInternalError, "internal");
|
||||
NS_NAMED_LITERAL_CSTRING(kQuotaExternalError, "external");
|
||||
const nsLiteralCString kQuotaInternalError = "internal"_ns;
|
||||
const nsLiteralCString kQuotaExternalError = "external"_ns;
|
||||
#endif
|
||||
|
||||
LogModule* GetQuotaManagerLogger() { return gLogger; }
|
||||
|
|
|
@ -76,7 +76,7 @@ TEST(QuotaManager, OriginScope)
|
|||
// Sanity checks.
|
||||
|
||||
{
|
||||
NS_NAMED_LITERAL_CSTRING(origin, "http://www.mozilla.org");
|
||||
constexpr auto origin = "http://www.mozilla.org"_ns;
|
||||
originScope.SetFromOrigin(origin);
|
||||
EXPECT_TRUE(originScope.IsOrigin());
|
||||
EXPECT_TRUE(originScope.GetOrigin().Equals(origin));
|
||||
|
@ -84,7 +84,7 @@ TEST(QuotaManager, OriginScope)
|
|||
}
|
||||
|
||||
{
|
||||
NS_NAMED_LITERAL_CSTRING(prefix, "http://www.mozilla.org");
|
||||
constexpr auto prefix = "http://www.mozilla.org"_ns;
|
||||
originScope.SetFromPrefix(prefix);
|
||||
EXPECT_TRUE(originScope.IsPrefix());
|
||||
EXPECT_TRUE(originScope.GetOriginNoSuffix().Equals(prefix));
|
||||
|
|
|
@ -131,7 +131,7 @@ LazyLogModule ScriptLoader::gScriptLoaderLog("ScriptLoader");
|
|||
|
||||
// Alternate Data MIME type used by the ScriptLoader to register that we want to
|
||||
// store bytecode without reading it.
|
||||
static NS_NAMED_LITERAL_CSTRING(kNullMimeType, "javascript/null");
|
||||
static constexpr auto kNullMimeType = "javascript/null"_ns;
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// ScriptLoader::PreloadInfo
|
||||
|
|
|
@ -212,27 +212,25 @@ nsString OptimizeFileName(const nsAString& aFileName) {
|
|||
FilenameTypeAndDetails nsContentSecurityUtils::FilenameToFilenameType(
|
||||
const nsString& fileName, bool collectAdditionalExtensionData) {
|
||||
// These are strings because the Telemetry Events API only accepts strings
|
||||
static NS_NAMED_LITERAL_CSTRING(kChromeURI, "chromeuri");
|
||||
static NS_NAMED_LITERAL_CSTRING(kResourceURI, "resourceuri");
|
||||
static NS_NAMED_LITERAL_CSTRING(kBlobUri, "bloburi");
|
||||
static NS_NAMED_LITERAL_CSTRING(kDataUri, "dataurl");
|
||||
static NS_NAMED_LITERAL_CSTRING(kSingleString, "singlestring");
|
||||
static NS_NAMED_LITERAL_CSTRING(kMozillaExtension, "mozillaextension");
|
||||
static NS_NAMED_LITERAL_CSTRING(kOtherExtension, "otherextension");
|
||||
static NS_NAMED_LITERAL_CSTRING(kSuspectedUserChromeJS,
|
||||
"suspectedUserChromeJS");
|
||||
static constexpr auto kChromeURI = "chromeuri"_ns;
|
||||
static constexpr auto kResourceURI = "resourceuri"_ns;
|
||||
static constexpr auto kBlobUri = "bloburi"_ns;
|
||||
static constexpr auto kDataUri = "dataurl"_ns;
|
||||
static constexpr auto kSingleString = "singlestring"_ns;
|
||||
static constexpr auto kMozillaExtension = "mozillaextension"_ns;
|
||||
static constexpr auto kOtherExtension = "otherextension"_ns;
|
||||
static constexpr auto kSuspectedUserChromeJS = "suspectedUserChromeJS"_ns;
|
||||
#if defined(XP_WIN)
|
||||
static NS_NAMED_LITERAL_CSTRING(kSanitizedWindowsURL, "sanitizedWindowsURL");
|
||||
static NS_NAMED_LITERAL_CSTRING(kSanitizedWindowsPath,
|
||||
"sanitizedWindowsPath");
|
||||
static constexpr auto kSanitizedWindowsURL = "sanitizedWindowsURL"_ns;
|
||||
static constexpr auto kSanitizedWindowsPath = "sanitizedWindowsPath"_ns;
|
||||
#endif
|
||||
static NS_NAMED_LITERAL_CSTRING(kOther, "other");
|
||||
static NS_NAMED_LITERAL_CSTRING(kOtherWorker, "other-on-worker");
|
||||
static NS_NAMED_LITERAL_CSTRING(kRegexFailure, "regexfailure");
|
||||
static constexpr auto kOther = "other"_ns;
|
||||
static constexpr auto kOtherWorker = "other-on-worker"_ns;
|
||||
static constexpr auto kRegexFailure = "regexfailure"_ns;
|
||||
|
||||
static NS_NAMED_LITERAL_STRING(kUCJSRegex, "(.+).uc.js\\?*[0-9]*$");
|
||||
static NS_NAMED_LITERAL_STRING(kExtensionRegex, "extensions/(.+)@(.+)!(.+)$");
|
||||
static NS_NAMED_LITERAL_STRING(kSingleFileRegex, "^[a-zA-Z0-9.?]+$");
|
||||
static constexpr auto kUCJSRegex = u"(.+).uc.js\\?*[0-9]*$"_ns;
|
||||
static constexpr auto kExtensionRegex = u"extensions/(.+)@(.+)!(.+)$"_ns;
|
||||
static constexpr auto kSingleFileRegex = u"^[a-zA-Z0-9.?]+$"_ns;
|
||||
|
||||
// resource:// and chrome://
|
||||
if (StringBeginsWith(fileName, u"chrome://"_ns)) {
|
||||
|
@ -419,9 +417,9 @@ bool nsContentSecurityUtils::IsEvalAllowed(JSContext* cx,
|
|||
// We also permit two specific idioms in eval()-like contexts. We'd like to
|
||||
// elminate these too; but there are in-the-wild Mozilla privileged extensions
|
||||
// that use them.
|
||||
static NS_NAMED_LITERAL_STRING(sAllowedEval1, "this");
|
||||
static NS_NAMED_LITERAL_STRING(sAllowedEval2,
|
||||
"function anonymous(\n) {\nreturn this\n}");
|
||||
static constexpr auto sAllowedEval1 = u"this"_ns;
|
||||
static constexpr auto sAllowedEval2 =
|
||||
u"function anonymous(\n) {\nreturn this\n}"_ns;
|
||||
|
||||
if (MOZ_LIKELY(!aIsSystemPrincipal && !XRE_IsE10sParentProcess())) {
|
||||
// We restrict eval in the system principal and parent process.
|
||||
|
|
|
@ -17,18 +17,17 @@
|
|||
#include "mozilla/dom/SimpleGlobalObject.h"
|
||||
#include "mozilla/extensions/WebExtensionPolicy.h"
|
||||
|
||||
static NS_NAMED_LITERAL_CSTRING(kChromeURI, "chromeuri");
|
||||
static NS_NAMED_LITERAL_CSTRING(kResourceURI, "resourceuri");
|
||||
static NS_NAMED_LITERAL_CSTRING(kBlobUri, "bloburi");
|
||||
static NS_NAMED_LITERAL_CSTRING(kDataUri, "dataurl");
|
||||
static NS_NAMED_LITERAL_CSTRING(kSingleString, "singlestring");
|
||||
static NS_NAMED_LITERAL_CSTRING(kMozillaExtension, "mozillaextension");
|
||||
static NS_NAMED_LITERAL_CSTRING(kOtherExtension, "otherextension");
|
||||
static NS_NAMED_LITERAL_CSTRING(kSuspectedUserChromeJS,
|
||||
"suspectedUserChromeJS");
|
||||
static NS_NAMED_LITERAL_CSTRING(kSanitizedWindowsURL, "sanitizedWindowsURL");
|
||||
static NS_NAMED_LITERAL_CSTRING(kSanitizedWindowsPath, "sanitizedWindowsPath");
|
||||
static NS_NAMED_LITERAL_CSTRING(kOther, "other");
|
||||
static constexpr auto kChromeURI = "chromeuri"_ns;
|
||||
static constexpr auto kResourceURI = "resourceuri"_ns;
|
||||
static constexpr auto kBlobUri = "bloburi"_ns;
|
||||
static constexpr auto kDataUri = "dataurl"_ns;
|
||||
static constexpr auto kSingleString = "singlestring"_ns;
|
||||
static constexpr auto kMozillaExtension = "mozillaextension"_ns;
|
||||
static constexpr auto kOtherExtension = "otherextension"_ns;
|
||||
static constexpr auto kSuspectedUserChromeJS = "suspectedUserChromeJS"_ns;
|
||||
static constexpr auto kSanitizedWindowsURL = "sanitizedWindowsURL"_ns;
|
||||
static constexpr auto kSanitizedWindowsPath = "sanitizedWindowsPath"_ns;
|
||||
static constexpr auto kOther = "other"_ns;
|
||||
|
||||
#define ASSERT_AND_PRINT(first, second, condition) \
|
||||
fprintf(stderr, "First: %s\n", first.get()); \
|
||||
|
@ -39,14 +38,14 @@ static NS_NAMED_LITERAL_CSTRING(kOther, "other");
|
|||
TEST(FilenameEvalParser, ResourceChrome)
|
||||
{
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "chrome://firegestures/content/browser.js");
|
||||
constexpr auto str = u"chrome://firegestures/content/browser.js"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kChromeURI && ret.second.isSome() &&
|
||||
ret.second.value() == str);
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "resource://firegestures/content/browser.js");
|
||||
constexpr auto str = u"resource://firegestures/content/browser.js"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kResourceURI && ret.second.isSome() &&
|
||||
|
@ -57,25 +56,25 @@ TEST(FilenameEvalParser, ResourceChrome)
|
|||
TEST(FilenameEvalParser, BlobData)
|
||||
{
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "blob://000-000");
|
||||
constexpr auto str = u"blob://000-000"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kBlobUri && !ret.second.isSome());
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "blob:000-000");
|
||||
constexpr auto str = u"blob:000-000"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kBlobUri && !ret.second.isSome());
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "data://blahblahblah");
|
||||
constexpr auto str = u"data://blahblahblah"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kDataUri && !ret.second.isSome());
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "data:blahblahblah");
|
||||
constexpr auto str = u"data:blahblahblah"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kDataUri && !ret.second.isSome());
|
||||
|
@ -85,11 +84,11 @@ TEST(FilenameEvalParser, BlobData)
|
|||
TEST(FilenameEvalParser, MozExtension)
|
||||
{
|
||||
{ // Test shield.mozilla.org replacing
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
str,
|
||||
"jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/foo/"
|
||||
constexpr auto str =
|
||||
u"jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/"
|
||||
u"foo/"
|
||||
"extensions/federated-learning@shield.mozilla.org.xpi!/experiments/"
|
||||
"study/api.js");
|
||||
"study/api.js"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kMozillaExtension &&
|
||||
|
@ -97,11 +96,11 @@ TEST(FilenameEvalParser, MozExtension)
|
|||
u"federated-learning@s!/experiments/study/api.js"_ns);
|
||||
}
|
||||
{ // Test mozilla.org replacing
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
str,
|
||||
"jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/foo/"
|
||||
constexpr auto str =
|
||||
u"jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/"
|
||||
u"foo/"
|
||||
"extensions/federated-learning@shigeld.mozilla.org.xpi!/experiments/"
|
||||
"study/api.js");
|
||||
"study/api.js"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(
|
||||
|
@ -111,11 +110,11 @@ TEST(FilenameEvalParser, MozExtension)
|
|||
u"federated-learning@shigeld.m!/experiments/study/api.js"));
|
||||
}
|
||||
{ // Test truncating
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
str,
|
||||
"jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/foo/"
|
||||
constexpr auto str =
|
||||
u"jar:file:///c:/users/bob/appdata/roaming/mozilla/firefox/profiles/"
|
||||
u"foo/"
|
||||
"extensions/federated-learning@shigeld.mozilla.org.xpi!/experiments/"
|
||||
"study/apiiiiiiiiiiiiiiiiiiiiiiiiiiiiii.js");
|
||||
"study/apiiiiiiiiiiiiiiiiiiiiiiiiiiiiii.js"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kMozillaExtension &&
|
||||
|
@ -128,29 +127,27 @@ TEST(FilenameEvalParser, MozExtension)
|
|||
TEST(FilenameEvalParser, UserChromeJS)
|
||||
{
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "firegestures/content/browser.uc.js");
|
||||
constexpr auto str = u"firegestures/content/browser.uc.js"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kSuspectedUserChromeJS && !ret.second.isSome());
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "firegestures/content/browser.uc.js?");
|
||||
constexpr auto str = u"firegestures/content/browser.uc.js?"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kSuspectedUserChromeJS && !ret.second.isSome());
|
||||
}
|
||||
{
|
||||
nsLiteralString str =
|
||||
NS_LITERAL_STRING("firegestures/content/browser.uc.js?243244224");
|
||||
constexpr auto str = u"firegestures/content/browser.uc.js?243244224"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kSuspectedUserChromeJS && !ret.second.isSome());
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
str,
|
||||
"file:///b:/fxprofiles/mark/chrome/"
|
||||
"addbookmarkherewithmiddleclick.uc.js?1558444389291");
|
||||
constexpr auto str =
|
||||
u"file:///b:/fxprofiles/mark/chrome/"
|
||||
"addbookmarkherewithmiddleclick.uc.js?1558444389291"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kSuspectedUserChromeJS && !ret.second.isSome());
|
||||
|
@ -160,14 +157,14 @@ TEST(FilenameEvalParser, UserChromeJS)
|
|||
TEST(FilenameEvalParser, SingleFile)
|
||||
{
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "browser.uc.js?2456");
|
||||
constexpr auto str = u"browser.uc.js?2456"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kSingleString && ret.second.isSome() &&
|
||||
ret.second.value() == str);
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "debugger");
|
||||
constexpr auto str = u"debugger"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kSingleString && ret.second.isSome() &&
|
||||
|
@ -178,13 +175,13 @@ TEST(FilenameEvalParser, SingleFile)
|
|||
TEST(FilenameEvalParser, Other)
|
||||
{
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "firegestures--content");
|
||||
constexpr auto str = u"firegestures--content"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kOther && !ret.second.isSome());
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "gallop://thing/fire");
|
||||
constexpr auto str = u"gallop://thing/fire"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
#if defined(XP_WIN)
|
||||
|
@ -195,7 +192,7 @@ TEST(FilenameEvalParser, Other)
|
|||
#endif
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "gallop://fire");
|
||||
constexpr auto str = u"gallop://fire"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
#if defined(XP_WIN)
|
||||
|
@ -206,7 +203,7 @@ TEST(FilenameEvalParser, Other)
|
|||
#endif
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "firegestures/content");
|
||||
constexpr auto str = u"firegestures/content"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
#if defined(XP_WIN)
|
||||
|
@ -217,7 +214,7 @@ TEST(FilenameEvalParser, Other)
|
|||
#endif
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "firegestures\\content");
|
||||
constexpr auto str = u"firegestures\\content"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
#if defined(XP_WIN)
|
||||
|
@ -228,7 +225,7 @@ TEST(FilenameEvalParser, Other)
|
|||
#endif
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "/home/tom/files/thing");
|
||||
constexpr auto str = u"/home/tom/files/thing"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
#if defined(XP_WIN)
|
||||
|
@ -239,7 +236,7 @@ TEST(FilenameEvalParser, Other)
|
|||
#endif
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "file://c/uers/tom/file.txt");
|
||||
constexpr auto str = u"file://c/uers/tom/file.txt"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
#if defined(XP_WIN)
|
||||
|
@ -250,7 +247,7 @@ TEST(FilenameEvalParser, Other)
|
|||
#endif
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "c:/uers/tom/file.txt");
|
||||
constexpr auto str = u"c:/uers/tom/file.txt"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
#if defined(XP_WIN)
|
||||
|
@ -261,7 +258,7 @@ TEST(FilenameEvalParser, Other)
|
|||
#endif
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "http://example.com/");
|
||||
constexpr auto str = u"http://example.com/"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
#if defined(XP_WIN)
|
||||
|
@ -272,7 +269,7 @@ TEST(FilenameEvalParser, Other)
|
|||
#endif
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(str, "http://example.com/thing.html");
|
||||
constexpr auto str = u"http://example.com/thing.html"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
#if defined(XP_WIN)
|
||||
|
@ -321,9 +318,8 @@ TEST(FilenameEvalParser, WebExtensionPathParser)
|
|||
mozilla::extensions::WebExtensionPolicy::Constructor(go, *wEI, eR);
|
||||
w->SetActive(true, eR);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
str,
|
||||
"moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/file.js");
|
||||
constexpr auto str =
|
||||
u"moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/file.js"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, true);
|
||||
|
||||
|
@ -335,17 +331,16 @@ TEST(FilenameEvalParser, WebExtensionPathParser)
|
|||
w->SetActive(false, eR);
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
str,
|
||||
"moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/file.js");
|
||||
constexpr auto str =
|
||||
u"moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/file.js"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, false);
|
||||
ASSERT_TRUE(ret.first == kSanitizedWindowsURL &&
|
||||
ret.second.value() == u"moz-extension"_ns);
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
str, "moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/file.js");
|
||||
constexpr auto str =
|
||||
u"moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/file.js"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, true);
|
||||
ASSERT_TRUE(
|
||||
|
@ -355,10 +350,9 @@ TEST(FilenameEvalParser, WebExtensionPathParser)
|
|||
u"moz-extension://[failed finding addon by host]/file.js"));
|
||||
}
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
str,
|
||||
"moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/"
|
||||
"file.js?querystringx=6");
|
||||
constexpr auto str =
|
||||
u"moz-extension://e37c3c08-beac-a04b-8032-c4f699a1a856/path/to/"
|
||||
"file.js?querystringx=6"_ns;
|
||||
FilenameTypeAndDetails ret =
|
||||
nsContentSecurityUtils::FilenameToFilenameType(str, true);
|
||||
ASSERT_TRUE(ret.first == kSanitizedWindowsURL &&
|
||||
|
|
|
@ -286,7 +286,7 @@ already_AddRefed<Promise> ServiceWorkerContainer::Register(
|
|||
|
||||
// Step 4. If none passed, parse against script's URL
|
||||
if (!aOptions.mScope.WasPassed()) {
|
||||
NS_NAMED_LITERAL_CSTRING(defaultScope, "./");
|
||||
constexpr auto defaultScope = "./"_ns;
|
||||
rv = NS_NewURI(getter_AddRefs(scopeURI), defaultScope, nullptr, scriptURI);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
nsAutoCString spec;
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace {
|
|||
|
||||
const uint32_t kCopyBufferSize = 32768;
|
||||
|
||||
constexpr auto kSDBSuffix = NS_LITERAL_STRING(".sdb");
|
||||
constexpr auto kSDBSuffix = u".sdb"_ns;
|
||||
|
||||
/*******************************************************************************
|
||||
* Actor class declarations
|
||||
|
|
|
@ -31,15 +31,14 @@ class nsHTMLDocument {
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kFinishEnrollment, "navigator.id.finishEnrollment");
|
||||
NS_NAMED_LITERAL_STRING(kGetAssertion, "navigator.id.getAssertion");
|
||||
constexpr auto kFinishEnrollment = u"navigator.id.finishEnrollment"_ns;
|
||||
constexpr auto kGetAssertion = u"navigator.id.getAssertion"_ns;
|
||||
|
||||
// Bug #1436078 - Permit Google Accounts. Remove in Bug #1436085 in Jan 2023.
|
||||
NS_NAMED_LITERAL_STRING(kGoogleAccountsAppId1,
|
||||
"https://www.gstatic.com/securitykey/origins.json");
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
kGoogleAccountsAppId2,
|
||||
"https://www.gstatic.com/securitykey/a/google.com/origins.json");
|
||||
constexpr auto kGoogleAccountsAppId1 =
|
||||
u"https://www.gstatic.com/securitykey/origins.json"_ns;
|
||||
constexpr auto kGoogleAccountsAppId2 =
|
||||
u"https://www.gstatic.com/securitykey/a/google.com/origins.json"_ns;
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(U2F)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
|
|
|
@ -26,7 +26,7 @@ enum class ErrorCode {
|
|||
|
||||
typedef MozPromise<nsString, ErrorCode, false> U2FPromise;
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kRequiredU2FVersion, "U2F_V2");
|
||||
constexpr auto kRequiredU2FVersion = u"U2F_V2"_ns;
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -15,17 +15,17 @@ namespace dom {
|
|||
|
||||
// Collected from
|
||||
// https://developers.google.com/android/reference/com/google/android/gms/fido/fido2/api/common/ErrorCode
|
||||
NS_NAMED_LITERAL_STRING(kSecurityError, "SECURITY_ERR");
|
||||
NS_NAMED_LITERAL_STRING(kConstraintError, "CONSTRAINT_ERR");
|
||||
NS_NAMED_LITERAL_STRING(kNotSupportedError, "NOT_SUPPORTED_ERR");
|
||||
NS_NAMED_LITERAL_STRING(kInvalidStateError, "INVALID_STATE_ERR");
|
||||
NS_NAMED_LITERAL_STRING(kNotAllowedError, "NOT_ALLOWED_ERR");
|
||||
NS_NAMED_LITERAL_STRING(kAbortError, "ABORT_ERR");
|
||||
NS_NAMED_LITERAL_STRING(kEncodingError, "ENCODING_ERR");
|
||||
NS_NAMED_LITERAL_STRING(kDataError, "DATA_ERR");
|
||||
NS_NAMED_LITERAL_STRING(kTimeoutError, "TIMEOUT_ERR");
|
||||
NS_NAMED_LITERAL_STRING(kNetworkError, "NETWORK_ERR");
|
||||
NS_NAMED_LITERAL_STRING(kUnknownError, "UNKNOWN_ERR");
|
||||
constexpr auto kSecurityError = u"SECURITY_ERR"_ns;
|
||||
constexpr auto kConstraintError = u"CONSTRAINT_ERR"_ns;
|
||||
constexpr auto kNotSupportedError = u"NOT_SUPPORTED_ERR"_ns;
|
||||
constexpr auto kInvalidStateError = u"INVALID_STATE_ERR"_ns;
|
||||
constexpr auto kNotAllowedError = u"NOT_ALLOWED_ERR"_ns;
|
||||
constexpr auto kAbortError = u"ABORT_ERR"_ns;
|
||||
constexpr auto kEncodingError = u"ENCODING_ERR"_ns;
|
||||
constexpr auto kDataError = u"DATA_ERR"_ns;
|
||||
constexpr auto kTimeoutError = u"TIMEOUT_ERR"_ns;
|
||||
constexpr auto kNetworkError = u"NETWORK_ERR"_ns;
|
||||
constexpr auto kUnknownError = u"UNKNOWN_ERR"_ns;
|
||||
|
||||
class AndroidWebAuthnResult {
|
||||
public:
|
||||
|
|
|
@ -27,7 +27,7 @@ using mozilla::dom::CreateECParamsForCurve;
|
|||
const nsCString U2FSoftTokenManager::mSecretNickname = "U2F_NSSTOKEN"_ns;
|
||||
|
||||
namespace {
|
||||
NS_NAMED_LITERAL_CSTRING(kAttestCertSubjectName, "CN=Firefox U2F Soft Token");
|
||||
constexpr auto kAttestCertSubjectName = "CN=Firefox U2F Soft Token"_ns;
|
||||
|
||||
// This U2F-compatible soft token uses FIDO U2F-compatible ECDSA keypairs
|
||||
// on the SEC_OID_SECG_EC_SECP256R1 curve. When asked to Register, it will
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kDeactivateEvent, "deactivate");
|
||||
NS_NAMED_LITERAL_STRING(kVisibilityChange, "visibilitychange");
|
||||
constexpr auto kDeactivateEvent = u"deactivate"_ns;
|
||||
constexpr auto kVisibilityChange = u"visibilitychange"_ns;
|
||||
|
||||
WebAuthnManagerBase::WebAuthnManagerBase(nsPIDOMWindowInner* aParent)
|
||||
: mParent(aParent) {
|
||||
|
|
|
@ -13,11 +13,10 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
|
||||
// Bug #1436078 - Permit Google Accounts. Remove in Bug #1436085 in Jan 2023.
|
||||
NS_NAMED_LITERAL_STRING(kGoogleAccountsAppId1,
|
||||
"https://www.gstatic.com/securitykey/origins.json");
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
kGoogleAccountsAppId2,
|
||||
"https://www.gstatic.com/securitykey/a/google.com/origins.json");
|
||||
constexpr auto kGoogleAccountsAppId1 =
|
||||
u"https://www.gstatic.com/securitykey/origins.json"_ns;
|
||||
constexpr auto kGoogleAccountsAppId2 =
|
||||
u"https://www.gstatic.com/securitykey/a/google.com/origins.json"_ns;
|
||||
|
||||
const uint8_t FLAG_TUP = 0x01; // Test of User Presence required
|
||||
const uint8_t FLAG_AT = 0x40; // Authenticator Data is provided
|
||||
|
|
|
@ -1009,7 +1009,7 @@ PersistNodeFixup::FixupNode(nsINode* aNodeIn, bool* aSerializeCloneKids,
|
|||
FixupAttribute(*aNodeOut, "src");
|
||||
|
||||
nsAutoString valueStr;
|
||||
NS_NAMED_LITERAL_STRING(valueAttr, "value");
|
||||
constexpr auto valueAttr = u"value"_ns;
|
||||
// Update element node attributes with user-entered form state
|
||||
RefPtr<dom::HTMLInputElement> outElt =
|
||||
dom::HTMLInputElement::FromNode((*aNodeOut)->AsContent());
|
||||
|
|
|
@ -367,8 +367,8 @@ void LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */) {
|
|||
return;
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(jsPrefix, PREF_JS_OPTIONS_PREFIX);
|
||||
NS_NAMED_LITERAL_CSTRING(workersPrefix, PREF_WORKERS_OPTIONS_PREFIX);
|
||||
constexpr auto jsPrefix = nsLiteralCString{PREF_JS_OPTIONS_PREFIX};
|
||||
constexpr auto workersPrefix = nsLiteralCString{PREF_WORKERS_OPTIONS_PREFIX};
|
||||
|
||||
const nsDependentCString fullPrefName(aPrefName);
|
||||
|
||||
|
|
|
@ -1308,8 +1308,8 @@ nsXMLContentSink::ReportError(const char16_t* aErrorText,
|
|||
|
||||
const char16_t* noAtts[] = {0, 0};
|
||||
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
errorNs, "http://www.mozilla.org/newlayout/xml/parsererror.xml");
|
||||
constexpr auto errorNs =
|
||||
u"http://www.mozilla.org/newlayout/xml/parsererror.xml"_ns;
|
||||
|
||||
nsAutoString parsererror(errorNs);
|
||||
parsererror.Append((char16_t)0xFFFF);
|
||||
|
|
|
@ -976,8 +976,8 @@ void txMozillaXSLTProcessor::notifyError() {
|
|||
"Bad readyState.");
|
||||
document->SetReadyStateInternal(Document::READYSTATE_LOADING);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
ns, "http://www.mozilla.org/newlayout/xml/parsererror.xml");
|
||||
constexpr auto ns =
|
||||
u"http://www.mozilla.org/newlayout/xml/parsererror.xml"_ns;
|
||||
|
||||
IgnoredErrorResult rv;
|
||||
ElementCreationOptionsOrString options;
|
||||
|
|
|
@ -569,8 +569,8 @@ XULContentSinkImpl::ReportError(const char16_t* aErrorText,
|
|||
|
||||
const char16_t* noAtts[] = {0, 0};
|
||||
|
||||
NS_NAMED_LITERAL_STRING(
|
||||
errorNs, "http://www.mozilla.org/newlayout/xml/parsererror.xml");
|
||||
constexpr auto errorNs =
|
||||
u"http://www.mozilla.org/newlayout/xml/parsererror.xml"_ns;
|
||||
|
||||
nsAutoString parsererror(errorNs);
|
||||
parsererror.Append((char16_t)0xFFFF);
|
||||
|
|
|
@ -1044,7 +1044,7 @@ bool CSSEditUtils::IsCSSEquivalentToHTMLInlineStyleSetInternal(
|
|||
} else {
|
||||
htmlColor.AppendLiteral("rgb(");
|
||||
|
||||
NS_NAMED_LITERAL_STRING(comma, ", ");
|
||||
constexpr auto comma = u", "_ns;
|
||||
|
||||
tmpStr.AppendInt(NS_GET_R(rgba), 10);
|
||||
htmlColor.Append(tmpStr + comma);
|
||||
|
|
|
@ -1618,8 +1618,8 @@ EditActionResult HTMLEditor::HandleInsertText(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
NS_NAMED_LITERAL_STRING(tabStr, "\t");
|
||||
NS_NAMED_LITERAL_STRING(spacesStr, " ");
|
||||
constexpr auto tabStr = u"\t"_ns;
|
||||
constexpr auto spacesStr = u" "_ns;
|
||||
char specialChars[] = {TAB, nsCRT::LF, 0};
|
||||
nsAutoString insertionString(aInsertionString); // For FindCharInSet().
|
||||
while (pos != -1 &&
|
||||
|
|
|
@ -1386,7 +1386,7 @@ NS_IMETHODIMP HTMLEditor::RebuildDocumentFromSource(
|
|||
} else {
|
||||
nsReadingIterator<char16_t> begintotal;
|
||||
aSourceString.BeginReading(begintotal);
|
||||
NS_NAMED_LITERAL_STRING(head, "<head>");
|
||||
constexpr auto head = u"<head>"_ns;
|
||||
if (foundclosehead) {
|
||||
nsresult rv = ReplaceHeadContentsWithSourceWithTransaction(
|
||||
head + Substring(begintotal, beginclosehead));
|
||||
|
@ -1426,7 +1426,7 @@ NS_IMETHODIMP HTMLEditor::RebuildDocumentFromSource(
|
|||
}
|
||||
|
||||
if (!foundbody) {
|
||||
NS_NAMED_LITERAL_STRING(body, "<body>");
|
||||
constexpr auto body = u"<body>"_ns;
|
||||
// XXX Without recourse to some parser/content sink/docshell hackery we
|
||||
// don't really know where the head ends and the body begins
|
||||
if (foundclosehead) {
|
||||
|
|
|
@ -546,7 +546,7 @@ nsresult HTMLEditor::HideResizersInternal() {
|
|||
// are no document observers to notify, but we still want to
|
||||
// UnbindFromTree.
|
||||
|
||||
NS_NAMED_LITERAL_STRING(mousedown, "mousedown");
|
||||
constexpr auto mousedown = u"mousedown"_ns;
|
||||
|
||||
// HTMLEditor should forget all members related to resizers first since
|
||||
// removing a part of UI may cause showing the resizers again. In such
|
||||
|
|
|
@ -246,7 +246,7 @@ bool TextEditor::UpdateMetaCharset(Document& aDocument,
|
|||
|
||||
metaElement->GetAttr(kNameSpaceID_None, nsGkAtoms::content, currentValue);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(charsetEquals, "charset=");
|
||||
constexpr auto charsetEquals = u"charset="_ns;
|
||||
nsAString::const_iterator originalStart, start, end;
|
||||
originalStart = currentValue.BeginReading(start);
|
||||
currentValue.EndReading(end);
|
||||
|
|
|
@ -117,9 +117,9 @@ static nsresult gssInit() {
|
|||
} else {
|
||||
#ifdef XP_WIN
|
||||
# ifdef _WIN64
|
||||
NS_NAMED_LITERAL_STRING(kLibName, "gssapi64.dll");
|
||||
constexpr auto kLibName = u"gssapi64.dll"_ns;
|
||||
# else
|
||||
NS_NAMED_LITERAL_STRING(kLibName, "gssapi32.dll");
|
||||
constexpr auto kLibName = u"gssapi32.dll"_ns;
|
||||
# endif
|
||||
|
||||
lib = LoadLibraryWithFlags(kLibName.get());
|
||||
|
|
|
@ -132,7 +132,7 @@ nsresult nsReadConfig::readConfigFile() {
|
|||
prefService->GetDefaultBranch(nullptr, getter_AddRefs(defaultPrefBranch));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(channel, MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL));
|
||||
constexpr auto channel = nsLiteralCString{MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL)};
|
||||
|
||||
bool sandboxEnabled =
|
||||
channel.EqualsLiteral("beta") || channel.EqualsLiteral("release");
|
||||
|
|
|
@ -123,7 +123,7 @@ void ImageMemoryReporter::ReportSharedSurface(
|
|||
? nsIMemoryReporter::KIND_NONHEAP
|
||||
: nsIMemoryReporter::KIND_OTHER;
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(desc, "Decoded image data stored in shared memory.");
|
||||
constexpr auto desc = "Decoded image data stored in shared memory."_ns;
|
||||
aHandleReport->Callback(EmptyCString(), path, kind,
|
||||
nsIMemoryReporter::UNITS_BYTES, surfaceSize, desc,
|
||||
aData);
|
||||
|
|
|
@ -384,11 +384,10 @@ nsStringBundleBase::CollectReports(nsIHandleReportCallback* aHandleReport,
|
|||
|
||||
path.AppendLiteral(")");
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(
|
||||
desc,
|
||||
constexpr auto desc =
|
||||
"A StringBundle instance representing the data in a (probably "
|
||||
"localized) .properties file. Data may be shared between "
|
||||
"processes.");
|
||||
"processes."_ns;
|
||||
|
||||
aHandleReport->Callback(EmptyCString(), path, KIND_HEAP, UNITS_BYTES,
|
||||
heapSize, desc, aData);
|
||||
|
|
|
@ -870,7 +870,7 @@ void BaseProcessLauncher::GetChildLogName(const char* origLogName,
|
|||
|
||||
// Remove .moz_log extension to avoid its duplication, it will be added
|
||||
// automatically by the logging backend
|
||||
static NS_NAMED_LITERAL_CSTRING(kMozLogExt, MOZ_LOG_FILE_EXTENSION);
|
||||
static constexpr auto kMozLogExt = nsLiteralCString{MOZ_LOG_FILE_EXTENSION};
|
||||
if (StringEndsWith(buffer, kMozLogExt)) {
|
||||
buffer.Truncate(buffer.Length() - kMozLogExt.Length());
|
||||
}
|
||||
|
|
|
@ -773,7 +773,7 @@ void ScriptPreloader::NoteScript(const nsCString& url,
|
|||
}
|
||||
|
||||
// Don't bother caching files that belong to the mochitest harness.
|
||||
NS_NAMED_LITERAL_CSTRING(mochikitPrefix, "chrome://mochikit/");
|
||||
constexpr auto mochikitPrefix = "chrome://mochikit/"_ns;
|
||||
if (StringHead(url, mochikitPrefix.Length()) == mochikitPrefix) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -254,9 +254,9 @@ void RealmPrivate::Init(HandleObject aGlobal, const SiteIdentifier& aSite) {
|
|||
static bool TryParseLocationURICandidate(
|
||||
const nsACString& uristr, RealmPrivate::LocationHint aLocationHint,
|
||||
nsIURI** aURI) {
|
||||
static NS_NAMED_LITERAL_CSTRING(kGRE, "resource://gre/");
|
||||
static NS_NAMED_LITERAL_CSTRING(kToolkit, "chrome://global/");
|
||||
static NS_NAMED_LITERAL_CSTRING(kBrowser, "chrome://browser/");
|
||||
static constexpr auto kGRE = "resource://gre/"_ns;
|
||||
static constexpr auto kToolkit = "chrome://global/"_ns;
|
||||
static constexpr auto kBrowser = "chrome://browser/"_ns;
|
||||
|
||||
if (aLocationHint == RealmPrivate::LocationHintAddon) {
|
||||
// Blacklist some known locations which are clearly not add-on related.
|
||||
|
|
|
@ -31,8 +31,9 @@ using namespace dom;
|
|||
|
||||
NS_IMPL_ISUPPORTS(AccessibleCaret::DummyTouchListener, nsIDOMEventListener)
|
||||
|
||||
NS_NAMED_LITERAL_STRING(AccessibleCaret::sTextOverlayElementId, "text-overlay");
|
||||
NS_NAMED_LITERAL_STRING(AccessibleCaret::sCaretImageElementId, "image");
|
||||
const nsLiteralString AccessibleCaret::sTextOverlayElementId =
|
||||
u"text-overlay"_ns;
|
||||
const nsLiteralString AccessibleCaret::sCaretImageElementId = u"image"_ns;
|
||||
|
||||
#define AC_PROCESS_ENUM_TO_STREAM(e) \
|
||||
case (e): \
|
||||
|
|
|
@ -3125,7 +3125,7 @@ nsresult PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll,
|
|||
|
||||
// Search for anchor in the HTML namespace with a matching name
|
||||
if (!content && !mDocument->IsHTMLDocument()) {
|
||||
NS_NAMED_LITERAL_STRING(nameSpace, "http://www.w3.org/1999/xhtml");
|
||||
constexpr auto nameSpace = u"http://www.w3.org/1999/xhtml"_ns;
|
||||
// Get the list of anchor elements
|
||||
nsCOMPtr<nsINodeList> list =
|
||||
mDocument->GetElementsByTagNameNS(nameSpace, u"a"_ns);
|
||||
|
@ -3215,7 +3215,7 @@ nsresult PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll,
|
|||
}
|
||||
} else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
NS_NAMED_LITERAL_STRING(top, "top");
|
||||
constexpr auto top = u"top"_ns;
|
||||
if (nsContentUtils::EqualsIgnoreASCIICase(aAnchorName, top)) {
|
||||
// Scroll to the top/left if aAnchorName is "top" and there is no element
|
||||
// with such a name or id.
|
||||
|
|
|
@ -2535,10 +2535,8 @@ void nsImageFrame::GetLoadGroup(nsPresContext* aPresContext,
|
|||
nsresult nsImageFrame::LoadIcons(nsPresContext* aPresContext) {
|
||||
NS_ASSERTION(!gIconLoad, "called LoadIcons twice");
|
||||
|
||||
NS_NAMED_LITERAL_STRING(loadingSrc,
|
||||
"resource://gre-resources/loading-image.png");
|
||||
NS_NAMED_LITERAL_STRING(brokenSrc,
|
||||
"resource://gre-resources/broken-image.png");
|
||||
constexpr auto loadingSrc = u"resource://gre-resources/loading-image.png"_ns;
|
||||
constexpr auto brokenSrc = u"resource://gre-resources/broken-image.png"_ns;
|
||||
|
||||
gIconLoad = new IconLoad();
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ void nsPageFrame::ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr) {
|
|||
|
||||
// Search to see if the &D code is in the string
|
||||
// then subst in the current date/time
|
||||
NS_NAMED_LITERAL_STRING(kDate, "&D");
|
||||
constexpr auto kDate = u"&D"_ns;
|
||||
if (aStr.Find(kDate) != kNotFound) {
|
||||
aNewStr.ReplaceSubstring(kDate, mPD->mDateTimeStr);
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ void nsPageFrame::ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr) {
|
|||
// Search to see if the "page number and page" total code are in the string
|
||||
// and replace the page number and page total code with the actual
|
||||
// values
|
||||
NS_NAMED_LITERAL_STRING(kPageAndTotal, "&PT");
|
||||
constexpr auto kPageAndTotal = u"&PT"_ns;
|
||||
if (aStr.Find(kPageAndTotal) != kNotFound) {
|
||||
nsAutoString uStr;
|
||||
nsTextFormatter::ssprintf(uStr, mPD->mPageNumAndTotalsFormat.get(),
|
||||
|
@ -196,24 +196,24 @@ void nsPageFrame::ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr) {
|
|||
|
||||
// Search to see if the page number code is in the string
|
||||
// and replace the page number code with the actual value
|
||||
NS_NAMED_LITERAL_STRING(kPage, "&P");
|
||||
constexpr auto kPage = u"&P"_ns;
|
||||
if (aStr.Find(kPage) != kNotFound) {
|
||||
nsAutoString uStr;
|
||||
nsTextFormatter::ssprintf(uStr, mPD->mPageNumFormat.get(), mPageNum);
|
||||
aNewStr.ReplaceSubstring(kPage, uStr);
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kTitle, "&T");
|
||||
constexpr auto kTitle = u"&T"_ns;
|
||||
if (aStr.Find(kTitle) != kNotFound) {
|
||||
aNewStr.ReplaceSubstring(kTitle, mPD->mDocTitle);
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kDocURL, "&U");
|
||||
constexpr auto kDocURL = u"&U"_ns;
|
||||
if (aStr.Find(kDocURL) != kNotFound) {
|
||||
aNewStr.ReplaceSubstring(kDocURL, mPD->mDocURL);
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kPageTotal, "&L");
|
||||
constexpr auto kPageTotal = u"&L"_ns;
|
||||
if (aStr.Find(kPageTotal) != kNotFound) {
|
||||
nsAutoString uStr;
|
||||
nsTextFormatter::ssprintf(uStr, mPD->mPageNumFormat.get(), mTotNumPages);
|
||||
|
|
|
@ -96,7 +96,7 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
aCtx->SetColor(sRGBColor::OpaqueWhite());
|
||||
nscoord ascent = fm->MaxAscent();
|
||||
NS_NAMED_LITERAL_STRING(errorMsg, "invalid-markup");
|
||||
constexpr auto errorMsg = u"invalid-markup"_ns;
|
||||
nsLayoutUtils::DrawUniDirString(errorMsg.get(), uint32_t(errorMsg.Length()),
|
||||
nsPoint(pt.x, pt.y + ascent), *fm, *aCtx);
|
||||
}
|
||||
|
|
|
@ -2118,7 +2118,7 @@ bool nsPrintJob::PrintDocContent(const UniquePtr<nsPrintObject>& aPO,
|
|||
return false;
|
||||
}
|
||||
|
||||
static NS_NAMED_LITERAL_STRING(kEllipsis, u"\x2026");
|
||||
static constexpr auto kEllipsis = u"\x2026"_ns;
|
||||
|
||||
/**
|
||||
* Builds the complement set of ranges and adds those to the selection.
|
||||
|
|
|
@ -77,7 +77,7 @@ static void ServoGetPropertyValueById() {
|
|||
RefPtr<URLExtraData> data =
|
||||
new URLExtraData(uri.forget(), referrerInfo.forget(),
|
||||
NullPrincipal::CreateWithoutOriginAttributes());
|
||||
NS_NAMED_LITERAL_CSTRING(css_, "10px");
|
||||
constexpr auto css_ = "10px"_ns;
|
||||
const nsACString& css = css_;
|
||||
Servo_DeclarationBlock_SetPropertyById(
|
||||
block, eCSSProperty_width, &css,
|
||||
|
|
|
@ -90,8 +90,8 @@ nsMenuBarFrame::SetActive(bool aActiveFlag) {
|
|||
RemoveKeyboardNavigator();
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_STRING(active, "DOMMenuBarActive");
|
||||
NS_NAMED_LITERAL_STRING(inactive, "DOMMenuBarInactive");
|
||||
constexpr auto active = u"DOMMenuBarActive"_ns;
|
||||
constexpr auto inactive = u"DOMMenuBarInactive"_ns;
|
||||
|
||||
FireDOMEvent(mIsActive ? active : inactive, mContent);
|
||||
|
||||
|
|
|
@ -959,7 +959,7 @@ nsresult nsTreeBodyFrame::GetCoordsForCellItem(int32_t aRow, nsTreeColumn* aCol,
|
|||
ComputedStyle* cellContext =
|
||||
GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeCell());
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(cell, "cell");
|
||||
constexpr auto cell = "cell"_ns;
|
||||
if (currCol->IsCycler() || cell.Equals(aElement)) {
|
||||
// If the current Column is a Cycler, then the Rect is just the cell - the
|
||||
// margins. Similarly, if we're just being asked for the cell rect,
|
||||
|
|
|
@ -561,8 +561,8 @@ NS_IMETHODIMP nsTreeSelection::SetCurrentIndex(int32_t aIndex) {
|
|||
// Fire DOMMenuItemActive or DOMMenuItemInactive event for tree.
|
||||
NS_ENSURE_STATE(mTree);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(DOMMenuItemActive, "DOMMenuItemActive");
|
||||
NS_NAMED_LITERAL_STRING(DOMMenuItemInactive, "DOMMenuItemInactive");
|
||||
constexpr auto DOMMenuItemActive = u"DOMMenuItemActive"_ns;
|
||||
constexpr auto DOMMenuItemInactive = u"DOMMenuItemInactive"_ns;
|
||||
|
||||
RefPtr<AsyncEventDispatcher> asyncDispatcher = new AsyncEventDispatcher(
|
||||
mTree, (aIndex != -1 ? DOMMenuItemActive : DOMMenuItemInactive),
|
||||
|
|
|
@ -26,7 +26,7 @@ using mozilla::LogLevel;
|
|||
static const char* default_tmp_dir = "/dev/null";
|
||||
static const char* default_log_name = "nspr";
|
||||
#else // Assume a POSIX environment
|
||||
NS_NAMED_LITERAL_CSTRING(default_log_name, "WebRTC.log");
|
||||
constexpr auto default_log_name = "WebRTC.log"_ns;
|
||||
#endif
|
||||
|
||||
static mozilla::LazyLogModule sWebRtcLog("webrtc_trace");
|
||||
|
|
|
@ -3353,7 +3353,7 @@ static bool TelemetryPrefValue() {
|
|||
// toolkit.telemetry.enabled determines whether we send "extended" data.
|
||||
// We only want extended data from pre-release channels due to size.
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(channel, MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL));
|
||||
constexpr auto channel = nsLiteralCString{MOZ_STRINGIFY(MOZ_UPDATE_CHANNEL)};
|
||||
|
||||
// Easy cases: Nightly, Aurora, Beta.
|
||||
if (channel.EqualsLiteral("nightly") || channel.EqualsLiteral("aurora") ||
|
||||
|
|
|
@ -39,7 +39,7 @@ TEST(TestDllBlocklist, BlockDllByName)
|
|||
{
|
||||
// The DLL name has capital letters, so this also tests that the comparison
|
||||
// is case-insensitive.
|
||||
NS_NAMED_LITERAL_STRING(kLeafName, "TestDllBlocklist_MatchByName.dll");
|
||||
constexpr auto kLeafName = u"TestDllBlocklist_MatchByName.dll"_ns;
|
||||
nsString dllPath = GetFullPath(kLeafName);
|
||||
|
||||
nsModuleHandle hDll(::LoadLibraryW(dllPath.get()));
|
||||
|
@ -50,7 +50,7 @@ TEST(TestDllBlocklist, BlockDllByName)
|
|||
|
||||
TEST(TestDllBlocklist, BlockDllByVersion)
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(kLeafName, "TestDllBlocklist_MatchByVersion.dll");
|
||||
constexpr auto kLeafName = u"TestDllBlocklist_MatchByVersion.dll"_ns;
|
||||
nsString dllPath = GetFullPath(kLeafName);
|
||||
|
||||
nsModuleHandle hDll(::LoadLibraryW(dllPath.get()));
|
||||
|
@ -61,7 +61,7 @@ TEST(TestDllBlocklist, BlockDllByVersion)
|
|||
|
||||
TEST(TestDllBlocklist, AllowDllByVersion)
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(kLeafName, "TestDllBlocklist_AllowByVersion.dll");
|
||||
constexpr auto kLeafName = u"TestDllBlocklist_AllowByVersion.dll"_ns;
|
||||
nsString dllPath = GetFullPath(kLeafName);
|
||||
|
||||
nsModuleHandle hDll(::LoadLibraryW(dllPath.get()));
|
||||
|
@ -74,7 +74,7 @@ TEST(TestDllBlocklist, NoOpEntryPoint)
|
|||
{
|
||||
// DllMain of this dll has MOZ_RELEASE_ASSERT. This test makes sure we load
|
||||
// the module successfully without running DllMain.
|
||||
NS_NAMED_LITERAL_STRING(kLeafName, "TestDllBlocklist_NoOpEntryPoint.dll");
|
||||
constexpr auto kLeafName = u"TestDllBlocklist_NoOpEntryPoint.dll"_ns;
|
||||
nsString dllPath = GetFullPath(kLeafName);
|
||||
|
||||
nsModuleHandle hDll(::LoadLibraryW(dllPath.get()));
|
||||
|
@ -130,7 +130,7 @@ TEST(TestDllBlocklist, BlockThreadWithLoadLibraryEntryPoint)
|
|||
#if defined(NIGHTLY_BUILD)
|
||||
using ThreadProc = unsigned(__stdcall*)(void*);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kLeafNameW, "TestDllBlocklist_MatchByVersion.dll");
|
||||
constexpr auto kLeafNameW = u"TestDllBlocklist_MatchByVersion.dll"_ns;
|
||||
|
||||
nsString fullPathW = GetFullPath(kLeafNameW);
|
||||
EXPECT_FALSE(fullPathW.IsEmpty());
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "nsXULAppAPI.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
static NS_NAMED_LITERAL_STRING(kInterfaceName, u"captive-portal-inteface");
|
||||
static constexpr auto kInterfaceName = u"captive-portal-inteface"_ns;
|
||||
|
||||
static const char kOpenCaptivePortalLoginEvent[] = "captive-portal-login";
|
||||
static const char kAbortCaptivePortalLoginEvent[] =
|
||||
|
|
|
@ -758,7 +758,7 @@ nsIncrementalDownload::AsyncOnChannelRedirect(
|
|||
nsCOMPtr<nsIHttpChannel> newHttpChannel = do_QueryInterface(newChannel);
|
||||
NS_ENSURE_STATE(newHttpChannel);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(rangeHdr, "Range");
|
||||
constexpr auto rangeHdr = "Range"_ns;
|
||||
|
||||
nsresult rv = ClearRequestHeader(newHttpChannel);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
|
@ -118,7 +118,7 @@ nsresult net_GetURLSpecFromActualFile(nsIFile* aFile, nsACString& result) {
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoCString escPath;
|
||||
NS_NAMED_LITERAL_CSTRING(prefix, "file://");
|
||||
constexpr auto prefix = "file://"_ns;
|
||||
|
||||
// Escape the path with the directory mask
|
||||
if (NS_EscapeURL(ePath.get(), ePath.Length(), esc_Directory + esc_Forced,
|
||||
|
|
|
@ -32,7 +32,7 @@ nsresult net_GetURLSpecFromActualFile(nsIFile* aFile, nsACString& result) {
|
|||
ePath = nativePath;
|
||||
|
||||
nsAutoCString escPath;
|
||||
NS_NAMED_LITERAL_CSTRING(prefix, "file://");
|
||||
constexpr auto prefix = "file://"_ns;
|
||||
|
||||
// Escape the path with the directory mask
|
||||
if (NS_EscapeURL(ePath.get(), -1, esc_Directory + esc_Forced, escPath))
|
||||
|
|
|
@ -31,7 +31,7 @@ nsresult net_GetURLSpecFromActualFile(nsIFile* aFile, nsACString& result) {
|
|||
// 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:///");
|
||||
constexpr auto prefix = "file:///"_ns;
|
||||
|
||||
// Escape the path with the directory mask
|
||||
NS_ConvertUTF16toUTF8 ePath(path);
|
||||
|
|
|
@ -1088,8 +1088,8 @@ CookiePersistentStorage::OpenDBResult CookiePersistentStorage::TryInitDB(
|
|||
new ConvertAppIdToOriginAttrsSQLFunction());
|
||||
NS_ENSURE_TRUE(convertToOriginAttrs, RESULT_RETRY);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(convertToOriginAttrsName,
|
||||
"CONVERT_TO_ORIGIN_ATTRIBUTES");
|
||||
constexpr auto convertToOriginAttrsName =
|
||||
"CONVERT_TO_ORIGIN_ATTRIBUTES"_ns;
|
||||
|
||||
rv = mSyncConn->CreateFunction(convertToOriginAttrsName, 2,
|
||||
convertToOriginAttrs);
|
||||
|
@ -1141,7 +1141,7 @@ CookiePersistentStorage::OpenDBResult CookiePersistentStorage::TryInitDB(
|
|||
new SetAppIdFromOriginAttributesSQLFunction());
|
||||
NS_ENSURE_TRUE(setAppId, RESULT_RETRY);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(setAppIdName, "SET_APP_ID");
|
||||
constexpr auto setAppIdName = "SET_APP_ID"_ns;
|
||||
|
||||
rv = mSyncConn->CreateFunction(setAppIdName, 1, setAppId);
|
||||
NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
|
||||
|
@ -1150,7 +1150,7 @@ CookiePersistentStorage::OpenDBResult CookiePersistentStorage::TryInitDB(
|
|||
new SetInBrowserFromOriginAttributesSQLFunction());
|
||||
NS_ENSURE_TRUE(setInBrowser, RESULT_RETRY);
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(setInBrowserName, "SET_IN_BROWSER");
|
||||
constexpr auto setInBrowserName = "SET_IN_BROWSER"_ns;
|
||||
|
||||
rv = mSyncConn->CreateFunction(setInBrowserName, 1, setInBrowser);
|
||||
NS_ENSURE_SUCCESS(rv, RESULT_RETRY);
|
||||
|
|
|
@ -54,11 +54,11 @@ namespace net {
|
|||
|
||||
static StaticRefPtr<CookieService> gCookieService;
|
||||
|
||||
constexpr auto CONSOLE_SAMESITE_CATEGORY = NS_LITERAL_CSTRING("cookieSameSite");
|
||||
constexpr auto CONSOLE_OVERSIZE_CATEGORY =
|
||||
NS_LITERAL_CSTRING("cookiesOversize");
|
||||
constexpr auto SAMESITE_MDN_URL = NS_LITERAL_STRING(
|
||||
"https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite");
|
||||
constexpr auto CONSOLE_SAMESITE_CATEGORY = "cookieSameSite"_ns;
|
||||
constexpr auto CONSOLE_OVERSIZE_CATEGORY = "cookiesOversize"_ns;
|
||||
constexpr auto SAMESITE_MDN_URL =
|
||||
"https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/"
|
||||
u"SameSite"_ns;
|
||||
|
||||
namespace {
|
||||
|
||||
|
|
|
@ -108,8 +108,8 @@ bool TRRService::CheckCaptivePortalIsPassed() {
|
|||
return result;
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(kTRRIsAutoDetectedKey, "(auto-detected)");
|
||||
NS_NAMED_LITERAL_CSTRING(kTRRNotAutoDetectedKey, "(default)");
|
||||
constexpr auto kTRRIsAutoDetectedKey = "(auto-detected)"_ns;
|
||||
constexpr auto kTRRNotAutoDetectedKey = "(default)"_ns;
|
||||
// static
|
||||
const nsCString& TRRService::AutoDetectedKey() {
|
||||
if (gTRRService && gTRRService->IsUsingAutoDetectedURL()) {
|
||||
|
|
|
@ -137,8 +137,7 @@ nsresult nsAboutCacheEntry::Channel::GetContentStream(nsIURI* uri,
|
|||
true, false, 256, UINT32_MAX);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(
|
||||
buffer,
|
||||
constexpr auto buffer =
|
||||
"<!DOCTYPE html>\n"
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
|
@ -151,7 +150,7 @@ nsresult nsAboutCacheEntry::Channel::GetContentStream(nsIURI* uri,
|
|||
"href=\"chrome://global/skin/aboutCacheEntry.css\" type=\"text/css\"/>\n"
|
||||
"</head>\n"
|
||||
"<body>\n"
|
||||
"<h1>Cache entry information</h1>\n");
|
||||
"<h1>Cache entry information</h1>\n"_ns;
|
||||
uint32_t n;
|
||||
rv = mOutputStream->Write(buffer.get(), buffer.Length(), &n);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -464,8 +463,7 @@ nsresult nsAboutCacheEntry::Channel::WriteCacheEntryDescription(
|
|||
|
||||
nsresult nsAboutCacheEntry::Channel::WriteCacheEntryUnavailable() {
|
||||
uint32_t n;
|
||||
NS_NAMED_LITERAL_CSTRING(buffer,
|
||||
"The cache entry you selected is not available.");
|
||||
constexpr auto buffer = "The cache entry you selected is not available."_ns;
|
||||
mOutputStream->Write(buffer.get(), buffer.Length(), &n);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -500,7 +498,7 @@ NS_IMETHODIMP
|
|||
nsAboutCacheEntry::Channel::OnStartRequest(nsIRequest* request) {
|
||||
mHexDumpState = 0;
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(buffer, "<hr/>\n<pre>");
|
||||
constexpr auto buffer = "<hr/>\n<pre>"_ns;
|
||||
uint32_t n;
|
||||
return mOutputStream->Write(buffer.get(), buffer.Length(), &n);
|
||||
}
|
||||
|
@ -535,7 +533,7 @@ nsresult nsAboutCacheEntry::Channel::PrintCacheData(
|
|||
NS_IMETHODIMP
|
||||
nsAboutCacheEntry::Channel::OnStopRequest(nsIRequest* request,
|
||||
nsresult result) {
|
||||
NS_NAMED_LITERAL_CSTRING(buffer, "</pre>\n");
|
||||
constexpr auto buffer = "</pre>\n"_ns;
|
||||
uint32_t n;
|
||||
mOutputStream->Write(buffer.get(), buffer.Length(), &n);
|
||||
|
||||
|
@ -545,7 +543,7 @@ nsAboutCacheEntry::Channel::OnStopRequest(nsIRequest* request,
|
|||
}
|
||||
|
||||
void nsAboutCacheEntry::Channel::CloseContent() {
|
||||
NS_NAMED_LITERAL_CSTRING(buffer, "</body>\n</html>\n");
|
||||
constexpr auto buffer = "</body>\n</html>\n"_ns;
|
||||
uint32_t n;
|
||||
mOutputStream->Write(buffer.get(), buffer.Length(), &n);
|
||||
|
||||
|
|
|
@ -150,8 +150,8 @@ nsresult nsDataHandler::ParsePathWithoutRef(
|
|||
const nsACString& aPath, nsCString& aContentType,
|
||||
nsCString* aContentCharset, bool& aIsBase64,
|
||||
nsDependentCSubstring* aDataBuffer) {
|
||||
static NS_NAMED_LITERAL_CSTRING(kBase64, "base64");
|
||||
static NS_NAMED_LITERAL_CSTRING(kCharset, "charset");
|
||||
static constexpr auto kBase64 = "base64"_ns;
|
||||
static constexpr auto kCharset = "charset"_ns;
|
||||
|
||||
aIsBase64 = false;
|
||||
|
||||
|
@ -242,7 +242,7 @@ nsresult nsDataHandler::ParsePathWithoutRef(
|
|||
nsresult nsDataHandler::ParseURI(nsCString& spec, nsCString& contentType,
|
||||
nsCString* contentCharset, bool& isBase64,
|
||||
nsCString* dataBuffer) {
|
||||
static NS_NAMED_LITERAL_CSTRING(kDataScheme, "data:");
|
||||
static constexpr auto kDataScheme = "data:"_ns;
|
||||
|
||||
// move past "data:"
|
||||
int32_t scheme = spec.Find(kDataScheme, /* aIgnoreCase = */ true);
|
||||
|
|
|
@ -1182,8 +1182,8 @@ void AltSvcCache::ClearHostMapping(const nsACString& host, int32_t port,
|
|||
}
|
||||
nsAutoCString key;
|
||||
for (int secure = 0; secure < 2; ++secure) {
|
||||
NS_NAMED_LITERAL_CSTRING(http, "http");
|
||||
NS_NAMED_LITERAL_CSTRING(https, "https");
|
||||
constexpr auto http = "http"_ns;
|
||||
constexpr auto https = "https"_ns;
|
||||
const nsLiteralCString& scheme = secure ? https : http;
|
||||
for (int pb = 1; pb >= 0; --pb) {
|
||||
for (int isolate = 0; isolate < 2; ++isolate) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(kInvalidCategory, "INVALID_CATEGORY");
|
||||
constexpr auto kInvalidCategory = "INVALID_CATEGORY"_ns;
|
||||
|
||||
#define DEFINE_CATEGORY(_name, _idx) nsLiteralCString("Y" #_idx "_" #_name),
|
||||
static const nsCString gKeyName[] = {
|
||||
|
|
|
@ -3394,7 +3394,7 @@ bool nsHttpChannel::ResponseWouldVary(nsICacheEntry* entry) {
|
|||
nsAutoCString buf, metaKey;
|
||||
Unused << mCachedResponseHead->GetHeader(nsHttp::Vary, buf);
|
||||
if (!buf.IsEmpty()) {
|
||||
NS_NAMED_LITERAL_CSTRING(prefix, "request-");
|
||||
constexpr auto prefix = "request-"_ns;
|
||||
|
||||
// enumerate the elements of the Vary header...
|
||||
char* val = buf.BeginWriting(); // going to munge buf
|
||||
|
@ -5641,7 +5641,7 @@ nsresult DoAddCacheEntryHeaders(nsHttpChannel* self, nsICacheEntry* entry,
|
|||
nsAutoCString buf, metaKey;
|
||||
Unused << responseHead->GetHeader(nsHttp::Vary, buf);
|
||||
if (!buf.IsEmpty()) {
|
||||
NS_NAMED_LITERAL_CSTRING(prefix, "request-");
|
||||
constexpr auto prefix = "request-"_ns;
|
||||
|
||||
char* bufData = buf.BeginWriting(); // going to munge buf
|
||||
char* token = nsCRT::strtok(bufData, NS_HTTP_HEADER_SEPS, &bufData);
|
||||
|
|
|
@ -720,8 +720,8 @@ nsresult nsHttpHandler::AddConnectionHeader(nsHttpRequestHead* request,
|
|||
// user-agents. But this is not a problem in practice, and the
|
||||
// alternative proxy-connection is worse. see 570283
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(close, "close");
|
||||
NS_NAMED_LITERAL_CSTRING(keepAlive, "keep-alive");
|
||||
constexpr auto close = "close"_ns;
|
||||
constexpr auto keepAlive = "keep-alive"_ns;
|
||||
|
||||
const nsLiteralCString* connectionType = &close;
|
||||
if (caps & NS_HTTP_ALLOW_KEEPALIVE) {
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче