author | Nathan Froyd <froydnj@mozilla.com> |
Thu, 17 Sep 2015 00:08:21 -0400 | |
changeset 263191 | e8bb18a02a560187ed66d852685ecf84b58d1378 |
parent 263190 | 7d7181321bf11dd62e649401c03547f02b3ef11c |
child 263192 | 1ab076078dc357724b011db374d035e7a1563b21 |
push id | 29391 |
push user | cbook@mozilla.com |
push date | Fri, 18 Sep 2015 11:19:21 +0000 |
treeherder | mozilla-central@37c7812ce0e6 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz |
bugs | 1204994 |
milestone | 43.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/test/browser_use_counters.js +++ b/dom/base/test/browser_use_counters.js @@ -103,30 +103,34 @@ function grabHistogramsFromContent(brows function snapshot_histogram(name) { return telemetry.getHistogramById(name).snapshot(); } let histogram_page_name = "USE_COUNTER2_" + arg.middlefix + "_PAGE"; let histogram_document_name = "USE_COUNTER2_" + arg.middlefix + "_DOCUMENT"; let histogram_page = snapshot_histogram(histogram_page_name); let histogram_document = snapshot_histogram(histogram_document_name); - return [histogram_page.sum, histogram_document.sum]; + let histogram_docs = snapshot_histogram("CONTENT_DOCUMENTS_DESTROYED"); + let histogram_toplevel_docs = snapshot_histogram("TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED"); + return [histogram_page.sum, histogram_document.sum, + histogram_docs.sum, histogram_toplevel_docs.sum]; }); } var check_use_counter_iframe = Task.async(function* (file, use_counter_middlefix, check_documents=true) { info("checking " + file + " with histogram " + use_counter_middlefix); let newTab = gBrowser.addTab( "about:blank"); gBrowser.selectedTab = newTab; newTab.linkedBrowser.stop(); // Hold on to the current values of the telemetry histograms we're // interested in. - let [histogram_page_before, histogram_document_before] = + let [histogram_page_before, histogram_document_before, + histogram_docs_before, histogram_toplevel_docs_before] = yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix); gBrowser.selectedBrowser.loadURI(gHttpTestRoot + "file_use_counter_outer.html"); yield waitForPageLoad(gBrowser.selectedBrowser); // Inject our desired file into the iframe of the newly-loaded page. yield ContentTask.spawn(gBrowser.selectedBrowser, { file: file }, function(opts) { Cu.import("resource://gre/modules/PromiseUtils.jsm"); @@ -156,37 +160,41 @@ var check_use_counter_iframe = Task.asyn gBrowser.removeTab(newTab); // The histograms only get recorded when the document actually gets // destroyed, which might not have happened yet due to GC/CC effects, etc. // Try to force document destruction. yield waitForDestroyedDocuments(); // Grab histograms again and compare. - let [histogram_page_after, histogram_document_after] = + let [histogram_page_after, histogram_document_after, + histogram_docs_after, histogram_toplevel_docs_after] = yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix); is(histogram_page_after, histogram_page_before + 1, "page counts for " + use_counter_middlefix + " after are correct"); + ok(histogram_toplevel_docs_after >= histogram_toplevel_docs_before + 1, + "top level document counts are correct"); if (check_documents) { is(histogram_document_after, histogram_document_before + 1, - "document counts " + use_counter_middlefix + " after are correct"); + "document counts for " + use_counter_middlefix + " after are correct"); } }); var check_use_counter_img = Task.async(function* (file, use_counter_middlefix) { info("checking " + file + " as image with histogram " + use_counter_middlefix); let newTab = gBrowser.addTab("about:blank"); gBrowser.selectedTab = newTab; newTab.linkedBrowser.stop(); // Hold on to the current values of the telemetry histograms we're // interested in. - let [histogram_page_before, histogram_document_before] = + let [histogram_page_before, histogram_document_before, + histogram_docs_before, histogram_toplevel_docs_before] = yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix); gBrowser.selectedBrowser.loadURI(gHttpTestRoot + "file_use_counter_outer.html"); yield waitForPageLoad(gBrowser.selectedBrowser); // Inject our desired file into the img of the newly-loaded page. yield ContentTask.spawn(gBrowser.selectedBrowser, { file: file }, function(opts) { Cu.import("resource://gre/modules/PromiseUtils.jsm"); @@ -217,34 +225,42 @@ var check_use_counter_img = Task.async(f gBrowser.removeTab(newTab); // The histograms only get recorded when the document actually gets // destroyed, which might not have happened yet due to GC/CC effects, etc. // Try to force document destruction. yield waitForDestroyedDocuments(); // Grab histograms again and compare. - let [histogram_page_after, histogram_document_after] = + let [histogram_page_after, histogram_document_after, + histogram_docs_after, histogram_toplevel_docs_after] = yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix); is(histogram_page_after, histogram_page_before + 1, "page counts for " + use_counter_middlefix + " after are correct"); is(histogram_document_after, histogram_document_before + 1, - "document counts " + use_counter_middlefix + " after are correct"); + "document counts for " + use_counter_middlefix + " after are correct"); + ok(histogram_toplevel_docs_after >= histogram_toplevel_docs_before + 1, + "top level document counts are correct"); + // 2 documents: one for the outer html page containing the <img> element, and + // one for the SVG image itself. + ok(histogram_docs_after >= histogram_docs_before + 2, + "document counts are correct"); }); var check_use_counter_direct = Task.async(function* (file, use_counter_middlefix, xfail=false) { info("checking " + file + " with histogram " + use_counter_middlefix); let newTab = gBrowser.addTab( "about:blank"); gBrowser.selectedTab = newTab; newTab.linkedBrowser.stop(); // Hold on to the current values of the telemetry histograms we're // interested in. - let [histogram_page_before, histogram_document_before] = + let [histogram_page_before, histogram_document_before, + histogram_docs_before, histogram_toplevel_docs_before] = yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix); gBrowser.selectedBrowser.loadURI(gHttpTestRoot + file); yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() { Cu.import("resource://gre/modules/PromiseUtils.jsm"); yield new Promise(resolve => { let listener = () => { removeEventListener("load", listener, true); @@ -262,15 +278,20 @@ var check_use_counter_direct = Task.asyn gBrowser.removeTab(newTab); // The histograms only get recorded when the document actually gets // destroyed, which might not have happened yet due to GC/CC effects, etc. // Try to force document destruction. yield waitForDestroyedDocuments(); // Grab histograms again and compare. - let [histogram_page_after, histogram_document_after] = + let [histogram_page_after, histogram_document_after, + histogram_docs_after, histogram_toplevel_docs_after] = yield grabHistogramsFromContent(gBrowser.selectedBrowser, use_counter_middlefix); (xfail ? todo_is : is)(histogram_page_after, histogram_page_before + 1, "page counts for " + use_counter_middlefix + " after are correct"); (xfail ? todo_is : is)(histogram_document_after, histogram_document_before + 1, - "document counts " + use_counter_middlefix + " after are correct"); + "document counts for " + use_counter_middlefix + " after are correct"); + ok(histogram_toplevel_docs_after >= histogram_toplevel_docs_before + 1, + "top level document counts are correct"); + ok(histogram_docs_after >= histogram_docs_before + 1, + "document counts are correct"); });