1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/base/nsIConsoleService.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsIConsoleListener; 1.12 +interface nsIConsoleMessage; 1.13 + 1.14 +[scriptable, uuid(0eb81d20-c37e-42d4-82a8-ca9ae96bdf52)] 1.15 +interface nsIConsoleService : nsISupports 1.16 +{ 1.17 + void logMessage(in nsIConsoleMessage message); 1.18 + 1.19 + /** 1.20 + * Convenience method for logging simple messages. 1.21 + */ 1.22 + void logStringMessage(in wstring message); 1.23 + 1.24 + /** 1.25 + * Get an array of all the messages logged so far. If no messages 1.26 + * are logged, this function will return a count of 0, but still 1.27 + * will allocate one word for messages, so as to show up as a 1.28 + * 0-length array when called from script. 1.29 + */ 1.30 + void getMessageArray([optional] out uint32_t count, 1.31 + [retval, array, size_is(count)] out nsIConsoleMessage messages); 1.32 + 1.33 + /** 1.34 + * To guard against stack overflows from listeners that could log 1.35 + * messages (it's easy to do this inadvertently from listeners 1.36 + * implemented in JavaScript), we don't call any listeners when 1.37 + * another error is already being logged. 1.38 + */ 1.39 + void registerListener(in nsIConsoleListener listener); 1.40 + 1.41 + /** 1.42 + * Each registered listener should also be unregistered. 1.43 + */ 1.44 + void unregisterListener(in nsIConsoleListener listener); 1.45 + 1.46 + /** 1.47 + * Clear the message buffer (e.g. for privacy reasons). 1.48 + */ 1.49 + void reset(); 1.50 +}; 1.51 + 1.52 + 1.53 +%{ C++ 1.54 +#define NS_CONSOLESERVICE_CID \ 1.55 +{ 0x7e3ff85c, 0x1dd2, 0x11b2, { 0x8d, 0x4b, 0xeb, 0x45, 0x2c, 0xb0, 0xff, 0x40 }} 1.56 + 1.57 +#define NS_CONSOLESERVICE_CONTRACTID "@mozilla.org/consoleservice;1" 1.58 +%} 1.59 +