Commit 8aada8ee authored by Sandor Molnar's avatar Sandor Molnar
Browse files

Backed out 2 changesets (bug 1595491) for causing build bustages in...

Backed out 2 changesets (bug 1595491) for causing build bustages in docshell/base/BrowsingContext.cpp CLOSED TREE

Backed out changeset 3687b7153c44 (bug 1595491)
Backed out changeset 91d87de145e3 (bug 1595491)
parent 5af4144f
Loading
Loading
Loading
Loading
+8 −32
Original line number Diff line number Diff line
@@ -23,8 +23,6 @@
          src="../name.js"></script>

  <script type="application/javascript">
    const syntheticBrowsingContexts = SpecialPowers.getBoolPref("browser.opaqueResponseBlocking.syntheticBrowsingContext", false);

    async function doTest() {
      // ////////////////////////////////////////////////////////////////////////
      // HTML:a@href
@@ -463,21 +461,10 @@
      // ////////////////////////////////////////////////////////////////////////
      // HTML:embed

      if (syntheticBrowsingContexts) {
        obj = {
          INTERNAL_FRAME: [ {
            DOCUMENT: [ {
              role: ROLE_GRAPHIC,
              interfaces: [ nsIAccessibleImage ],
            } ],
          } ],
        };
      } else {
      obj = {
        role: ROLE_GRAPHIC,
        interfaces: [ nsIAccessibleImage ],
      };
      }
      testElm("embed_png", obj);

      obj = {
@@ -1133,21 +1120,10 @@
      // ////////////////////////////////////////////////////////////////////////
      // HTML:object and HTML:param

      if (syntheticBrowsingContexts) {
      obj = {
          INTERNAL_FRAME: [ {
            DOCUMENT: [ {
        role: ROLE_GRAPHIC,
        interfaces: [ nsIAccessibleImage ],
            } ],
          } ],
      };
      } else {
        obj = {
          role: ROLE_GRAPHIC,
          interfaces: [ nsIAccessibleImage ],
        };
      }
      testElm("object_png", obj);

      obj = {
+3 −9
Original line number Diff line number Diff line
@@ -262,21 +262,15 @@ const internalFrameRule = function(accessible) {
      return title && title === name
        ? null
        : { score: FAIL, issue: IFRAME_NO_NAME_FROM_TITLE };
    case "OBJECT": {
    case "OBJECT":
      const type = DOMNode.getAttribute("type");
      if (!type || !type.startsWith("image/")) {
        return null;
      }

      return imageRule(accessible);
    }
    case "EMBED": {
      const type = DOMNode.getAttribute("type");
      if (!type || !type.startsWith("image/")) {
    case "EMBED":
      return mustHaveNonEmptyNameRule(EMBED_NO_NAME, accessible);
      }
      return imageRule(accessible);
    }
    default:
      return null;
  }
+3 −30
Original line number Diff line number Diff line
@@ -737,22 +737,9 @@ void BrowsingContext::SetEmbedderElement(Element* aEmbedder) {
      obs->NotifyWhenScriptSafe(ToSupports(this),
                                "browsing-context-did-set-embedder", nullptr);
    }

    if (IsEmbedderTypeObjectOrEmbed()) {
      if (WindowContext* context = GetParentWindowContext()) {
        Unused << SetSyntheticDocumentContainer(true);
      }
    }
  }
}

bool BrowsingContext::IsEmbedderTypeObjectOrEmbed() {
  if (const Maybe<nsString>& type = GetEmbedderElementType()) {
    return nsGkAtoms::object->Equals(*type) || nsGkAtoms::embed->Equals(*type);
  }
  return false;
}

void BrowsingContext::Embed() {
  if (auto* frame = HTMLIFrameElement::FromNode(mEmbedderElement)) {
    frame->BindToBrowsingContext(this);
@@ -1072,13 +1059,6 @@ void BrowsingContext::GetChildren(
  aChildren.AppendElements(Children());
}

Span<RefPtr<BrowsingContext>> BrowsingContext::NonSyntheticChildren() const {
  if (WindowContext* current = mCurrentWindowContext) {
    return current->NonSyntheticChildren();
  }
  return Span<RefPtr<BrowsingContext>>();
}

void BrowsingContext::GetWindowContexts(
    nsTArray<RefPtr<WindowContext>>& aWindows) {
  aWindows.AppendElements(mWindowContexts);
@@ -1229,7 +1209,7 @@ BrowsingContext* BrowsingContext::FindWithName(
        found = parent;
        break;
      } else {
        siblings = parent->NonSyntheticChildren();
        siblings = parent->Children();
      }

      for (BrowsingContext* sibling : siblings) {
@@ -1264,7 +1244,7 @@ BrowsingContext* BrowsingContext::FindChildWithName(
    return nullptr;
  }

  for (BrowsingContext* child : NonSyntheticChildren()) {
  for (BrowsingContext* child : Children()) {
    if (child->NameEquals(aName) && aRequestingContext.CanAccess(child) &&
        child->IsTargetable()) {
      return child;
@@ -1308,7 +1288,7 @@ BrowsingContext* BrowsingContext::FindWithNameInSubtree(
    return this;
  }

  for (BrowsingContext* child : NonSyntheticChildren()) {
  for (BrowsingContext* child : Children()) {
    if (BrowsingContext* found =
            child->FindWithNameInSubtree(aName, aRequestingContext)) {
      return found;
@@ -2986,13 +2966,6 @@ void BrowsingContext::DidSet(FieldIndex<IDX_IsInBFCache>) {
  }
}

void BrowsingContext::DidSet(FieldIndex<IDX_SyntheticDocumentContainer>) {
  if (WindowContext* parentWindowContext = GetParentWindowContext()) {
    parentWindowContext->UpdateChildSynthetic(this,
                                              GetSyntheticDocumentContainer());
  }
}

void BrowsingContext::SetCustomPlatform(const nsAString& aPlatform,
                                        ErrorResult& aRv) {
  Top()->SetPlatformOverride(aPlatform, aRv);
+1 −12
Original line number Diff line number Diff line
@@ -234,10 +234,7 @@ enum class ExplicitActiveStatus : uint8_t {
  /* This field only gets incrememented when we start navigations in the      \
   * parent process. This is used for keeping track of the racing navigations \
   * between the parent and content processes. */                             \
  FIELD(ParentInitiatedNavigationEpoch, uint64_t)                             \
  /* This browsing context is for a synthetic image document wrapping an      \
   * image embedded in <object> or <embed>. */                                \
  FIELD(SyntheticDocumentContainer, bool)
  FIELD(ParentInitiatedNavigationEpoch, uint64_t)

// BrowsingContext, in this context, is the cross process replicated
// environment in which information about documents is stored. In
@@ -369,10 +366,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
  Element* GetEmbedderElement() const { return mEmbedderElement; }
  void SetEmbedderElement(Element* aEmbedder);

  // Return true if the type of the embedder element is either object
  // or embed, false otherwise.
  bool IsEmbedderTypeObjectOrEmbed();

  // Called after the BrowingContext has been embedded in a FrameLoader. This
  // happens after `SetEmbedderElement` is called on the BrowsingContext and
  // after the BrowsingContext has been set on the FrameLoader.
@@ -495,8 +488,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
  Span<RefPtr<BrowsingContext>> Children() const;
  void GetChildren(nsTArray<RefPtr<BrowsingContext>>& aChildren);

  Span<RefPtr<BrowsingContext>> NonSyntheticChildren() const;

  const nsTArray<RefPtr<WindowContext>>& GetWindowContexts() {
    return mWindowContexts;
  }
@@ -1203,8 +1194,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
  bool CanSet(FieldIndex<IDX_IsInBFCache>, bool, ContentParent* aSource);
  void DidSet(FieldIndex<IDX_IsInBFCache>);

  void DidSet(FieldIndex<IDX_SyntheticDocumentContainer>);

  // Allow if the process attemping to set field is the same as the owning
  // process. Deprecated. New code that might use this should generally be moved
  // to WindowContext or be settable only by the parent process.
+0 −19
Original line number Diff line number Diff line
@@ -122,9 +122,6 @@ void WindowContext::AppendChildBrowsingContext(
  MOZ_DIAGNOSTIC_ASSERT(!mChildren.Contains(aBrowsingContext));

  mChildren.AppendElement(aBrowsingContext);
  if (!aBrowsingContext->IsEmbedderTypeObjectOrEmbed()) {
    mNonSyntheticChildren.AppendElement(aBrowsingContext);
  }

  // If we're the current WindowContext in our BrowsingContext, make sure to
  // clear any cached `children` value.
@@ -139,7 +136,6 @@ void WindowContext::RemoveChildBrowsingContext(
                        "Mismatched groups?");

  mChildren.RemoveElement(aBrowsingContext);
  mNonSyntheticChildren.RemoveElement(aBrowsingContext);

  // If we're the current WindowContext in our BrowsingContext, make sure to
  // clear any cached `children` value.
@@ -148,19 +144,6 @@ void WindowContext::RemoveChildBrowsingContext(
  }
}

void WindowContext::UpdateChildSynthetic(BrowsingContext* aBrowsingContext,
                                         bool aIsSynthetic) {
  if (aIsSynthetic) {
    mNonSyntheticChildren.RemoveElement(aBrowsingContext);
  } else {
    // The same BrowsingContext will be reused for error pages, so it can be in
    // the list already.
    if (!mNonSyntheticChildren.Contains(aBrowsingContext)) {
      mNonSyntheticChildren.AppendElement(aBrowsingContext);
    }
  }
}

void WindowContext::SendCommitTransaction(ContentParent* aParent,
                                          const BaseTransaction& aTxn,
                                          uint64_t aEpoch) {
@@ -586,14 +569,12 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(WindowContext)

  NS_IMPL_CYCLE_COLLECTION_UNLINK(mBrowsingContext)
  NS_IMPL_CYCLE_COLLECTION_UNLINK(mChildren)
  NS_IMPL_CYCLE_COLLECTION_UNLINK(mNonSyntheticChildren)
  NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END

NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(WindowContext)
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBrowsingContext)
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChildren)
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNonSyntheticChildren)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END

NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(WindowContext)
Loading