Bug 1874684 - Part 6: Limit day length calculations to safe integers. r=mgaudet
[gecko.git] / dom / performance / PerformanceNavigation.h
blob2f6e21fe65b17a6eb4861864bdde4298630fb86e
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 #ifndef mozilla_dom_PerformanceNavigation_h
8 #define mozilla_dom_PerformanceNavigation_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/dom/Performance.h"
12 #include "nsDOMNavigationTiming.h"
13 #include "nsWrapperCache.h"
15 namespace mozilla::dom {
17 // Script "performance.navigation" object
18 class PerformanceNavigation final : public nsWrapperCache {
19 public:
20 explicit PerformanceNavigation(Performance* aPerformance);
22 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PerformanceNavigation)
23 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(PerformanceNavigation)
25 nsDOMNavigationTiming* GetDOMTiming() const {
26 return mPerformance->GetDOMTiming();
29 PerformanceTiming* GetPerformanceTiming() const {
30 return mPerformance->Timing();
33 Performance* GetParentObject() const { return mPerformance; }
35 virtual JSObject* WrapObject(JSContext* cx,
36 JS::Handle<JSObject*> aGivenProto) override;
38 // PerformanceNavigation WebIDL methods
39 uint16_t Type() const { return GetDOMTiming()->GetType(); }
41 uint16_t RedirectCount() const;
43 private:
44 ~PerformanceNavigation();
45 RefPtr<Performance> mPerformance;
48 } // namespace mozilla::dom
50 #endif // mozilla_dom_PerformanceNavigation_h