2014-02-28 03:39:00 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2018-09-13 23:04:55 +03:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2014-02-28 03:39:00 +04: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
|
2017-04-20 14:49:49 +03:00
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* For more information on this interface, please see
|
|
|
|
* https://console.spec.whatwg.org/#console-namespace
|
|
|
|
*/
|
2014-02-28 03:39:00 +04:00
|
|
|
|
2018-10-21 03:02:53 +03:00
|
|
|
[Exposed=(Window,Worker,WorkerDebugger,Worklet),
|
2016-06-04 10:33:24 +03:00
|
|
|
ClassString="Console",
|
|
|
|
ProtoObjectHack]
|
2016-06-04 10:32:51 +03:00
|
|
|
namespace console {
|
2018-01-04 21:19:43 +03:00
|
|
|
|
|
|
|
// NOTE: if you touch this namespace, remember to update the ConsoleInstance
|
|
|
|
// interface as well!
|
|
|
|
|
2017-04-20 14:49:49 +03:00
|
|
|
// Logging
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2017-04-20 14:49:49 +03:00
|
|
|
void assert(optional boolean condition = false, any... data);
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2017-04-20 14:50:13 +03:00
|
|
|
void clear();
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2017-04-20 14:52:41 +03:00
|
|
|
void count(optional DOMString label = "default");
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2018-05-22 12:34:41 +03:00
|
|
|
void countReset(optional DOMString label = "default");
|
|
|
|
[UseCounter]
|
2017-04-20 14:49:49 +03:00
|
|
|
void debug(any... data);
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2017-04-20 14:49:49 +03:00
|
|
|
void error(any... data);
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2014-02-28 03:39:00 +04:00
|
|
|
void info(any... data);
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2017-04-20 14:49:49 +03:00
|
|
|
void log(any... data);
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2017-04-20 14:49:49 +03:00
|
|
|
void table(any... data); // FIXME: The spec is still unclear about this.
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2017-04-20 14:52:24 +03:00
|
|
|
void trace(any... data);
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2014-02-28 03:39:00 +04:00
|
|
|
void warn(any... data);
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2017-04-20 14:49:49 +03:00
|
|
|
void dir(any... data); // FIXME: This doesn't follow the spec yet.
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2015-04-29 18:34:00 +03:00
|
|
|
void dirxml(any... data);
|
2017-04-20 14:49:49 +03:00
|
|
|
|
|
|
|
// Grouping
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2014-02-28 03:39:00 +04:00
|
|
|
void group(any... data);
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2014-02-28 03:39:00 +04:00
|
|
|
void groupCollapsed(any... data);
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2017-04-18 11:04:00 +03:00
|
|
|
void groupEnd();
|
2017-04-20 14:49:49 +03:00
|
|
|
|
|
|
|
// Timing
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2017-04-20 14:52:31 +03:00
|
|
|
void time(optional DOMString label = "default");
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2018-05-15 14:00:49 +03:00
|
|
|
void timeLog(optional DOMString label = "default", any... data);
|
|
|
|
[UseCounter]
|
2017-04-20 14:52:31 +03:00
|
|
|
void timeEnd(optional DOMString label = "default");
|
2017-04-20 14:49:49 +03:00
|
|
|
|
|
|
|
// Mozilla only or Webcompat methods
|
|
|
|
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2017-04-20 14:49:49 +03:00
|
|
|
void _exception(any... data);
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2015-04-29 22:48:57 +03:00
|
|
|
void timeStamp(optional any data);
|
2014-02-28 03:39:00 +04:00
|
|
|
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2014-02-28 03:39:00 +04:00
|
|
|
void profile(any... data);
|
2018-02-24 03:11:16 +03:00
|
|
|
[UseCounter]
|
2014-02-28 03:39:00 +04:00
|
|
|
void profileEnd(any... data);
|
|
|
|
|
2016-06-04 10:32:51 +03:00
|
|
|
[ChromeOnly]
|
|
|
|
const boolean IS_NATIVE_CONSOLE = true;
|
2018-01-04 21:19:43 +03:00
|
|
|
|
|
|
|
[ChromeOnly, NewObject]
|
2019-07-03 10:52:35 +03:00
|
|
|
ConsoleInstance createInstance(optional ConsoleInstanceOptions options = {});
|
2014-02-28 03:39:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// This is used to propagate console events to the observers.
|
|
|
|
dictionary ConsoleEvent {
|
2015-03-17 14:13:00 +03:00
|
|
|
(unsigned long long or DOMString) ID;
|
|
|
|
(unsigned long long or DOMString) innerID;
|
2018-01-04 21:19:43 +03:00
|
|
|
DOMString consoleID = "";
|
2017-02-27 00:13:45 +03:00
|
|
|
DOMString addonId = "";
|
2014-02-28 03:39:00 +04:00
|
|
|
DOMString level = "";
|
|
|
|
DOMString filename = "";
|
2019-01-17 01:00:38 +03:00
|
|
|
// Unique identifier within the process for the script source this event is
|
|
|
|
// associated with, or zero.
|
|
|
|
unsigned long sourceId = 0;
|
2014-02-28 03:39:00 +04:00
|
|
|
unsigned long lineNumber = 0;
|
2014-09-22 22:27:59 +04:00
|
|
|
unsigned long columnNumber = 0;
|
2014-02-28 03:39:00 +04:00
|
|
|
DOMString functionName = "";
|
|
|
|
double timeStamp = 0;
|
|
|
|
sequence<any> arguments;
|
2016-02-13 19:08:17 +03:00
|
|
|
sequence<DOMString?> styles;
|
2014-02-28 03:39:00 +04:00
|
|
|
boolean private = false;
|
2014-04-16 06:58:44 +04:00
|
|
|
// stacktrace is handled via a getter in some cases so we can construct it
|
|
|
|
// lazily. Note that we're not making this whole thing an interface because
|
|
|
|
// consumers expect to see own properties on it, which would mean making the
|
|
|
|
// props unforgeable, which means lots of JSFunction allocations. Maybe we
|
|
|
|
// should fix those consumers, of course....
|
|
|
|
// sequence<ConsoleStackEntry> stacktrace;
|
2014-02-28 03:39:00 +04:00
|
|
|
DOMString groupName = "";
|
|
|
|
any timer = null;
|
2014-02-28 03:39:24 +04:00
|
|
|
any counter = null;
|
2018-01-17 20:19:36 +03:00
|
|
|
DOMString prefix = "";
|
2019-04-02 01:42:34 +03:00
|
|
|
boolean chromeContext = false;
|
2014-02-28 03:39:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// Event for profile operations
|
|
|
|
dictionary ConsoleProfileEvent {
|
|
|
|
DOMString action = "";
|
|
|
|
sequence<any> arguments;
|
2019-04-02 01:42:34 +03:00
|
|
|
boolean chromeContext = false;
|
2014-02-28 03:39:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// This dictionary is used to manage stack trace data.
|
|
|
|
dictionary ConsoleStackEntry {
|
|
|
|
DOMString filename = "";
|
2019-01-17 01:00:38 +03:00
|
|
|
// Unique identifier within the process for the script source this entry is
|
|
|
|
// associated with, or zero.
|
|
|
|
unsigned long sourceId = 0;
|
2014-02-28 03:39:00 +04:00
|
|
|
unsigned long lineNumber = 0;
|
2014-09-22 22:27:59 +04:00
|
|
|
unsigned long columnNumber = 0;
|
2014-02-28 03:39:00 +04:00
|
|
|
DOMString functionName = "";
|
2015-10-21 09:40:00 +03:00
|
|
|
DOMString? asyncCause;
|
2014-02-28 03:39:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
dictionary ConsoleTimerStart {
|
|
|
|
DOMString name = "";
|
|
|
|
};
|
|
|
|
|
2018-05-15 14:00:49 +03:00
|
|
|
dictionary ConsoleTimerLogOrEnd {
|
2014-02-28 03:39:00 +04:00
|
|
|
DOMString name = "";
|
|
|
|
double duration = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary ConsoleTimerError {
|
2017-05-12 00:36:09 +03:00
|
|
|
DOMString error = "";
|
|
|
|
DOMString name = "";
|
2014-02-28 03:39:00 +04:00
|
|
|
};
|
2014-02-28 03:39:24 +04:00
|
|
|
|
|
|
|
dictionary ConsoleCounter {
|
|
|
|
DOMString label = "";
|
|
|
|
unsigned long count = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary ConsoleCounterError {
|
2018-05-22 12:34:41 +03:00
|
|
|
DOMString label = "";
|
|
|
|
DOMString error = "";
|
2014-02-28 03:39:24 +04:00
|
|
|
};
|
2018-01-04 21:19:43 +03:00
|
|
|
|
|
|
|
[ChromeOnly,
|
2018-10-21 03:02:53 +03:00
|
|
|
Exposed=(Window,Worker,WorkerDebugger,Worklet)]
|
2018-01-04 21:19:43 +03:00
|
|
|
// This is basically a copy of the console namespace.
|
|
|
|
interface ConsoleInstance {
|
|
|
|
// Logging
|
|
|
|
void assert(optional boolean condition = false, any... data);
|
|
|
|
void clear();
|
|
|
|
void count(optional DOMString label = "default");
|
2018-05-22 12:34:41 +03:00
|
|
|
void countReset(optional DOMString label = "default");
|
2018-01-04 21:19:43 +03:00
|
|
|
void debug(any... data);
|
|
|
|
void error(any... data);
|
|
|
|
void info(any... data);
|
|
|
|
void log(any... data);
|
|
|
|
void table(any... data); // FIXME: The spec is still unclear about this.
|
|
|
|
void trace(any... data);
|
|
|
|
void warn(any... data);
|
|
|
|
void dir(any... data); // FIXME: This doesn't follow the spec yet.
|
|
|
|
void dirxml(any... data);
|
|
|
|
|
|
|
|
// Grouping
|
|
|
|
void group(any... data);
|
|
|
|
void groupCollapsed(any... data);
|
|
|
|
void groupEnd();
|
|
|
|
|
|
|
|
// Timing
|
|
|
|
void time(optional DOMString label = "default");
|
2018-05-15 14:00:49 +03:00
|
|
|
void timeLog(optional DOMString label = "default", any... data);
|
2018-01-04 21:19:43 +03:00
|
|
|
void timeEnd(optional DOMString label = "default");
|
|
|
|
|
|
|
|
// Mozilla only or Webcompat methods
|
|
|
|
|
|
|
|
void _exception(any... data);
|
|
|
|
void timeStamp(optional any data);
|
|
|
|
|
|
|
|
void profile(any... data);
|
|
|
|
void profileEnd(any... data);
|
|
|
|
};
|
|
|
|
|
2018-01-04 21:19:44 +03:00
|
|
|
callback ConsoleInstanceDumpCallback = void (DOMString message);
|
|
|
|
|
2018-01-04 21:19:44 +03:00
|
|
|
enum ConsoleLogLevel {
|
2018-05-15 14:00:49 +03:00
|
|
|
"All", "Debug", "Log", "Info", "Clear", "Trace", "TimeLog", "TimeEnd", "Time",
|
|
|
|
"Group", "GroupEnd", "Profile", "ProfileEnd", "Dir", "Dirxml", "Warn", "Error",
|
|
|
|
"Off"
|
2018-01-04 21:19:44 +03:00
|
|
|
};
|
|
|
|
|
2018-01-04 21:19:43 +03:00
|
|
|
dictionary ConsoleInstanceOptions {
|
2018-01-04 21:19:44 +03:00
|
|
|
// An optional function to intercept all strings written to stdout.
|
2018-01-04 21:19:44 +03:00
|
|
|
ConsoleInstanceDumpCallback dump;
|
2018-01-04 21:19:44 +03:00
|
|
|
|
|
|
|
// An optional prefix string to be printed before the actual logged message.
|
2018-01-04 21:19:43 +03:00
|
|
|
DOMString prefix = "";
|
2018-01-04 21:19:44 +03:00
|
|
|
|
|
|
|
// An ID representing the source of the message. Normally the inner ID of a
|
|
|
|
// DOM window.
|
2018-01-04 21:19:43 +03:00
|
|
|
DOMString innerID = "";
|
2018-01-04 21:19:44 +03:00
|
|
|
|
|
|
|
// String identified for the console, this will be passed through the console
|
|
|
|
// notifications.
|
2018-01-04 21:19:43 +03:00
|
|
|
DOMString consoleID = "";
|
2018-01-04 21:19:44 +03:00
|
|
|
|
|
|
|
// Identifier that allows to filter which messages are logged based on their
|
|
|
|
// log level.
|
2018-01-04 21:19:44 +03:00
|
|
|
ConsoleLogLevel maxLogLevel;
|
2018-01-04 21:19:44 +03:00
|
|
|
|
|
|
|
// String pref name which contains the level to use for maxLogLevel. If the
|
|
|
|
// pref doesn't exist, gets removed or it is used in workers, the maxLogLevel
|
|
|
|
// will default to the value passed to this constructor (or "all" if it wasn't
|
|
|
|
// specified).
|
|
|
|
DOMString maxLogLevelPref = "";
|
2018-01-04 21:19:43 +03:00
|
|
|
};
|
2018-01-11 00:06:37 +03:00
|
|
|
|
2018-01-11 00:06:38 +03:00
|
|
|
enum ConsoleLevel { "log", "warning", "error" };
|
|
|
|
|
2018-01-11 00:06:37 +03:00
|
|
|
// this interface is just for testing
|
|
|
|
partial interface ConsoleInstance {
|
|
|
|
[ChromeOnly]
|
|
|
|
void reportForServiceWorkerScope(DOMString scope, DOMString message,
|
|
|
|
DOMString filename, unsigned long lineNumber,
|
2018-01-11 00:06:38 +03:00
|
|
|
unsigned long columnNumber,
|
|
|
|
ConsoleLevel level);
|
2018-01-11 00:06:37 +03:00
|
|
|
};
|