--- a/browser/components/shell/nsWindowsShellService.cpp
+++ b/browser/components/shell/nsWindowsShellService.cpp
@@ -161,24 +161,24 @@ nsWindowsShellService::ShortcutMaintenan
taskbarInfo->GetAvailable(&isSupported);
if (!isSupported)
return NS_OK;
nsAutoString appId;
if (NS_FAILED(taskbarInfo->GetDefaultGroupId(appId)))
return NS_ERROR_UNEXPECTED;
- NS_NAMED_LITERAL_CSTRING(prefName, "browser.taskbar.lastgroupid");
+ const char* prefName = "browser.taskbar.lastgroupid";
nsCOMPtr<nsIPrefBranch> prefs =
do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsISupportsString> prefString;
- rv = prefs->GetComplexValue(prefName.get(),
+ rv = prefs->GetComplexValue(prefName,
NS_GET_IID(nsISupportsString),
getter_AddRefs(prefString));
if (NS_SUCCEEDED(rv)) {
nsAutoString version;
prefString->GetData(version);
if (!version.IsEmpty() && version.Equals(appId)) {
// We're all good, get out of here.
return NS_OK;
@@ -186,17 +186,17 @@ nsWindowsShellService::ShortcutMaintenan
}
// Update the version in prefs
prefString =
do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
prefString->SetData(appId);
- rv = prefs->SetComplexValue(prefName.get(),
+ rv = prefs->SetComplexValue(prefName,
NS_GET_IID(nsISupportsString),
prefString);
if (NS_FAILED(rv)) {
NS_WARNING("Couldn't set last user model id!");
return NS_ERROR_UNEXPECTED;
}
nsAutoString appHelperPath;
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1627,21 +1627,21 @@ nsJSContext::EndCycleCollectionCallback(
mergeMsg.AssignLiteral(" merged");
}
nsCString gcMsg;
if (aResults.mForcedGC) {
gcMsg.AssignLiteral(", forced a GC");
}
- NS_NAMED_LITERAL_STRING(kFmt,
+ const char16_t *kFmt =
u"CC(T+%.1f)[%s-%i] max pause: %lums, total time: %lums, slices: %lu, suspected: %lu, visited: %lu RCed and %lu%s GCed, collected: %lu RCed and %lu GCed (%lu|%lu|%lu waiting for GC)%s\n"
- u"ForgetSkippable %lu times before CC, min: %lu ms, max: %lu ms, avg: %lu ms, total: %lu ms, max sync: %lu ms, removed: %lu");
+ u"ForgetSkippable %lu times before CC, min: %lu ms, max: %lu ms, avg: %lu ms, total: %lu ms, max sync: %lu ms, removed: %lu";
nsString msg;
- msg.Adopt(nsTextFormatter::smprintf(kFmt.get(), double(delta) / PR_USEC_PER_SEC,
+ msg.Adopt(nsTextFormatter::smprintf(kFmt, double(delta) / PR_USEC_PER_SEC,
ProcessNameForCollectorLog(), getpid(),
gCCStats.mMaxSliceTime, gCCStats.mTotalSliceTime,
aResults.mNumSlices, gCCStats.mSuspected,
aResults.mVisitedRefCounted, aResults.mVisitedGCed, mergeMsg.get(),
aResults.mFreedRefCounted, aResults.mFreedGCed,
sCCollectedWaitingForGC, sCCollectedZonesWaitingForGC, sLikelyShortLivingObjectsNeedingGC,
gcMsg.get(),
sForgetSkippableBeforeCC,
@@ -1659,17 +1659,17 @@ nsJSContext::EndCycleCollectionCallback(
}
}
if (gCCStats.mFile) {
fprintf(gCCStats.mFile, "%s\n", NS_ConvertUTF16toUTF8(msg).get());
}
}
if (sPostGCEventsToObserver) {
- NS_NAMED_LITERAL_STRING(kJSONFmt,
+ const char16_t* kJSONFmt =
u"{ \"timestamp\": %llu, "
u"\"duration\": %lu, "
u"\"max_slice_pause\": %lu, "
u"\"total_slice_pause\": %lu, "
u"\"max_finish_gc_duration\": %lu, "
u"\"max_sync_skippable_duration\": %lu, "
u"\"suspected\": %lu, "
u"\"visited\": { "
@@ -1684,20 +1684,20 @@ nsJSContext::EndCycleCollectionCallback(
u"\"forced_gc\": %d, "
u"\"forget_skippable\": { "
u"\"times_before_cc\": %lu, "
u"\"min\": %lu, "
u"\"max\": %lu, "
u"\"avg\": %lu, "
u"\"total\": %lu, "
u"\"removed\": %lu } "
- u"}");
+ u"}";
nsString json;
- json.Adopt(nsTextFormatter::smprintf(kJSONFmt.get(), PR_Now(), ccNowDuration,
+ json.Adopt(nsTextFormatter::smprintf(kJSONFmt, PR_Now(), ccNowDuration,
gCCStats.mMaxSliceTime,
gCCStats.mTotalSliceTime,
gCCStats.mMaxGCDuration,
gCCStats.mMaxSkippableDuration,
gCCStats.mSuspected,
aResults.mVisitedRefCounted, aResults.mVisitedGCed,
aResults.mFreedRefCounted, aResults.mFreedGCed,
sCCollectedWaitingForGC,
@@ -2134,20 +2134,19 @@ DOMGCSliceCallback(JSContext* aCx, JS::G
sCCLockedOut = true;
break;
}
case JS::GC_CYCLE_END: {
PRTime delta = GetCollectionTimeDelta();
if (sPostGCEventsToConsole) {
- NS_NAMED_LITERAL_STRING(kFmt, "GC(T+%.1f)[%s-%i] ");
nsString prefix, gcstats;
gcstats.Adopt(aDesc.formatSummaryMessage(aCx));
- prefix.Adopt(nsTextFormatter::smprintf(kFmt.get(),
+ prefix.Adopt(nsTextFormatter::smprintf(u"GC(T+%.1f)[%s-%i] ",
double(delta) / PR_USEC_PER_SEC,
ProcessNameForCollectorLog(),
getpid()));
nsString msg = prefix + gcstats;
nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (cs) {
cs->LogStringMessage(msg.get());
}
@@ -2218,20 +2217,19 @@ DOMGCSliceCallback(JSContext* aCx, JS::G
"InterSliceGCTimerFired");
}
if (ShouldTriggerCC(nsCycleCollector_suspectedCount())) {
nsCycleCollector_dispatchDeferredDeletion();
}
if (sPostGCEventsToConsole) {
- NS_NAMED_LITERAL_STRING(kFmt, "[%s-%i] ");
nsString prefix, gcstats;
gcstats.Adopt(aDesc.formatSliceMessage(aCx));
- prefix.Adopt(nsTextFormatter::smprintf(kFmt.get(),
+ prefix.Adopt(nsTextFormatter::smprintf(u"[%s-%i] ",
ProcessNameForCollectorLog(),
getpid()));
nsString msg = prefix + gcstats;
nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (cs) {
cs->LogStringMessage(msg.get());
}
}
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -580,18 +580,17 @@ ImageDocument::OnLoadComplete(imgIReques
// mImageContent can be null if the document is already destroyed
if (NS_FAILED(aStatus) && mStringBundle && mImageContent) {
nsAutoCString src;
mDocumentURI->GetSpec(src);
NS_ConvertUTF8toUTF16 srcString(src);
const char16_t* formatString[] = { srcString.get() };
nsXPIDLString errorMsg;
- NS_NAMED_LITERAL_STRING(str, "InvalidImage");
- mStringBundle->FormatStringFromName(str.get(), formatString, 1,
+ mStringBundle->FormatStringFromName(u"InvalidImage", formatString, 1,
getter_Copies(errorMsg));
mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::alt, errorMsg, false);
}
return NS_OK;
}
--- a/dom/html/MediaDocument.cpp
+++ b/dom/html/MediaDocument.cpp
@@ -413,18 +413,17 @@ MediaDocument::UpdateTitleAndCharset(con
// set it on the document
if (aStatus.IsEmpty()) {
SetTitle(title);
}
else {
nsXPIDLString titleWithStatus;
const nsPromiseFlatString& status = PromiseFlatString(aStatus);
const char16_t *formatStrings[2] = {title.get(), status.get()};
- NS_NAMED_LITERAL_STRING(fmtName, "TitleWithStatus");
- mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 2,
+ mStringBundle->FormatStringFromName(u"TitleWithStatus", formatStrings, 2,
getter_Copies(titleWithStatus));
SetTitle(titleWithStatus);
}
}
void
MediaDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject)
{
--- a/dom/media/android/AndroidMediaResourceServer.cpp
+++ b/dom/media/android/AndroidMediaResourceServer.cpp
@@ -218,20 +218,20 @@ ServeResourceEvent::Run() {
// only check for the range request format used by Android rather
// than implementing all possibilities in the HTTP specification.
// That is, the range request is of the form:
// Range: bytes=nnnn-
// Were 'nnnn' is an integer number.
// The end of the range is not checked, instead we return up to
// the end of the resource and the client is informed of this via
// the content-range header.
- NS_NAMED_LITERAL_CSTRING(byteRange, "Range: bytes=");
- const char* s = strstr(line.get(), byteRange.get());
+ const char byteRange[] = "Range: bytes=";
+ const char* s = strstr(line.get(), byteRange);
if (s) {
- start = strtoll(s+byteRange.Length(), nullptr, 10);
+ start = strtoll(s+mozilla::ArrayLength(byteRange)-1, nullptr, 10);
// Clamp 'start' to be between 0 and the resource length.
start = std::max(int64_t(0), std::min(resource->GetLength(), start));
}
}
// HTTP response to use if this is a non byte range request
const char* response_normal = "HTTP/1.1 200 OK\r\n";
--- a/dom/media/gmp/widevine-adapter/WidevineAdapter.cpp
+++ b/dom/media/gmp/widevine-adapter/WidevineAdapter.cpp
@@ -94,17 +94,17 @@ WidevineAdapter::GMPGetAPI(const char* a
aAPIName, aHostAPI, aPluginAPI, aDecryptorId, this);
return GMPGenericErr;
}
auto* decryptor = new WidevineDecryptor();
auto cdm = reinterpret_cast<cdm::ContentDecryptionModule*>(
create(cdm::ContentDecryptionModule::kVersion,
- kEMEKeySystemWidevine.get(),
+ kEMEKeySystemWidevine.Data(),
kEMEKeySystemWidevine.Length(),
&GetCdmHost,
decryptor));
if (!cdm) {
CDM_LOG("WidevineAdapter::GMPGetAPI(%s, 0x%p, 0x%p, %u) this=0x%p FAILED to create cdm",
aAPIName, aHostAPI, aPluginAPI, aDecryptorId, this);
return GMPGenericErr;
}
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -1926,23 +1926,23 @@ CreateFileAHookFn(LPCSTR fname, DWORD ac
return sCreateFileAStub(fname, access, share, security, creation, flags,
ftemplate);
}
static bool
GetLocalLowTempPath(size_t aLen, LPWSTR aPath)
{
- NS_NAMED_LITERAL_STRING(tempname, "\\Temp");
+ const wchar_t tempname[] = L"\\Temp";
LPWSTR path;
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0,
nullptr, &path))) {
- if (wcslen(path) + tempname.Length() < aLen) {
+ if (wcslen(path) + ArrayLength(tempname) - 1 < aLen) {
wcscpy(aPath, path);
- wcscat(aPath, tempname.get());
+ wcscat(aPath, tempname);
::CoTaskMemFree(path);
return true;
}
::CoTaskMemFree(path);
}
// XP doesn't support SHGetKnownFolderPath and LocalLow
if (!GetTempPathW(aLen, aPath)) {
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -2676,17 +2676,17 @@ PluginModuleParent::NPP_New(NPMIMEType p
return NS_PLUGIN_INIT_PENDING;
}
class nsCaseInsensitiveUTF8StringArrayComparator
{
public:
template<class A, class B>
bool Equals(const A& a, const B& b) const {
- return a.Equals(b.get(), nsCaseInsensitiveUTF8StringComparator());
+ return a.Equals(b.Data(), nsCaseInsensitiveUTF8StringComparator());
}
};
void
PluginModuleParent::AccumulateModuleInitBlockedTime()
{
if (mPluginName.IsEmpty()) {
GetPluginDetails();
--- a/dom/power/PowerManagerService.cpp
+++ b/dom/power/PowerManagerService.cpp
@@ -119,22 +119,22 @@ PowerManagerService::Notify(const WakeLo
}
}
void
PowerManagerService::SyncProfile()
{
nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
if (obsServ) {
- NS_NAMED_LITERAL_STRING(context, "shutdown-persist");
- obsServ->NotifyObservers(nullptr, "profile-change-net-teardown", context.get());
- obsServ->NotifyObservers(nullptr, "profile-change-teardown", context.get());
- obsServ->NotifyObservers(nullptr, "profile-before-change", context.get());
- obsServ->NotifyObservers(nullptr, "profile-before-change-qm", context.get());
- obsServ->NotifyObservers(nullptr, "profile-before-change-telemetry", context.get());
+ const char16_t* context = u"shutdown-persist";
+ obsServ->NotifyObservers(nullptr, "profile-change-net-teardown", context);
+ obsServ->NotifyObservers(nullptr, "profile-change-teardown", context);
+ obsServ->NotifyObservers(nullptr, "profile-before-change", context);
+ obsServ->NotifyObservers(nullptr, "profile-before-change-qm", context);
+ obsServ->NotifyObservers(nullptr, "profile-before-change-telemetry", context);
}
}
NS_IMETHODIMP
PowerManagerService::Reboot()
{
LOG_FUNCTION_AND_JS_STACK() // bug 839452
--- a/dom/security/nsCSPParser.cpp
+++ b/dom/security/nsCSPParser.cpp
@@ -1111,17 +1111,17 @@ nsCSPParser::directiveName()
// child-src has it's own class to handle frame-src if necessary
if (CSP_IsDirective(mCurToken, nsIContentSecurityPolicy::CHILD_SRC_DIRECTIVE)) {
mChildSrc = new nsCSPChildSrcDirective(CSP_StringToCSPDirective(mCurToken));
return mChildSrc;
}
// if we have a frame-src, cache it so we can decide whether to use child-src
if (CSP_IsDirective(mCurToken, nsIContentSecurityPolicy::FRAME_SRC_DIRECTIVE)) {
- const char16_t* params[] = { mCurToken.get(), NS_LITERAL_STRING("child-src").get() };
+ const char16_t* params[] = { mCurToken.get(), u"child-src" };
logWarningErrorToConsole(nsIScriptError::warningFlag, "deprecatedDirective",
params, ArrayLength(params));
mFrameSrc = new nsCSPDirective(CSP_StringToCSPDirective(mCurToken));
return mFrameSrc;
}
if (CSP_IsDirective(mCurToken, nsIContentSecurityPolicy::REQUIRE_SRI_FOR)) {
return new nsRequireSRIForDirective(CSP_StringToCSPDirective(mCurToken));
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -2583,21 +2583,20 @@ XMLHttpRequestMainThread::InitiateFetch(
// always seem to implement the nsIUploadChannel2 interface, presumably
// because it's a new interface. Eventually we should remove this and simply
// require that http channels implement the new interface (see bug 529041).
nsCOMPtr<nsIUploadChannel2> uploadChannel2 = do_QueryInterface(httpChannel);
if (!uploadChannel2) {
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (consoleService) {
- consoleService->LogStringMessage(NS_LITERAL_STRING(
- "Http channel implementation doesn't support nsIUploadChannel2. "
+ consoleService->LogStringMessage(
+ u"Http channel implementation doesn't support nsIUploadChannel2. "
"An extension has supplied a non-functional http protocol handler. "
- "This will break behavior and in future releases not work at all."
- ).get());
+ "This will break behavior and in future releases not work at all.");
}
}
if (aUploadStream) {
// If necessary, wrap the stream in a buffered stream so as to guarantee
// support for our upload when calling ExplicitSetUploadStream.
nsCOMPtr<nsIInputStream> bufferedStream;
if (!NS_InputStreamIsBuffered(aUploadStream)) {
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -186,56 +186,56 @@ nsPageFrame::GetFrameName(nsAString& aRe
void
nsPageFrame::ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr)
{
aNewStr = aStr;
// Search to see if the &D code is in the string
// then subst in the current date/time
- NS_NAMED_LITERAL_STRING(kDate, "&D");
+ const char16_t* kDate = u"&D";
if (aStr.Find(kDate) != kNotFound) {
- aNewStr.ReplaceSubstring(kDate.get(), mPD->mDateTimeStr.get());
+ aNewStr.ReplaceSubstring(kDate, mPD->mDateTimeStr.get());
}
// NOTE: Must search for &PT before searching for &P
//
// 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");
+ const char16_t* kPageAndTotal = u"&PT";
if (aStr.Find(kPageAndTotal) != kNotFound) {
char16_t * uStr = nsTextFormatter::smprintf(mPD->mPageNumAndTotalsFormat.get(), mPageNum, mTotNumPages);
- aNewStr.ReplaceSubstring(kPageAndTotal.get(), uStr);
+ aNewStr.ReplaceSubstring(kPageAndTotal, uStr);
free(uStr);
}
// 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");
+ const char16_t* kPage = u"&P";
if (aStr.Find(kPage) != kNotFound) {
char16_t * uStr = nsTextFormatter::smprintf(mPD->mPageNumFormat.get(), mPageNum);
- aNewStr.ReplaceSubstring(kPage.get(), uStr);
+ aNewStr.ReplaceSubstring(kPage, uStr);
free(uStr);
}
- NS_NAMED_LITERAL_STRING(kTitle, "&T");
+ const char16_t* kTitle = u"&T";
if (aStr.Find(kTitle) != kNotFound) {
- aNewStr.ReplaceSubstring(kTitle.get(), mPD->mDocTitle.get());
+ aNewStr.ReplaceSubstring(kTitle, mPD->mDocTitle.get());
}
- NS_NAMED_LITERAL_STRING(kDocURL, "&U");
+ const char16_t* kDocURL = u"&U";
if (aStr.Find(kDocURL) != kNotFound) {
- aNewStr.ReplaceSubstring(kDocURL.get(), mPD->mDocURL.get());
+ aNewStr.ReplaceSubstring(kDocURL, mPD->mDocURL.get());
}
- NS_NAMED_LITERAL_STRING(kPageTotal, "&L");
+ const char16_t* kPageTotal = u"&L";
if (aStr.Find(kPageTotal) != kNotFound) {
char16_t * uStr = nsTextFormatter::smprintf(mPD->mPageNumFormat.get(), mTotNumPages);
- aNewStr.ReplaceSubstring(kPageTotal.get(), uStr);
+ aNewStr.ReplaceSubstring(kPageTotal, uStr);
free(uStr);
}
}
//------------------------------------------------------------------------------
nscoord nsPageFrame::GetXPosition(nsRenderingContext& aRenderingContext,
nsFontMetrics& aFontMetrics,
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -100,18 +100,18 @@ void nsDisplayMathMLError::Paint(nsDispl
Rect rect = NSRectToSnappedRect(nsRect(pt, mFrame->GetSize()),
appUnitsPerDevPixel,
*drawTarget);
ColorPattern red(ToDeviceColor(Color(1.f, 0.f, 0.f, 1.f)));
drawTarget->FillRect(rect, red);
aCtx->ThebesContext()->SetColor(Color(1.f, 1.f, 1.f));
nscoord ascent = fm->MaxAscent();
- NS_NAMED_LITERAL_STRING(errorMsg, "invalid-markup");
- nsLayoutUtils::DrawUniDirString(errorMsg.get(), uint32_t(errorMsg.Length()),
+ const char16_t errorMsg[] = u"invalid-markup";
+ nsLayoutUtils::DrawUniDirString(errorMsg, ArrayLength(errorMsg)-1,
nsPoint(pt.x, pt.y + ascent), *fm, *aCtx);
}
/* /////////////
* nsIMathMLFrame - support methods for stretchy elements
* =============================================================================
*/
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
@@ -80,22 +80,20 @@ public:
NS_XPCOM_SHUTDOWN_OBSERVER_ID);
MOZ_ALWAYS_SUCCEEDS(rv);
// Make sure we're not deleted while still inside ::Observe()
RefPtr<PeerConnectionCtxObserver> kungFuDeathGrip(this);
PeerConnectionCtx::gPeerConnectionCtxObserver = nullptr;
}
if (strcmp(aTopic, NS_IOSERVICE_OFFLINE_STATUS_TOPIC) == 0) {
- const nsLiteralString onlineString(u"" NS_IOSERVICE_ONLINE);
- const nsLiteralString offlineString(u"" NS_IOSERVICE_OFFLINE);
- if (NS_strcmp(aData, offlineString.get()) == 0) {
+ if (NS_strcmp(aData, u"" NS_IOSERVICE_OFFLINE) == 0) {
CSFLogDebug(logTag, "Updating network state to offline");
PeerConnectionCtx::UpdateNetworkState(false);
- } else if(NS_strcmp(aData, onlineString.get()) == 0) {
+ } else if(NS_strcmp(aData, u"" NS_IOSERVICE_ONLINE) == 0) {
CSFLogDebug(logTag, "Updating network state to online");
PeerConnectionCtx::UpdateNetworkState(true);
} else {
CSFLogDebug(logTag, "Received unsupported network state event");
MOZ_CRASH();
}
}
return NS_OK;
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -829,19 +829,20 @@ nsIOService::NewChannelFromURIWithProxyF
// implement the new interface.
// See bug 529041
if (!gHasWarnedUploadChannel2 && scheme.EqualsLiteral("http")) {
nsCOMPtr<nsIUploadChannel2> uploadChannel2 = do_QueryInterface(channel);
if (!uploadChannel2) {
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (consoleService) {
- consoleService->LogStringMessage(NS_LITERAL_STRING(
- "Http channel implementation doesn't support nsIUploadChannel2. An extension has supplied a non-functional http protocol handler. This will break behavior and in future releases not work at all."
- ).get());
+ consoleService->LogStringMessage(u"Http channel implementation "
+ "doesn't support nsIUploadChannel2. An extension has "
+ "supplied a non-functional http protocol handler. This will "
+ "break behavior and in future releases not work at all.");
}
gHasWarnedUploadChannel2 = true;
}
}
channel.forget(result);
return NS_OK;
}
@@ -1057,33 +1058,32 @@ nsIOService::SetOffline(bool offline)
}
}
nsIIOService *subject = static_cast<nsIIOService *>(this);
while (mSetOfflineValue != mOffline) {
offline = mSetOfflineValue;
if (offline && !mOffline) {
- NS_NAMED_LITERAL_STRING(offlineString, NS_IOSERVICE_OFFLINE);
mOffline = true; // indicate we're trying to shutdown
// don't care if notifications fail
if (observerService)
observerService->NotifyObservers(subject,
NS_IOSERVICE_GOING_OFFLINE_TOPIC,
- offlineString.get());
+ u"" NS_IOSERVICE_OFFLINE);
if (mSocketTransportService)
mSocketTransportService->SetOffline(true);
mLastOfflineStateChange = PR_IntervalNow();
if (observerService)
observerService->NotifyObservers(subject,
NS_IOSERVICE_OFFLINE_STATUS_TOPIC,
- offlineString.get());
+ u"" NS_IOSERVICE_OFFLINE);
}
else if (!offline && mOffline) {
// go online
if (mDNSService) {
DebugOnly<nsresult> rv = mDNSService->Init();
NS_ASSERTION(NS_SUCCEEDED(rv), "DNS service init failed");
}
InitializeSocketTransportService();
@@ -1188,23 +1188,22 @@ nsIOService::SetConnectivityInternal(boo
// send the ONLINE notification
observerService->NotifyObservers(
static_cast<nsIIOService *>(this),
NS_IOSERVICE_OFFLINE_STATUS_TOPIC,
(u"" NS_IOSERVICE_ONLINE));
} else {
// If we were previously online and lost connectivity
// send the OFFLINE notification
- const nsLiteralString offlineString(u"" NS_IOSERVICE_OFFLINE);
observerService->NotifyObservers(static_cast<nsIIOService *>(this),
NS_IOSERVICE_GOING_OFFLINE_TOPIC,
- offlineString.get());
+ u"" NS_IOSERVICE_OFFLINE);
observerService->NotifyObservers(static_cast<nsIIOService *>(this),
NS_IOSERVICE_OFFLINE_STATUS_TOPIC,
- offlineString.get());
+ u"" NS_IOSERVICE_OFFLINE);
}
return NS_OK;
}
NS_IMETHODIMP
nsIOService::AllowPort(int32_t inPort, const char *scheme, bool *_retval)
{
int16_t port = inPort;
--- a/netwerk/protocol/about/nsAboutCacheEntry.cpp
+++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp
@@ -148,33 +148,33 @@ nsAboutCacheEntry::Channel::GetContentSt
// Init: (block size, maximum length)
nsCOMPtr<nsIAsyncInputStream> inputStream;
rv = NS_NewPipe2(getter_AddRefs(inputStream),
getter_AddRefs(mOutputStream),
true, false,
256, UINT32_MAX);
if (NS_FAILED(rv)) return rv;
- NS_NAMED_LITERAL_CSTRING(
- buffer,
+ const char buffer[] =
"<!DOCTYPE html>\n"
"<html>\n"
"<head>\n"
" <title>Cache entry information</title>\n"
" <link rel=\"stylesheet\" "
"href=\"chrome://global/skin/about.css\" type=\"text/css\"/>\n"
" <link rel=\"stylesheet\" "
"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";
+ uint32_t bufferLen = mozilla::ArrayLength(buffer)-1;
uint32_t n;
- rv = mOutputStream->Write(buffer.get(), buffer.Length(), &n);
+ rv = mOutputStream->Write(buffer, bufferLen, &n);
if (NS_FAILED(rv)) return rv;
- if (n != buffer.Length()) return NS_ERROR_UNEXPECTED;
+ if (n != bufferLen) return NS_ERROR_UNEXPECTED;
rv = OpenCacheEntry(uri);
if (NS_FAILED(rv)) return rv;
inputStream.forget(result);
return NS_OK;
}
@@ -499,19 +499,19 @@ nsAboutCacheEntry::Channel::WriteCacheEn
mWaitingForData = true;
return NS_OK;
}
nsresult
nsAboutCacheEntry::Channel::WriteCacheEntryUnavailable()
{
uint32_t n;
- NS_NAMED_LITERAL_CSTRING(buffer,
- "The cache entry you selected is not available.");
- mOutputStream->Write(buffer.get(), buffer.Length(), &n);
+ const char str[] =
+ "The cache entry you selected is not available.";
+ mOutputStream->Write(str, mozilla::ArrayLength(str)-1, &n);
return NS_OK;
}
//-----------------------------------------------------------------------------
// nsICacheEntryMetaDataVisitor implementation
//-----------------------------------------------------------------------------
NS_IMETHODIMP
@@ -535,19 +535,19 @@ nsAboutCacheEntry::Channel::OnMetaDataEl
// nsIStreamListener implementation
//-----------------------------------------------------------------------------
NS_IMETHODIMP
nsAboutCacheEntry::Channel::OnStartRequest(nsIRequest *request, nsISupports *ctx)
{
mHexDumpState = 0;
- NS_NAMED_LITERAL_CSTRING(buffer, "<hr/>\n<pre>");
+ const char str[] = "<hr/>\n<pre>";
uint32_t n;
- return mOutputStream->Write(buffer.get(), buffer.Length(), &n);
+ return mOutputStream->Write(str, mozilla::ArrayLength(str)-1, &n);
}
NS_IMETHODIMP
nsAboutCacheEntry::Channel::OnDataAvailable(nsIRequest *request, nsISupports *ctx,
nsIInputStream *aInputStream,
uint64_t aOffset,
uint32_t aCount)
{
@@ -577,27 +577,27 @@ nsAboutCacheEntry::Channel::PrintCacheDa
return NS_OK;
}
NS_IMETHODIMP
nsAboutCacheEntry::Channel::OnStopRequest(nsIRequest *request, nsISupports *ctx,
nsresult result)
{
- NS_NAMED_LITERAL_CSTRING(buffer, "</pre>\n");
+ const char str[] = "</pre>\n";
uint32_t n;
- mOutputStream->Write(buffer.get(), buffer.Length(), &n);
+ mOutputStream->Write(str, mozilla::ArrayLength(str)-1, &n);
CloseContent();
return NS_OK;
}
void
nsAboutCacheEntry::Channel::CloseContent()
{
- NS_NAMED_LITERAL_CSTRING(buffer, "</body>\n</html>\n");
+ const char str[] = "</body>\n</html>\n";
uint32_t n;
- mOutputStream->Write(buffer.get(), buffer.Length(), &n);
+ mOutputStream->Write(str, mozilla::ArrayLength(str)-1, &n);
mOutputStream->Close();
mOutputStream = nullptr;
}
--- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
+++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
@@ -941,20 +941,19 @@ nsFtpState::R_syst() {
nsCOMPtr<nsIStringBundle> bundle;
nsresult rv = bundleService->CreateBundle(NECKO_MSGS_URL,
getter_AddRefs(bundle));
if (NS_FAILED(rv))
return FTP_ERROR;
char16_t* ucs2Response = ToNewUnicode(mResponseMsg);
const char16_t *formatStrings[1] = { ucs2Response };
- NS_NAMED_LITERAL_STRING(name, "UnsupportedFTPServer");
nsXPIDLString formattedString;
- rv = bundle->FormatStringFromName(name.get(), formatStrings, 1,
+ rv = bundle->FormatStringFromName(u"UnsupportedFTPServer", formatStrings, 1,
getter_Copies(formattedString));
free(ucs2Response);
if (NS_FAILED(rv))
return FTP_ERROR;
// TODO(darin): this code should not be dictating UI like this!
nsCOMPtr<nsIPrompt> prompter;
mChannel->GetCallback(prompter);
--- a/security/manager/ssl/ContentSignatureVerifier.cpp
+++ b/security/manager/ssl/ContentSignatureVerifier.cpp
@@ -441,28 +441,28 @@ ContentSignatureVerifier::ParseContentSi
return NS_ERROR_FAILURE;
}
LinkedList<nsSecurityHeaderDirective>* directives = parser.GetDirectives();
for (nsSecurityHeaderDirective* directive = directives->getFirst();
directive != nullptr; directive = directive->getNext()) {
CSVerifier_LOG(("CSVerifier: found directive %s\n", directive->mName.get()));
if (directive->mName.Length() == signature_var.Length() &&
- directive->mName.EqualsIgnoreCase(signature_var.get(),
+ directive->mName.EqualsIgnoreCase(signature_var.Data(),
signature_var.Length())) {
if (!mSignature.IsEmpty()) {
CSVerifier_LOG(("CSVerifier: found two ContentSignatures\n"));
return NS_ERROR_INVALID_SIGNATURE;
}
CSVerifier_LOG(("CSVerifier: found a ContentSignature directive\n"));
mSignature = directive->mValue;
}
if (directive->mName.Length() == certChainURL_var.Length() &&
- directive->mName.EqualsIgnoreCase(certChainURL_var.get(),
+ directive->mName.EqualsIgnoreCase(certChainURL_var.Data(),
certChainURL_var.Length())) {
if (!mCertChainURL.IsEmpty()) {
CSVerifier_LOG(("CSVerifier: found two x5u values\n"));
return NS_ERROR_INVALID_SIGNATURE;
}
CSVerifier_LOG(("CSVerifier: found an x5u directive\n"));
mCertChainURL = directive->mValue;
--- a/security/manager/ssl/nsNSSComponent.cpp
+++ b/security/manager/ssl/nsNSSComponent.cpp
@@ -1959,22 +1959,20 @@ nsNSSComponent::Init()
return rv;
}
// Access our string bundles now, this prevents assertions from I/O
// - nsStandardURL not thread-safe
// - wrong thread: 'NS_IsMainThread()' in nsIOService.cpp
// when loading error strings on the SSL threads.
{
- NS_NAMED_LITERAL_STRING(dummy_name, "dummy");
+ const char16_t* dummy = u"dummy";
nsXPIDLString result;
- mPIPNSSBundle->GetStringFromName(dummy_name.get(),
- getter_Copies(result));
- mNSSErrorsBundle->GetStringFromName(dummy_name.get(),
- getter_Copies(result));
+ mPIPNSSBundle->GetStringFromName(dummy, getter_Copies(result));
+ mNSSErrorsBundle->GetStringFromName(dummy, getter_Copies(result));
}
rv = InitializeNSS();
if (NS_FAILED(rv)) {
MOZ_LOG(gPIPNSSLog, LogLevel::Error,
("nsNSSComponent::InitializeNSS() failed\n"));
return rv;
--- a/security/manager/ssl/nsNSSU2FToken.cpp
+++ b/security/manager/ssl/nsNSSU2FToken.cpp
@@ -24,17 +24,17 @@ NS_IMPL_ISUPPORTS(nsNSSU2FToken, nsIU2FT
// name causes the window.u2f object to disappear until preferences get
// reloaded, as its' pref is a substring!
#define PREF_U2F_NSSTOKEN_COUNTER "security.webauth.softtoken_counter"
const nsCString nsNSSU2FToken::mSecretNickname =
NS_LITERAL_CSTRING("U2F_NSSTOKEN");
const nsString nsNSSU2FToken::mVersion =
NS_LITERAL_STRING("U2F_V2");
-NS_NAMED_LITERAL_CSTRING(kAttestCertSubjectName, "CN=Firefox U2F Soft Token");
+const char* kAttestCertSubjectName = "CN=Firefox U2F Soft Token";
// 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
// generate and return a new keypair KP, where the private component is wrapped
// using AES-KW with the 128-bit mWrappingKey to make an opaque "key handle".
// In other words, Register yields { KP_pub, AES-KW(KP_priv, key=mWrappingKey) }
//
// The value mWrappingKey is long-lived; it is persisted as part of the NSS DB
@@ -245,17 +245,17 @@ GetAttestationCertificate(const UniquePK
nsresult rv = GenEcKeypair(aSlot, aAttestPrivKey, pubKey, locker);
if (NS_FAILED(rv) || !aAttestPrivKey || !pubKey) {
MOZ_LOG(gNSSTokenLog, LogLevel::Warning,
("Failed to gen keypair, NSS error #%d", PORT_GetError()));
return NS_ERROR_FAILURE;
}
// Construct the Attestation Certificate itself
- UniqueCERTName subjectName(CERT_AsciiToName(kAttestCertSubjectName.get()));
+ UniqueCERTName subjectName(CERT_AsciiToName(kAttestCertSubjectName));
if (!subjectName) {
MOZ_LOG(gNSSTokenLog, LogLevel::Warning,
("Failed to set subject name, NSS error #%d", PORT_GetError()));
return NS_ERROR_FAILURE;
}
UniqueCERTSubjectPublicKeyInfo spki(
SECKEY_CreateSubjectPublicKeyInfo(pubKey.get()));
--- a/security/manager/ssl/nsSiteSecurityService.cpp
+++ b/security/manager/ssl/nsSiteSecurityService.cpp
@@ -814,17 +814,17 @@ ParseSSSHeaders(uint32_t aType,
return nsISiteSecurityService::ERROR_COULD_NOT_PARSE_HEADER;
}
mozilla::LinkedList<nsSecurityHeaderDirective>* directives = parser.GetDirectives();
for (nsSecurityHeaderDirective* directive = directives->getFirst();
directive != nullptr; directive = directive->getNext()) {
SSSLOG(("SSS: found directive %s\n", directive->mName.get()));
if (directive->mName.Length() == max_age_var.Length() &&
- directive->mName.EqualsIgnoreCase(max_age_var.get(),
+ directive->mName.EqualsIgnoreCase(max_age_var.Data(),
max_age_var.Length())) {
if (foundMaxAge) {
SSSLOG(("SSS: found two max-age directives"));
return nsISiteSecurityService::ERROR_MULTIPLE_MAX_AGES;
}
SSSLOG(("SSS: found max-age directive"));
foundMaxAge = true;
@@ -840,44 +840,44 @@ ParseSSSHeaders(uint32_t aType,
if (PR_sscanf(directive->mValue.get(), "%llu", &maxAge) != 1) {
SSSLOG(("SSS: could not parse delta-seconds"));
return nsISiteSecurityService::ERROR_INVALID_MAX_AGE;
}
SSSLOG(("SSS: parsed delta-seconds: %" PRIu64, maxAge));
} else if (directive->mName.Length() == include_subd_var.Length() &&
- directive->mName.EqualsIgnoreCase(include_subd_var.get(),
+ directive->mName.EqualsIgnoreCase(include_subd_var.Data(),
include_subd_var.Length())) {
if (foundIncludeSubdomains) {
SSSLOG(("SSS: found two includeSubdomains directives"));
return nsISiteSecurityService::ERROR_MULTIPLE_INCLUDE_SUBDOMAINS;
}
SSSLOG(("SSS: found includeSubdomains directive"));
foundIncludeSubdomains = true;
if (directive->mValue.Length() != 0) {
SSSLOG(("SSS: includeSubdomains directive unexpectedly had value '%s'",
directive->mValue.get()));
return nsISiteSecurityService::ERROR_INVALID_INCLUDE_SUBDOMAINS;
}
} else if (aType == nsISiteSecurityService::HEADER_HPKP &&
directive->mName.Length() == pin_sha256_var.Length() &&
- directive->mName.EqualsIgnoreCase(pin_sha256_var.get(),
+ directive->mName.EqualsIgnoreCase(pin_sha256_var.Data(),
pin_sha256_var.Length())) {
SSSLOG(("SSS: found pinning entry '%s' length=%d",
directive->mValue.get(), directive->mValue.Length()));
if (!stringIsBase64EncodingOf256bitValue(directive->mValue)) {
return nsISiteSecurityService::ERROR_INVALID_PIN;
}
sha256keys.AppendElement(directive->mValue);
} else if (aType == nsISiteSecurityService::HEADER_HPKP &&
directive->mName.Length() == report_uri_var.Length() &&
- directive->mName.EqualsIgnoreCase(report_uri_var.get(),
+ directive->mName.EqualsIgnoreCase(report_uri_var.Data(),
report_uri_var.Length())) {
// We don't support the report-uri yet, but to avoid unrecognized
// directive warnings, we still have to handle its presence
if (foundReportURI) {
SSSLOG(("SSS: found two report-uri directives"));
return nsISiteSecurityService::ERROR_MULTIPLE_REPORT_URIS;
}
SSSLOG(("SSS: found report-uri directive"));
--- a/storage/VacuumManager.cpp
+++ b/storage/VacuumManager.cpp
@@ -24,18 +24,18 @@
#include "mozStorageHelper.h"
#include "nsXULAppAPI.h"
#define OBSERVER_TOPIC_IDLE_DAILY "idle-daily"
#define OBSERVER_TOPIC_XPCOM_SHUTDOWN "xpcom-shutdown"
// Used to notify begin and end of a heavy IO task.
#define OBSERVER_TOPIC_HEAVY_IO "heavy-io-task"
-#define OBSERVER_DATA_VACUUM_BEGIN NS_LITERAL_STRING("vacuum-begin")
-#define OBSERVER_DATA_VACUUM_END NS_LITERAL_STRING("vacuum-end")
+#define OBSERVER_DATA_VACUUM_BEGIN u"vacuum-begin"
+#define OBSERVER_DATA_VACUUM_END u"vacuum-end"
// This preferences root will contain last vacuum timestamps (in seconds) for
// each database. The database filename is used as a key.
#define PREF_VACUUM_BRANCH "storage.vacuum.last."
// Time between subsequent vacuum calls for a certain database.
#define VACUUM_INTERVAL_SECONDS 30 * 86400 // 30 days.
@@ -186,17 +186,17 @@ Vacuumer::execute()
return false;
}
// Notify a heavy IO task is about to start.
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (os) {
rv =
os->NotifyObservers(nullptr, OBSERVER_TOPIC_HEAVY_IO,
- OBSERVER_DATA_VACUUM_BEGIN.get());
+ OBSERVER_DATA_VACUUM_BEGIN);
MOZ_ASSERT(NS_SUCCEEDED(rv), "Should be able to notify");
}
// Execute the statements separately, since the pragma may conflict with the
// vacuum, if they are executed in the same transaction.
nsCOMPtr<mozIStorageAsyncStatement> pageSizeStmt;
nsAutoCString pageSizeQuery(MOZ_STORAGE_UNIQUIFY_QUERY_STR
"PRAGMA page_size = ");
@@ -284,17 +284,17 @@ Vacuumer::HandleCompletion(uint16_t aRea
}
nsresult
Vacuumer::notifyCompletion(bool aSucceeded)
{
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (os) {
os->NotifyObservers(nullptr, OBSERVER_TOPIC_HEAVY_IO,
- OBSERVER_DATA_VACUUM_END.get());
+ OBSERVER_DATA_VACUUM_END);
}
nsresult rv = mParticipant->OnEndVacuum(aSucceeded);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
--- a/toolkit/components/find/nsWebBrowserFind.cpp
+++ b/toolkit/components/find/nsWebBrowserFind.cpp
@@ -87,21 +87,19 @@ nsWebBrowserFind::FindNext(bool* aResult
nsCOMPtr<nsIObserverService> observerSvc =
mozilla::services::GetObserverService();
if (observerSvc) {
nsCOMPtr<nsISupportsInterfacePointer> windowSupportsData =
do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupports> searchWindowSupports = do_QueryInterface(rootFrame);
windowSupportsData->SetData(searchWindowSupports);
- NS_NAMED_LITERAL_STRING(dnStr, "down");
- NS_NAMED_LITERAL_STRING(upStr, "up");
observerSvc->NotifyObservers(windowSupportsData,
"nsWebBrowserFind_FindAgain",
- mFindBackwards ? upStr.get() : dnStr.get());
+ mFindBackwards ? u"up" : u"down");
windowSupportsData->GetData(getter_AddRefs(searchWindowSupports));
// findnext performed if search window data cleared out
*aResult = searchWindowSupports == nullptr;
if (*aResult) {
return NS_OK;
}
}
--- a/toolkit/components/startup/nsAppStartup.cpp
+++ b/toolkit/components/startup/nsAppStartup.cpp
@@ -453,21 +453,18 @@ nsAppStartup::Quit(uint32_t aMode)
}
if (ferocity == eForceQuit) {
// do it!
// No chance of the shutdown being cancelled from here on; tell people
// we're shutting down for sure while all services are still available.
if (obsService) {
- NS_NAMED_LITERAL_STRING(shutdownStr, "shutdown");
- NS_NAMED_LITERAL_STRING(restartStr, "restart");
obsService->NotifyObservers(nullptr, "quit-application",
- (mRestart || mRestartNotSameProfile) ?
- restartStr.get() : shutdownStr.get());
+ (mRestart || mRestartNotSameProfile) ? u"restart" : u"shutdown");
}
if (!mRunning) {
postedExitEvent = true;
}
else {
// no matter what, make sure we send the exit event. If
// worst comes to worst, we'll do a leaky shutdown but we WILL
--- a/toolkit/mozapps/extensions/AddonContentPolicy.cpp
+++ b/toolkit/mozapps/extensions/AddonContentPolicy.cpp
@@ -295,17 +295,17 @@ class CSPValidator final : public nsCSPS
};
// Formatters
template <typename... T>
inline void FormatError(const char* aName, const T ...aParams)
{
- const char16_t* params[] = { mDirective.get(), aParams.get()... };
+ const char16_t* params[] = { mDirective.get(), aParams.Data()... };
FormatErrorParams(aName, params, MOZ_ARRAY_LENGTH(params));
};
private:
// Validators
bool HostIsAllowed(nsAString& host)
{
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -569,17 +569,17 @@ XRE_InitChildProcess(int aArgc,
// group with the parent app on the Win7 taskbar.
const char* const appModelUserId = aArgv[--aArgc];
if (appModelUserId) {
// '-' implies no support
if (*appModelUserId != '-') {
nsString appId;
appId.AssignWithConversion(nsDependentCString(appModelUserId));
// The version string is encased in quotes
- appId.Trim(NS_LITERAL_CSTRING("\"").get());
+ appId.Trim("\"");
// Set the id
SetTaskbarGroupId(appId);
}
}
#endif
base::AtExitManager exitManager;
--- a/toolkit/xre/nsNativeAppSupportWin.cpp
+++ b/toolkit/xre/nsNativeAppSupportWin.cpp
@@ -948,17 +948,17 @@ nsNativeAppSupportWin::HandleDDENotifica
// command, therefore it is returned as a null string
// This isn't really a loop. We just use "break"
// statements to bypass the remaining steps when
// something goes wrong.
do {
// Get most recently used Nav window.
nsCOMPtr<mozIDOMWindowProxy> navWin;
- GetMostRecentWindow( NS_LITERAL_STRING( "navigator:browser" ).get(),
+ GetMostRecentWindow( u"navigator:browser",
getter_AddRefs( navWin ) );
nsCOMPtr<nsPIDOMWindowOuter> piNavWin = do_QueryInterface(navWin);
if ( !piNavWin ) {
// There is not a window open
break;
}
// Get content window.
@@ -1425,17 +1425,17 @@ nsNativeAppSupportWin::OpenBrowserWindow
// Open the argument URL in the most recently used Navigator window.
// If there is no Nav window, open a new one.
// If at all possible, hand the request off to the most recent
// browser window.
nsCOMPtr<mozIDOMWindowProxy> navWin;
- GetMostRecentWindow( NS_LITERAL_STRING( "navigator:browser" ).get(), getter_AddRefs( navWin ) );
+ GetMostRecentWindow( u"navigator:browser", getter_AddRefs( navWin ) );
// This isn't really a loop. We just use "break" statements to fall
// out to the OpenWindow call when things go awry.
do {
// If caller requires a new window, then don't use an existing one.
if ( !navWin ) {
// Have to open a new one.
break;
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -1283,19 +1283,19 @@ GetShellFolderPath(int folder, nsAString
* Provides a fallback for getting the path to APPDATA or LOCALAPPDATA by
* querying the registry when the call to SHGetSpecialFolderLocation or
* SHGetPathFromIDListW is unable to provide these paths (Bug 513958).
*/
static nsresult
GetRegWindowsAppDataFolder(bool aLocal, nsAString& _retval)
{
HKEY key;
- NS_NAMED_LITERAL_STRING(keyName,
- "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- DWORD res = ::RegOpenKeyExW(HKEY_CURRENT_USER, keyName.get(), 0, KEY_READ,
+ LPCWSTR keyName =
+ L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
+ DWORD res = ::RegOpenKeyExW(HKEY_CURRENT_USER, keyName, 0, KEY_READ,
&key);
if (res != ERROR_SUCCESS) {
_retval.SetLength(0);
return NS_ERROR_NOT_AVAILABLE;
}
DWORD type, size;
res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"),
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -162,18 +162,17 @@ public:
if (sPauseCount != 1) {
return;
}
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
obsServ->NotifyObservers(nullptr, "application-background", nullptr);
- NS_NAMED_LITERAL_STRING(minimize, "heap-minimize");
- obsServ->NotifyObservers(nullptr, "memory-pressure", minimize.get());
+ obsServ->NotifyObservers(nullptr, "memory-pressure", u"heap-minimize");
// If we are OOM killed with the disk cache enabled, the entire
// cache will be cleared (bug 105843), so shut down the cache here
// and re-init on foregrounding
if (nsCacheService::GlobalInstance()) {
nsCacheService::GlobalInstance()->Shutdown();
}
--- a/widget/windows/WindowsUIUtils.cpp
+++ b/widget/windows/WindowsUIUtils.cpp
@@ -163,20 +163,18 @@ WindowsUIUtils::UpdateTabletModeState()
UserInteractionMode mode;
hr = uiViewSettings->get_UserInteractionMode(&mode);
if (SUCCEEDED(hr)) {
TabletModeState oldTabletModeState = mInTabletMode;
mInTabletMode = (mode == UserInteractionMode_Touch) ? eTabletModeOn : eTabletModeOff;
if (mInTabletMode != oldTabletModeState) {
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
- NS_NAMED_LITERAL_STRING(tabletMode, "tablet-mode");
- NS_NAMED_LITERAL_STRING(normalMode, "normal-mode");
observerService->NotifyObservers(nullptr, "tablet-mode-change",
- ((mInTabletMode == eTabletModeOn) ? tabletMode.get() : normalMode.get()));
+ ((mInTabletMode == eTabletModeOn) ? u"tablet-mode" : u"normal-mode"));
}
}
}
}
#endif
return NS_OK;
}
--- a/widget/windows/nsFilePicker.cpp
+++ b/widget/windows/nsFilePicker.cpp
@@ -494,23 +494,21 @@ nsFilePicker::ShowFilePicker(const nsStr
// title
dialog->SetTitle(mTitle.get());
// default filename
if (!mDefaultFilename.IsEmpty()) {
dialog->SetFileName(mDefaultFilename.get());
}
- NS_NAMED_LITERAL_STRING(htmExt, "html");
-
// default extension to append to new files
if (!mDefaultExtension.IsEmpty()) {
dialog->SetDefaultExtension(mDefaultExtension.get());
} else if (IsDefaultPathHtml()) {
- dialog->SetDefaultExtension(htmExt.get());
+ dialog->SetDefaultExtension(L"html");
}
// initial location
if (!aInitialDir.IsEmpty()) {
RefPtr<IShellItem> folder;
if (SUCCEEDED(
SHCreateItemFromParsingName(aInitialDir.get(), nullptr,
IID_IShellItem,
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -5038,26 +5038,26 @@ nsWindow::ProcessMessage(UINT msg, WPARA
if (msg == MOZ_WM_APP_QUIT || (wParam == TRUE && sCanQuit == TRI_TRUE))
{
// Let's fake a shutdown sequence without actually closing windows etc.
// to avoid Windows killing us in the middle. A proper shutdown would
// require having a chance to pump some messages. Unfortunately
// Windows won't let us do that. Bug 212316.
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
- NS_NAMED_LITERAL_STRING(context, "shutdown-persist");
- NS_NAMED_LITERAL_STRING(syncShutdown, "syncShutdown");
- obsServ->NotifyObservers(nullptr, "quit-application-granted", syncShutdown.get());
+ const char16_t* context = u"shutdown-persist";
+ const char16_t* syncShutdown = u"syncShutdown";
+ obsServ->NotifyObservers(nullptr, "quit-application-granted", syncShutdown);
obsServ->NotifyObservers(nullptr, "quit-application-forced", nullptr);
obsServ->NotifyObservers(nullptr, "quit-application", nullptr);
- obsServ->NotifyObservers(nullptr, "profile-change-net-teardown", context.get());
- obsServ->NotifyObservers(nullptr, "profile-change-teardown", context.get());
- obsServ->NotifyObservers(nullptr, "profile-before-change", context.get());
- obsServ->NotifyObservers(nullptr, "profile-before-change-qm", context.get());
- obsServ->NotifyObservers(nullptr, "profile-before-change-telemetry", context.get());
+ obsServ->NotifyObservers(nullptr, "profile-change-net-teardown", context);
+ obsServ->NotifyObservers(nullptr, "profile-change-teardown", context);
+ obsServ->NotifyObservers(nullptr, "profile-before-change", context);
+ obsServ->NotifyObservers(nullptr, "profile-before-change-qm", context);
+ obsServ->NotifyObservers(nullptr, "profile-before-change-telemetry", context);
// Then a controlled but very quick exit.
_exit(0);
}
sCanQuit = TRI_UNKNOWN;
result = true;
break;
case WM_SYSCOLORCHANGE:
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -178,19 +178,17 @@ GetHDDInfo(const char* aSpecialDirName,
free(deviceOutput);
return NS_OK;
}
nsresult GetInstallYear(uint32_t& aYear)
{
HKEY hKey;
LONG status = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
- NS_LITERAL_STRING(
- "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
- ).get(),
+ L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion",
0, KEY_READ | KEY_WOW64_64KEY, &hKey);
if (status != ERROR_SUCCESS) {
return NS_ERROR_UNEXPECTED;
}
nsAutoRegKey key(hKey);
--- a/xpcom/io/SpecialSystemDirectory.cpp
+++ b/xpcom/io/SpecialSystemDirectory.cpp
@@ -146,19 +146,19 @@ GetLibrarySaveToPath(int aFallbackFolder
* Provides a fallback for getting the path to APPDATA or LOCALAPPDATA by
* querying the registry when the call to SHGetSpecialFolderPathW is unable to
* provide these paths (Bug 513958).
*/
static nsresult
GetRegWindowsAppDataFolder(bool aLocal, nsIFile** aFile)
{
HKEY key;
- NS_NAMED_LITERAL_STRING(keyName,
- "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- DWORD res = ::RegOpenKeyExW(HKEY_CURRENT_USER, keyName.get(), 0, KEY_READ,
+ LPCWSTR keyName =
+ L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
+ DWORD res = ::RegOpenKeyExW(HKEY_CURRENT_USER, keyName, 0, KEY_READ,
&key);
if (res != ERROR_SUCCESS) {
return NS_ERROR_FAILURE;
}
WCHAR path[MAX_PATH + 2];
DWORD type, size;
res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"),
--- a/xpcom/tests/gtest/TestObserverService.cpp
+++ b/xpcom/tests/gtest/TestObserverService.cpp
@@ -247,42 +247,42 @@ TEST(ObserverService, TestNotify)
// Add two observers for topicA.
testResult(svc->AddObserver(aObserver, topicA.get(), false));
testResult(svc->AddObserver(bObserver, topicA.get(), false));
// Add one observer for topicB.
testResult(svc->AddObserver(bObserver, topicB.get(), false));
// Notify topicA.
- NS_NAMED_LITERAL_STRING(dataA, "Testing Notify(observer-A, topic-A)");
+ const char16_t* dataA = u"Testing Notify(observer-A, topic-A)";
aObserver->mExpectedData = dataA;
bObserver->mExpectedData = dataA;
nsresult rv =
- svc->NotifyObservers(ToSupports(aObserver), topicA.get(), dataA.get());
+ svc->NotifyObservers(ToSupports(aObserver), topicA.get(), dataA);
testResult(rv);
ASSERT_EQ(aObserver->mObservations, 1);
ASSERT_EQ(bObserver->mObservations, 1);
// Notify topicB.
- NS_NAMED_LITERAL_STRING(dataB, "Testing Notify(observer-B, topic-B)");
+ const char16_t* dataB = u"Testing Notify(observer-B, topic-B)";
bObserver->mExpectedData = dataB;
- rv = svc->NotifyObservers(ToSupports(bObserver), topicB.get(), dataB.get());
+ rv = svc->NotifyObservers(ToSupports(bObserver), topicB.get(), dataB);
testResult(rv);
ASSERT_EQ(aObserver->mObservations, 1);
ASSERT_EQ(bObserver->mObservations, 2);
// Remove one of the topicA observers, make sure it's not notified.
testResult(svc->RemoveObserver(aObserver, topicA.get()));
// Notify topicA, only bObserver is expected to be notified.
bObserver->mExpectedData = dataA;
- rv = svc->NotifyObservers(ToSupports(aObserver), topicA.get(), dataA.get());
+ rv = svc->NotifyObservers(ToSupports(aObserver), topicA.get(), dataA);
testResult(rv);
ASSERT_EQ(aObserver->mObservations, 1);
ASSERT_EQ(bObserver->mObservations, 3);
// Remove the other topicA observer, make sure none are notified.
testResult(svc->RemoveObserver(bObserver, topicA.get()));
- rv = svc->NotifyObservers(ToSupports(aObserver), topicA.get(), dataA.get());
+ rv = svc->NotifyObservers(ToSupports(aObserver), topicA.get(), dataA);
testResult(rv);
ASSERT_EQ(aObserver->mObservations, 1);
ASSERT_EQ(bObserver->mObservations, 3);
}
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -1488,25 +1488,22 @@ nsThread::DoMainThreadSpecificProcessing
}
// Fire a memory pressure notification, if one is pending.
if (!ShuttingDown()) {
MemoryPressureState mpPending = NS_GetPendingMemoryPressure();
if (mpPending != MemPressure_None) {
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
- // Use no-forward to prevent the notifications from being transferred to
- // the children of this process.
- NS_NAMED_LITERAL_STRING(lowMem, "low-memory-no-forward");
- NS_NAMED_LITERAL_STRING(lowMemOngoing, "low-memory-ongoing-no-forward");
-
if (os) {
+ // Use no-forward to prevent the notifications from being transferred to
+ // the children of this process.
os->NotifyObservers(nullptr, "memory-pressure",
- mpPending == MemPressure_New ? lowMem.get() :
- lowMemOngoing.get());
+ mpPending == MemPressure_New ? u"low-memory-no-forward" :
+ u"low-memory-ongoing-no-forward");
} else {
NS_WARNING("Can't get observer service!");
}
}
}
#ifdef MOZ_CRASHREPORTER
if (!ShuttingDown()) {