Verified Commit 0278ecd0 authored by Andreas Farre's avatar Andreas Farre Committed by ma1
Browse files

Bug 2045468 - Make sure to check the correct browsing context. a=RyanVM DONTBUILD

parent 542aa3e4
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -3773,11 +3773,17 @@ bool BrowsingContext::CanSet(
  return XRE_IsParentProcess() && !aSource && IsTop();
}

bool BrowsingContext::CanSet(FieldIndex<IDX_BrowserId>, const uint32_t& aValue,
bool BrowsingContext::CanSet(FieldIndex<IDX_BrowserId>, const uint64_t& aValue,
                             ContentParent* aSource) {
  // We should only be able to set this for toplevel contexts which don't have
  // an ID yet.
  return GetBrowserId() == 0 && IsTop() && Children().IsEmpty();
  if (XRE_IsParentProcess() && !aSource) {
    return true;
  }

  if (aSource && !Canonical()->IsOwnedByProcess(aSource->ChildID())) {
    return false;
  }

  return GetBrowserId() == 0 && Children().IsEmpty();
}

bool BrowsingContext::CanSet(FieldIndex<IDX_PendingInitialization>,
+1 −1
Original line number Diff line number Diff line
@@ -1286,7 +1286,7 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {

  void DidSet(FieldIndex<IDX_HasSessionHistory>, bool aOldValue);

  bool CanSet(FieldIndex<IDX_BrowserId>, const uint32_t& aValue,
  bool CanSet(FieldIndex<IDX_BrowserId>, const uint64_t& aValue,
              ContentParent* aSource);

  bool CanSet(FieldIndex<IDX_UseErrorPages>, const bool& aUseErrorPages,
+4 −0
Original line number Diff line number Diff line
@@ -3352,6 +3352,10 @@ class nsContentUtils {
   */
  static uint64_t GenerateProcessSpecificId(uint64_t aId);

  /**
   * Split an id generated by GenerateProcessSpecificId back into the process id
   * and the serial number it was composed from, returned in that order.
   */
  static std::tuple<uint64_t, uint64_t> SplitProcessSpecificId(uint64_t aId);

  /**