Bug 1308956 - Get rid of MessagePortList - part 2 - files removed, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 13 Oct 2016 15:19:52 +0200
changeset 317795 36d6e588e7d497d8d9154e9ed0e8732f8a42cd43
parent 317794 f9d090c04d8fc96ac07691a45dcffc575aa3eb33
child 317796 9de739c57c87fbfcb47f9c36523d750277c12c94
push id82740
push useramarchesini@mozilla.com
push dateThu, 13 Oct 2016 13:20:14 +0000
treeherdermozilla-inbound@36d6e588e7d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1308956
milestone52.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 1308956 - Get rid of MessagePortList - part 2 - files removed, r=smaug
dom/base/nsFrameMessageManager.cpp
dom/messagechannel/MessagePortList.cpp
dom/messagechannel/MessagePortList.h
dom/messagechannel/moz.build
dom/webidl/MessagePortList.webidl
dom/webidl/moz.build
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -30,17 +30,16 @@
 #include "nsIDOMClassInfo.h"
 #include "xpcpublic.h"
 #include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/IntentionalCrash.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/MessagePort.h"
-#include "mozilla/dom/MessagePortList.h"
 #include "mozilla/dom/nsIContentParent.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
 #include "mozilla/dom/ProcessGlobal.h"
 #include "mozilla/dom/SameProcessMessageQueue.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/ipc/BlobChild.h"
 #include "mozilla/dom/ipc/BlobParent.h"
 #include "mozilla/dom/ipc/StructuredCloneData.h"
@@ -1188,20 +1187,18 @@ nsFrameMessageManager::ReceiveMessage(ns
       }
 
       // Get cloned MessagePort from StructuredCloneData.
       nsTArray<RefPtr<mozilla::dom::MessagePort>> ports;
       if (aCloneData) {
         ports = aCloneData->TakeTransferredPorts();
       }
 
-      JS::Rooted<JSObject*> transferredList(cx);
-      RefPtr<MessagePortList> portList = new MessagePortList(aTargetFrameLoader, ports);
-      transferredList = portList->WrapObject(cx, nullptr);
-      if (NS_WARN_IF(!transferredList)) {
+      JS::Rooted<JS::Value> transferredList(cx);
+      if (NS_WARN_IF(!ToJSValue(cx, ports, &transferredList))) {
         return NS_ERROR_UNEXPECTED;
       }
 
       JS::Rooted<JSString*> jsMessage(cx,
         JS_NewUCStringCopyN(cx,
                             static_cast<const char16_t*>(aMessage.BeginReading()),
                             aMessage.Length()));
       NS_ENSURE_TRUE(jsMessage, NS_ERROR_OUT_OF_MEMORY);
deleted file mode 100644
--- a/dom/messagechannel/MessagePortList.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "MessagePortList.h"
-#include "mozilla/dom/MessagePortListBinding.h"
-#include "mozilla/dom/MessagePort.h"
-
-namespace mozilla {
-namespace dom {
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MessagePortList, mOwner, mPorts)
-NS_IMPL_CYCLE_COLLECTING_ADDREF(MessagePortList)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(MessagePortList)
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MessagePortList)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-JSObject*
-MessagePortList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
-  return MessagePortListBinding::Wrap(aCx, this, aGivenProto);
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/messagechannel/MessagePortList.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_MessagePortList_h
-#define mozilla_dom_MessagePortList_h
-
-#include "mozilla/Attributes.h"
-#include "mozilla/ErrorResult.h"
-#include "nsCycleCollectionParticipant.h"
-#include "mozilla/dom/MessagePort.h"
-#include "nsWrapperCache.h"
-#include "nsTArray.h"
-
-namespace mozilla {
-namespace dom {
-
-class MessagePortList final : public nsISupports
-                            , public nsWrapperCache
-{
-  ~MessagePortList() {}
-
-public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MessagePortList)
-
-public:
-  MessagePortList(nsISupports* aOwner,
-                  const nsTArray<RefPtr<MessagePort>>& aPorts)
-    : mOwner(aOwner)
-    , mPorts(aPorts)
-  {
-  }
-
-  nsISupports*
-  GetParentObject() const
-  {
-    return mOwner;
-  }
-
-  virtual JSObject*
-  WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
-  uint32_t
-  Length() const
-  {
-    return mPorts.Length();
-  }
-
-  MessagePort*
-  Item(uint32_t aIndex)
-  {
-    return mPorts.SafeElementAt(aIndex);
-  }
-
-  MessagePort*
-  IndexedGetter(uint32_t aIndex, bool &aFound)
-  {
-    aFound = aIndex < mPorts.Length();
-    if (!aFound) {
-      return nullptr;
-    }
-    return mPorts[aIndex];
-  }
-
-private:
-  nsCOMPtr<nsISupports> mOwner;
-  nsTArray<RefPtr<MessagePort>> mPorts;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_MessagePortList_h
-
--- a/dom/messagechannel/moz.build
+++ b/dom/messagechannel/moz.build
@@ -5,25 +5,23 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 TEST_DIRS += ['tests']
 
 EXPORTS.mozilla.dom += [
     'MessageChannel.h',
     'MessagePort.h',
     'MessagePortChild.h',
-    'MessagePortList.h',
     'MessagePortParent.h',
 ]
 
 UNIFIED_SOURCES += [
     'MessageChannel.cpp',
     'MessagePort.cpp',
     'MessagePortChild.cpp',
-    'MessagePortList.cpp',
     'MessagePortParent.cpp',
     'MessagePortService.cpp',
     'SharedMessagePortMessage.cpp',
 ]
 
 IPDL_SOURCES += [
     'PMessagePort.ipdl',
 ]
deleted file mode 100644
--- a/dom/webidl/MessagePortList.webidl
+++ /dev/null
@@ -1,11 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-[NoInterfaceObject, ArrayClass, Exposed=(Window,Worker,System)]
-interface MessagePortList {
-  readonly attribute unsigned long length;
-  getter MessagePort? item(unsigned long index);
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -322,17 +322,16 @@ WEBIDL_FILES = [
     'MediaStreamTrack.webidl',
     'MediaTrackConstraintSet.webidl',
     'MediaTrackSettings.webidl',
     'MediaTrackSupportedConstraints.webidl',
     'MenuBoxObject.webidl',
     'MessageChannel.webidl',
     'MessageEvent.webidl',
     'MessagePort.webidl',
-    'MessagePortList.webidl',
     'MimeType.webidl',
     'MimeTypeArray.webidl',
     'MMICall.webidl',
     'MmsMessage.webidl',
     'MobileMessageThread.webidl',
     'MouseEvent.webidl',
     'MouseScrollEvent.webidl',
     'MozIcc.webidl',