Bug 1410415 - Set a sandboxName on the WebExtensions Content Script sandboxes. r=mixedpuppy
authorLuca Greco <lgreco@mozilla.com>
Fri, 20 Oct 2017 15:35:29 +0200
changeset 387752 474d75b9420f237e95a59e529f177966967f20a8
parent 387751 deab7f534b9fba6e7c4c2c96d676b26483c7370f
child 387753 363bf0516c8938219c67553522f9e6ac69b98fad
push id96497
push userarchaeopteryx@coole-files.de
push dateTue, 24 Oct 2017 09:57:53 +0000
treeherdermozilla-inbound@7de3cc48b5b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1410415
milestone58.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 1410415 - Set a sandboxName on the WebExtensions Content Script sandboxes. r=mixedpuppy MozReview-Commit-ID: aIcayH9TYd
toolkit/components/extensions/ExtensionContent.jsm
--- a/toolkit/components/extensions/ExtensionContent.jsm
+++ b/toolkit/components/extensions/ExtensionContent.jsm
@@ -420,32 +420,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}`,
         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}`,
         sandboxPrototype: contentWindow,
         sameZoneAs: contentWindow,
         wantXrays: true,
         isWebExtensionContentScript: true,
         wantExportHelpers: true,
         wantGlobalProperties: ["XMLHttpRequest", "fetch"],
         originAttributes: attrs,
       });