Bug 1668757 - Fix lifetime extension issues with 0-length literals. r=xpcom-reviewers,nika

Differential Revision: https://phabricator.services.mozilla.com/D92179
This commit is contained in:
Simon Giesecke 2020-10-06 15:03:01 +00:00
Родитель ba155900e9
Коммит 59dd6d410d
3 изменённых файлов: 4 добавлений и 6 удалений

Просмотреть файл

@ -287,10 +287,8 @@ nsresult txCopy::execute(txExecutionState& aEs) {
switch (txXPathNodeUtils::getNodeType(node)) {
case txXPathNodeType::DOCUMENT_NODE:
case txXPathNodeType::DOCUMENT_FRAGMENT_NODE: {
const nsString& empty = u""_ns;
// "close" current element to ensure that no attributes are added
rv = aEs.mResultHandler->characters(empty, false);
rv = aEs.mResultHandler->characters(u""_ns, false);
NS_ENSURE_SUCCESS(rv, rv);
rv = aEs.pushBool(false);

Просмотреть файл

@ -2180,8 +2180,8 @@ nsresult HTMLEditor::PasteNoFormattingAsAction(int32_t aSelectionType,
return rv;
}
const nsString& empty = u""_ns;
rv = InsertFromTransferable(transferable, nullptr, empty, empty, false, true);
rv = InsertFromTransferable(transferable, nullptr, u""_ns, u""_ns, false,
true);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"HTMLEditor::InsertFromTransferable() failed");
return EditorBase::ToGenericNSResult(rv);

Просмотреть файл

@ -430,7 +430,7 @@ STDMETHODIMP nsDataObj::CMemStream::Stat(STATSTG* statstg, DWORD dwFlags) {
memset((void*)statstg, 0, sizeof(STATSTG));
if (dwFlags != STATFLAG_NONAME) {
const nsString& wideFileName = u""_ns;
const nsString& wideFileName = EmptyString();
uint32_t nMaxNameLength = (wideFileName.Length() * 2) + 2;
void* retBuf = CoTaskMemAlloc(nMaxNameLength); // freed by caller