Commit fcbd8c98 authored by Sebastian Hengst's avatar Sebastian Hengst
Browse files

Backed out changeset 7568383eb18d (bug 1337056) for crashing xpcshell test...

Backed out changeset 7568383eb18d (bug 1337056) for crashing xpcshell test test_bug930456_child.js on debug. r=backout
parent 1bb61f61
Loading
Loading
Loading
Loading
+0 −42
Original line number Diff line number Diff line
@@ -2933,45 +2933,3 @@ nsPermissionManager::FetchPermissions() {
  }
  return NS_OK;
}

// XXX: Support file URIs here as well!
/* static */ void
nsPermissionManager::GetKeyForPrincipal(nsIPrincipal* aPrincipal, nsACString& aKey)
{
  MOZ_ASSERT(aPrincipal);
  aKey.Truncate();

  nsCOMPtr<nsIURI> uri;
  nsresult rv = aPrincipal->GetURI(getter_AddRefs(uri));
  if (NS_WARN_IF(NS_FAILED(rv))) {
    // NOTE: We don't propagate the error here, instead we produce the default
    // "" permission key. This means that we can assign every principal a key,
    // even if the GetURI operation on that principal is not meaningful.
    return;
  }

  // If the URI isn't of one of the supported schemes, it has the "" permission
  // key. We can do an early return in that case.
  nsAutoCString scheme;
  uri->GetScheme(scheme);
  if (!scheme.EqualsLiteral("http") &&
      !scheme.EqualsLiteral("https") &&
      !scheme.EqualsLiteral("ftp")) {
    return;
  }

  // We key sets of permissions to be sent over IPC based on their eTLD+1, or in
  // the case where that isn't meaningful, on their IP address or spec.
  nsCOMPtr<nsIEffectiveTLDService> etldService =
    do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
  rv = etldService->GetBaseDomain(uri, 0, aKey);
  if (NS_FAILED(rv)) {
    rv = uri->GetHost(aKey);
  }
  if (NS_FAILED(rv)) {
    rv = uri->GetSpec(aKey);
  }
  if (NS_FAILED(rv)) {
    aKey.Truncate();
  }
}
+0 −14
Original line number Diff line number Diff line
@@ -209,20 +209,6 @@ public:
  nsresult
  RemovePermissionsWithAttributes(mozilla::OriginAttributesPattern& aAttrs);

  /**
   * See `nsIPermissionManager::GetPermissionsWithKey` for more info on
   * permission keys.
   *
   * Get the permission key corresponding to the given Principal. This method is
   * intentionally infallible, as we want to provide an permission key to every
   * principal. Principals which don't have meaningful URIs with http://,
   * https://, or ftp:// schemes are given the default "" Permission Key.
   *
   * @param aPrincipal  The Principal which the key is to be extracted from.
   * @param aPermissionKey  A string which will be filled with the permission key.
   */
  static void GetKeyForPrincipal(nsIPrincipal* aPrincipal, nsACString& aPermissionKey);

private:
  virtual ~nsPermissionManager();