michael@0: /* vim:set ts=2 sw=2 sts=2 et: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: const TEST_URI = "http://example.com/browser/dom/tests/browser/test_bug1004814.html"; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: ConsoleObserver.init(); michael@0: michael@0: var tab = gBrowser.addTab(TEST_URI); michael@0: gBrowser.selectedTab = tab; michael@0: michael@0: registerCleanupFunction(function () { michael@0: gBrowser.removeTab(tab); michael@0: }); michael@0: } michael@0: michael@0: var ConsoleObserver = { michael@0: QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), michael@0: michael@0: init: function() { michael@0: Services.obs.addObserver(this, "console-api-log-event", false); michael@0: }, michael@0: michael@0: destroy: function() { michael@0: Services.obs.removeObserver(this, "console-api-log-event"); michael@0: }, michael@0: michael@0: observe: function(aSubject, aTopic, aData) { michael@0: var obj = aSubject.wrappedJSObject; michael@0: if (obj.arguments.length != 1 || obj.arguments[0] != 'bug1004814' || michael@0: obj.level != 'timeEnd') { michael@0: return; michael@0: } michael@0: michael@0: ok("timer" in obj, "ConsoleEvent contains 'timer' property"); michael@0: ok("duration" in obj.timer, "ConsoleEvent.timer contains 'duration' property"); michael@0: ok(obj.timer.duration > 0, "ConsoleEvent.timer.duration > 0: " + obj.timer.duration + " ~ 200ms"); michael@0: michael@0: this.destroy(); michael@0: finish(); michael@0: } michael@0: };