2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2000-04-18 02:34:54 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Base implementation for console messages.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nsConsoleMessage.h"
|
2001-09-29 08:28:41 +00:00
|
|
|
#include "nsReadableUtils.h"
|
2013-05-24 18:36:56 +00:00
|
|
|
#include "jsapi.h"
|
2000-04-18 02:34:54 +00:00
|
|
|
|
2003-09-08 00:31:50 +00:00
|
|
|
NS_IMPL_THREADSAFE_ISUPPORTS1(nsConsoleMessage, nsIConsoleMessage)
|
2000-04-18 02:34:54 +00:00
|
|
|
|
2013-05-24 18:36:56 +00:00
|
|
|
nsConsoleMessage::nsConsoleMessage()
|
2013-06-14 03:46:23 +00:00
|
|
|
: mTimeStamp(0),
|
|
|
|
mMessage()
|
2000-04-18 02:34:54 +00:00
|
|
|
{
|
|
|
|
}
|
2000-08-22 05:54:25 +00:00
|
|
|
|
2013-05-24 18:36:56 +00:00
|
|
|
nsConsoleMessage::nsConsoleMessage(const PRUnichar *message)
|
2000-08-22 05:54:25 +00:00
|
|
|
{
|
2013-05-24 18:36:56 +00:00
|
|
|
mTimeStamp = JS_Now() / 1000;
|
|
|
|
mMessage.Assign(message);
|
2000-08-22 05:54:25 +00:00
|
|
|
}
|
|
|
|
|
2000-04-18 02:34:54 +00:00
|
|
|
NS_IMETHODIMP
|
2013-05-24 18:36:56 +00:00
|
|
|
nsConsoleMessage::GetMessageMoz(PRUnichar **result)
|
|
|
|
{
|
|
|
|
*result = ToNewUnicode(mMessage);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2000-04-18 02:34:54 +00:00
|
|
|
|
2013-05-24 18:36:56 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsConsoleMessage::GetTimeStamp(int64_t *aTimeStamp)
|
|
|
|
{
|
|
|
|
*aTimeStamp = mTimeStamp;
|
|
|
|
return NS_OK;
|
2000-04-18 02:34:54 +00:00
|
|
|
}
|
|
|
|
|
2013-05-24 18:36:56 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsConsoleMessage::ToString(nsACString& /*UTF8*/ aResult)
|
|
|
|
{
|
|
|
|
CopyUTF16toUTF8(mMessage, aResult);
|
2000-04-18 02:34:54 +00:00
|
|
|
|
2013-05-24 18:36:56 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|