This removes a rule that was incorrectly added in the tests in patch 3,
which dholbert pointed out in a review comment (comment 18) made after
granting review (and only 3 minutes before I pushed the patches), which
I didn't see before pushing them.
I had incorrectly copied that rule from the
min-intrinsic-with-percents-across-elements.html test, which I based
these on.
MozReview-Commit-ID: IARSYkKkIRx
While currently unused, the functionality of mByteRange was preserved.
To avoid unforeseen regressions, we only error on an invalid Content-Range response if mByteRange was set, otherwise the error is ignored and code proceed as before.
MozReview-Commit-ID: BRiO633uTh7
The lone remaining startup cache-related uses of nsAutoArrayPtr are both
in TestStartupCache.cpp, for use with nsIStartupCache::GetBuffer. The
uses can't use StartupCache::GetBuffer because StartupCache::GetBuffer
isn't visible outside of libxul, and TestStartupCache is a normal C++
unit test.
The Right Thing is to convert TestStartupCache to a gtest so we can see
libxul internal symbols and then delete nsIStartupCache entirely.
That's a bit complicated, as TestStartupCache doesn't fit nicely into
gtest's framework. The simpler solution is to add a UniquePtr overload
in the interface that hides the XPCOM outparam management details.
The only uses of this class use a template argument with a size of
|char| (uint8_t and char), and the class isn't designed to accomodate
template arguments of larger size (e.g. the implementation of Forget()
neglects to divide by sizeof(T) for allocating a return buffer). Let's
enforce this with a static_assert. This change makes the class safer to
use and also makes future changes simpler to reason about.
Similar to the previous change to NewObjectInputStreamFromBuffer, we
want to make the ownership transfer out of NewBufferFromStorageStream
more obvious. Doing this also lets us get rid of some uses of
nsAutoArrayPtr, which is less idiomatic than UniquePtr.
Because NewObjectInputStreamFromBuffer takes a raw pointer as input, the
typical coding pattern to use it is:
nsAutoArrayPtr<char> buf;
// assign something to buf
nsresult rv = NewObjectInputStreamFromBuffer(buf, ...);
if (NS_FAILED(rv)) {
...
return rv;
}
buf.forget();
Which is clumsy, error-prone, and obscures the ownership transfer of the
pointer into the stream returned by NewObjectInputStreamFromBuffer.
Let's address all of these concerns by changing the argument to a
UniquePtr<char[]>.
TestWriteObject() in TestStartupCache.cpp uses this odd pattern of
acquiring a raw pointer from the startup cache, and then stashing that
raw pointer into an nsAutoArrayPtr. We can do better by using the
getter_Transfers idiom and thereby always using the smart pointer.