示例#1
0
MOZ_WARN_UNUSED_RESULT
bool
CookieServiceParent::GetOriginAttributesFromParams(const IPC::SerializedLoadContext &aLoadContext,
                                                   NeckoOriginAttributes& aAttrs,
                                                   bool& aIsPrivate)
{
  aIsPrivate = false;

  DocShellOriginAttributes docShellAttrs;
  const char* error = NeckoParent::GetValidatedAppInfo(aLoadContext,
                                                       Manager()->Manager(),
                                                       docShellAttrs);
  if (error) {
    NS_WARNING(nsPrintfCString("CookieServiceParent: GetOriginAttributesFromParams: "
                               "FATAL error: %s: KILLING CHILD PROCESS\n",
                               error).get());
    return false;
  }

  if (aLoadContext.IsPrivateBitValid()) {
    aIsPrivate = aLoadContext.mUsePrivateBrowsing;
  }

  aAttrs.InheritFromDocShellToNecko(docShellAttrs);
  return true;
}
MOZ_WARN_UNUSED_RESULT
bool
CookieServiceParent::GetAppInfoFromParams(const IPC::SerializedLoadContext &aLoadContext,
                                          uint32_t& aAppId,
                                          bool& aIsInBrowserElement,
                                          bool& aIsPrivate)
{
  aAppId = NECKO_NO_APP_ID;
  aIsInBrowserElement = false;
  aIsPrivate = false;

  const char* error = NeckoParent::GetValidatedAppInfo(aLoadContext,
                                                       Manager()->Manager(),
                                                       &aAppId,
                                                       &aIsInBrowserElement);
  if (error) {
    NS_WARNING(nsPrintfCString("CookieServiceParent: GetAppInfoFromParams: "
                               "FATAL error: %s: KILLING CHILD PROCESS\n",
                               error).get());
    return false;
  }

  if (aLoadContext.IsPrivateBitValid()) {
    aIsPrivate = aLoadContext.mUsePrivateBrowsing;
  }
  return true;
}
bool
WyciwygChannelParent::SetupAppData(const IPC::SerializedLoadContext& loadContext,
                                   PBrowserParent* aParent)
{
  if (!mChannel)
    return true;

  const char* error = NeckoParent::CreateChannelLoadContext(aParent,
                                                            Manager()->Manager(),
                                                            loadContext,
                                                            mLoadContext);
  if (error) {
    printf_stderr("WyciwygChannelParent::SetupAppData: FATAL ERROR: %s\n",
                  error);
    return false;
  }

  if (!mLoadContext && loadContext.IsPrivateBitValid()) {
    nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel = do_QueryInterface(mChannel);
    if (pbChannel)
      pbChannel->SetPrivate(loadContext.mUsePrivateBrowsing);
  }

  mReceivedAppData = true;
  return true;
}
void
CookieServiceParent::GetAppInfoFromLoadContext(
                       const IPC::SerializedLoadContext &aLoadContext,
                        uint32_t& aAppId,
                        bool& aIsInBrowserElement)
{
  // TODO: bug 782542: what to do when we get null loadContext?  For now assume
  // NECKO_NO_APP_ID.
  aAppId = NECKO_NO_APP_ID;
  aIsInBrowserElement = false;

  if (aLoadContext.IsNotNull()) {
    aAppId = aLoadContext.mAppId;
    aIsInBrowserElement = aLoadContext.mIsInBrowserElement;
  }
}