Bug 1507709 - Move WebExtensions geckoProfiler API to toolkit. r=kmag
authorPhilipp Kewisch <mozilla@kewis.ch>
Fri, 22 Mar 2019 13:18:01 +0000
changeset 465832 2a4bddaaf3dc989f91cd974a6e23f829adec088d
parent 465831 ca91ac220ca923a5c2a05e62914ed739cb544203
child 465833 8941a9be9141409229814e2688d207a890e3121b
push id35748
push userbtara@mozilla.com
push dateSat, 23 Mar 2019 21:42:11 +0000
treeherdermozilla-central@8941a9be9141 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1507709
milestone68.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
Bug 1507709 - Move WebExtensions geckoProfiler API to toolkit. r=kmag Differential Revision: https://phabricator.services.mozilla.com/D12100
.eslintignore
browser/components/extensions/ProfilerGetSymbols-worker.js
browser/components/extensions/ProfilerGetSymbols.jsm
browser/components/extensions/ext-browser.json
browser/components/extensions/jar.mn
browser/components/extensions/moz.build
browser/components/extensions/parent/ext-geckoProfiler.js
browser/components/extensions/profiler_get_symbols.js
browser/components/extensions/schemas/geckoProfiler.json
browser/components/extensions/schemas/jar.mn
browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_control.js
browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_schema.js
browser/components/extensions/test/xpcshell/xpcshell-common.ini
browser/components/extensions/test/xpcshell/xpcshell.ini
devtools/client/performance-new/store/actions.js
toolkit/components/extensions/ProfilerGetSymbols-worker.js
toolkit/components/extensions/ProfilerGetSymbols.jsm
toolkit/components/extensions/jar.mn
toolkit/components/extensions/moz.build
toolkit/components/extensions/parent/ext-geckoProfiler.js
toolkit/components/extensions/profiler_get_symbols.js
toolkit/components/extensions/schemas/geckoProfiler.json
toolkit/components/extensions/schemas/jar.mn
toolkit/components/extensions/test/xpcshell/test_ext_geckoProfiler_control.js
toolkit/components/extensions/test/xpcshell/test_ext_geckoProfiler_schema.js
toolkit/components/extensions/test/xpcshell/xpcshell-common.ini
toolkit/components/extensions/test/xpcshell/xpcshell.ini
tools/profiler/public/GeckoProfiler.h
--- a/.eslintignore
+++ b/.eslintignore
@@ -52,18 +52,16 @@ browser/base/content/test/general/gZipOf
 browser/base/content/test/urlbar/file_blank_but_not_blank.html
 # Test files that are really json not js, and don't need to be linted.
 browser/components/sessionstore/test/unit/data/sessionstore_valid.js
 browser/components/sessionstore/test/unit/data/sessionstore_invalid.js
 # This file is split into two in order to keep it as a valid json file
 # for documentation purposes (policies.json) but to be accessed by the
 # code as a .jsm (schema.jsm)
 browser/components/enterprisepolicies/schemas/schema.jsm
