From 59dd6d410d09e25ce7d19c2c834e07d6de6d93cb Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Tue, 6 Oct 2020 15:03:01 +0000 Subject: [PATCH] Bug 1668757 - Fix lifetime extension issues with 0-length literals. r=xpcom-reviewers,nika Differential Revision: https://phabricator.services.mozilla.com/D92179 --- dom/xslt/xslt/txInstructions.cpp | 4 +--- editor/libeditor/HTMLEditorDataTransfer.cpp | 4 ++-- widget/windows/nsDataObj.cpp | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dom/xslt/xslt/txInstructions.cpp b/dom/xslt/xslt/txInstructions.cpp index cf6a132d7ed3..d3af47f0ba14 100644 --- a/dom/xslt/xslt/txInstructions.cpp +++ b/dom/xslt/xslt/txInstructions.cpp @@ -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); diff --git a/editor/libeditor/HTMLEditorDataTransfer.cpp b/editor/libeditor/HTMLEditorDataTransfer.cpp index 363d1e25c1f5..2cf894f66357 100644 --- a/editor/libeditor/HTMLEditorDataTransfer.cpp +++ b/editor/libeditor/HTMLEditorDataTransfer.cpp @@ -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); diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp index cb8c7a0ee797..62fce5362912 100644 --- a/widget/windows/nsDataObj.cpp +++ b/widget/windows/nsDataObj.cpp @@ -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