toolkit/components/extensions/webrequest/StreamFilterEvents.cpp
author Ehsan Akhgari <ehsan@mozilla.com>
Thu, 29 Nov 2018 10:30:46 +0000
changeset 505141 04f0bbf40bf36957dc1f72a8aae9916df0e3222f
parent 478957 a97feb8161b7a4c60a539d83cb702a6e50fab1b1
child 505383 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
Bug 1508472 - Part 5: Fifth batch of comment fix-ups in preparation for the tree reformat r=sylvestre This is a best effort attempt at ensuring that the adverse impact of reformatting the entire tree over the comments would be minimal. I've used a combination of strategies including disabling of formatting, some manual formatting and some changes to formatting to work around some clang-format limitations. Differential Revision: https://phabricator.services.mozilla.com/D13371

/* -*- Mode: C++; tab-width: 2; 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 "mozilla/extensions/StreamFilterEvents.h"

namespace mozilla {
namespace extensions {

NS_IMPL_CYCLE_COLLECTION_CLASS(StreamFilterDataEvent)

NS_IMPL_ADDREF_INHERITED(StreamFilterDataEvent, Event)
NS_IMPL_RELEASE_INHERITED(StreamFilterDataEvent, Event)

NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(StreamFilterDataEvent, Event)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END

NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(StreamFilterDataEvent, Event)
  NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mData)
NS_IMPL_CYCLE_COLLECTION_TRACE_END

NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(StreamFilterDataEvent, Event)
  tmp->mData = nullptr;
NS_IMPL_CYCLE_COLLECTION_UNLINK_END

NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(StreamFilterDataEvent)
NS_INTERFACE_MAP_END_INHERITING(Event)


/* static */ already_AddRefed<StreamFilterDataEvent>
StreamFilterDataEvent::Constructor(EventTarget* aEventTarget,
                                   const nsAString& aType,
                                   const StreamFilterDataEventInit& aParam)
{
  RefPtr<StreamFilterDataEvent> event = new StreamFilterDataEvent(aEventTarget);

  bool trusted = event->Init(aEventTarget);
  event->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
  event->SetTrusted(trusted);
  event->SetComposed(aParam.mComposed);

  event->SetData(aParam.mData);

  return event.forget();
}

JSObject*
StreamFilterDataEvent::WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
  return StreamFilterDataEvent_Binding::Wrap(aCx, this, aGivenProto);
}

} // namespace extensions
} // namespace mozilla