mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1425574 - Fill the feature gap between Console.jsm and Console API - part 2 - consoleID in ConsoleEvent, r=smaug, r=bgrins
This commit is contained in:
parent
d820259403
commit
3137ff8bcc
@ -1507,6 +1507,7 @@ Console::PopulateConsoleNotificationInTheTargetScope(JSContext* aCx,
|
||||
event.mInnerID.Value().SetAsUnsignedLongLong() = 0;
|
||||
}
|
||||
|
||||
event.mConsoleID = mConsoleID;
|
||||
event.mLevel = aData->mMethodString;
|
||||
event.mFilename = frame.mFilename;
|
||||
|
||||
|
@ -415,6 +415,7 @@ private:
|
||||
|
||||
uint64_t mOuterID;
|
||||
uint64_t mInnerID;
|
||||
nsString mConsoleID;
|
||||
|
||||
enum {
|
||||
eUnknown,
|
||||
|
@ -21,7 +21,9 @@ NS_INTERFACE_MAP_END
|
||||
|
||||
ConsoleInstance::ConsoleInstance(const ConsoleInstanceOptions& aOptions)
|
||||
: mConsole(new Console(nullptr))
|
||||
{}
|
||||
{
|
||||
mConsole->mConsoleID = aOptions.mConsoleID;
|
||||
}
|
||||
|
||||
ConsoleInstance::~ConsoleInstance()
|
||||
{}
|
||||
|
@ -7,6 +7,8 @@ this.EXPORTED_SYMBOLS = [ "ConsoleTest" ];
|
||||
this.ConsoleTest = {
|
||||
go: function() {
|
||||
console.log("Hello world!");
|
||||
console.createInstance().log("Hello world!");
|
||||
console.createInstance({
|
||||
consoleID: "wow",
|
||||
}).log("Hello world!");
|
||||
}
|
||||
};
|
||||
|
@ -31,6 +31,12 @@ consoleListener.prototype = {
|
||||
is(obj.ID, "jsm", "ID and InnerID are correctly set.");
|
||||
is (obj.arguments[0], "Hello world!", "Message matches");
|
||||
|
||||
if (this.count == 0) {
|
||||
is(obj.consoleID, "", "No consoleID for console API");
|
||||
} else {
|
||||
is(obj.consoleID, "wow", "consoleID is set by consoleInstance");
|
||||
}
|
||||
|
||||
// We want to see 2 messages, the first is generated by console.log,
|
||||
// the second one from createInstance().log();
|
||||
if (++this.count == 2) {
|
||||
|
@ -58,6 +58,7 @@ namespace console {
|
||||
dictionary ConsoleEvent {
|
||||
(unsigned long long or DOMString) ID;
|
||||
(unsigned long long or DOMString) innerID;
|
||||
DOMString consoleID = "";
|
||||
DOMString addonId = "";
|
||||
DOMString level = "";
|
||||
DOMString filename = "";
|
||||
@ -154,5 +155,11 @@ interface ConsoleInstance {
|
||||
};
|
||||
|
||||
dictionary ConsoleInstanceOptions {
|
||||
// TODO
|
||||
/* TODO:
|
||||
boolean dump = false;
|
||||
DOMString prefix = "";
|
||||
DOMString maxLogLevel = "";
|
||||
DOMString innerID = "";
|
||||
*/
|
||||
DOMString consoleID = "";
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user