зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1161240 - Make sure that NS_CloneInputStream correctly deals with null input; r=froydnj
This commit is contained in:
Родитель
cd411ff6db
Коммит
d2b480a8db
|
@ -853,6 +853,10 @@ nsresult
|
|||
NS_CloneInputStream(nsIInputStream* aSource, nsIInputStream** aCloneOut,
|
||||
nsIInputStream** aReplacementOut)
|
||||
{
|
||||
if (NS_WARN_IF(!aSource)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Attempt to perform the clone directly on the source stream
|
||||
nsCOMPtr<nsICloneableInputStream> cloneable = do_QueryInterface(aSource);
|
||||
if (cloneable && cloneable->GetCloneable()) {
|
||||
|
|
|
@ -12,6 +12,14 @@
|
|||
#include "nsStreamUtils.h"
|
||||
#include "nsStringStream.h"
|
||||
|
||||
TEST(CloneInputStream, InvalidInput)
|
||||
{
|
||||
nsCOMPtr<nsIInputStream> clone;
|
||||
nsresult rv = NS_CloneInputStream(nullptr, getter_AddRefs(clone));
|
||||
ASSERT_TRUE(NS_FAILED(rv));
|
||||
ASSERT_FALSE(clone);
|
||||
}
|
||||
|
||||
TEST(CloneInputStream, CloneableInput)
|
||||
{
|
||||
nsTArray<char> inputData;
|
||||
|
|
Загрузка…
Ссылка в новой задаче