Use partitionAllocGetSize for memory reporting of the JS engine.

For debugging purposes, this also asserts that the reported size for every
non-null pointer is nonzero. This it easier to spot places in which
we call moz_malloc_size_of for objects allocated through partitionAlloc,
as moz_malloc_size_of silently returns 0 for invalid pointers.
Bug 1071967 - Replace ScopedFreePtr with UniquePtr in jsapi.cpp r=terrence

ScopedFreePtr is deprecated and uses |free| directly, as opposed to
UniquePtr, which can be made to use js_free.
Bug 1071976 - Use js_calloc for allocating ArrayBufferContents objects. r=Yoric
Copy sandbox option strings instead of adopting them.

Strings coming from JS objects are allocated on a separate heap,
but nsCString is unaware of that, and tries to free its underlying
buffer using a regular free(); because of that, we need to copy the
string into a separate buffer allocated from the correct heap.
Bug 1071993 - Use js_realloc in nsXMLHttpRequest::ArrayBufferBuilder. r=sfink
Use js_free in ThreadSharedFloatArrayBufferList.

This may be wrong, as the underlying buffer seems to be entirely internal
and not exposed to content (in fact, it is immutable). Perhaps the proper
solution to this would be to copy the buffer in

StealJSArrayDataIntoThreadSharedFloatArrayBufferList

in AudioBuffer.cpp
Bug 1071996 - Use JS_free to free memory allocated by JS_malloc in testXDR.cpp r=Waldo
Bug 1071998 - Use js_free to free JSShellContextData in the JS shell. r=jorendorff