diff --git a/dom/base/Console.cpp b/dom/base/Console.cpp index 4cb08b191727..ab13358d46ed 100644 --- a/dom/base/Console.cpp +++ b/dom/base/Console.cpp @@ -1042,6 +1042,7 @@ METHOD(Error, "error") METHOD(Exception, "exception") METHOD(Debug, "debug") METHOD(Table, "table") +METHOD(Clear, "clear") void Console::Trace(JSContext* aCx) @@ -1537,6 +1538,11 @@ Console::ProcessCallData(JSContext* aCx, ConsoleCallData* aData, innerID.AppendInt(aData->mInnerIDNumber); } + if (aData->mMethodName == MethodClear) { + nsresult rv = mStorage->ClearEvents(innerID); + NS_WARN_IF(NS_FAILED(rv)); + } + if (NS_FAILED(mStorage->RecordEvent(innerID, outerID, eventValue))) { NS_WARNING("Failed to record a console event."); } diff --git a/dom/base/Console.h b/dom/base/Console.h index 503f47c76b6c..edd4c6b6ca3e 100644 --- a/dom/base/Console.h +++ b/dom/base/Console.h @@ -115,6 +115,9 @@ public: void Count(JSContext* aCx, const Sequence& aData); + void + Clear(JSContext* aCx, const Sequence& aData); + void NoopMethod(); @@ -156,7 +159,8 @@ private: MethodTimeEnd, MethodTimeStamp, MethodAssert, - MethodCount + MethodCount, + MethodClear }; void diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index 16a3a09568e4..dfe70743c78c 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -649,6 +649,7 @@ skip-if = toolkit == 'android' #bug 687032 [test_bug650776.html] [test_bug650784.html] [test_bug656283.html] +[test_bug659625.html] [test_bug664916.html] [test_bug666604.html] skip-if = buildapp == 'b2g' # b2g(dom.disable_open_during_load not implemented in b2g) b2g-debug(dom.disable_open_during_load not implemented in b2g) b2g-desktop(dom.disable_open_during_load not implemented in b2g) diff --git a/dom/base/test/test_bug659625.html b/dom/base/test/test_bug659625.html new file mode 100644 index 000000000000..7adf8726424e --- /dev/null +++ b/dom/base/test/test_bug659625.html @@ -0,0 +1,92 @@ + + + + + + Test for Bug 659625 + + + + +Mozilla Bug 659625 + + + diff --git a/dom/webidl/Console.webidl b/dom/webidl/Console.webidl index da4554cf2b2c..fe96841eeca0 100644 --- a/dom/webidl/Console.webidl +++ b/dom/webidl/Console.webidl @@ -23,6 +23,7 @@ interface Console { void time(optional any time); void timeEnd(optional any time); void timeStamp(optional any data); + void clear(any... data); void profile(any... data); void profileEnd(any... data); @@ -32,8 +33,6 @@ interface Console { // No-op methods for compatibility with other browsers. [BinaryName="noopMethod"] - void clear(); - [BinaryName="noopMethod"] void markTimeline(); [BinaryName="noopMethod"] void timeline(); diff --git a/toolkit/modules/Console.jsm b/toolkit/modules/Console.jsm index f2630f1ed333..120572ee53a9 100644 --- a/toolkit/modules/Console.jsm +++ b/toolkit/modules/Console.jsm @@ -283,6 +283,7 @@ const LOG_LEVELS = { "debug": 2, "log": 3, "info": 3, + "clear": 3, "trace": 3, "timeEnd": 3, "time": 3,