dom/base/nsIConsoleAPIStorage.idl
author Andrea Marchesini <amarchesini@mozilla.com>
Tue, 06 Jan 2015 10:45:00 -0500
changeset 222288 d32672ecbff9a45e12bf74518bf0a0b32d92d222
parent 171095 ed97de4f1d285cf6fb1b197652b2e90890127de8
child 225305 cc20ed1a63ff0dc694fc69d3d59c981283319059
permissions -rw-r--r--
Bug 1058644 - Console API in ServiceWorkers. r=khuey

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

[scriptable, uuid(cce39123-585e-411b-9edd-2513f7cf7e47)]
interface nsIConsoleAPIStorage : nsISupports
{
  /**
   * Get the events array by inner window ID or all events from all windows.
   *
   * @param string [aId]
   *        Optional, the inner window ID for which you want to get the array of
   *        cached events.
   * @returns array
   *          The array of cached events for the given window. If no |aId| is
   *          given this function returns all of the cached events, from any
   *          window.
   */
  jsval getEvents([optional] in DOMString aId);

  /**
   * Record an event associated with the given window ID.
   *
   * @param string aId
   *        The ID of the inner window for which the event occurred or "jsm" for
   *        messages logged from JavaScript modules..
   * @param string aOuterId
   *        This ID is used as 3rd parameters for the console-api-log-event
   *        notification.
   * @param object aEvent
   *        A JavaScript object you want to store.
   */
  void recordEvent(in DOMString aId, in DOMString aOuterId, in jsval aEvent);

  /**
   * Similar to recordEvent() but these events will be collected
   * and dispatched with a timer in order to avoid flooding the devtools
   * webconsole.
   *
   * @param string aId
   *        The ID of the inner window for which the event occurred or "jsm" for
   *        messages logged from JavaScript modules..
   * @param string aOuterId
   *        This ID is used as 3rd parameters for the console-api-log-event
   *        notification.
   * @param object aEvent
   *        A JavaScript object you want to store.
   */
  void recordPendingEvent(in DOMString aId, in DOMString aOuterId, in jsval aEvent);

  /**
   * Clear storage data for the given window.
   *
   * @param string [aId]
   *        Optional, the inner window ID for which you want to clear the
   *        messages. If this is not specified all of the cached messages are
   *        cleared, from all window objects.
   */
  void clearEvents([optional] in DOMString aId);
};