Ejemplo n.º 1
0
NS_IMETHODIMP
AboutRedirector::GetURIFlags(nsIURI *aURI, uint32_t *result)
{
  NS_ENSURE_ARG_POINTER(aURI);

  nsAutoCString name = GetAboutModuleName(aURI);

  for (int i = 0; i < kRedirTotal; i++) {
    if (name.Equals(kRedirMap[i].id)) {
      *result = kRedirMap[i].flags;
      return NS_OK;
    }
  }

  return NS_ERROR_ILLEGAL_VALUE;
}
Ejemplo n.º 2
0
NS_IMETHODIMP
AboutRedirector::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result)
{
  NS_ENSURE_ARG_POINTER(aURI);

  nsAutoCString name = GetAboutModuleName(aURI);

  for (int i = 0; i < kRedirTotal; i++) {
    if (name.Equals(kRedirMap[i].id)) {
      const char* postfix = kRedirMap[i].idbOriginPostfix;
      if (!postfix) {
        break;
      }

      result.AssignASCII(postfix);
      return NS_OK;
    }
  }

  SetDOMStringToNull(result);
  return NS_ERROR_ILLEGAL_VALUE;
}
Ejemplo n.º 3
0
NS_IMETHODIMP
AboutRedirector::GetURIFlags(nsIURI *aURI, uint32_t *result)
{
  NS_ENSURE_ARG_POINTER(aURI);

  nsAutoCString name = GetAboutModuleName(aURI);

  static bool sASEnabledCacheInited = false;
  if (!sASEnabledCacheInited) {
    Preferences::AddBoolVarCache(&sActivityStreamEnabled,
                                 "browser.newtabpage.activity-stream.enabled");
    sASEnabledCacheInited = true;
  }

  for (auto & redir : kRedirMap) {
    if (name.Equals(redir.id)) {

      // Once ActivityStream is fully rolled out and we've removed Tiles,
      // this special case can go away and the flag can just become part
      // of the normal about:newtab entry in kRedirMap.
      if (name.EqualsLiteral("newtab")) {
        if (sActivityStreamEnabled) {
          *result = redir.flags |
            nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
            nsIAboutModule::ENABLE_INDEXED_DB |
            nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT;
          return NS_OK;
        }
      }

      *result = redir.flags;
      return NS_OK;
    }
  }

  return NS_ERROR_ILLEGAL_VALUE;
}