Exemplo n.º 1
0
bool
AssertAppProcess(TabContext& aContext,
                 AssertAppProcessType aType,
                 const char* aCapability)
{
  const mozilla::DocShellOriginAttributes& attr = aContext.OriginAttributesRef();
  nsCString suffix;
  attr.CreateSuffix(suffix);

  if (!aContext.SignedPkgOriginNoSuffix().IsEmpty()) {
    LOG("TabContext owning signed package origin: %s, originAttr; %s\n",
        nsCString(aContext.SignedPkgOriginNoSuffix()).get(),
        suffix.get());
  }

  // Do a origin-based permission check if the TabContext owns a signed package.
  if (!aContext.SignedPkgOriginNoSuffix().IsEmpty() &&
      (ASSERT_APP_HAS_PERMISSION == aType || ASSERT_APP_PROCESS_PERMISSION == aType)) {
    nsCString origin = aContext.SignedPkgOriginNoSuffix() + suffix;
    return CheckOriginPermission(origin, aCapability);
  }

  nsCOMPtr<mozIApplication> app = aContext.GetOwnOrContainingApp();
  return CheckAppTypeHelper(app, aType, aCapability, aContext.IsBrowserElement());
}
Exemplo n.º 2
0
bool
AssertAppProcess(TabContext& aContext,
                 AssertAppProcessType aType,
                 const char* aCapability)
{

  nsCOMPtr<mozIApplication> app = aContext.GetOwnOrContainingApp();
  return CheckAppTypeHelper(app, aType, aCapability, aContext.IsBrowserElement());
}
Exemplo n.º 3
0
bool
AssertAppProcess(PBrowserParent* aActor,
                 AssertAppProcessType aType,
                 const char* aCapability)
{
  if (!aActor) {
    NS_WARNING("Testing process capability for null actor");
    return false;
  }

  TabParent* tab = TabParent::GetFrom(aActor);
  nsCOMPtr<mozIApplication> app = tab->GetOwnOrContainingApp();

  return CheckAppTypeHelper(app, aType, aCapability, tab->IsBrowserElement());
}