Bug 815671 part 5. Various miscellaneous fixups in dom/ and hal/ code to copy arrays only when we explicitly want to. r=jlebar
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 29 Nov 2012 11:14:14 -0500
changeset 123606 c2e33f49c60f853246cd9f1b8c5fdfffddf24007
parent 123605 453b63c3f22014ab9f8329158f1c805f86e494f4
child 123607 ef768d59bb71ec6d08ba456c609ee5e16a0a8c7a
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar
bugs815671
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 815671 part 5. Various miscellaneous fixups in dom/ and hal/ code to copy arrays only when we explicitly want to. r=jlebar
dom/bluetooth/ipc/BluetoothParent.cpp
dom/network/src/TCPSocketChild.cpp
dom/network/src/TCPSocketParent.cpp
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginHost.h
hal/WindowIdentifier.cpp
hal/WindowIdentifier.h
hal/sandbox/SandboxHal.cpp
--- a/dom/bluetooth/ipc/BluetoothParent.cpp
+++ b/dom/bluetooth/ipc/BluetoothParent.cpp
@@ -388,18 +388,19 @@ BluetoothRequestParent::DoRequest(const 
 }
 
 bool
 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);
 
   return true;
 }
 
 bool
 BluetoothRequestParent::DoRequest(const SetPinCodeRequest& aRequest)
--- a/dom/network/src/TCPSocketChild.cpp
+++ b/dom/network/src/TCPSocketChild.cpp
@@ -13,17 +13,17 @@
 #include "jsfriendapi.h"
 
 using mozilla::net::gNeckoChild;
 
 namespace IPC {
 
 bool
 DeserializeUint8Array(JSRawObject aObj,
-                      const nsTArray<uint8_t>& aBuffer,
+                      const InfallibleTArray<uint8_t>& aBuffer,
                       jsval* aVal)
 {
   JSContext* cx = nsContentUtils::GetSafeJSContext();
   JSAutoRequest ar(cx);
   JSAutoCompartment ac(cx, aObj);
 
   JSObject* obj = JS_NewArrayBuffer(cx, aBuffer.Length());
   if (!obj)
--- a/dom/network/src/TCPSocketParent.cpp
+++ b/dom/network/src/TCPSocketParent.cpp
@@ -10,17 +10,17 @@
 #include "mozilla/unused.h"
 #include "mozilla/AppProcessPermissions.h"
 
 namespace IPC {
 
 //Defined in TCPSocketChild.cpp
 extern bool
 DeserializeUint8Array(JSRawObject aObj,
-                      const nsTArray<uint8_t>& aBuffer,
+                      const InfallibleTArray<uint8_t>& aBuffer,
                       jsval* aVal);
 
 }
 
 namespace mozilla {
 namespace dom {
 
 static void
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1736,17 +1736,17 @@ nsPluginHost::NormalizeHostname(nsCStrin
 }
 
 // Enumerate a 'sites' array returned by GetSitesWithData and determine if
 // any of them have a base domain in common with 'domain'; if so, append them
 // to the 'result' array. If 'firstMatchOnly' is true, return after finding the
 // first match.
 nsresult
 nsPluginHost::EnumerateSiteData(const nsACString& domain,
-                                const nsTArray<nsCString>& sites,
+                                const InfallibleTArray<nsCString>& sites,
                                 InfallibleTArray<nsCString>& result,
                                 bool firstMatchOnly)
 {
   NS_ASSERTION(!domain.IsVoid(), "null domain string");
 
   nsresult rv;
   if (!mTLDService) {
     mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv);
--- a/dom/plugins/base/nsPluginHost.h
+++ b/dom/plugins/base/nsPluginHost.h
@@ -299,17 +299,17 @@ private:
 #endif
 
   nsCOMPtr<nsIEffectiveTLDService> mTLDService;
   nsCOMPtr<nsIIDNService> mIDNService;
 
   // 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);
 
   nsWeakPtr mCurrentDocument; // weak reference, we use it to id document only
 
   static nsIFile *sPluginTempDir;
 
   // We need to hold a global ptr to ourselves because we register for
--- a/hal/WindowIdentifier.cpp
+++ b/hal/WindowIdentifier.cpp
@@ -19,17 +19,17 @@ WindowIdentifier::WindowIdentifier()
 
 WindowIdentifier::WindowIdentifier(nsIDOMWindow *window)
   : mWindow(window)
   , mIsEmpty(false)
 {
   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)
 {
   mID.AppendElement(GetWindowID());
 }
 
 WindowIdentifier::WindowIdentifier(const WindowIdentifier &other)
--- a/hal/WindowIdentifier.h
+++ b/hal/WindowIdentifier.h
@@ -61,17 +61,17 @@ public:
    */
   explicit WindowIdentifier(nsIDOMWindow* window);
 
   /**
    * Create a new WindowIdentifier with the given id array and window.
    * 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.
    */
   typedef InfallibleTArray<uint64_t> IDArrayType;
   const IDArrayType& AsArray() const;
 
   /**
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -435,17 +435,18 @@ public:
               const InfallibleTArray<uint64_t> &id,
               PBrowserParent *browserParent) MOZ_OVERRIDE
   {
     // We give all content vibration permission.
     TabParent *tabParent = static_cast<TabParent*>(browserParent);
     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;
   }
 
   virtual bool
   RecvCancelVibrate(const InfallibleTArray<uint64_t> &id,
                     PBrowserParent *browserParent) MOZ_OVERRIDE
   {
     TabParent *tabParent = static_cast<TabParent*>(browserParent);