1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "PerformanceNavigation.h"
8 #include "PerformanceTiming.h"
9 #include "mozilla/dom/PerformanceNavigationBinding.h"
11 namespace mozilla::dom
{
13 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(PerformanceNavigation
, mPerformance
)
15 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(PerformanceNavigation
, AddRef
)
16 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(PerformanceNavigation
, Release
)
18 PerformanceNavigation::PerformanceNavigation(Performance
* aPerformance
)
19 : mPerformance(aPerformance
) {
20 MOZ_ASSERT(aPerformance
, "Parent performance object should be provided");
23 PerformanceNavigation::~PerformanceNavigation() = default;
25 JSObject
* PerformanceNavigation::WrapObject(JSContext
* cx
,
26 JS::Handle
<JSObject
*> aGivenProto
) {
27 return PerformanceNavigation_Binding::Wrap(cx
, this, aGivenProto
);
30 uint16_t PerformanceNavigation::RedirectCount() const {
31 return GetPerformanceTiming()->Data()->GetRedirectCount();
34 } // namespace mozilla::dom