Skip to content

Commit

Permalink
Bug 1277106 - Part 2: Expand MOZ_UTF16() strings to u"" string litera…
Browse files Browse the repository at this point in the history
…ls. r=Waldo
  • Loading branch information
cpeterso committed Jul 21, 2016
1 parent 8949f73 commit b175c9f
Show file tree
Hide file tree
Showing 160 changed files with 720 additions and 745 deletions.
10 changes: 5 additions & 5 deletions accessible/generic/Accessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2761,36 +2761,36 @@ KeyBinding::ToPlatformFormat(nsAString& aValue) const
return;

nsAutoString separator;
keyStringBundle->GetStringFromName(MOZ_UTF16("MODIFIER_SEPARATOR"),
keyStringBundle->GetStringFromName(u"MODIFIER_SEPARATOR",
getter_Copies(separator));

nsAutoString modifierName;
if (mModifierMask & kControl) {
keyStringBundle->GetStringFromName(MOZ_UTF16("VK_CONTROL"),
keyStringBundle->GetStringFromName(u"VK_CONTROL",
getter_Copies(modifierName));

aValue.Append(modifierName);
aValue.Append(separator);
}

if (mModifierMask & kAlt) {
keyStringBundle->GetStringFromName(MOZ_UTF16("VK_ALT"),
keyStringBundle->GetStringFromName(u"VK_ALT",
getter_Copies(modifierName));

aValue.Append(modifierName);
aValue.Append(separator);
}

if (mModifierMask & kShift) {
keyStringBundle->GetStringFromName(MOZ_UTF16("VK_SHIFT"),
keyStringBundle->GetStringFromName(u"VK_SHIFT",
getter_Copies(modifierName));

aValue.Append(modifierName);
aValue.Append(separator);
}

if (mModifierMask & kMeta) {
keyStringBundle->GetStringFromName(MOZ_UTF16("VK_META"),
keyStringBundle->GetStringFromName(u"VK_META",
getter_Copies(modifierName));

aValue.Append(modifierName);
Expand Down
2 changes: 1 addition & 1 deletion accessible/generic/ApplicationAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ApplicationAccessible::Name(nsString& aName)
return eNameOK;

nsXPIDLString appName;
rv = bundle->GetStringFromName(MOZ_UTF16("brandShortName"),
rv = bundle->GetStringFromName(u"brandShortName",
getter_Copies(appName));
if (NS_FAILED(rv) || appName.IsEmpty()) {
NS_WARNING("brandShortName not found, using default app name");
Expand Down
4 changes: 2 additions & 2 deletions browser/components/shell/nsGNOMEShellService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
NS_ENSURE_SUCCESS(rv, rv);

nsString brandShortName;
brandBundle->GetStringFromName(MOZ_UTF16("brandShortName"),
brandBundle->GetStringFromName(u"brandShortName",
getter_Copies(brandShortName));

// use brandShortName as the application id.
Expand Down Expand Up @@ -402,7 +402,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
rv = bundleService->CreateBundle(BRAND_PROPERTIES,
getter_AddRefs(brandBundle));
if (NS_SUCCEEDED(rv) && brandBundle) {
rv = brandBundle->GetStringFromName(MOZ_UTF16("brandShortName"),
rv = brandBundle->GetStringFromName(u"brandShortName",
getter_Copies(brandName));
NS_ENSURE_SUCCESS(rv, rv);
}
Expand Down
2 changes: 1 addition & 1 deletion browser/components/shell/nsWindowsShellService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement,
// e.g. "Desktop Background.bmp"
nsString fileLeafName;
rv = shellBundle->GetStringFromName
(MOZ_UTF16("desktopBackgroundLeafNameWin"),
(u"desktopBackgroundLeafNameWin",
getter_Copies(fileLeafName));
NS_ENSURE_SUCCESS(rv, rv);

Expand Down
2 changes: 1 addition & 1 deletion caps/nsScriptSecurityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ nsScriptSecurityManager::CheckLoadURIFlags(nsIURI *aSourceURI,
NS_ConvertASCIItoUTF16 ucsTargetScheme(targetScheme);
const char16_t* formatStrings[] = { ucsTargetScheme.get() };
rv = sStrBundle->
FormatStringFromName(MOZ_UTF16("ProtocolFlagError"),
FormatStringFromName(u"ProtocolFlagError",
formatStrings,
ArrayLength(formatStrings),
getter_Copies(message));
Expand Down
2 changes: 1 addition & 1 deletion devtools/shared/heapsnapshot/DeserializedNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace ubi {
using mozilla::devtools::DeserializedEdge;

const char16_t Concrete<DeserializedNode>::concreteTypeName[] =
MOZ_UTF16("mozilla::devtools::DeserializedNode");
u"mozilla::devtools::DeserializedNode";

const char16_t*
Concrete<DeserializedNode>::typeName() const
Expand Down
2 changes: 1 addition & 1 deletion devtools/shared/heapsnapshot/HeapSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ AddGlobalsAsRoots(AutoObjectVector& globals, ubi::RootList& roots)
unsigned length = globals.length();
for (unsigned i = 0; i < length; i++) {
if (!roots.addRoot(ubi::Node(globals[i].get()),
MOZ_UTF16("heap snapshot global")))
u"heap snapshot global"))
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ size_t fakeMallocSizeOf(const void*) {
}

DEF_TEST(DeserializedNodeUbiNodes, {
const char16_t* typeName = MOZ_UTF16("TestTypeName");
const char16_t* typeName = u"TestTypeName";
const char* className = "MyObjectClassName";
const char* filename = "my-cool-filename.js";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ DEF_TEST(DeserializedStackFrameUbiStackFrames, {
StackFrameId id = uint64_t(1) << 42;
uint32_t line = 1337;
uint32_t column = 9; // 3 space tabs!?
const char16_t* source = MOZ_UTF16("my-javascript-file.js");
const char16_t* functionDisplayName = MOZ_UTF16("myFunctionName");
const char16_t* source = u"my-javascript-file.js";
const char16_t* functionDisplayName = u"myFunctionName";

MockDeserializedStackFrame mocked;
mocked.id = id;
Expand Down
2 changes: 1 addition & 1 deletion devtools/shared/heapsnapshot/tests/gtest/DevTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class Concrete<FakeNode> : public Base
}
};

const char16_t Concrete<FakeNode>::concreteTypeName[] = MOZ_UTF16("FakeNode");
const char16_t Concrete<FakeNode>::concreteTypeName[] = u"FakeNode";

} // namespace ubi
} // namespace JS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ DEF_TEST(SerializesEdgeNames, {
FakeNode node;
FakeNode referent;

const char16_t edgeName[] = MOZ_UTF16("edge name");
const char16_t emptyStr[] = MOZ_UTF16("");
const char16_t edgeName[] = u"edge name";
const char16_t emptyStr[] = u"";

AddEdge(node, referent, edgeName);
AddEdge(node, referent, emptyStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DEF_TEST(SerializesTypeNames, {

::testing::NiceMock<MockWriter> writer;
EXPECT_CALL(writer, writeNode(Property(&JS::ubi::Node::typeName,
UTF16StrEq(MOZ_UTF16("FakeNode"))),
UTF16StrEq(u"FakeNode")),
_))
.Times(1)
.WillOnce(Return(true));
Expand Down
2 changes: 1 addition & 1 deletion docshell/base/nsDSURIContentListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ nsDSURIContentListener::CheckFrameOptions(nsIRequest* aRequest)
if (mDocShell) {
nsCOMPtr<nsIWebNavigation> webNav(do_QueryObject(mDocShell));
if (webNav) {
webNav->LoadURI(MOZ_UTF16("about:blank"),
webNav->LoadURI(u"about:blank",
0, nullptr, nullptr, nullptr);
}
}
Expand Down
12 changes: 6 additions & 6 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5073,7 +5073,7 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
// LoadErrorPage. If the page doesn't have a title, we will use a blank
// space which will be trimmed and thus treated as empty by the front-end.
if (messageStr.IsEmpty()) {
messageStr.AssignLiteral(MOZ_UTF16(" "));
messageStr.AssignLiteral(u" ");
}
} else {
// Errors requiring simple formatting
Expand Down Expand Up @@ -7688,7 +7688,7 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
// We have to load a fallback in this case.
// XXX: We always load about blank here, firefox has to overwrite this if
// it wants to display something else.
return LoadURI(MOZ_UTF16("about:blank"), // URI string
return LoadURI(u"about:blank", // URI string
nsIChannel::LOAD_NORMAL, // Load flags
nullptr, // Referring URI
nullptr, // Post data stream
Expand Down Expand Up @@ -13011,19 +13011,19 @@ nsDocShell::ConfirmRepost(bool* aRepost)
"Unable to set up repost prompter.");

nsXPIDLString brandName;
rv = brandBundle->GetStringFromName(MOZ_UTF16("brandShortName"),
rv = brandBundle->GetStringFromName(u"brandShortName",
getter_Copies(brandName));

nsXPIDLString msgString, button0Title;
if (NS_FAILED(rv)) { // No brand, use the generic version.
rv = appBundle->GetStringFromName(MOZ_UTF16("confirmRepostPrompt"),
rv = appBundle->GetStringFromName(u"confirmRepostPrompt",
getter_Copies(msgString));
} else {
// Brand available - if the app has an override file with formatting, the
// app name will be included. Without an override, the prompt will look
// like the generic version.
const char16_t* formatStrings[] = { brandName.get() };
rv = appBundle->FormatStringFromName(MOZ_UTF16("confirmRepostPrompt"),
rv = appBundle->FormatStringFromName(u"confirmRepostPrompt",
formatStrings,
ArrayLength(formatStrings),
getter_Copies(msgString));
Expand All @@ -13032,7 +13032,7 @@ nsDocShell::ConfirmRepost(bool* aRepost)
return rv;
}

rv = appBundle->GetStringFromName(MOZ_UTF16("resendButton.label"),
rv = appBundle->GetStringFromName(u"resendButton.label",
getter_Copies(button0Title));
if (NS_FAILED(rv)) {
return rv;
Expand Down
4 changes: 2 additions & 2 deletions dom/audiochannel/AudioChannelService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class NotifyChannelActiveRunnable final : public Runnable

observerService->NotifyObservers(wrapper, topic.get(),
mActive
? MOZ_UTF16("active")
: MOZ_UTF16("inactive"));
? u"active"
: u"inactive");

MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
("NotifyChannelActiveRunnable, type = %d, active = %d\n",
Expand Down
4 changes: 2 additions & 2 deletions dom/base/EventSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,11 +878,11 @@ EventSource::ConsoleError()

if (mReadyState == CONNECTING) {
rv = PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
MOZ_UTF16("connectionFailure"),
u"connectionFailure",
formatStrings, ArrayLength(formatStrings));
} else {
rv = PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
MOZ_UTF16("netInterrupt"),
u"netInterrupt",
formatStrings, ArrayLength(formatStrings));
}
NS_ENSURE_SUCCESS(rv, rv);
Expand Down
8 changes: 4 additions & 4 deletions dom/base/WebSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,11 @@ WebSocketImpl::ConsoleError()

if (mWebSocket->ReadyState() < WebSocket::OPEN) {
PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
MOZ_UTF16("connectionFailure"),
u"connectionFailure",
formatStrings, ArrayLength(formatStrings));
} else {
PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
MOZ_UTF16("netInterrupt"),
u"netInterrupt",
formatStrings, ArrayLength(formatStrings));
}
/// todo some specific errors - like for message too large
Expand Down Expand Up @@ -1599,8 +1599,8 @@ WebSocketImpl::Init(JSContext* aCx,
}
mSecure = true;

const char16_t* params[] = { reportSpec.get(), MOZ_UTF16("wss") };
CSP_LogLocalizedStr(MOZ_UTF16("upgradeInsecureRequest"),
const char16_t* params[] = { reportSpec.get(), u"wss" };
CSP_LogLocalizedStr(u"upgradeInsecureRequest",
params, ArrayLength(params),
EmptyString(), // aSourceFile
EmptyString(), // aScriptSample
Expand Down
22 changes: 9 additions & 13 deletions dom/base/nsContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,12 +686,12 @@ nsContentUtils::InitializeModifierStrings()
nsXPIDLString modifierSeparator;
if (bundle) {
//macs use symbols for each modifier key, so fetch each from the bundle, which also covers i18n
bundle->GetStringFromName(MOZ_UTF16("VK_SHIFT"), getter_Copies(shiftModifier));
bundle->GetStringFromName(MOZ_UTF16("VK_META"), getter_Copies(metaModifier));
bundle->GetStringFromName(MOZ_UTF16("VK_WIN"), getter_Copies(osModifier));
bundle->GetStringFromName(MOZ_UTF16("VK_ALT"), getter_Copies(altModifier));
bundle->GetStringFromName(MOZ_UTF16("VK_CONTROL"), getter_Copies(controlModifier));
bundle->GetStringFromName(MOZ_UTF16("MODIFIER_SEPARATOR"), getter_Copies(modifierSeparator));
bundle->GetStringFromName(u"VK_SHIFT", getter_Copies(shiftModifier));
bundle->GetStringFromName(u"VK_META", getter_Copies(metaModifier));
bundle->GetStringFromName(u"VK_WIN", getter_Copies(osModifier));
bundle->GetStringFromName(u"VK_ALT", getter_Copies(altModifier));
bundle->GetStringFromName(u"VK_CONTROL", getter_Copies(controlModifier));
bundle->GetStringFromName(u"MODIFIER_SEPARATOR", getter_Copies(modifierSeparator));
}
//if any of these don't exist, we get an empty string
sShiftText = new nsString(shiftModifier);
Expand Down Expand Up @@ -5122,7 +5122,7 @@ nsContentUtils::GetMostRecentNonPBWindow()
nsCOMPtr<nsIWindowMediator_44> wm = do_QueryInterface(windowMediator);

nsCOMPtr<mozIDOMWindowProxy> window;
wm->GetMostRecentNonPBWindow(MOZ_UTF16("navigator:browser"),
wm->GetMostRecentNonPBWindow(u"navigator:browser",
getter_AddRefs(window));
nsCOMPtr<nsPIDOMWindowOuter> pwindow;
pwindow = do_QueryInterface(window);
Expand Down Expand Up @@ -6391,16 +6391,12 @@ nsContentUtils::PlatformToDOMLineBreaks(nsString& aString, const fallible_t& aFa
{
if (aString.FindChar(char16_t('\r')) != -1) {
// Windows linebreaks: Map CRLF to LF:
if (!aString.ReplaceSubstring(MOZ_UTF16("\r\n"),
MOZ_UTF16("\n"),
aFallible)) {
if (!aString.ReplaceSubstring(u"\r\n", u"\n", aFallible)) {
return false;
}

// Mac linebreaks: Map any remaining CR to LF:
if (!aString.ReplaceSubstring(MOZ_UTF16("\r"),
MOZ_UTF16("\n"),
aFallible)) {
if (!aString.ReplaceSubstring(u"\r", u"\n", aFallible)) {
return false;
}
}
Expand Down
10 changes: 5 additions & 5 deletions dom/base/nsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3026,7 +3026,7 @@ GetFormattedTimeString(PRTime aTime, nsAString& aFormattedTimeString)
} else {
// If we for whatever reason failed to find the last modified time
// (or even the current time), fall back to what NS4.x returned.
aFormattedTimeString.AssignLiteral(MOZ_UTF16("01/01/1970 00:00:00"));
aFormattedTimeString.AssignLiteral(u"01/01/1970 00:00:00");
}
}

Expand Down Expand Up @@ -9752,16 +9752,16 @@ nsIDocument::GetReadyState(nsAString& aReadyState) const
{
switch(mReadyState) {
case READYSTATE_LOADING :
aReadyState.AssignLiteral(MOZ_UTF16("loading"));
aReadyState.AssignLiteral(u"loading");
break;
case READYSTATE_INTERACTIVE :
aReadyState.AssignLiteral(MOZ_UTF16("interactive"));
aReadyState.AssignLiteral(u"interactive");
break;
case READYSTATE_COMPLETE :
aReadyState.AssignLiteral(MOZ_UTF16("complete"));
aReadyState.AssignLiteral(u"complete");
break;
default:
aReadyState.AssignLiteral(MOZ_UTF16("uninitialized"));
aReadyState.AssignLiteral(u"uninitialized");
}
}

Expand Down
4 changes: 2 additions & 2 deletions dom/base/nsGlobalWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9485,7 +9485,7 @@ nsGlobalWindow::FindOuter(const nsAString& aString, bool aCaseSensitive,
nsCOMPtr<mozIDOMWindowProxy> findDialog;

if (windowMediator) {
windowMediator->GetMostRecentWindow(MOZ_UTF16("findInPage"),
windowMediator->GetMostRecentWindow(u"findInPage",
getter_AddRefs(findDialog));
}

Expand Down Expand Up @@ -11537,7 +11537,7 @@ nsGlobalWindow::Observe(nsISupports* aSubject, const char* aTopic,
#endif // MOZ_B2G

if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
MOZ_ASSERT(!NS_strcmp(aData, MOZ_UTF16("intl.accept_languages")));
MOZ_ASSERT(!NS_strcmp(aData, u"intl.accept_languages"));
MOZ_ASSERT(IsInnerWindow());

// The user preferred languages have changed, we need to fire an event on
Expand Down
4 changes: 2 additions & 2 deletions dom/base/nsHTMLContentSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ nsHTMLContentSerializer::SerializeHTMLAttributes(nsIContent* aContent,
nsDependentAtomString nameStr(attrName);
nsAutoString prefix;
if (namespaceID == kNameSpaceID_XML) {
prefix.AssignLiteral(MOZ_UTF16("xml"));
prefix.AssignLiteral(u"xml");
} else if (namespaceID == kNameSpaceID_XLink) {
prefix.AssignLiteral(MOZ_UTF16("xlink"));
prefix.AssignLiteral(u"xlink");
}

// Expand shorthand attribute.
Expand Down
Loading

0 comments on commit b175c9f

Please sign in to comment.