Backed out changeset 9d8b4c0b99ed (bug 1945683) for causing btime failures. CLOSED...
[gecko.git] / dom / tests / browser / browser_bug1004814.js
blobeb2272285fcbd16cdbf264face14cb6f4f798f4e
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 () {
7 const TEST_URI =
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;
19 if (
20 obj.arguments.length != 1 ||
21 obj.arguments[0] != "bug1004814" ||
22 obj.level != "timeEnd"
23 ) {
24 return;
27 ConsoleAPIStorage.removeLogEventListener(observe);
28 resolve(obj.timer.duration);
31 ConsoleAPIStorage.addLogEventListener(
32 observe,
33 Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal)
36 var w = new content.Worker("worker_bug1004814.js");
37 w.postMessage(true);
38 });
39 });
41 Assert.greater(
42 duration,
44 "ConsoleEvent.timer.duration > 0: " + duration + " ~ 200ms"
46 });
47 });