Browse Source

One backport

Frank-Rainer Grahl 1 week ago
parent
commit
b88fb1af1a
2 changed files with 294 additions and 0 deletions
  1. 293 0
      mozilla-release/patches/1306801-133a1.patch
  2. 1 0
      mozilla-release/patches/series

+ 293 - 0
mozilla-release/patches/1306801-133a1.patch

@@ -0,0 +1,293 @@
+# HG changeset patch
+# User Oskar Mansfeld <omansfeld@mozilla.com>
+# Date 1728652722 0
+# Node ID d15a37213282e299ffe1da39b828924113352a4e
+# Parent  f397e1ba21c59db828232f5c27297b4e636e3662
+Bug 1306801 - Removed UsingNeckoIPCSecurity() mention and changed return type for GetValidatedOriginAttributes to void. r=necko-reviewers,kershaw
+
+Also removed the now obsolete error checks and made CreateChannelLoadContext void as well, because it was now always returning a null pointer, too.
+
+Differential Revision: https://phabricator.services.mozilla.com/D224793
+
+diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp
+--- a/netwerk/ipc/NeckoParent.cpp
++++ b/netwerk/ipc/NeckoParent.cpp
+@@ -132,49 +132,36 @@ GetRequestingPrincipal(const FTPChannelC
+   if (aArgs.type() != FTPChannelCreationArgs::TFTPChannelOpenArgs) {
+     return nullptr;
+   }
+ 
+   const FTPChannelOpenArgs& args = aArgs.get_FTPChannelOpenArgs();
+   return GetRequestingPrincipal(args.loadInfo());
+ }
+ 
+-const char*
+-NeckoParent::GetValidatedOriginAttributes(const SerializedLoadContext& aSerialized,
+-                                          PContentParent* aContent,
+-                                          nsIPrincipal* aRequestingPrincipal,
+-                                          OriginAttributes& aAttrs)
+-{
++void NeckoParent::GetValidatedOriginAttributes(
++    const SerializedLoadContext& aSerialized, PContentParent* aContent,
++    nsIPrincipal* aRequestingPrincipal, OriginAttributes& aAttrs) {
+   if (!aSerialized.IsNotNull()) {
+     // If serialized is null, we cannot validate anything. We have to assume
+     // that this requests comes from a SystemPrincipal.
+     aAttrs = OriginAttributes(NECKO_NO_APP_ID, false);
+   } else {
+     aAttrs = aSerialized.mOriginAttributes;
+   }
+-
+-  return nullptr;
+ }
+ 
+-const char *
+-NeckoParent::CreateChannelLoadContext(const PBrowserOrId& aBrowser,
+-                                      PContentParent* aContent,
+-                                      const SerializedLoadContext& aSerialized,
+-                                      nsIPrincipal* aRequestingPrincipal,
+-                                      nsCOMPtr<nsILoadContext> &aResult)
+-{
++void NeckoParent::CreateChannelLoadContext(
++    const PBrowserOrId& aBrowser, PContentParent* aContent,
++    const SerializedLoadContext& aSerialized,
++    nsIPrincipal* aRequestingPrincipal, nsCOMPtr<nsILoadContext> &aResult) {
+   OriginAttributes attrs;
+-  const char* error = GetValidatedOriginAttributes(aSerialized, aContent,
+-                                                   aRequestingPrincipal, attrs);
+-  if (error) {
+-    return error;
+-  }
++  GetValidatedOriginAttributes(aSerialized, aContent, aRequestingPrincipal,
++                               attrs);
+ 
+-  // if !UsingNeckoIPCSecurity(), we may not have a LoadContext to set. This is
+-  // the common case for most xpcshell tests.
+   if (aSerialized.IsNotNull()) {
+     attrs.SyncAttributesWithPrivateBrowsing(aSerialized.mOriginAttributes.mPrivateBrowsingId > 0);
+     switch (aBrowser.type()) {
+       case PBrowserOrId::TPBrowserParent:
+       {
+         RefPtr<TabParent> tabParent =
+           TabParent::GetFrom(aBrowser.get_PBrowserParent());
+         dom::Element* topFrameElement = nullptr;
+@@ -188,18 +175,16 @@ NeckoParent::CreateChannelLoadContext(co
+       {
+         aResult = new LoadContext(aSerialized, aBrowser.get_TabId(), attrs);
+         break;
+       }
+       default:
+         MOZ_CRASH();
+     }
+   }
+-
+-  return nullptr;
+ }
+ 
+ void
+ NeckoParent::ActorDestroy(ActorDestroyReason aWhy)
+ {
+   // Nothing needed here. Called right before destructor since this is a
+   // non-refcounted class.
+ }
+@@ -208,25 +193,18 @@ PHttpChannelParent*
+ NeckoParent::AllocPHttpChannelParent(const PBrowserOrId& aBrowser,
+                                      const SerializedLoadContext& aSerialized,
+                                      const HttpChannelCreationArgs& aOpenArgs)
+ {
+   nsCOMPtr<nsIPrincipal> requestingPrincipal =
+     GetRequestingPrincipal(aOpenArgs);
+ 
+   nsCOMPtr<nsILoadContext> loadContext;
+-  const char *error = CreateChannelLoadContext(aBrowser, Manager(),
+-                                               aSerialized, requestingPrincipal,
+-                                               loadContext);
+-  if (error) {
+-    printf_stderr("NeckoParent::AllocPHttpChannelParent: "
+-                  "FATAL error: %s: KILLING CHILD PROCESS\n",
+-                  error);
+-    return nullptr;
+-  }
++  CreateChannelLoadContext(aBrowser, Manager(), aSerialized,
++                           requestingPrincipal, loadContext);
+   PBOverrideStatus overrideStatus = PBOverrideStatusFromLoadContext(aSerialized);
+   HttpChannelParent *p = new HttpChannelParent(aBrowser, loadContext, overrideStatus);
+   p->AddRef();
+   return p;
+ }
+ 
+ bool
+ NeckoParent::DeallocPHttpChannelParent(PHttpChannelParent* channel)
+@@ -300,25 +278,18 @@ PFTPChannelParent*
+ NeckoParent::AllocPFTPChannelParent(const PBrowserOrId& aBrowser,
+                                     const SerializedLoadContext& aSerialized,
+                                     const FTPChannelCreationArgs& aOpenArgs)
+ {
+   nsCOMPtr<nsIPrincipal> requestingPrincipal =
+     GetRequestingPrincipal(aOpenArgs);
+ 
+   nsCOMPtr<nsILoadContext> loadContext;
+-  const char *error = CreateChannelLoadContext(aBrowser, Manager(),
+-                                               aSerialized, requestingPrincipal,
+-                                               loadContext);
+-  if (error) {
+-    printf_stderr("NeckoParent::AllocPFTPChannelParent: "
+-                  "FATAL error: %s: KILLING CHILD PROCESS\n",
+-                  error);
+-    return nullptr;
+-  }
++  CreateChannelLoadContext(aBrowser, Manager(), aSerialized,
++                           requestingPrincipal, loadContext);
+   PBOverrideStatus overrideStatus = PBOverrideStatusFromLoadContext(aSerialized);
+   FTPChannelParent *p = new FTPChannelParent(aBrowser, loadContext, overrideStatus);
+   p->AddRef();
+   return p;
+ }
+ 
+ bool
+ NeckoParent::DeallocPFTPChannelParent(PFTPChannelParent* channel)
+@@ -372,26 +343,18 @@ NeckoParent::DeallocPWyciwygChannelParen
+ }
+ 
+ PWebSocketParent*
+ NeckoParent::AllocPWebSocketParent(const PBrowserOrId& browser,
+                                    const SerializedLoadContext& serialized,
+                                    const uint32_t& aSerial)
+ {
+   nsCOMPtr<nsILoadContext> loadContext;
+-  const char *error = CreateChannelLoadContext(browser, Manager(),
+-                                               serialized,
+-                                               nullptr,
+-                                               loadContext);
+-  if (error) {
+-    printf_stderr("NeckoParent::AllocPWebSocketParent: "
+-                  "FATAL error: %s: KILLING CHILD PROCESS\n",
+-                  error);
+-    return nullptr;
+-  }
++  CreateChannelLoadContext(browser, Manager(), serialized, nullptr,
++                           loadContext);
+ 
+   RefPtr<TabParent> tabParent = TabParent::GetFrom(browser.get_PBrowserParent());
+   PBOverrideStatus overrideStatus = PBOverrideStatusFromLoadContext(serialized);
+   WebSocketChannelParent* p = new WebSocketChannelParent(tabParent, loadContext,
+                                                          overrideStatus,
+                                                          aSerial);
+   p->AddRef();
+   return p;
+diff --git a/netwerk/ipc/NeckoParent.cpp.1306801.later b/netwerk/ipc/NeckoParent.cpp.1306801.later
+new file mode 100644
+--- /dev/null
++++ b/netwerk/ipc/NeckoParent.cpp.1306801.later
+@@ -0,0 +1,30 @@
++--- NeckoParent.cpp
+++++ NeckoParent.cpp
++@@ -361,25 +339,18 @@ static already_AddRefed<nsIPrincipal> Ge
++ 
++ PGIOChannelParent* NeckoParent::AllocPGIOChannelParent(
++     PBrowserParent* aBrowser, const SerializedLoadContext& aSerialized,
++     const GIOChannelCreationArgs& aOpenArgs) {
++   nsCOMPtr<nsIPrincipal> requestingPrincipal =
++       GetRequestingPrincipal(aOpenArgs);
++ 
++   nsCOMPtr<nsILoadContext> loadContext;
++-  const char* error = CreateChannelLoadContext(
++-      aBrowser, Manager(), aSerialized, requestingPrincipal, loadContext);
++-  if (error) {
++-    printf_stderr(
++-        "NeckoParent::AllocPGIOChannelParent: "
++-        "FATAL error: %s: KILLING CHILD PROCESS\n",
++-        error);
++-    return nullptr;
++-  }
+++  CreateChannelLoadContext(aBrowser, Manager(), aSerialized,
+++                           requestingPrincipal, loadContext);
++   PBOverrideStatus overrideStatus =
++       PBOverrideStatusFromLoadContext(aSerialized);
++   GIOChannelParent* p = new GIOChannelParent(BrowserParent::GetFrom(aBrowser),
++                                              loadContext, overrideStatus);
++   p->AddRef();
++   return p;
++ }
++ 
+diff --git a/netwerk/ipc/NeckoParent.h b/netwerk/ipc/NeckoParent.h
+--- a/netwerk/ipc/NeckoParent.h
++++ b/netwerk/ipc/NeckoParent.h
+@@ -28,37 +28,30 @@ enum PBOverrideStatus {
+ // Header file contents
+ class NeckoParent
+   : public PNeckoParent
+ {
+ public:
+   NeckoParent();
+   virtual ~NeckoParent();
+ 
+-  MOZ_MUST_USE
+-  static const char *
+-  GetValidatedOriginAttributes(const SerializedLoadContext& aSerialized,
+-                               PContentParent* aBrowser,
+-                               nsIPrincipal* aRequestingPrincipal,
+-                               mozilla::OriginAttributes& aAttrs);
++  static void GetValidatedOriginAttributes(
++      const SerializedLoadContext& aSerialized, PContentParent* aContent,
++      nsIPrincipal* aRequestingPrincipal, mozilla::OriginAttributes& aAttrs);
+ 
+   /*
+    * Creates LoadContext for parent-side of an e10s channel.
+    *
+    * PContentParent corresponds to the process that is requesting the load.
+-   *
+-   * Returns null if successful, or an error string if failed.
+    */
+-  MOZ_MUST_USE
+-  static const char*
+-  CreateChannelLoadContext(const PBrowserOrId& aBrowser,
+-                           PContentParent* aContent,
+-                           const SerializedLoadContext& aSerialized,
+-                           nsIPrincipal* aRequestingPrincipal,
+-                           nsCOMPtr<nsILoadContext> &aResult);
++  static void CreateChannelLoadContext(const PBrowserOrId& aBrowser,
++                                       PContentParent* aContent,
++                                       const SerializedLoadContext& aSerialized,
++                                       nsIPrincipal* aRequestingPrincipal,
++                                       nsCOMPtr<nsILoadContext> &aResult);
+ 
+   virtual void ActorDestroy(ActorDestroyReason aWhy) override;
+   virtual PCookieServiceParent* AllocPCookieServiceParent() override;
+   virtual mozilla::ipc::IPCResult
+   RecvPCookieServiceConstructor(PCookieServiceParent* aActor) override
+   {
+     return PNeckoParent::RecvPCookieServiceConstructor(aActor);
+   }
+diff --git a/netwerk/protocol/wyciwyg/WyciwygChannelParent.cpp b/netwerk/protocol/wyciwyg/WyciwygChannelParent.cpp
+--- a/netwerk/protocol/wyciwyg/WyciwygChannelParent.cpp
++++ b/netwerk/protocol/wyciwyg/WyciwygChannelParent.cpp
+@@ -167,26 +167,18 @@ WyciwygChannelParent::RecvAppData(const 
+ 
+ bool
+ WyciwygChannelParent::SetupAppData(const IPC::SerializedLoadContext& loadContext,
+                                    const PBrowserOrId &aParent)
+ {
+   if (!mChannel)
+     return true;
+ 
+-  const char* error = NeckoParent::CreateChannelLoadContext(aParent,
+-                                                            Manager()->Manager(),
+-                                                            loadContext,
+-                                                            nullptr,
+-                                                            mLoadContext);
+-  if (error) {
+-    printf_stderr("WyciwygChannelParent::SetupAppData: FATAL ERROR: %s\n",
+-                  error);
+-    return false;
+-  }
++  NeckoParent::CreateChannelLoadContext(aParent, Manager()->Manager(),
++                                        loadContext, nullptr, mLoadContext);
+ 
+   if (!mLoadContext && loadContext.IsPrivateBitValid()) {
+     nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel = do_QueryInterface(mChannel);
+     if (pbChannel)
+       pbChannel->SetPrivate(loadContext.mOriginAttributes.mPrivateBrowsingId > 0);
+   }
+ 
+   mReceivedAppData = true;

+ 1 - 0
mozilla-release/patches/series

@@ -7683,6 +7683,7 @@ TOP-NOBUG-1712804fix-25320.patch
 1912715-131a1.patch
 1916476-132a1.patch
 1912471-132a1.patch
+1306801-133a1.patch
 1902935-seamonkey-credits-25320.patch
 1862395-incorrect-version-resistfingerprinting-v2-25320.patch
 1737436-use-mozilla-compat-version-define-25320.patch