Commit 73427257 authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1596204 - Remove nsGlobalWindowInner::mCachedXBLPrototypeHandlers. r=smaug

Dead code after XBL removal.

Differential Revision: https://phabricator.services.mozilla.com/D52897

--HG--
extra : moz-landing-system : lando
parent 40bb7a45
Loading
Loading
Loading
Loading
+0 −42
Original line number Diff line number Diff line
@@ -1057,13 +1057,6 @@ void nsGlobalWindowInner::ShutDown() {
  sInnerWindowsById = nullptr;
}

// static
void nsGlobalWindowInner::CleanupCachedXBLHandlers() {
  if (mCachedXBLPrototypeHandlers && mCachedXBLPrototypeHandlers->Count() > 0) {
    mCachedXBLPrototypeHandlers->Clear();
  }
}

void nsGlobalWindowInner::FreeInnerObjects() {
  if (IsDying()) {
    return;
@@ -1152,8 +1145,6 @@ void nsGlobalWindowInner::FreeInnerObjects() {

  NotifyWindowIDDestroyed("inner-window-destroyed");

  CleanupCachedXBLHandlers();

  for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
    mAudioContexts[i]->Shutdown();
  }
@@ -1275,12 +1266,6 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGlobalWindowInner)
      return true;
    }
    tmp->mCanSkipCCGeneration = nsCCUncollectableMarker::sGeneration;
    if (tmp->mCachedXBLPrototypeHandlers) {
      for (auto iter = tmp->mCachedXBLPrototypeHandlers->Iter(); !iter.Done();
           iter.Next()) {
        iter.Data().exposeToActiveJS();
      }
    }
    if (EventListenerManager* elm = tmp->GetExistingListenerManager()) {
      elm->MarkForCC();
    }
@@ -1406,8 +1391,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
    JS::RealmBehaviorsRef(js::GetNonCCWObjectRealm(wrapper)).setNonLive();
  }

  tmp->CleanupCachedXBLHandlers();

  NS_IMPL_CYCLE_COLLECTION_UNLINK(mNavigator)

  NS_IMPL_CYCLE_COLLECTION_UNLINK(mPerformance)
@@ -1520,12 +1503,6 @@ void nsGlobalWindowInner::RiskyUnlink() {
#endif

NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGlobalWindowInner)
  if (tmp->mCachedXBLPrototypeHandlers) {
    for (auto iter = tmp->mCachedXBLPrototypeHandlers->Iter(); !iter.Done();
         iter.Next()) {
      aCallbacks.Trace(&iter.Data(), "Cached XBL prototype handler", aClosure);
    }
  }
  NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_TRACE_END

@@ -3893,25 +3870,6 @@ void nsGlobalWindowInner::NotifyDOMWindowThawed(nsGlobalWindowInner* aWindow) {
  }
}

JSObject* nsGlobalWindowInner::GetCachedXBLPrototypeHandler(
    nsXBLPrototypeHandler* aKey) {
  JS::Rooted<JSObject*> handler(RootingCx());
  if (mCachedXBLPrototypeHandlers) {
    mCachedXBLPrototypeHandlers->Get(aKey, handler.address());
  }
  return handler;
}

void nsGlobalWindowInner::CacheXBLPrototypeHandler(
    nsXBLPrototypeHandler* aKey, JS::Handle<JSObject*> aHandler) {
  if (!mCachedXBLPrototypeHandlers) {
    mCachedXBLPrototypeHandlers = MakeUnique<XBLPrototypeHandlerTable>();
    PreserveWrapper(ToSupports(this));
  }

  mCachedXBLPrototypeHandlers->Put(aKey, aHandler);
}

Element* nsGlobalWindowInner::GetFrameElement(nsIPrincipal& aSubjectPrincipal,
                                              ErrorResult& aError) {
  FORWARD_TO_OUTER_OR_THROW(GetFrameElementOuter, (aSubjectPrincipal), aError,
+0 −12
Original line number Diff line number Diff line
@@ -446,8 +446,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
  static void ShutDown();
  static bool IsCallerChrome();

  void CleanupCachedXBLHandlers();

  friend class WindowStateHolder;

  NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(
@@ -459,12 +457,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
  void RiskyUnlink();
#endif

  virtual JSObject* GetCachedXBLPrototypeHandler(
      nsXBLPrototypeHandler* aKey) override;

  virtual void CacheXBLPrototypeHandler(
      nsXBLPrototypeHandler* aKey, JS::Handle<JSObject*> aHandler) override;

  virtual bool TakeFocus(bool aFocus, uint32_t aFocusMethod) override;
  virtual void SetReadyForFocus() override;
  virtual void PageHidden() override;
@@ -1364,10 +1356,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,

  RefPtr<nsDOMOfflineResourceList> mApplicationCache;

  using XBLPrototypeHandlerTable =
      nsJSThingHashtable<nsPtrHashKey<nsXBLPrototypeHandler>, JSObject*>;
  mozilla::UniquePtr<XBLPrototypeHandlerTable> mCachedXBLPrototypeHandlers;

  RefPtr<mozilla::dom::IDBFactory> mIndexedDB;

  // This counts the number of windows that have been opened in rapid succession
+0 −6
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ class nsIURI;
class nsPIDOMWindowInner;
class nsPIDOMWindowOuter;
class nsPIWindowRoot;
class nsXBLPrototypeHandler;

typedef uint32_t SuspendTypes;

@@ -441,11 +440,6 @@ class nsPIDOMWindowInner : public mozIDOMWindow {
    return mMayHaveSelectionChangeEventListener;
  }

  virtual JSObject* GetCachedXBLPrototypeHandler(
      nsXBLPrototypeHandler* aKey) = 0;
  virtual void CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
                                        JS::Handle<JSObject*> aHandler) = 0;

  /*
   * Get and set the currently focused element within the document. If
   * aNeedsFocus is true, then set mNeedsFocus to true to indicate that a