Backed out changeset 9fee865dcbf5 (bug 1468550) for xpcshell failures at toolkit/components/extensions/test/xpcshell/test_ext_performance_counters.js on a CLOSED TREE

This commit is contained in:
Coroiu Cristina 2018-07-27 19:45:56 +03:00
Родитель 7d34b79e90
Коммит 27148b0bc9
4 изменённых файлов: 2 добавлений и 77 удалений

Просмотреть файл

@ -4969,9 +4969,6 @@ pref("extensions.webextensions.background-delayed-startup", false);
// Whether or not the installed extensions should be migrated to the storage.local IndexedDB backend.
pref("extensions.webextensions.ExtensionStorageIDB.enabled", false);
// if enabled, store execution times for API calls
pref("extensions.webextensions.enablePerformanceCounters", false);
// Report Site Issue button
pref("extensions.webcompat-reporter.newIssueEndpoint", "https://webcompat.com/issues/new");
#if defined(MOZ_DEV_EDITION) || defined(NIGHTLY_BUILD)

Просмотреть файл

@ -60,7 +60,6 @@ const BASE_SCHEMA = "chrome://extensions/content/schemas/manifest.json";
const CATEGORY_EXTENSION_MODULES = "webextension-modules";
const CATEGORY_EXTENSION_SCHEMAS = "webextension-schemas";
const CATEGORY_EXTENSION_SCRIPTS = "webextension-scripts";
const TIMING_ENABLED_PREF = "extensions.webextensions.enablePerformanceCounters";
let schemaURLs = new Set();
@ -750,9 +749,6 @@ class DevToolsExtensionPageContextParent extends ExtensionPageContextParent {
}
ParentAPIManager = {
// stores dispatches counts per web extension and API
performanceCounters: new DefaultMap(() => new DefaultMap(() => ({duration: 0, calls: 0}))),
proxyContexts: new Map(),
init() {
@ -763,7 +759,6 @@ ParentAPIManager = {
Services.mm.addMessageListener("API:Call", this);
Services.mm.addMessageListener("API:AddListener", this);
Services.mm.addMessageListener("API:RemoveListener", this);
XPCOMUtils.defineLazyPreferenceGetter(this, "_timingEnabled", TIMING_ENABLED_PREF, false);
},
attachMessageManager(extension, processMessageManager) {
@ -881,26 +876,6 @@ ParentAPIManager = {
}
},
storeExecutionTime(webExtensionId, apiPath, duration) {
let apiCounter = this.performanceCounters.get(webExtensionId).get(apiPath);
apiCounter.duration += duration;
apiCounter.calls += 1;
},
async withTiming(data, callable) {
if (!this._timingEnabled) {
return callable();
}
let webExtId = data.childId.split(".")[0];
let start = Cu.now();
try {
return callable();
} finally {
let end = Cu.now();
this.storeExecutionTime(webExtId, data.path, end - start);
}
},
async call(data, target) {
let context = this.getContextById(data.childId);
if (context.parentMessageManager !== target.messageManager) {
@ -926,11 +901,8 @@ ParentAPIManager = {
let args = data.args;
let pendingBrowser = context.pendingEventBrowser;
let fun = await context.apiCan.asyncFindAPIPath(data.path);
let result = this.withTiming(data, () => {
return context.withPendingBrowser(pendingBrowser,
() => fun(...args));
});
let result = context.withPendingBrowser(pendingBrowser,
() => fun(...args));
if (data.callId) {
result = result || Promise.resolve();

Просмотреть файл

@ -1,43 +0,0 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
ChromeUtils.import("resource://gre/modules/ExtensionParent.jsm");
const ENABLE_COUNTER_PREF = "extensions.webextensions.enablePerformanceCounters";
let {
ParentAPIManager,
} = ExtensionParent;
async function test_counter() {
async function background() {
// creating a bookmark
let folder = await browser.bookmarks.create({title: "Folder"});
await browser.bookmarks.create({title: "Bookmark", url: "http://example.com",
parentId: folder.id});
browser.test.sendMessage("done");
}
let extensionData = {
background,
manifest: {
permissions: ["bookmarks"],
},
};
let extension = ExtensionTestUtils.loadExtension(extensionData);
await extension.startup();
await extension.awaitMessage("done");
await extension.unload();
// check that the bookmarks.create API was tracked
let counters = ParentAPIManager.performanceCounters;
let counter = counters.get(extension.id).get("bookmarks.create");
ok(counter.calls > 0);
ok(counter.duration > 0);
}
add_task(function test_performance_counter() {
return runWithPrefs([[ENABLE_COUNTER_PREF, true]], test_counter);
});

Просмотреть файл

@ -134,4 +134,3 @@ skip-if = os == "android" # Bug 1350559
[test_proxy_scripts.js]
[test_proxy_scripts_results.js]
[test_ext_brokenlinks.js]
[test_ext_performance_counters.js]