Bug 1410415 - Set a sandboxName on the WebExtensions Content Script sandboxes. draft
authorLuca Greco <lgreco@mozilla.com>
Fri, 20 Oct 2017 15:35:29 +0200
changeset 683899 e3d652ab3dbded3da6847b3e61c58c04324d5e4b
parent 683863 d1e995c8640a191cd127e87273ec96cb2fabffa9
child 736756 1ba8a1b41a7417608f434ed7cc8921b12e71db09
push id85495
push userluca.greco@alcacoop.it
push dateFri, 20 Oct 2017 13:38:59 +0000
bugs1410415
milestone58.0a1
Bug 1410415 - Set a sandboxName on the WebExtensions Content Script sandboxes. 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,
       });