Bug 1429567: Add more detailed add-on info to sandbox names. r=zombie
authorKris Maglione <maglione.k@gmail.com>
Fri, 12 Jan 2018 13:21:03 -0800
changeset 450967 4806f68141637e47411ad6d202b6ce9b8cd4d910
parent 450966 0fa20efa446906e82545076eb72c66a18ae1ed43
child 450968 b2498157399c438a401b54aee1e0b297a7a59ff9
push id8543
push userryanvm@gmail.com
push dateTue, 16 Jan 2018 14:33:22 +0000
treeherdermozilla-beta@a6525ed16a32 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszombie
bugs1429567
milestone59.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 1429567: Add more detailed add-on info to sandbox names. r=zombie MozReview-Commit-ID: DMs8dd49j03
toolkit/components/extensions/ExtensionContent.jsm
toolkit/components/extensions/ProxyScriptContext.jsm
toolkit/components/extensions/extension-process-script.js
--- a/toolkit/components/extensions/ExtensionContent.jsm
+++ b/toolkit/components/extensions/ExtensionContent.jsm
@@ -421,34 +421,34 @@ class ContentScriptContextChild extends 
 
     if (this.isExtensionPage) {
       // This is an iframe with content script API enabled and its principal
       // should be the contentWindow itself. We create a sandbox with the
       // contentWindow as principal and with X-rays disabled because it
       // enables us to create the APIs object in this sandbox object and then
       // copying it into the iframe's window.  See bug 1214658.
       this.sandbox = Cu.Sandbox(contentWindow, {
-        sandboxName: `Content Script ExtensionPage ${this.extension.id}`,
+        sandboxName: `Web-Accessible Extension Page ${extension.policy.debugName}`,
         sandboxPrototype: contentWindow,
         sameZoneAs: contentWindow,
         wantXrays: false,
         isWebExtensionContentScript: true,
       });
     } else {
       // This metadata is required by the Developer Tools, in order for
       // the content script to be associated with both the extension and
       // the tab holding the content page.
       let metadata = {
         "inner-window-id": this.innerWindowID,
         addonId: extensionPrincipal.addonId,
       };
 
       this.sandbox = Cu.Sandbox(principal, {
         metadata,
-        sandboxName: `Content Script ${this.extension.id}`,
+        sandboxName: `Content Script ${extension.policy.debugName}`,
         sandboxPrototype: contentWindow,
         sameZoneAs: contentWindow,
         wantXrays: true,
         isWebExtensionContentScript: true,
         wantExportHelpers: true,
         wantGlobalProperties: ["XMLHttpRequest", "fetch"],
         originAttributes: attrs,
       });
--- a/toolkit/components/extensions/ProxyScriptContext.jsm
+++ b/toolkit/components/extensions/ProxyScriptContext.jsm
@@ -195,17 +195,17 @@ const ProxyInfoData = {
 
 class ProxyScriptContext extends BaseContext {
   constructor(extension, url, contextInfo = {}) {
     super("proxy_script", extension);
     this.contextInfo = contextInfo;
     this.extension = extension;
     this.messageManager = Services.cpmm;
     this.sandbox = Cu.Sandbox(this.extension.principal, {
-      sandboxName: `proxyscript:${extension.id}:${url}`,
+      sandboxName: `Extension Proxy Script (${extension.policy.debugName}): ${url}`,
       metadata: {addonID: extension.id},
     });
     this.url = url;
     this.FindProxyForURL = null;
   }
 
   /**
    * Loads and validates a proxy script into the sandbox, and then
--- a/toolkit/components/extensions/extension-process-script.js
+++ b/toolkit/components/extensions/extension-process-script.js
@@ -338,16 +338,18 @@ ExtensionManager = {
         localizeCallback,
 
         backgroundScripts: (extension.manifest.background &&
                             extension.manifest.background.scripts),
 
         contentScripts: extension.contentScripts.map(parseScriptOptions),
       });
 
+      policy.debugName = `${JSON.stringify(policy.name)} (ID: ${policy.id}, ${policy.getURL()})`;
+
       // Register any existent dinamically registered content script for the extension
       // when a content process is started for the first time (which also cover
       // a content process that crashed and it has been recreated).
       const registeredContentScripts = this.registeredContentScripts.get(policy);
 
       if (extension.registeredContentScripts) {
         for (let [scriptId, options] of extension.registeredContentScripts) {
           const parsedOptions = parseScriptOptions(options);