dom/tests/browser/browser_bug1004814.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 /* vim:set ts=2 sw=2 sts=2 et: */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 const TEST_URI = "http://example.com/browser/dom/tests/browser/test_bug1004814.html";
     8 function test() {
     9   waitForExplicitFinish();
    11   ConsoleObserver.init();
    13   var tab = gBrowser.addTab(TEST_URI);
    14   gBrowser.selectedTab = tab;
    16   registerCleanupFunction(function () {
    17     gBrowser.removeTab(tab);
    18   });
    19 }
    21 var ConsoleObserver = {
    22   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
    24   init: function() {
    25     Services.obs.addObserver(this, "console-api-log-event", false);
    26   },
    28   destroy: function() {
    29     Services.obs.removeObserver(this, "console-api-log-event");
    30   },
    32   observe: function(aSubject, aTopic, aData) {
    33     var obj = aSubject.wrappedJSObject;
    34     if (obj.arguments.length != 1 || obj.arguments[0] != 'bug1004814' ||
    35         obj.level != 'timeEnd') {
    36       return;
    37     }
    39     ok("timer" in obj, "ConsoleEvent contains 'timer' property");
    40     ok("duration" in obj.timer, "ConsoleEvent.timer contains 'duration' property");
    41     ok(obj.timer.duration > 0, "ConsoleEvent.timer.duration > 0: " + obj.timer.duration + " ~ 200ms");
    43     this.destroy();
    44     finish();
    45   }
    46 };

mercurial