NavigationActivation.cpp (1893B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=2 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/. */ 6 7 #include "mozilla/dom/NavigationActivation.h" 8 9 #include "mozilla/dom/NavigationActivationBinding.h" 10 #include "mozilla/dom/NavigationHistoryEntry.h" 11 12 namespace mozilla::dom { 13 14 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(NavigationActivation, mNewEntry, 15 mOldEntry, mGlobal) 16 NS_IMPL_CYCLE_COLLECTING_ADDREF(NavigationActivation) 17 NS_IMPL_CYCLE_COLLECTING_RELEASE(NavigationActivation) 18 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(NavigationActivation) 19 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY 20 NS_INTERFACE_MAP_ENTRY(nsISupports) 21 NS_INTERFACE_MAP_END 22 23 NavigationActivation::NavigationActivation(nsIGlobalObject* aGlobal, 24 NavigationHistoryEntry* aNewEntry, 25 NavigationHistoryEntry* aOldEntry, 26 enum NavigationType aType) 27 : mGlobal(aGlobal), 28 mNewEntry(aNewEntry), 29 mOldEntry(aOldEntry), 30 mType(aType) {} 31 32 JSObject* NavigationActivation::WrapObject(JSContext* aCx, 33 JS::Handle<JSObject*> aGivenProto) { 34 return NavigationActivation_Binding::Wrap(aCx, this, aGivenProto); 35 } 36 37 // https://html.spec.whatwg.org/#dom-navigationactivation-from 38 already_AddRefed<NavigationHistoryEntry> NavigationActivation::GetFrom() const { 39 return do_AddRef(mOldEntry); 40 } 41 42 // https://html.spec.whatwg.org/#dom-navigationactivation-entry 43 already_AddRefed<NavigationHistoryEntry> NavigationActivation::Entry() const { 44 return do_AddRef(mNewEntry); 45 } 46 47 } // namespace mozilla::dom