gecko-dev/docshell/test/browser/browser_timelineMarkers-frame-04.js
Ryan VanderMeulen 7f057e1c5f Backed out changeset 0dca237df7e2 (bug 1160307) for causing bug 1184752.
--HG--
extra : rebase_source : 56a2060af6a1d4cbb1f21665d65e50ec3b834265
2015-07-16 20:38:13 -04:00

35 lines
1.2 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that the docShell profile timeline API returns the right
// markers for XMLHttpRequest events.
let TESTS = [{
desc: "Event dispatch from XMLHttpRequest",
searchFor: function(markers) {
return markers.filter(m => m.name == "DOMEvent").length >= 5;
},
setup: function(docShell) {
content.dispatchEvent(new content.Event("dog"));
},
check: function(markers) {
let domMarkers = markers.filter(m => m.name == "DOMEvent");
// One subtlety here is that we have five events: the event we
// inject in "setup", plus the four state transition events. The
// first state transition is reported synchronously and so should
// show up as a nested marker.
is(domMarkers.length, 5, "Got 5 markers");
// We should see some Javascript markers, and they should have a
// cause.
let jsMarkers = markers.filter(m => m.name == "Javascript" && m.causeName);
ok(jsMarkers.length > 0, "Got some Javascript markers");
is(jsMarkers[0].stack.functionDisplayName, "do_xhr",
"Javascript marker has entry point name");
}
}];
timelineContentTest(TESTS);