tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

NavigationTransition.cpp (2417B)


      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/NavigationTransition.h"
      8 
      9 #include "mozilla/dom/NavigationBinding.h"
     10 #include "mozilla/dom/NavigationHistoryEntry.h"
     11 #include "mozilla/dom/NavigationTransitionBinding.h"
     12 #include "mozilla/dom/Promise.h"
     13 #include "nsIGlobalObject.h"
     14 
     15 namespace mozilla::dom {
     16 
     17 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(NavigationTransition, mGlobalObject,
     18                                      mFrom, mCommitted, mFinished)
     19 NS_IMPL_CYCLE_COLLECTING_ADDREF(NavigationTransition)
     20 NS_IMPL_CYCLE_COLLECTING_RELEASE(NavigationTransition)
     21 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(NavigationTransition)
     22  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
     23  NS_INTERFACE_MAP_ENTRY(nsISupports)
     24 NS_INTERFACE_MAP_END
     25 
     26 NavigationTransition::NavigationTransition(nsIGlobalObject* aGlobalObject,
     27                                           enum NavigationType aNavigationType,
     28                                           NavigationHistoryEntry* aFrom,
     29                                           Promise* aCommitted,
     30                                           Promise* aFinished)
     31    : mNavigationType(aNavigationType),
     32      mFrom(aFrom),
     33      mCommitted(aCommitted),
     34      mFinished(aFinished) {}
     35 
     36 // https://html.spec.whatwg.org/#dom-navigationtransition-navigationtype
     37 enum NavigationType NavigationTransition::NavigationType() const {
     38  return mNavigationType;
     39 }
     40 
     41 // https://html.spec.whatwg.org/#dom-navigationtransition-from
     42 NavigationHistoryEntry* NavigationTransition::From() const { return mFrom; }
     43 
     44 // https://html.spec.whatwg.org/#dom-navigationtransition-committed
     45 Promise* NavigationTransition::Committed() const { return mCommitted; }
     46 
     47 // https://html.spec.whatwg.org/#dom-navigationtransition-finished
     48 Promise* NavigationTransition::Finished() const { return mFinished; }
     49 
     50 JSObject* NavigationTransition::WrapObject(JSContext* aCx,
     51                                           JS::Handle<JSObject*> aGivenProto) {
     52  return NavigationTransition_Binding::Wrap(aCx, this, aGivenProto);
     53 }
     54 
     55 nsIGlobalObject* NavigationTransition::GetParentObject() const {
     56  return mGlobalObject;
     57 }
     58 
     59 }  // namespace mozilla::dom