зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1674336 - Add WorkerScope#clearConsoleEvents. r=asuth.
This will be used from the DevTools webconsole to clear events when the user hits the clear button in the UI. A test for the console is added in the next patch of the queue. Differential Revision: https://phabricator.services.mozilla.com/D138314
This commit is contained in:
Родитель
03a7882ef0
Коммит
ce39e48888
|
@ -1584,7 +1584,7 @@ DOMInterfaces = {
|
|||
'WorkerDebuggerGlobalScope': {
|
||||
'headerFile': 'mozilla/dom/WorkerScope.h',
|
||||
'implicitJSContext': [
|
||||
'dump', 'reportError', 'setConsoleEventHandler',
|
||||
'dump', 'clearConsoleEvents', 'reportError', 'setConsoleEventHandler',
|
||||
],
|
||||
},
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@ interface WorkerDebuggerGlobalScope : EventTarget {
|
|||
[Throws]
|
||||
void setConsoleEventHandler(AnyCallback? handler);
|
||||
|
||||
[Throws]
|
||||
void clearConsoleEvents();
|
||||
|
||||
// base64 utility methods
|
||||
[Throws]
|
||||
DOMString btoa(DOMString btoa);
|
||||
|
|
|
@ -1253,6 +1253,20 @@ void WorkerDebuggerGlobalScope::RetrieveConsoleEvents(
|
|||
console->RetrieveConsoleEvents(aCx, aEvents, aRv);
|
||||
}
|
||||
|
||||
void WorkerDebuggerGlobalScope::ClearConsoleEvents(JSContext* aCx,
|
||||
ErrorResult& aRv) {
|
||||
WorkerGlobalScope* scope = mWorkerPrivate->GetOrCreateGlobalScope(aCx);
|
||||
if (!scope) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<Console> console = scope->GetConsoleIfExists();
|
||||
if (console) {
|
||||
console->ClearStorage();
|
||||
}
|
||||
}
|
||||
|
||||
void WorkerDebuggerGlobalScope::SetConsoleEventHandler(JSContext* aCx,
|
||||
AnyCallback* aHandler,
|
||||
ErrorResult& aRv) {
|
||||
|
|
|
@ -489,6 +489,8 @@ class WorkerDebuggerGlobalScope final : public WorkerGlobalScopeBase {
|
|||
void RetrieveConsoleEvents(JSContext* aCx, nsTArray<JS::Value>& aEvents,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void ClearConsoleEvents(JSContext* aCx, ErrorResult& aRv);
|
||||
|
||||
void SetConsoleEventHandler(JSContext* aCx, AnyCallback* aHandler,
|
||||
ErrorResult& aRv);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче