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 add_task(async
function () {
8 "http://example.com/browser/dom/tests/browser/test_bug1004814.html";
10 await BrowserTestUtils
.withNewTab(TEST_URI
, async aBrowser
=> {
11 let duration
= await SpecialPowers
.spawn(aBrowser
, [], function () {
12 const ConsoleAPIStorage
= Cc
[
13 "@mozilla.org/consoleAPI-storage;1"
14 ].getService(Ci
.nsIConsoleAPIStorage
);
16 return new Promise(resolve
=> {
17 function observe(aSubject
) {
18 var obj
= aSubject
.wrappedJSObject
;
20 obj
.arguments
.length
!= 1 ||
21 obj
.arguments
[0] != "bug1004814" ||
22 obj
.level
!= "timeEnd"
27 ConsoleAPIStorage
.removeLogEventListener(observe
);
28 resolve(obj
.timer
.duration
);
31 ConsoleAPIStorage
.addLogEventListener(
33 Cc
["@mozilla.org/systemprincipal;1"].createInstance(Ci
.nsIPrincipal
)
36 var w
= new content
.Worker("worker_bug1004814.js");
44 "ConsoleEvent.timer.duration > 0: " + duration
+ " ~ 200ms"