-# Ignore generated code from wasm-bindgen
-browser/components/extensions/profiler_get_symbols.js
 # generated & special files in cld2
 browser/components/translation/cld2/**
 # Screenshots is imported as a system add-on and has
 # their own lint rules currently.
 browser/extensions/screenshots/**
 browser/extensions/pdfjs/content/build**
 browser/extensions/pdfjs/content/web**
 # generated or library files in pocket
@@ -357,8 +355,11 @@ toolkit/components/reader/Readerable.jsm
 toolkit/content/widgets/wizard.xml
 toolkit/modules/AppConstants.jsm
 toolkit/mozapps/update/tests/data/xpcshellConstantsPP.js
 tools/tryselect/selectors/chooser/templates/chooser.html
 
 # Third party
 toolkit/modules/third_party/**
 third_party/**
+
+# Ignore generated code from wasm-bindgen
+toolkit/components/extensions/profiler_get_symbols.js
--- a/browser/components/extensions/ext-browser.json
+++ b/browser/components/extensions/ext-browser.json
@@ -135,18 +135,18 @@
     "url": "chrome://browser/content/parent/ext-pkcs11.js",
     "schema": "chrome://browser/content/schemas/pkcs11.json",
     "scopes": ["addon_parent"],
     "paths": [
       ["pkcs11"]
     ]
   },
   "geckoProfiler": {
-    "url": "chrome://browser/content/parent/ext-geckoProfiler.js",
-    "schema": "chrome://browser/content/schemas/geckoProfiler.json",
+    "url": "chrome://extensions/content/parent/ext-geckoProfiler.js",
+    "schema": "chrome://extensions/content/schemas/geckoProfiler.json",
     "scopes": ["addon_parent"],
     "paths": [
       ["geckoProfiler"]
     ]
   },
   "search": {
     "url": "chrome://browser/content/parent/ext-search.js",
     "schema": "chrome://browser/content/schemas/search.json",
--- a/browser/components/extensions/jar.mn
+++ b/browser/components/extensions/jar.mn
@@ -19,17 +19,16 @@ browser.jar:
     content/browser/parent/ext-browsingData.js (parent/ext-browsingData.js)
     content/browser/parent/ext-chrome-settings-overrides.js (parent/ext-chrome-settings-overrides.js)
     content/browser/parent/ext-commands.js (parent/ext-commands.js)
     content/browser/parent/ext-devtools.js (parent/ext-devtools.js)
     content/browser/parent/ext-devtools-inspectedWindow.js (parent/ext-devtools-inspectedWindow.js)
     content/browser/parent/ext-devtools-network.js (parent/ext-devtools-network.js)
     content/browser/parent/ext-devtools-panels.js (parent/ext-devtools-panels.js)
     content/browser/parent/ext-find.js (parent/ext-find.js)
-    content/browser/parent/ext-geckoProfiler.js (parent/ext-geckoProfiler.js)
     content/browser/parent/ext-history.js (parent/ext-history.js)
     content/browser/parent/ext-menus.js (parent/ext-menus.js)
     content/browser/parent/ext-omnibox.js (parent/ext-omnibox.js)
     content/browser/parent/ext-pageAction.js (parent/ext-pageAction.js)
     content/browser/parent/ext-pkcs11.js (parent/ext-pkcs11.js)
     content/browser/parent/ext-search.js (parent/ext-search.js)
     content/browser/parent/ext-sessions.js (parent/ext-sessions.js)
     content/browser/parent/ext-sidebarAction.js (parent/ext-sidebarAction.js)
--- a/browser/components/extensions/moz.build
+++ b/browser/components/extensions/moz.build
@@ -11,19 +11,16 @@ JAR_MANIFESTS += ['jar.mn']
 
 EXTRA_COMPONENTS += [
     'extensions-browser.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'ExtensionControlledPopup.jsm',
     'ExtensionPopups.jsm',
-    'profiler_get_symbols.js',
-    'ProfilerGetSymbols-worker.js',
-    'ProfilerGetSymbols.jsm',
 ]
 
 DIRS += ['schemas']
 
 BROWSER_CHROME_MANIFESTS += [
     'test/browser/browser-private.ini',
     'test/browser/browser-remote.ini',
     'test/browser/browser.ini',
--- a/browser/components/extensions/schemas/jar.mn
+++ b/browser/components/extensions/schemas/jar.mn
@@ -8,17 +8,16 @@ browser.jar:
     content/browser/schemas/browsing_data.json
     content/browser/schemas/chrome_settings_overrides.json
     content/browser/schemas/commands.json
     content/browser/schemas/devtools.json
     content/browser/schemas/devtools_inspected_window.json
     content/browser/schemas/devtools_network.json
     content/browser/schemas/devtools_panels.json
     content/browser/schemas/find.json
-    content/browser/schemas/geckoProfiler.json
     content/browser/schemas/history.json
     content/browser/schemas/menus.json
     content/browser/schemas/menus_child.json
     content/browser/schemas/omnibox.json
     content/browser/schemas/page_action.json
     content/browser/schemas/pkcs11.json
     content/browser/schemas/search.json
     content/browser/schemas/sessions.json
--- a/browser/components/extensions/test/xpcshell/xpcshell-common.ini
+++ b/browser/components/extensions/test/xpcshell/xpcshell-common.ini
@@ -1,16 +1,15 @@
 [test_ext_bookmarks.js]
 [test_ext_browsingData.js]
 [test_ext_browsingData_cookies_cache.js]
 [test_ext_browsingData_downloads.js]
 [test_ext_browsingData_passwords.js]
 [test_ext_browsingData_settings.js]
 [test_ext_chrome_settings_overrides_update.js]
 [test_ext_distribution_popup.js]
-[test_ext_geckoProfiler_control.js]
 [test_ext_history.js]
 [test_ext_settings_overrides_search.js]
 [test_ext_settings_overrides_search_mozParam.js]
 [test_ext_settings_overrides_shutdown.js]
 [test_ext_url_overrides_newtab.js]
 [test_ext_url_overrides_newtab_update.js]
 
--- a/browser/components/extensions/test/xpcshell/xpcshell.ini
+++ b/browser/components/extensions/test/xpcshell/xpcshell.ini
@@ -11,17 +11,16 @@ dupe-manifest =
 # Tests which are affected by remote content or remote extensions should
 # go in one of:
 #
 #  - xpcshell-common.ini
 #    For tests which should run in all configurations.
 #  - xpcshell-remote.ini
 #    For tests which should only run with both remote extensions and remote content.
 
-[test_ext_geckoProfiler_schema.js]
 [test_ext_manifest.js]
 [test_ext_manifest_commands.js]
 [test_ext_manifest_omnibox.js]
 [test_ext_manifest_permissions.js]
 [test_ext_pageAction_shutdown.js]
 [test_ext_pkcs11_management.js]
 
 [include:xpcshell-common.ini]
--- a/devtools/client/performance-new/store/actions.js
+++ b/devtools/client/performance-new/store/actions.js
@@ -6,17 +6,17 @@
 const selectors = require("devtools/client/performance-new/store/selectors");
 const { recordingState: {
   AVAILABLE_TO_RECORD,
   REQUEST_TO_START_RECORDING,
   REQUEST_TO_GET_PROFILE_AND_STOP_PROFILER,
   REQUEST_TO_STOP_PROFILER,
 }} = require("devtools/client/performance-new/utils");
 const { OS } = require("resource://gre/modules/osfile.jsm");
-const { ProfilerGetSymbols } = require("resource://app/modules/ProfilerGetSymbols.jsm");
+const { ProfilerGetSymbols } = require("resource://gre/modules/ProfilerGetSymbols.jsm");
 
 /**
  * The recording state manages the current state of the recording panel.
  * @param {string} state - A valid state in `recordingState`.
  * @param {object} options
  */
 const changeRecordingState = exports.changeRecordingState =
   (state, options = { didRecordingUnexpectedlyStopped: false }) => ({
rename from browser/components/extensions/ProfilerGetSymbols-worker.js
rename to toolkit/components/extensions/ProfilerGetSymbols-worker.js
--- a/browser/components/extensions/ProfilerGetSymbols-worker.js
+++ b/toolkit/components/extensions/ProfilerGetSymbols-worker.js
@@ -1,16 +1,16 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 /* eslint-env mozilla/chrome-worker */
 
 "use strict";
 
 importScripts("resource://gre/modules/osfile.jsm",
-              "resource://app/modules/profiler_get_symbols.js");
+              "resource://gre/modules/profiler_get_symbols.js");
 
 // This worker uses the wasm module that was generated from https://github.com/mstange/profiler-get-symbols.
 // See ProfilerGetSymbols.jsm for more information.
 //
 // The worker instantiates the module, reads the binary into wasm memory, runs
 // the wasm code, and returns the symbol table or an error. Then it shuts down
 // itself.
 
rename from browser/components/extensions/ProfilerGetSymbols.jsm
rename to toolkit/components/extensions/ProfilerGetSymbols.jsm
--- a/browser/components/extensions/ProfilerGetSymbols.jsm
+++ b/toolkit/components/extensions/ProfilerGetSymbols.jsm
@@ -76,17 +76,17 @@ this.ProfilerGetSymbols = {
    * @returns {Promise} The symbol table in SymbolTableAsTuple format, see the
    *   documentation for nsIProfiler.getSymbolTable.
    */
   async getSymbolTable(binaryPath, debugPath, breakpadId) {
     const module = await getWASMProfilerGetSymbolsModule();
 
     return new Promise((resolve, reject) => {
       const worker =
-        new ChromeWorker("resource://app/modules/ProfilerGetSymbols-worker.js");
+        new ChromeWorker("resource://gre/modules/ProfilerGetSymbols-worker.js");
       worker.onmessage = (e) => {
         if (e.data.error) {
           reject(e.data.error);
           return;
         }
         resolve(e.data.result);
       };
       worker.postMessage({binaryPath, debugPath, breakpadId, module});
--- a/toolkit/components/extensions/jar.mn
+++ b/toolkit/components/extensions/jar.mn
@@ -12,16 +12,19 @@ toolkit.jar:
     content/extensions/parent/ext-browserSettings.js (parent/ext-browserSettings.js)
     content/extensions/parent/ext-contentScripts.js (parent/ext-contentScripts.js)
     content/extensions/parent/ext-contextualIdentities.js (parent/ext-contextualIdentities.js)
     content/extensions/parent/ext-clipboard.js (parent/ext-clipboard.js)
     content/extensions/parent/ext-cookies.js (parent/ext-cookies.js)
     content/extensions/parent/ext-dns.js (parent/ext-dns.js)
     content/extensions/parent/ext-downloads.js (parent/ext-downloads.js)
     content/extensions/parent/ext-extension.js (parent/ext-extension.js)
+#ifndef ANDROID
+    content/extensions/parent/ext-geckoProfiler.js (parent/ext-geckoProfiler.js)
+#endif
     content/extensions/parent/ext-i18n.js (parent/ext-i18n.js)
 #ifndef ANDROID
     content/extensions/parent/ext-identity.js (parent/ext-identity.js)
 #endif
     content/extensions/parent/ext-idle.js (parent/ext-idle.js)
     content/extensions/parent/ext-management.js (parent/ext-management.js)
     content/extensions/parent/ext-notifications.js (parent/ext-notifications.js)
     content/extensions/parent/ext-permissions.js (parent/ext-permissions.js)
--- a/toolkit/components/extensions/moz.build
+++ b/toolkit/components/extensions/moz.build
@@ -31,16 +31,23 @@ EXTRA_JS_MODULES += [
     'MessageManagerProxy.jsm',
     'NativeManifests.jsm',
     'NativeMessaging.jsm',
     'PerformanceCounters.jsm',
     'ProxyScriptContext.jsm',
     'Schemas.jsm',
 ]
 
+if CONFIG['MOZ_WIDGET_TOOLKIT'] != "android":
+    EXTRA_JS_MODULES += [
+        'profiler_get_symbols.js',
+        'ProfilerGetSymbols-worker.js',
+        'ProfilerGetSymbols.jsm',
+    ]
+
 EXTRA_COMPONENTS += [
     'extensions-toolkit.manifest',
 ]
 
 TESTING_JS_MODULES += [
     'ExtensionTestCommon.jsm',
     'ExtensionXPCShellUtils.jsm',
 ]
rename from browser/components/extensions/parent/ext-geckoProfiler.js
rename to toolkit/components/extensions/parent/ext-geckoProfiler.js
--- a/browser/components/extensions/parent/ext-geckoProfiler.js
+++ b/toolkit/components/extensions/parent/ext-geckoProfiler.js
@@ -1,16 +1,16 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
-ChromeUtils.defineModuleGetter(this, "ProfilerGetSymbols", "resource://app/modules/ProfilerGetSymbols.jsm");
+ChromeUtils.defineModuleGetter(this, "ProfilerGetSymbols", "resource://gre/modules/ProfilerGetSymbols.jsm");
 
 const PREF_ASYNC_STACK = "javascript.options.asyncstack";
 
 const ASYNC_STACKS_ENABLED = Services.prefs.getBoolPref(PREF_ASYNC_STACK, false);
 
 var {
   ExtensionError,
 } = ExtensionUtils;
rename from browser/components/extensions/profiler_get_symbols.js
rename to toolkit/components/extensions/profiler_get_symbols.js
rename from browser/components/extensions/schemas/geckoProfiler.json
rename to toolkit/components/extensions/schemas/geckoProfiler.json
--- a/toolkit/components/extensions/schemas/jar.mn
+++ b/toolkit/components/extensions/schemas/jar.mn
@@ -12,16 +12,19 @@ toolkit.jar:
     content/extensions/schemas/cookies.json
     content/extensions/schemas/dns.json
     content/extensions/schemas/downloads.json
     content/extensions/schemas/events.json
     content/extensions/schemas/experiments.json
     content/extensions/schemas/extension.json
     content/extensions/schemas/extension_types.json
     content/extensions/schemas/extension_protocol_handlers.json
+#ifndef ANDROID
+    content/extensions/schemas/geckoProfiler.json
+#endif
     content/extensions/schemas/i18n.json
 #ifndef ANDROID
     content/extensions/schemas/identity.json
 #endif
     content/extensions/schemas/idle.json
     content/extensions/schemas/management.json
     content/extensions/schemas/manifest.json
     content/extensions/schemas/native_manifest.json
rename from browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_control.js
rename to toolkit/components/extensions/test/xpcshell/test_ext_geckoProfiler_control.js
rename from browser/components/extensions/test/xpcshell/test_ext_geckoProfiler_schema.js
rename to toolkit/components/extensions/test/xpcshell/test_ext_geckoProfiler_schema.js
--- a/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini
+++ b/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini
@@ -55,16 +55,18 @@ skip-if = appname == "thunderbird" || os
 [test_ext_experiments.js]
 fail-if = appname == "thunderbird"
 [test_ext_extension.js]
 [test_ext_extensionPreferencesManager.js]
 [test_ext_extensionSettingsStore.js]
 [test_ext_extension_content_telemetry.js]
 skip-if = os == "android" # checking for telemetry needs to be updated: 1384923
 [test_ext_extension_startup_telemetry.js]
+[test_ext_geckoProfiler_control.js]
+skip-if = os == "android" # Not shipped on Android
 [test_ext_geturl.js]
 [test_ext_idle.js]
 [test_ext_incognito.js]
 [test_ext_localStorage.js]
 [test_ext_management.js]
 skip-if = (os == "win" && !debug) #Bug 1419183 disable on Windows
 [test_ext_management_uninstall_self.js]
 [test_ext_messaging_startup.js]
--- a/toolkit/components/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/components/extensions/test/xpcshell/xpcshell.ini
@@ -28,16 +28,18 @@ tags = webextensions in-process-webexten
 [test_MatchPattern.js]
 [test_WebExtensionContentScript.js]
 [test_WebExtensionPolicy.js]
 
 [test_csp_custom_policies.js]
 [test_csp_validator.js]
 [test_ext_contexts.js]
 [test_ext_json_parser.js]
+[test_ext_geckoProfiler_schema.js]
+skip-if = os == 'android' # Not shipped on Android
 [test_ext_manifest.js]
 skip-if = toolkit == 'android' # browser_action icon testing not supported on android
 [test_ext_manifest_content_security_policy.js]
 [test_ext_manifest_incognito.js]
 [test_ext_manifest_minimum_chrome_version.js]
 [test_ext_manifest_minimum_opera_version.js]
 [test_ext_manifest_themes.js]
 [test_ext_permission_warnings.js]
--- a/tools/profiler/public/GeckoProfiler.h
+++ b/tools/profiler/public/GeckoProfiler.h
@@ -112,17 +112,17 @@ class Vector;
 //---------------------------------------------------------------------------
 // Profiler features
 //---------------------------------------------------------------------------
 
 // Higher-order macro containing all the feature info in one place. Define
 // |MACRO| appropriately to extract the relevant parts. Note that the number
 // values are used internally only and so can be changed without consequence.
 // Any changes to this list should also be applied to the feature list in
-// browser/components/extensions/schemas/geckoProfiler.json.
+// toolkit/components/extensions/schemas/geckoProfiler.json.
 #  define PROFILER_FOR_EACH_FEATURE(MACRO)                         \
     /* Profile Java code (Android only). */                        \
     MACRO(0, "java", Java)                                         \
                                                                    \
     /* Get the JS engine to expose the JS stack to the profiler */ \
     MACRO(1, "js", JS)                                             \
                                                                    \
     /* Include the C++ leaf node if not stackwalking. */           \