Bug 815671 part 5. Various miscellaneous fixups in dom/ and hal/ code to copy arrays only when we explicitly want to. r=jlebar

This commit is contained in:
Boris Zbarsky 2012-11-29 11:14:14 -05:00
parent 4adc2730f3
commit 69ab92b7a0
8 changed files with 10 additions and 8 deletions

View File

@ -393,8 +393,9 @@ BluetoothRequestParent::DoRequest(const DevicePropertiesRequest& aRequest)
MOZ_ASSERT(mService);
MOZ_ASSERT(mRequestType == Request::TDevicePropertiesRequest);
// Have to copy because our array types don't match up
nsresult rv =
mService->GetPairedDevicePropertiesInternal(aRequest.addresses(),
mService->GetPairedDevicePropertiesInternal(nsTArray<nsString>(aRequest.addresses()),
mReplyRunnable.get());
NS_ENSURE_SUCCESS(rv, false);

View File

@ -18,7 +18,7 @@ namespace IPC {
bool
DeserializeUint8Array(JSRawObject aObj,
const nsTArray<uint8_t>& aBuffer,
const InfallibleTArray<uint8_t>& aBuffer,
jsval* aVal)
{
JSContext* cx = nsContentUtils::GetSafeJSContext();

View File

@ -15,7 +15,7 @@ namespace IPC {
//Defined in TCPSocketChild.cpp
extern bool
DeserializeUint8Array(JSRawObject aObj,
const nsTArray<uint8_t>& aBuffer,
const InfallibleTArray<uint8_t>& aBuffer,
jsval* aVal);
}

View File

@ -1741,7 +1741,7 @@ nsPluginHost::NormalizeHostname(nsCString& host)
// first match.
nsresult
nsPluginHost::EnumerateSiteData(const nsACString& domain,
const nsTArray<nsCString>& sites,
const InfallibleTArray<nsCString>& sites,
InfallibleTArray<nsCString>& result,
bool firstMatchOnly)
{

View File

@ -304,7 +304,7 @@ private:
// Helpers for ClearSiteData and SiteHasData.
nsresult NormalizeHostname(nsCString& host);
nsresult EnumerateSiteData(const nsACString& domain,
const nsTArray<nsCString>& sites,
const InfallibleTArray<nsCString>& sites,
InfallibleTArray<nsCString>& result,
bool firstMatchOnly);

View File

@ -24,7 +24,7 @@ WindowIdentifier::WindowIdentifier(nsIDOMWindow *window)
mID.AppendElement(GetWindowID());
}
WindowIdentifier::WindowIdentifier(const nsTArray<uint64_t> &id, nsIDOMWindow *window)
WindowIdentifier::WindowIdentifier(const InfallibleTArray<uint64_t> &id, nsIDOMWindow *window)
: mID(id)
, mWindow(window)
, mIsEmpty(false)

View File

@ -66,7 +66,7 @@ public:
* This automatically grabs the window's ID and appends it to the
* array.
*/
WindowIdentifier(const nsTArray<uint64_t>& id, nsIDOMWindow* window);
WindowIdentifier(const InfallibleTArray<uint64_t>& id, nsIDOMWindow* window);
/**
* Get the list of window and process IDs we contain.

View File

@ -440,7 +440,8 @@ public:
nsCOMPtr<nsIDOMWindow> window =
do_QueryInterface(tabParent->GetBrowserDOMWindow());
WindowIdentifier newID(id, window);
hal::Vibrate(pattern, newID);
// Have to copy, because Vibrate doesn't take a compatible array type
hal::Vibrate(nsTArray<uint32_t>(pattern), newID);
return true;
}