зеркало из https://github.com/mozilla/gecko-dev.git
Remove now-unused files.
This commit is contained in:
Родитель
9745b31350
Коммит
51f69aee35
|
@ -1 +0,0 @@
|
|||
nsIConsoleMessage.idl
|
Двоичные данные
xpfe/components/console/macbuild/Console.mcp
Двоичные данные
xpfe/components/console/macbuild/Console.mcp
Двоичный файл не отображается.
Двоичные данные
xpfe/components/console/macbuild/ConsoleIDL.mcp
Двоичные данные
xpfe/components/console/macbuild/ConsoleIDL.mcp
Двоичный файл не отображается.
|
@ -1,23 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "MacSharedPrefix.h"
|
|
@ -1,23 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "MacSharedPrefix_debug.h"
|
|
@ -1,49 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Base implementation for console messages.
|
||||
*/
|
||||
|
||||
#include "nsConsoleMessage.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS(nsConsoleMessage, NS_GET_IID(nsIConsoleMessage));
|
||||
|
||||
nsConsoleMessage::nsConsoleMessage()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
nsConsoleMessage::~nsConsoleMessage() {};
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConsoleMessage::GetMessage(PRUnichar **result) {
|
||||
*result = mMessage.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// NS_IMETHODIMP
|
||||
// nsConsoleMessage::Init(const PRUnichar *message) {
|
||||
// nsAutoString newMessage(message);
|
||||
// mMessage = newMessage.ToNewUnicode();
|
||||
// return NS_OK;
|
||||
// }
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __nsconsolemessage_h__
|
||||
#define __nsconsolemessage_h__
|
||||
|
||||
#include "nsIConsoleMessage.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsConsoleMessage : public nsIConsoleMessage {
|
||||
public:
|
||||
nsConsoleMessage();
|
||||
|
||||
virtual ~nsConsoleMessage();
|
||||
|
||||
nsConsoleMessage(const PRUnichar *message) {
|
||||
mMessage.Assign(message);
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICONSOLEMESSAGE
|
||||
|
||||
private:
|
||||
nsAutoString mMessage;
|
||||
};
|
||||
|
||||
#endif /* __nsconsolemessage_h__ */
|
|
@ -1,286 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Maintains a circular buffer of recent messages, and notifies
|
||||
* listeners when new messages are logged.
|
||||
*/
|
||||
|
||||
/* Threadsafe. */
|
||||
|
||||
#include "nsIAllocator.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsProxyObjectManager.h"
|
||||
|
||||
#include "nsConsoleService.h"
|
||||
#include "nsConsoleMessage.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS(nsConsoleService, NS_GET_IID(nsIConsoleService));
|
||||
|
||||
nsConsoleService::nsConsoleService()
|
||||
: mCurrent(0), mFull(PR_FALSE), mListening(PR_FALSE), mLock(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
// XXX grab this from a pref!
|
||||
// hm, but worry about circularity, bc we want to be able to report
|
||||
// prefs errs...
|
||||
mBufferSize = 250;
|
||||
|
||||
// XXX deal with below three by detecting null mLock in factory?
|
||||
nsresult rv;
|
||||
rv = nsSupportsArray::Create(NULL, NS_GET_IID(nsISupportsArray),
|
||||
(void**)&mListeners);
|
||||
mMessages = (nsIConsoleMessage **)
|
||||
nsAllocator::Alloc(mBufferSize * sizeof(nsIConsoleMessage *));
|
||||
|
||||
mLock = PR_NewLock();
|
||||
|
||||
// Array elements should be 0 initially for circular buffer algorithm.
|
||||
for (PRUint32 i = 0; i < mBufferSize; i++) {
|
||||
mMessages[i] = nsnull;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
nsConsoleService::~nsConsoleService()
|
||||
{
|
||||
PRUint32 i = 0;
|
||||
while (i < mBufferSize && mMessages[i] != nsnull) {
|
||||
NS_RELEASE(mMessages[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_mccabe
|
||||
{
|
||||
PRUint32 listenerCount;
|
||||
nsresult rv;
|
||||
rv = mListeners->Count(&listenerCount);
|
||||
if (listenerCount != 0) {
|
||||
fprintf(stderr,
|
||||
"WARNING - %d console error listeners still registered!\n"
|
||||
"More calls to nsIConsoleService::UnregisterListener needed.\n",
|
||||
listenerCount);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nsAllocator::Free(mMessages);
|
||||
if (mLock)
|
||||
PR_DestroyLock(mLock);
|
||||
}
|
||||
|
||||
// nsIConsoleService methods
|
||||
NS_IMETHODIMP
|
||||
nsConsoleService::LogMessage(nsIConsoleMessage *message)
|
||||
{
|
||||
if (message == nsnull)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsSupportsArray listenersSnapshot;
|
||||
nsIConsoleMessage *retiredMessage;
|
||||
|
||||
NS_ADDREF(message); // early, in case it's same as replaced below.
|
||||
|
||||
/*
|
||||
* Lock while updating buffer, and while taking snapshot of
|
||||
* listeners array.
|
||||
*/
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
/*
|
||||
* If there's already a message in the slot we're about to replace,
|
||||
* we've wrapped around, and we need to release the old message. We
|
||||
* save a pointer to it, so we can release below outside the lock.
|
||||
*/
|
||||
retiredMessage = mMessages[mCurrent];
|
||||
|
||||
mMessages[mCurrent++] = message;
|
||||
if (mCurrent == mBufferSize) {
|
||||
mCurrent = 0; // wrap around.
|
||||
mFull = PR_TRUE;
|
||||
}
|
||||
|
||||
listenersSnapshot.AppendElements(mListeners);
|
||||
}
|
||||
if (retiredMessage != nsnull)
|
||||
NS_RELEASE(retiredMessage);
|
||||
|
||||
/*
|
||||
* Iterate through any registered listeners and tell them about
|
||||
* the message. We use the mListening flag to guard against
|
||||
* recursive message logs. This could sometimes result in
|
||||
* listeners being skipped because of activity on other threads,
|
||||
* when we only care about the recursive case.
|
||||
*/
|
||||
nsCOMPtr<nsIConsoleListener> listener;
|
||||
nsresult rv;
|
||||
nsresult returned_rv;
|
||||
PRUint32 snapshotCount;
|
||||
rv = listenersSnapshot.Count(&snapshotCount);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
if (mListening)
|
||||
return NS_OK;
|
||||
mListening = PR_TRUE;
|
||||
}
|
||||
|
||||
returned_rv = NS_OK;
|
||||
for (PRUint32 i = 0; i < snapshotCount; i++) {
|
||||
rv = listenersSnapshot.GetElementAt(i, getter_AddRefs(listener));
|
||||
if (NS_FAILED(rv)) {
|
||||
returned_rv = rv;
|
||||
break; // fall thru to mListening restore code below.
|
||||
}
|
||||
listener->Observe(message);
|
||||
}
|
||||
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
mListening = PR_FALSE;
|
||||
}
|
||||
|
||||
return returned_rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConsoleService::LogStringMessage(const PRUnichar *message)
|
||||
{
|
||||
nsConsoleMessage *msg = new nsConsoleMessage(message);
|
||||
return this->LogMessage(msg);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConsoleService::GetMessageArray(nsIConsoleMessage ***messages, PRUint32 *count)
|
||||
{
|
||||
nsIConsoleMessage **messageArray;
|
||||
|
||||
/*
|
||||
* Lock the whole method, as we don't want anyone mucking with mCurrent or
|
||||
* mFull while we're copying out the buffer.
|
||||
*/
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
if (mCurrent == 0 && !mFull) {
|
||||
/*
|
||||
* Make a 1-length output array so that nobody gets confused,
|
||||
* and return a count of 0. This should result in a 0-length
|
||||
* array object when called from script.
|
||||
*/
|
||||
messageArray = (nsIConsoleMessage **)
|
||||
nsAllocator::Alloc(sizeof (nsIConsoleMessage *));
|
||||
*messageArray = nsnull;
|
||||
*messages = messageArray;
|
||||
*count = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint32 resultSize = mFull ? mBufferSize : mCurrent;
|
||||
messageArray =
|
||||
(nsIConsoleMessage **)nsAllocator::Alloc((sizeof (nsIConsoleMessage *))
|
||||
* resultSize);
|
||||
|
||||
if (messageArray == nsnull) {
|
||||
*messages = nsnull;
|
||||
*count = 0;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PRUint32 i;
|
||||
if (mFull) {
|
||||
for (i = 0; i < mBufferSize; i++) {
|
||||
// if full, fill the buffer starting from mCurrent (which'll be
|
||||
// oldest) wrapping around the buffer to the most recent.
|
||||
messageArray[i] = mMessages[(mCurrent + i) % mBufferSize];
|
||||
NS_ADDREF(messageArray[i]);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < mCurrent; i++) {
|
||||
messageArray[i] = mMessages[i];
|
||||
NS_ADDREF(messageArray[i]);
|
||||
}
|
||||
}
|
||||
*count = resultSize;
|
||||
*messages = messageArray;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConsoleService::RegisterListener(nsIConsoleListener *listener) {
|
||||
nsresult rv;
|
||||
|
||||
/*
|
||||
* Store a threadsafe proxy to the listener rather than the
|
||||
* listener itself; we want the console service to be callable
|
||||
* from any thread, but listeners can be implemented in
|
||||
* thread-specific ways, and we always want to call them on their
|
||||
* originating thread. JavaScript is the motivating example.
|
||||
*/
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyManager =
|
||||
(do_GetService(NS_XPCOMPROXY_PROGID));
|
||||
|
||||
if (proxyManager == nsnull)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
nsCOMPtr<nsIConsoleListener> proxiedListener;
|
||||
|
||||
/*
|
||||
* NOTE this will fail if the calling thread doesn't have an eventQ.
|
||||
*
|
||||
* Would it be better to catch that case and leave the listener unproxied?
|
||||
*/
|
||||
rv = proxyManager->GetProxyObject(NS_CURRENT_EVENTQ,
|
||||
NS_GET_IID(nsIConsoleListener),
|
||||
listener,
|
||||
PROXY_ASYNC | PROXY_ALWAYS,
|
||||
getter_AddRefs(proxiedListener));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
{
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
// ignore rv for now, as a comment says it returns prbool instead of
|
||||
// nsresult.
|
||||
// Any need to check for multiply registered listeners?
|
||||
mListeners->AppendElement(proxiedListener);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsConsoleService::UnregisterListener(nsIConsoleListener *listener) {
|
||||
nsAutoLock lock(mLock);
|
||||
|
||||
// ignore rv for now, as a comment says it returns prbool instead of
|
||||
// nsresult.
|
||||
|
||||
// Solaris needs the nsISupports cast to avoid confusion with
|
||||
// another nsSupportsArray::RemoveElement overloading.
|
||||
mListeners->RemoveElement((const nsISupports *)listener);
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
* nsConsoleService class declaration.
|
||||
*/
|
||||
|
||||
#ifndef __nsconsoleservice_h__
|
||||
#define __nsconsoleservice_h__
|
||||
|
||||
#include "nsSupportsArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoLock.h"
|
||||
|
||||
#include "nsIConsoleService.h"
|
||||
|
||||
class nsConsoleService : public nsIConsoleService
|
||||
{
|
||||
public:
|
||||
nsConsoleService();
|
||||
virtual ~nsConsoleService();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICONSOLESERVICE
|
||||
|
||||
private:
|
||||
// Circular buffer of saved messages
|
||||
nsIConsoleMessage **mMessages;
|
||||
|
||||
// How big?
|
||||
PRUint32 mBufferSize;
|
||||
|
||||
// Index of slot in mMessages that'll be filled by *next* log message
|
||||
PRUint32 mCurrent;
|
||||
|
||||
// Is the buffer full? (Has mCurrent wrapped around at least once?)
|
||||
PRBool mFull;
|
||||
|
||||
// Listeners to notify whenever a new message is logged.
|
||||
nsCOMPtr<nsSupportsArray> mListeners;
|
||||
|
||||
// Current listener being notified of a logged error - to prevent
|
||||
// stack overflows.
|
||||
PRBool mListening;
|
||||
|
||||
// To serialize interesting methods.
|
||||
PRLock *mLock;
|
||||
};
|
||||
|
||||
#endif /* __nsconsoleservice_h__ */
|
|
@ -1,63 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "nsConsoleService.h"
|
||||
#include "nsScriptError.h"
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsConsoleService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptError)
|
||||
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "Console Service", NS_CONSOLESERVICE_CID, NS_CONSOLESERVICE_PROGID,
|
||||
nsConsoleServiceConstructor,
|
||||
nsnull, // RegisterConsoleService
|
||||
nsnull, // UnregisterConsoleService
|
||||
},
|
||||
{ "Script Error", NS_SCRIPTERROR_CID, NS_SCRIPTERROR_PROGID,
|
||||
nsScriptErrorConstructor,
|
||||
nsnull,
|
||||
nsnull,
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implement the NSGetModule() exported function for your module
|
||||
// and the entire implementation of the module object.
|
||||
//
|
||||
// NOTE: If you want to use the module shutdown to release any
|
||||
// module specific resources, use the macro
|
||||
// NS_IMPL_NSGETMODULE_WITH_DTOR() instead of the vanilla
|
||||
// NS_IMPL_NSGETMODULE()
|
||||
//
|
||||
|
||||
// e.g. xpconnect uses this to release some singletons;
|
||||
// xdr search on ..._WITH_DTOR
|
||||
|
||||
NS_IMPL_NSGETMODULE("nsConsoleServiceModule", components)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
* Used by the console service to notify listeners of new console messages.
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIConsoleMessage.idl"
|
||||
|
||||
[scriptable, uuid(eaaf61d6-1dd1-11b2-bc6e-8fc96480f20d)]
|
||||
interface nsIConsoleListener : nsISupports
|
||||
{
|
||||
void observe(in nsIConsoleMessage aMessage);
|
||||
};
|
|
@ -1,41 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* This is intended as a base interface; implementations may want to
|
||||
* provide an object that can be qi'ed to provide more specific
|
||||
* message information.
|
||||
*/
|
||||
[scriptable, uuid(41bd8784-1dd2-11b2-9553-8606958fffe1)]
|
||||
interface nsIConsoleMessage : nsISupports
|
||||
{
|
||||
readonly attribute wstring message;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_CONSOLEMESSAGE_CID \
|
||||
{ 0x56c9d666, 0x1dd2, 0x11b2, { 0xb4, 0x3c, 0xa8, 0x4b, 0xf3, 0xb3, 0xec, 0xbb }}
|
||||
|
||||
#define NS_CONSOLEMESSAGE_PROGID "mozilla.consolemessage.1"
|
||||
%}
|
|
@ -1,70 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIConsoleListener.idl"
|
||||
#include "nsIConsoleMessage.idl"
|
||||
|
||||
[scriptable, uuid(a647f184-1dd1-11b2-a9d1-8537b201161b)]
|
||||
interface nsIConsoleService : nsISupports
|
||||
{
|
||||
void logMessage(in nsIConsoleMessage message);
|
||||
|
||||
/**
|
||||
* Convenience method for logging simple messages.
|
||||
*/
|
||||
void logStringMessage(in wstring message);
|
||||
|
||||
/**
|
||||
* Get an array of all the messages logged so far. If no messages
|
||||
* are logged, this function will return a count of 0, but still
|
||||
* will allocate one word for messages, so as to show up as a
|
||||
* 0-length array when called from script.
|
||||
*/
|
||||
void getMessageArray([array, size_is(count)] out nsIConsoleMessage messages,
|
||||
out PRUint32 count);
|
||||
|
||||
/**
|
||||
* To guard against stack overflows from listeners that could log
|
||||
* messages (it's easy to do this inadvertently from listeners
|
||||
* implemented in JavaScript), we don't call any listeners when
|
||||
* another error is already being logged.
|
||||
*/
|
||||
void registerListener(in nsIConsoleListener listener);
|
||||
|
||||
/**
|
||||
* Each registered listener should also be unregistered.
|
||||
*/
|
||||
void unregisterListener(in nsIConsoleListener listener);
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
#define NS_CONSOLESERVICE_CLASSNAME "Console Service"
|
||||
|
||||
#define NS_CONSOLESERVICE_CID \
|
||||
{ 0x7e3ff85c, 0x1dd2, 0x11b2, { 0x8d, 0x4b, 0xeb, 0x45, 0x2c, 0xb0, 0xff, 0x40 }}
|
||||
|
||||
#define NS_CONSOLESERVICE_PROGID "mozilla.consoleservice.1"
|
||||
%}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
* nsIConsole message subclass for representing JavaScript errors and warnings.
|
||||
*/
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIConsoleMessage.idl"
|
||||
|
||||
[scriptable, uuid(fc9e5a94-1dd1-11b2-888b-d8907b2c6996)]
|
||||
interface nsIScriptError : nsIConsoleMessage
|
||||
{
|
||||
/** pseudo-flag for default case */
|
||||
const unsigned long errorFlag = 0x0;
|
||||
|
||||
/** message is warning */
|
||||
const unsigned long warningFlag = 0x1;
|
||||
|
||||
/** exception was thrown for this case - exception-aware hosts can ignore */
|
||||
const unsigned long exceptionFlag = 0x2;
|
||||
|
||||
// XXX check how strict is implemented these days.
|
||||
/** error or warning is due to strict option */
|
||||
const unsigned long strictFlag = 0x4;
|
||||
|
||||
readonly attribute wstring sourceName;
|
||||
readonly attribute wstring sourceLine;
|
||||
readonly attribute PRUint32 lineNumber;
|
||||
readonly attribute PRUint32 columnNumber;
|
||||
readonly attribute PRUint32 flags;
|
||||
|
||||
/**
|
||||
* Categories I know about -
|
||||
* XUL javascript
|
||||
* content javascript (both of these from nsDocShell, currently)
|
||||
* component javascript (errors in JS components)
|
||||
*/
|
||||
readonly attribute string category;
|
||||
|
||||
void init(in wstring message,
|
||||
in wstring sourceName,
|
||||
in wstring sourceLine,
|
||||
in PRUint32 lineNumber,
|
||||
in PRUint32 columnNumber,
|
||||
in PRUint32 flags,
|
||||
in string category);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#define NS_SCRIPTERROR_CLASSNAME "Script Error"
|
||||
|
||||
#define NS_SCRIPTERROR_CID \
|
||||
{ 0xe38e53b9, 0x5bb0, 0x456a, { 0xb5, 0x53, 0x57, 0x93, 0x70, 0xcb, 0x15, 0x67 }}
|
||||
|
||||
#define NS_SCRIPTERROR_PROGID "mozilla.scripterror.1"
|
||||
%}
|
|
@ -1,102 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
* nsIScriptError implementation.
|
||||
*/
|
||||
|
||||
#include "nsScriptError.h"
|
||||
|
||||
// NS_IMPL_THREADSAFE_ISUPPORTS(nsScriptError, NS_GET_IID(nsIScriptError));
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS2(nsScriptError, nsIConsoleMessage, nsIScriptError);
|
||||
|
||||
nsScriptError::nsScriptError()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsScriptError::~nsScriptError() {};
|
||||
|
||||
// nsIConsoleMessage methods
|
||||
NS_IMETHODIMP
|
||||
nsScriptError::GetMessage(PRUnichar **result) {
|
||||
*result = mMessage.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIScriptError methods
|
||||
NS_IMETHODIMP
|
||||
nsScriptError::GetSourceName(PRUnichar **result) {
|
||||
*result = mSourceName.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptError::GetSourceLine(PRUnichar **result) {
|
||||
*result = mSourceLine.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptError::GetLineNumber(PRUint32 *result) {
|
||||
*result = mLineNumber;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptError::GetColumnNumber(PRUint32 *result) {
|
||||
*result = mColumnNumber;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptError::GetFlags(PRUint32 *result) {
|
||||
*result = mFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptError::GetCategory(char **result) {
|
||||
*result = mCategory.ToNewCString();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptError::Init(const PRUnichar *message,
|
||||
const PRUnichar *sourceName,
|
||||
const PRUnichar *sourceLine,
|
||||
PRUint32 lineNumber,
|
||||
PRUint32 columnNumber,
|
||||
PRUint32 flags,
|
||||
const char *category)
|
||||
{
|
||||
mMessage.Assign(message);
|
||||
mSourceName.Assign(sourceName);
|
||||
mLineNumber = lineNumber;
|
||||
mSourceLine.Assign(sourceLine);
|
||||
mColumnNumber = columnNumber;
|
||||
mFlags = flags;
|
||||
mCategory.Assign(category);
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsscripterror_h__
|
||||
#define __nsscripterror_h__
|
||||
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsScriptError : public nsIScriptError {
|
||||
public:
|
||||
nsScriptError();
|
||||
|
||||
virtual ~nsScriptError();
|
||||
|
||||
// TODO - do something reasonable on getting null from these babies.
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICONSOLEMESSAGE
|
||||
NS_DECL_NSISCRIPTERROR
|
||||
|
||||
private:
|
||||
nsAutoString mMessage;
|
||||
nsAutoString mSourceName;
|
||||
PRUint32 mLineNumber;
|
||||
nsAutoString mSourceLine;
|
||||
PRUint32 mColumnNumber;
|
||||
PRUint32 mFlags;
|
||||
nsCAutoString mCategory;
|
||||
};
|
||||
|
||||
#endif /* __nsscripterror_h__ */
|
Загрузка…
Ссылка в новой задаче