Exemplo n.º 1
0
nsresult
DOMFileImplFile::GetLastModifiedDate(JSContext* aCx,
                                     JS::MutableHandle<JS::Value> aLastModifiedDate)
{
  NS_ASSERTION(mIsFile, "Should only be called on files");

  PRTime msecs;
  if (IsDateUnknown()) {
    nsresult rv = mFile->GetLastModifiedTime(&msecs);
    NS_ENSURE_SUCCESS(rv, rv);
    mLastModificationDate = msecs;
  } else {
    msecs = mLastModificationDate;
  }

  JSObject* date = JS_NewDateObjectMsec(aCx, msecs);
  if (date) {
    aLastModifiedDate.setObject(*date);
  }
  else {
    date = JS_NewDateObjectMsec(aCx, JS_Now() / PR_USEC_PER_MSEC);
    aLastModifiedDate.setObject(*date);
  }

  return NS_OK;
}
Exemplo n.º 2
0
int64_t
BlobImplBase::GetLastModified(ErrorResult& aRv)
{
  NS_ASSERTION(mIsFile, "Should only be called on files");
  if (IsDateUnknown()) {
    mLastModificationDate = PR_Now();
  }

  return mLastModificationDate / PR_USEC_PER_MSEC;
}
Exemplo n.º 3
0
nsresult
DOMFileImplBase::GetMozLastModifiedDate(uint64_t* aLastModifiedDate)
{
  NS_ASSERTION(mIsFile, "Should only be called on files");
  if (IsDateUnknown()) {
    mLastModificationDate = PR_Now();
  }
  *aLastModifiedDate = mLastModificationDate;
  return NS_OK;
}
Exemplo n.º 4
0
nsresult
DOMFileImplFile::GetMozLastModifiedDate(uint64_t* aLastModifiedDate)
{
  NS_ASSERTION(mIsFile, "Should only be called on files");
  if (IsDateUnknown()) {
    PRTime msecs;
    nsresult rv = mFile->GetLastModifiedTime(&msecs);
    NS_ENSURE_SUCCESS(rv, rv);
    mLastModificationDate = msecs;
  }
  *aLastModifiedDate = mLastModificationDate;
  return NS_OK;
}
Exemplo n.º 5
0
int64_t
BlobImplFile::GetLastModified(ErrorResult& aRv)
{
  NS_ASSERTION(mIsFile, "Should only be called on files");
  if (IsDateUnknown()) {
    PRTime msecs;
    aRv = mFile->GetLastModifiedTime(&msecs);
    if (NS_WARN_IF(aRv.Failed())) {
      return 0;
    }

    mLastModificationDate = msecs;
  }

  return mLastModificationDate;
}