Backed out 8 changesets (bug 1356334) for frequent test_ext_contentscript_async_loading.html failures on Android debug on a CLOSED TREE.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 18 Aug 2017 11:32:18 -0400
changeset 427613 399db8547abb4549b05ffd419fab29c8cbd6c2ae
parent 427612 d2571908d00cad44be3fc9dcc14426060b8b0a77
child 427614 f3cc364d3dfdb49dfbf0df28e9fd1acb7bf34694
push id1567
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 12:36:05 +0000
treeherdermozilla-release@e512c14a0406 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1356334
milestone57.0a1
backs out9c677ebfdda09a2aad05a30427330eefec43b128
16b49fd1c38a9d978b7b32201687d4499ce50586
4f5bcd2b2dc695397c97f0c1391b66c6f8251939
d832803270ac831fd760356f36e16ef2a2d6d45b
b83aea215a82d44bec7443b69e60feef32f5fb2c
b2a663ffd1446f9f70b220866855a0ecb3503761
805c568069301ae91ead5780cdc118af73907229
7c880eca810ac03509cc3102bd421b5f386e82cb
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
Backed out 8 changesets (bug 1356334) for frequent test_ext_contentscript_async_loading.html failures on Android debug on a CLOSED TREE. Backed out changeset 9c677ebfdda0 (bug 1356334) Backed out changeset 16b49fd1c38a (bug 1356334) Backed out changeset 4f5bcd2b2dc6 (bug 1356334) Backed out changeset d832803270ac (bug 1356334) Backed out changeset b83aea215a82 (bug 1356334) Backed out changeset b2a663ffd144 (bug 1356334) Backed out changeset 805c56806930 (bug 1356334) Backed out changeset 7c880eca810a (bug 1356334)
browser/locales/en-US/chrome/browser/browser.properties
browser/modules/ProcessHangMonitor.jsm
caps/BasePrincipal.h
caps/ContentPrincipal.h
caps/ExpandedPrincipal.h
caps/NullPrincipal.h
caps/SystemPrincipal.h
caps/nsIAddonPolicyService.idl
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/ipc/ContentPrefs.cpp
dom/ipc/PProcessHangMonitor.ipdl
dom/ipc/ProcessHangMonitor.cpp
dom/ipc/ProcessHangMonitor.h
dom/ipc/nsIHangReport.idl
dom/locales/en-US/chrome/dom/dom.properties
dom/webidl/WebExtensionPolicy.webidl
js/xpconnect/src/XPCJSContext.cpp
js/xpconnect/src/XPCJSRuntime.cpp
modules/libpref/init/all.js
toolkit/components/extensions/Extension.jsm
toolkit/components/extensions/ExtensionContent.jsm
toolkit/components/extensions/ExtensionPolicyService.cpp
toolkit/components/extensions/WebExtensionPolicy.cpp
toolkit/components/extensions/WebExtensionPolicy.h
toolkit/components/extensions/extension-process-script.js
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -581,25 +581,18 @@ browser.menu.showCharacterEncoding=false
 
 # Mozilla data reporting notification (Telemetry, Firefox Health Report, etc)
 dataReportingNotification.message       = %1$S automatically sends some data to %2$S so that we can improve your experience.
 dataReportingNotification.button.label  = Choose What I Share
 dataReportingNotification.button.accessKey  = C
 
 # Process hang reporter
 processHang.label = A web page is slowing down your browser. What would you like to do?
-# LOCALIZATION NOTE (processHang.add-on.label): The first %S is the name of
-# an extension. The second %S is the name of the product (e.g., Firefox)
-processHang.add-on.label = A script in the extension “%S” is causing %S to slow down.
-processHang.add-on.learn-more.text = Learn more
-processHang.add-on.learn-more.url = https://support.mozilla.org/en-US/kb/warning-unresponsive-script?cache=no#w_other-causes
 processHang.button_stop.label = Stop It
 processHang.button_stop.accessKey = S
-processHang.button_stop_sandbox.label = Temporarily Disable Extension on Page
-processHang.button_stop_sandbox.accessKey = A
 processHang.button_wait.label = Wait
 processHang.button_wait.accessKey = W
 processHang.button_debug.label = Debug Script
 processHang.button_debug.accessKey = D
 
 # LOCALIZATION NOTE (fullscreenButton.tooltip): %S is the keyboard shortcut for full screen
 fullscreenButton.tooltip=Display the window in full screen (%S)
 
--- a/browser/modules/ProcessHangMonitor.jsm
+++ b/browser/modules/ProcessHangMonitor.jsm
@@ -60,24 +60,16 @@ var ProcessHangMonitor = {
    * Terminate JavaScript associated with the hang being reported for
    * the selected browser in |win|.
    */
   terminateScript(win) {
     this.handleUserInput(win, report => report.terminateScript());
   },
 
   /**
-   * Terminate Sandbox globals associated with the hang being reported
-   * for the selected browser in |win|.
-   */
-  terminateGlobal(win) {
-    this.handleUserInput(win, report => report.terminateGlobal());
-  },
-
-  /**
    * Start devtools debugger for JavaScript associated with the hang
    * being reported for the selected browser in |win|.
    */
   debugScript(win) {
     this.handleUserInput(win, report => {
       function callback() {
         report.endStartingDebugger();
       }
@@ -115,33 +107,16 @@ var ProcessHangMonitor = {
         break;
       case report.PLUGIN_HANG:
         this.terminatePlugin(win);
         break;
     }
   },
 
   /**
-   * Stop all scripts from running in the Sandbox global attached to
-   * this window.
-   */
-  stopGlobal(win) {
-    let report = this.findActiveReport(win.gBrowser.selectedBrowser);
-    if (!report) {
-      return;
-    }
-
-    switch (report.hangType) {
-      case report.SLOW_SCRIPT:
-        this.terminateGlobal(win);
-        break;
-    }
-  },
-
-  /**
    * Dismiss the notification, clear the report from the active list and set up
    * a new timer to track a wait period during which we won't notify.
    */
   waitLonger(win) {
     let report = this.findActiveReport(win.gBrowser.selectedBrowser);
     if (!report) {
       return;
     }
@@ -324,61 +299,28 @@ var ProcessHangMonitor = {
       {
         label: bundle.getString("processHang.button_wait.label"),
         accessKey: bundle.getString("processHang.button_wait.accessKey"),
         callback() {
           ProcessHangMonitor.waitLonger(win);
         }
       }];
 
-    let message = bundle.getString("processHang.label");
-    if (report.addonId) {
-      let aps = Cc["@mozilla.org/addons/policy-service;1"].getService(Ci.nsIAddonPolicyService);
-
-      let doc = win.document;
-      let brandBundle = doc.getElementById("bundle_brand");
-
-      let addonName = aps.getExtensionName(report.addonId);
-
-      let label = bundle.getFormattedString("processHang.add-on.label",
-                                            [addonName, brandBundle.getString("brandShortName")]);
-
-      let linkText = bundle.getString("processHang.add-on.learn-more.text");
-      let linkURL = bundle.getString("processHang.add-on.learn-more.url");
-
-      let link = doc.createElement("label");
-      link.setAttribute("class", "text-link");
-      link.setAttribute("role", "link");
-      link.setAttribute("onclick", `openUILinkIn(${JSON.stringify(linkURL)}, "tab")`);
-      link.setAttribute("value", linkText);
-
-      message = doc.createDocumentFragment();
-      message.appendChild(doc.createTextNode(label + " "));
-      message.appendChild(link);
-
-      buttons.unshift({
-        label: bundle.getString("processHang.button_stop_sandbox.label"),
-        accessKey: bundle.getString("processHang.button_stop_sandbox.accessKey"),
-        callback() {
-          ProcessHangMonitor.stopGlobal(win);
-        }
-      });
-    }
-
     if (AppConstants.MOZ_DEV_EDITION && report.hangType == report.SLOW_SCRIPT) {
       buttons.push({
         label: bundle.getString("processHang.button_debug.label"),
         accessKey: bundle.getString("processHang.button_debug.accessKey"),
         callback() {
           ProcessHangMonitor.debugScript(win);
         }
       });
     }
 
-    nb.appendNotification(message, "process-hang",
+    nb.appendNotification(bundle.getString("processHang.label"),
+                          "process-hang",
                           "chrome://browser/content/aboutRobots-icon.png",
                           nb.PRIORITY_WARNING_HIGH, buttons);
   },
 
   /**
    * Ensure that no hang notifications are visible in |win|.
    */
   hideNotification(win) {
--- a/caps/BasePrincipal.h
+++ b/caps/BasePrincipal.h
@@ -35,29 +35,16 @@ public:
     eNullPrincipal,
     eCodebasePrincipal,
     eExpandedPrincipal,
     eSystemPrincipal
   };
 
   explicit BasePrincipal(PrincipalKind aKind);
 
-  template<typename T>
-  bool Is() const
-  {
-    return mKind == T::Kind();
-  }
-
-  template<typename T>
-  T* As()
-  {
-    MOZ_ASSERT(Is<T>());
-    return static_cast<T*>(this);
-  }
-
   enum DocumentDomainConsideration { DontConsiderDocumentDomain, ConsiderDocumentDomain};
   bool Subsumes(nsIPrincipal* aOther, DocumentDomainConsideration aConsideration);
 
   NS_IMETHOD GetOrigin(nsACString& aOrigin) final;
   NS_IMETHOD GetOriginNoSuffix(nsACString& aOrigin) final;
   NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval) final;
   NS_IMETHOD EqualsConsideringDomain(nsIPrincipal* other, bool* _retval) final;
   NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval) final;
--- a/caps/ContentPrincipal.h
+++ b/caps/ContentPrincipal.h
@@ -25,18 +25,16 @@ public:
   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
   NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
   NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
   bool IsCodebasePrincipal() const override { return true; }
 
   ContentPrincipal();
 
-  static PrincipalKind Kind() { return eCodebasePrincipal; }
-
   // Init() must be called before the principal is in a usable state.
   nsresult Init(nsIURI* aCodebase,
                 const mozilla::OriginAttributes& aOriginAttributes,
                 const nsACString& aOriginNoSuffix);
 
   virtual nsresult GetScriptLocation(nsACString& aStr) override;
 
   /**
--- a/caps/ExpandedPrincipal.h
+++ b/caps/ExpandedPrincipal.h
@@ -15,18 +15,16 @@
 class ExpandedPrincipal : public nsIExpandedPrincipal
                         , public mozilla::BasePrincipal
 {
 public:
   static already_AddRefed<ExpandedPrincipal>
   Create(nsTArray<nsCOMPtr<nsIPrincipal>>& aWhiteList,
          const mozilla::OriginAttributes& aAttrs);
 
-  static PrincipalKind Kind() { return eExpandedPrincipal; }
-
   NS_DECL_NSIEXPANDEDPRINCIPAL
   NS_DECL_NSISERIALIZABLE
 
   NS_IMETHOD_(MozExternalRefCountType) AddRef() override { return nsJSPrincipals::AddRef(); };
   NS_IMETHOD_(MozExternalRefCountType) Release() override { return nsJSPrincipals::Release(); };
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
   NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
   NS_IMETHOD GetURI(nsIURI** aURI) override;
--- a/caps/NullPrincipal.h
+++ b/caps/NullPrincipal.h
@@ -36,18 +36,16 @@ public:
   // This should only be used by deserialization, and the factory constructor.
   // Other consumers should use the Create and CreateWithInheritedAttributes
   // methods.
   NullPrincipal()
     : BasePrincipal(eNullPrincipal)
   {
   }
 
-  static PrincipalKind Kind() { return eNullPrincipal; }
-
   NS_DECL_NSISERIALIZABLE
 
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
   NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
   NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp) override;
   NS_IMETHOD GetURI(nsIURI** aURI) override;
   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
--- a/caps/SystemPrincipal.h
+++ b/caps/SystemPrincipal.h
@@ -25,18 +25,16 @@ class SystemPrincipal final : public moz
   SystemPrincipal()
     : BasePrincipal(eSystemPrincipal)
   {
   }
 
 public:
   static already_AddRefed<SystemPrincipal> Create();
 
-  static PrincipalKind Kind() { return eSystemPrincipal; }
-
   NS_DECL_NSISERIALIZABLE
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
   NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
   NS_IMETHOD GetURI(nsIURI** aURI) override;
   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
   NS_IMETHOD GetCsp(nsIContentSecurityPolicy** aCsp) override;
   NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp) override;
--- a/caps/nsIAddonPolicyService.idl
+++ b/caps/nsIAddonPolicyService.idl
@@ -48,22 +48,16 @@ interface nsIAddonPolicyService : nsISup
   /**
    * Returns true if unprivileged code associated with the given addon may load
    * data from |aURI|.  If |aExplicit| is true, the <all_urls> permission and
    * permissive host globs are ignored when checking for a match.
    */
   boolean addonMayLoadURI(in AString aAddonId, in nsIURI aURI, [optional] in boolean aExplicit);
 
   /**
-   * Returns the name of the WebExtension with the given ID, or the ID string
-   * if no matching add-on can be found.
-   */
-  AString getExtensionName(in AString aAddonId);
-
-  /**
    * Returns true if a given extension:// URI is web-accessible.
    */
   boolean extensionURILoadableByAnyone(in nsIURI aURI);
 
   /**
    * Maps an extension URI to the ID of the addon it belongs to.
    */
   AString extensionURIToAddonId(in nsIURI aURI);
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -120,17 +120,16 @@
 #include "nsIScrollableFrame.h"
 #include "nsView.h"
 #include "nsViewManager.h"
 #include "nsISelectionController.h"
 #include "nsISelection.h"
 #include "nsIPrompt.h"
 #include "nsIPromptService.h"
 #include "nsIPromptFactory.h"
-#include "nsIAddonPolicyService.h"
 #include "nsIWritablePropertyBag2.h"
 #include "nsIWebNavigation.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsIWebBrowserFind.h"  // For window.find()
 #include "nsIWindowMediator.h"  // For window.find()
 #include "nsComputedDOMStyle.h"
 #include "nsDOMCID.h"
 #include "nsDOMWindowUtils.h"
@@ -11678,17 +11677,17 @@ nsGlobalWindow::HandleIdleActiveEvent()
       NotifyIdleObserver(&idleObserver, false);
     }
   }
 
   return NS_OK;
 }
 
 nsGlobalWindow::SlowScriptResponse
-nsGlobalWindow::ShowSlowScriptDialog(const nsString& aAddonId)
+nsGlobalWindow::ShowSlowScriptDialog()
 {
   MOZ_ASSERT(IsInnerWindow());
 
   nsresult rv;
   AutoJSContext cx;
 
   if (Preferences::GetBool("dom.always_stop_slow_scripts")) {
     return KillSlowScript;
@@ -11728,24 +11727,20 @@ nsGlobalWindow::ShowSlowScriptDialog(con
 
   if (XRE_IsContentProcess() &&
       ProcessHangMonitor::Get()) {
     ProcessHangMonitor::SlowScriptAction action;
     RefPtr<ProcessHangMonitor> monitor = ProcessHangMonitor::Get();
     nsIDocShell* docShell = GetDocShell();
     nsCOMPtr<nsITabChild> child = docShell ? docShell->GetTabChild() : nullptr;
     action = monitor->NotifySlowScript(child,
-                                       filename.get(),
-                                       aAddonId);
+                                       filename.get());
     if (action == ProcessHangMonitor::Terminate) {
       return KillSlowScript;
     }
-    if (action == ProcessHangMonitor::TerminateGlobal) {
-      return KillScriptGlobal;
-    }
 
     if (action == ProcessHangMonitor::StartDebugger) {
       // Spin a nested event loop so that the debugger in the parent can fetch
       // any information it needs. Once the debugger has started, return to the
       // script.
       RefPtr<nsGlobalWindow> outer = GetOuterWindowInternal();
       outer->EnterModalState();
       SpinEventLoopUntil([&]() { return monitor->IsDebuggerStartupComplete(); });
@@ -11772,68 +11767,71 @@ nsGlobalWindow::ShowSlowScriptDialog(con
   if (hasFrame) {
     const char *debugCID = "@mozilla.org/dom/slow-script-debug;1";
     nsCOMPtr<nsISlowScriptDebug> debugService = do_GetService(debugCID, &rv);
     if (NS_SUCCEEDED(rv)) {
       debugService->GetActivationHandler(getter_AddRefs(debugCallback));
     }
   }
 
-  bool failed = false;
-  auto getString = [&] (const char* name,
-                        nsContentUtils::PropertiesFile propFile = nsContentUtils::eDOM_PROPERTIES) {
-    nsAutoString result;
-    nsresult rv = nsContentUtils::GetLocalizedString(
-      propFile, name, result);
-
-    // GetStringFromName can return NS_OK and still give nullptr string
-    failed = failed || NS_FAILED(rv) || result.IsEmpty();
-    return Move(result);
-  };
-
-  bool isAddonScript = !aAddonId.IsEmpty();
-  bool showDebugButton = debugCallback && !isAddonScript;
+  bool showDebugButton = !!debugCallback;
 
   // Get localizable strings
-
-  nsAutoString title, checkboxMsg, debugButton, msg;
-  if (isAddonScript) {
-    title = getString("KillAddonScriptTitle");
-    checkboxMsg = getString("KillAddonScriptGlobalMessage");
-
-    auto appName = getString("brandShortName", nsContentUtils::eBRAND_PROPERTIES);
-
-    nsCOMPtr<nsIAddonPolicyService> aps = do_GetService("@mozilla.org/addons/policy-service;1");
-    nsString addonName;
-    if (!aps || NS_FAILED(aps->GetExtensionName(aAddonId, addonName))) {
-      addonName = aAddonId;
-    }
-
-    const char16_t* params[] = {addonName.get(), appName.get()};
-    rv = nsContentUtils::FormatLocalizedString(
-        nsContentUtils::eDOM_PROPERTIES, "KillAddonScriptMessage",
-        params, msg);
-
-    failed = failed || NS_FAILED(rv);
-  } else {
-    title = getString("KillScriptTitle");
-    checkboxMsg = getString("DontAskAgain");
-
-    if (showDebugButton) {
-      debugButton = getString("DebugScriptButton");
-      msg = getString("KillScriptWithDebugMessage");
-    } else {
-      msg = getString("KillScriptMessage");
-    }
-  }
-
-  auto stopButton = getString("StopScriptButton");
-  auto waitButton = getString("WaitForScriptButton");
-
-  if (failed) {
+  nsAutoString title, msg, stopButton, waitButton, debugButton, neverShowDlg;
+
+  rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
+                                          "KillScriptTitle",
+                                          title);
+
+  nsresult tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
+                                           "StopScriptButton",
+                                           stopButton);
+  if (NS_FAILED(tmp)) {
+    rv = tmp;
+  }
+
+  tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
+                                           "WaitForScriptButton",
+                                           waitButton);
+  if (NS_FAILED(tmp)) {
+    rv = tmp;
+  }
+
+  tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
+                                           "DontAskAgain",
+                                           neverShowDlg);
+  if (NS_FAILED(tmp)) {
+    rv = tmp;
+  }
+
+  if (showDebugButton) {
+    tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
+                                             "DebugScriptButton",
+                                             debugButton);
+    if (NS_FAILED(tmp)) {
+      rv = tmp;
+    }
+
+    tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
+                                             "KillScriptWithDebugMessage",
+                                             msg);
+    if (NS_FAILED(tmp)) {
+      rv = tmp;
+    }
+  }
+  else {
+    tmp = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
+                                             "KillScriptMessage",
+                                             msg);
+    if (NS_FAILED(tmp)) {
+      rv = tmp;
+    }
+  }
+
+  if (NS_FAILED(rv)) {
     NS_ERROR("Failed to get localized strings.");
     return ContinueSlowScript;
   }
 
   // Append file and line number information, if available
   if (filename.get()) {
     nsAutoString scriptLocation;
     // We want to drop the middle part of too-long locations.  We'll
@@ -11871,54 +11869,46 @@ nsGlobalWindow::ShowSlowScriptDialog(con
     if (NS_SUCCEEDED(rv)) {
       msg.AppendLiteral("\n\n");
       msg.Append(scriptLocation);
       msg.Append(':');
       msg.AppendInt(lineno);
     }
   }
 
+  int32_t buttonPressed = 0; // In case the user exits dialog by clicking X.
+  bool neverShowDlgChk = false;
   uint32_t buttonFlags = nsIPrompt::BUTTON_POS_1_DEFAULT +
                          (nsIPrompt::BUTTON_TITLE_IS_STRING *
                           (nsIPrompt::BUTTON_POS_0 + nsIPrompt::BUTTON_POS_1));
 
   // Add a third button if necessary.
   if (showDebugButton)
     buttonFlags += nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_2;
 
-  bool checkboxValue = false;
-  int32_t buttonPressed = 0; // In case the user exits dialog by clicking X.
   {
     // Null out the operation callback while we're re-entering JS here.
     AutoDisableJSInterruptCallback disabler(cx);
-
     // Open the dialog.
     rv = prompt->ConfirmEx(title.get(), msg.get(), buttonFlags,
                            waitButton.get(), stopButton.get(),
-                           debugButton.get(), checkboxMsg.get(),
-                           &checkboxValue, &buttonPressed);
-  }
-
-  if (buttonPressed == 0) {
-    if (checkboxValue && !isAddonScript && NS_SUCCEEDED(rv))
-      return AlwaysContinueSlowScript;
-    return ContinueSlowScript;
-  }
-
+                           debugButton.get(), neverShowDlg.get(),
+                           &neverShowDlgChk, &buttonPressed);
+  }
+
+  if (NS_SUCCEEDED(rv) && (buttonPressed == 0)) {
+    return neverShowDlgChk ? AlwaysContinueSlowScript : ContinueSlowScript;
+  }
   if (buttonPressed == 2) {
-    MOZ_RELEASE_ASSERT(debugCallback);
-
-    rv = debugCallback->HandleSlowScriptDebug(this);
-    return NS_SUCCEEDED(rv) ? ContinueSlowScript : KillSlowScript;
-  }
-
+    if (debugCallback) {
+      rv = debugCallback->HandleSlowScriptDebug(this);
+      return NS_SUCCEEDED(rv) ? ContinueSlowScript : KillSlowScript;
+    }
+  }
   JS_ClearPendingException(cx);
-
-  if (checkboxValue && isAddonScript)
-    return KillScriptGlobal;
   return KillSlowScript;
 }
 
 uint32_t
 nsGlobalWindow::FindInsertionIndex(IdleObserverHolder* aIdleObserver)
 {
   MOZ_ASSERT(IsInnerWindow());
   MOZ_ASSERT(aIdleObserver, "Idle observer not instantiated.");
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -732,20 +732,19 @@ public:
   {
     mAllowScriptsToClose = true;
   }
 
   enum SlowScriptResponse {
     ContinueSlowScript = 0,
     ContinueSlowScriptAndKeepNotifying,
     AlwaysContinueSlowScript,
-    KillSlowScript,
-    KillScriptGlobal
+    KillSlowScript
   };
-  SlowScriptResponse ShowSlowScriptDialog(const nsString& aAddonId);
+  SlowScriptResponse ShowSlowScriptDialog();
 
   // Inner windows only.
   void AddGamepad(uint32_t aIndex, mozilla::dom::Gamepad* aGamepad);
   void RemoveGamepad(uint32_t aIndex);
   void GetGamepads(nsTArray<RefPtr<mozilla::dom::Gamepad> >& aGamepads);
   already_AddRefed<mozilla::dom::Gamepad> GetGamepad(uint32_t aIndex);
   void SetHasSeenGamepadInput(bool aHasSeen);
   bool HasSeenGamepadInput();
--- a/dom/ipc/ContentPrefs.cpp
+++ b/dom/ipc/ContentPrefs.cpp
@@ -49,17 +49,16 @@ const char* mozilla::dom::ContentPrefs::
   "dom.enable_resource_timing",
   "dom.event.handling-user-input-time-limit",
   "dom.event.touch.coalescing.enabled",
   "dom.forms.autocomplete.formautofill",
   "dom.ipc.processPriorityManager.backgroundGracePeriodMS",
   "dom.ipc.processPriorityManager.backgroundPerceivableGracePeriodMS",
   "dom.ipc.useNativeEventProcessing.content",
   "dom.max_chrome_script_run_time",
-  "dom.max_ext_content_script_run_time",
   "dom.max_script_run_time",
   "dom.mozBrowserFramesEnabled",
   "dom.performance.enable_notify_performance_timing",
   "dom.performance.enable_user_timing_logging",
   "dom.storage.testing",
   "dom.url.encode_decode_hash",
   "dom.url.getters_decode_hash",
   "dom.use_watchdog",
--- a/dom/ipc/PProcessHangMonitor.ipdl
+++ b/dom/ipc/PProcessHangMonitor.ipdl
@@ -9,17 +9,16 @@ using base::ProcessId from "base/process
 using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
 
 namespace mozilla {
 
 struct SlowScriptData
 {
   TabId tabId;
   nsCString filename;
-  nsString addonId;
 };
 
 struct PluginHangData
 {
   uint32_t pluginId;
   ProcessId contentProcessId;
 };
 
@@ -31,17 +30,17 @@ union HangData
 
 protocol PProcessHangMonitor
 {
 parent:
   async HangEvidence(HangData data);
   async ClearHang();
 
 child:
-  async TerminateScript(bool aTerminateGlobal);
+  async TerminateScript();
 
   async BeginStartingDebugger();
   async EndStartingDebugger();
 
   async ForcePaint(TabId tabId, uint64_t aLayerObserverEpoch);
 };
 
 } // namespace mozilla
--- a/dom/ipc/ProcessHangMonitor.cpp
+++ b/dom/ipc/ProcessHangMonitor.cpp
@@ -80,32 +80,30 @@ class HangMonitorChild
  public:
   explicit HangMonitorChild(ProcessHangMonitor* aMonitor);
   ~HangMonitorChild() override;
 
   void Bind(Endpoint<PProcessHangMonitorChild>&& aEndpoint);
 
   typedef ProcessHangMonitor::SlowScriptAction SlowScriptAction;
   SlowScriptAction NotifySlowScript(nsITabChild* aTabChild,
-                                    const char* aFileName,
-                                    const nsString& aAddonId);
+                                    const char* aFileName);
   void NotifySlowScriptAsync(TabId aTabId,
-                             const nsCString& aFileName,
-                             const nsString& aAddonId);
+                             const nsCString& aFileName);
 
   bool IsDebuggerStartupComplete();
 
   void NotifyPluginHang(uint32_t aPluginId);
   void NotifyPluginHangAsync(uint32_t aPluginId);
 
   void ClearHang();
   void ClearHangAsync();
   void ClearForcePaint();
 
-  mozilla::ipc::IPCResult RecvTerminateScript(const bool& aTerminateGlobal) override;
+  mozilla::ipc::IPCResult RecvTerminateScript() override;
   mozilla::ipc::IPCResult RecvBeginStartingDebugger() override;
   mozilla::ipc::IPCResult RecvEndStartingDebugger() override;
 
   mozilla::ipc::IPCResult RecvForcePaint(const TabId& aTabId, const uint64_t& aLayerObserverEpoch) override;
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
   void InterruptCallback();
@@ -128,17 +126,16 @@ class HangMonitorChild
   const RefPtr<ProcessHangMonitor> mHangMonitor;
   Monitor mMonitor;
 
   // Main thread-only.
   bool mSentReport;
 
   // These fields must be accessed with mMonitor held.
   bool mTerminateScript;
-  bool mTerminateGlobal;
   bool mStartDebugger;
   bool mFinishedStartingDebugger;
   bool mForcePaint;
   TabId mForcePaintTab;
   MOZ_INIT_OUTSIDE_CTOR uint64_t mForcePaintEpoch;
   JSContext* mContext;
   bool mShutdownDone;
 
@@ -160,22 +157,20 @@ public:
 
   HangMonitoredProcess(HangMonitorParent* aActor,
                        ContentParent* aContentParent)
     : mActor(aActor), mContentParent(aContentParent) {}
 
   NS_IMETHOD GetHangType(uint32_t* aHangType) override;
   NS_IMETHOD GetScriptBrowser(nsIDOMElement** aBrowser) override;
   NS_IMETHOD GetScriptFileName(nsACString& aFileName) override;
-  NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
 
   NS_IMETHOD GetPluginName(nsACString& aPluginName) override;
 
   NS_IMETHOD TerminateScript() override;
-  NS_IMETHOD TerminateGlobal() override;
   NS_IMETHOD BeginStartingDebugger() override;
   NS_IMETHOD EndStartingDebugger() override;
   NS_IMETHOD TerminatePlugin() override;
   NS_IMETHOD UserCanceled() override;
 
   NS_IMETHOD IsReportForBrowser(nsIFrameLoader* aFrameLoader, bool* aResult) override;
 
   // Called when a content process shuts down.
@@ -230,17 +225,17 @@ public:
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
   void SetProcess(HangMonitoredProcess* aProcess) { mProcess = aProcess; }
 
   void Shutdown();
 
   void ForcePaint(dom::TabParent* aTabParent, uint64_t aLayerObserverEpoch);
 
-  void TerminateScript(bool aTerminateGlobal);
+  void TerminateScript();
   void BeginStartingDebugger();
   void EndStartingDebugger();
   void CleanupPluginHang(uint32_t aPluginId, bool aRemoveFiles);
 
   /**
    * Update the dump for the specified plugin. This method is thread-safe and
    * is used to replace a browser minidump with a full minidump. If aDumpId is
    * empty this is a no-op.
@@ -295,17 +290,16 @@ bool HangMonitorParent::sShouldForcePain
 
 /* HangMonitorChild implementation */
 
 HangMonitorChild::HangMonitorChild(ProcessHangMonitor* aMonitor)
  : mHangMonitor(aMonitor),
    mMonitor("HangMonitorChild lock"),
    mSentReport(false),
    mTerminateScript(false),
-   mTerminateGlobal(false),
    mStartDebugger(false),
    mFinishedStartingDebugger(false),
    mForcePaint(false),
    mShutdownDone(false),
    mIPCOpen(true)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   mContext = danger::GetJSContext();
@@ -382,26 +376,22 @@ HangMonitorChild::ActorDestroy(ActorDest
   // We use a task here to ensure that IPDL is finished with this
   // HangMonitorChild before it gets deleted on the main thread.
   Dispatch(NewNonOwningRunnableMethod("HangMonitorChild::ShutdownOnThread",
                                       this,
                                       &HangMonitorChild::ShutdownOnThread));
 }
 
 mozilla::ipc::IPCResult
-HangMonitorChild::RecvTerminateScript(const bool& aTerminateGlobal)
+HangMonitorChild::RecvTerminateScript()
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
   MonitorAutoLock lock(mMonitor);
-  if (aTerminateGlobal) {
-    mTerminateGlobal = true;
-  } else {
-    mTerminateScript = true;
-  }
+  mTerminateScript = true;
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 HangMonitorChild::RecvBeginStartingDebugger()
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
@@ -457,65 +447,58 @@ HangMonitorChild::Bind(Endpoint<PProcess
   sInstance = this;
 
   DebugOnly<bool> ok = aEndpoint.Bind(this);
   MOZ_ASSERT(ok);
 }
 
 void
 HangMonitorChild::NotifySlowScriptAsync(TabId aTabId,
-                                        const nsCString& aFileName,
-                                        const nsString& aAddonId)
+                                        const nsCString& aFileName)
 {
   if (mIPCOpen) {
-    Unused << SendHangEvidence(SlowScriptData(aTabId, aFileName, aAddonId));
+    Unused << SendHangEvidence(SlowScriptData(aTabId, aFileName));
   }
 }
 
 HangMonitorChild::SlowScriptAction
 HangMonitorChild::NotifySlowScript(nsITabChild* aTabChild,
-                                   const char* aFileName,
-                                   const nsString& aAddonId)
+                                   const char* aFileName)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
 
   mSentReport = true;
 
   {
     MonitorAutoLock lock(mMonitor);
 
     if (mTerminateScript) {
       mTerminateScript = false;
       return SlowScriptAction::Terminate;
     }
 
-    if (mTerminateGlobal) {
-      mTerminateGlobal = false;
-      return SlowScriptAction::TerminateGlobal;
-    }
-
     if (mStartDebugger) {
       mStartDebugger = false;
       return SlowScriptAction::StartDebugger;
     }
   }
 
   TabId id;
   if (aTabChild) {
     RefPtr<TabChild> tabChild = static_cast<TabChild*>(aTabChild);
     id = tabChild->GetTabId();
   }
   nsAutoCString filename(aFileName);
 
-  Dispatch(NewNonOwningRunnableMethod<TabId, nsCString, nsString>(
+  Dispatch(NewNonOwningRunnableMethod<TabId, nsCString>(
     "HangMonitorChild::NotifySlowScriptAsync",
     this,
     &HangMonitorChild::NotifySlowScriptAsync,
     id,
-    filename, aAddonId));
+    filename));
   return SlowScriptAction::Continue;
 }
 
 bool
 HangMonitorChild::IsDebuggerStartupComplete()
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
 
@@ -566,17 +549,16 @@ HangMonitorChild::ClearHang()
     // bounce to background thread
     Dispatch(NewNonOwningRunnableMethod("HangMonitorChild::ClearHangAsync",
                                         this,
                                         &HangMonitorChild::ClearHangAsync));
 
     MonitorAutoLock lock(mMonitor);
     mSentReport = false;
     mTerminateScript = false;
-    mTerminateGlobal = false;
     mStartDebugger = false;
     mFinishedStartingDebugger = false;
   }
 }
 
 void
 HangMonitorChild::ClearHangAsync()
 {
@@ -849,22 +831,22 @@ HangMonitorParent::RecvClearHang()
   NS_DispatchToMainThread(
     mMainThreadTaskFactory.NewRunnableMethod(
       &HangMonitorParent::ClearHangNotification));
 
   return IPC_OK();
 }
 
 void
-HangMonitorParent::TerminateScript(bool aTerminateGlobal)
+HangMonitorParent::TerminateScript()
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
   if (mIPCOpen) {
-    Unused << SendTerminateScript(aTerminateGlobal);
+    Unused << SendTerminateScript();
   }
 }
 
 void
 HangMonitorParent::BeginStartingDebugger()
 {
   MOZ_RELEASE_ASSERT(IsOnThread());
 
@@ -969,28 +951,16 @@ HangMonitoredProcess::GetScriptFileName(
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   aFileName = mHangData.get_SlowScriptData().filename();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-HangMonitoredProcess::GetAddonId(nsAString& aAddonId)
-{
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-  if (mHangData.type() != HangData::TSlowScriptData) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  aAddonId = mHangData.get_SlowScriptData().addonId();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 HangMonitoredProcess::GetPluginName(nsACString& aPluginName)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   if (mHangData.type() != HangData::TPluginHangData) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   uint32_t id = mHangData.get_PluginHangData().pluginId();
@@ -1013,38 +983,19 @@ HangMonitoredProcess::TerminateScript()
     return NS_ERROR_UNEXPECTED;
   }
 
   if (!mActor) {
     return NS_ERROR_UNEXPECTED;
   }
 
   ProcessHangMonitor::Get()->Dispatch(
-    NewNonOwningRunnableMethod<bool>("HangMonitorParent::TerminateScript",
-                                     mActor,
-                                     &HangMonitorParent::TerminateScript, false));
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-HangMonitoredProcess::TerminateGlobal()
-{
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
-  if (mHangData.type() != HangData::TSlowScriptData) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  if (!mActor) {
-    return NS_ERROR_UNEXPECTED;
-  }
-
-  ProcessHangMonitor::Get()->Dispatch(
-    NewNonOwningRunnableMethod<bool>("HangMonitorParent::TerminateScript",
-                                     mActor,
-                                     &HangMonitorParent::TerminateScript, true));
+    NewNonOwningRunnableMethod("HangMonitorParent::TerminateScript",
+                               mActor,
+                               &HangMonitorParent::TerminateScript));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HangMonitoredProcess::BeginStartingDebugger()
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   if (mHangData.type() != HangData::TSlowScriptData) {
@@ -1209,21 +1160,20 @@ ProcessHangMonitor::Observe(nsISupports*
       obs->RemoveObserver(this, "xpcom-shutdown");
     }
   }
   return NS_OK;
 }
 
 ProcessHangMonitor::SlowScriptAction
 ProcessHangMonitor::NotifySlowScript(nsITabChild* aTabChild,
-                                     const char* aFileName,
-                                     const nsString& aAddonId)
+                                     const char* aFileName)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
-  return HangMonitorChild::Get()->NotifySlowScript(aTabChild, aFileName, aAddonId);
+  return HangMonitorChild::Get()->NotifySlowScript(aTabChild, aFileName);
 }
 
 bool
 ProcessHangMonitor::IsDebuggerStartupComplete()
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   return HangMonitorChild::Get()->IsDebuggerStartupComplete();
 }
--- a/dom/ipc/ProcessHangMonitor.h
+++ b/dom/ipc/ProcessHangMonitor.h
@@ -10,17 +10,16 @@
 #include "mozilla/AlreadyAddRefed.h"
 #include "mozilla/Atomics.h"
 #include "nsCOMPtr.h"
 #include "nsIObserver.h"
 
 class nsIRunnable;
 class nsITabChild;
 class nsIThread;
-class nsString;
 
 namespace mozilla {
 
 namespace dom {
 class ContentParent;
 class TabParent;
 } // namespace dom
 
@@ -48,22 +47,20 @@ class ProcessHangMonitor final
   static void ForcePaint(PProcessHangMonitorParent* aParent,
                          dom::TabParent* aTab,
                          uint64_t aLayerObserverEpoch);
   static void ClearForcePaint();
 
   enum SlowScriptAction {
     Continue,
     Terminate,
-    StartDebugger,
-    TerminateGlobal,
+    StartDebugger
   };
   SlowScriptAction NotifySlowScript(nsITabChild* aTabChild,
-                                    const char* aFileName,
-                                    const nsString& aAddonId);
+                                    const char* aFileName);
 
   void NotifyPluginHang(uint32_t aPluginId);
 
   bool IsDebuggerStartupComplete();
 
   void InitiateCPOWTimeout();
   bool ShouldTimeOutCPOWs();
 
--- a/dom/ipc/nsIHangReport.idl
+++ b/dom/ipc/nsIHangReport.idl
@@ -27,35 +27,29 @@ interface nsIHangReport : nsISupports
   // The type of hang being reported: SLOW_SCRIPT or PLUGIN_HANG.
   readonly attribute unsigned long hangType;
 
   // For SLOW_SCRIPT reports, these fields contain information about the
   // slow script.
   // Only valid for SLOW_SCRIPT reports.
   readonly attribute nsIDOMElement scriptBrowser;
   readonly attribute ACString scriptFileName;
-  readonly attribute AString addonId;
 
   // For PLUGIN_HANGs, this field contains information about the plugin.
   // Only valid for PLUGIN_HANG reports.
   readonly attribute ACString pluginName;
 
   // Called by front end code when user ignores or cancels
   // the notification.
   void userCanceled();
 
   // Terminate the slow script if it is still running.
   // Only valid for SLOW_SCRIPT reports.
   void terminateScript();
 
-  // Terminate all scripts on the global that triggered the slow script
-  // warning.
-  // Only valid for SLOW_SCRIPT reports.
-  void terminateGlobal();
-
   // Terminate the plugin if it is still hung.
   // Only valid for PLUGIN_HANG reports.
   void terminatePlugin();
 
   // Ask the content process to start up the slow script debugger.
   // Only valid for SLOW_SCRIPT reports.
   void beginStartingDebugger();
 
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -1,22 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 KillScriptTitle=Warning: Unresponsive script
 KillScriptMessage=A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.
 KillScriptWithDebugMessage=A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.
 KillScriptLocation=Script: %S
-
-KillAddonScriptTitle=Warning: Unresponsive add-on script
-# LOCALIZATION NOTE (KillAddonScriptMessage): The first %S is the name of an add-on. The second %S is the name of the application (e.g., Firefox).
-KillAddonScriptMessage=A script from the add-on “%S” is running on this page, and making %S unresponsive.\n\nIt may be busy, or it may have stopped responsing permanently. You can stop the script now, or you can continue to see if it will complete.
-KillAddonScriptGlobalMessage=Prevent the add-on script from running on this page until it next reloads.
-
 StopScriptButton=Stop script
 DebugScriptButton=Debug script
 WaitForScriptButton=Continue
 DontAskAgain=&Don’t ask me again
 JSURLLoadBlockedWarning=Attempt to load a javascript: URL from one host\nin a window displaying content from another host\nwas blocked by the security manager.
 WindowCloseBlockedWarning=Scripts may not close windows that were not opened by script.
 OnBeforeUnloadTitle=Are you sure?
 OnBeforeUnloadMessage=This page is asking you to confirm that you want to leave - data you have entered may not be saved.
--- a/dom/webidl/WebExtensionPolicy.webidl
+++ b/dom/webidl/WebExtensionPolicy.webidl
@@ -30,22 +30,16 @@ interface WebExtensionPolicy {
   /**
    * The file: or jar: URL to use for the base of the extension's
    * moz-extension: URL root.
    */
   [Constant]
   readonly attribute ByteString baseURL;
 
   /**
-   * The extension's user-visible name.
-   */
-  [Constant]
-  readonly attribute DOMString name;
-
-  /**
    * The content security policy string to apply to all pages loaded from the
    * extension's moz-extension: protocol.
    */
   [Constant]
   readonly attribute DOMString contentSecurityPolicy;
 
 
   /**
@@ -143,18 +137,16 @@ interface WebExtensionPolicy {
 
 dictionary WebExtensionInit {
   required DOMString id;
 
   required ByteString mozExtensionHostname;
 
   required DOMString baseURL;
 
-  DOMString name = "";
-
   required WebExtensionLocalizeCallback localizeCallback;
 
   required MatchPatternSet allowedOrigins;
 
   sequence<DOMString> permissions = [];
 
   sequence<MatchGlob> webAccessibleResources = [];
 
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -56,18 +56,16 @@
 #include "AccessCheck.h"
 #include "nsGlobalWindow.h"
 #include "nsAboutProtocolUtils.h"
 
 #include "GeckoProfiler.h"
 #include "nsIInputStream.h"
 #include "nsIXULRuntime.h"
 #include "nsJSPrincipals.h"
-#include "ExpandedPrincipal.h"
-#include "SystemPrincipal.h"
 
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #endif
 
 #ifdef XP_WIN
 #include <windows.h>
 #endif
@@ -224,17 +222,16 @@ class Watchdog
     bool mHibernating;
     bool mInitialized;
     bool mShuttingDown;
     mozilla::Atomic<int32_t> mMinScriptRunTimeSeconds;
 };
 
 #define PREF_MAX_SCRIPT_RUN_TIME_CONTENT "dom.max_script_run_time"
 #define PREF_MAX_SCRIPT_RUN_TIME_CHROME "dom.max_chrome_script_run_time"
-#define PREF_MAX_SCRIPT_RUN_TIME_EXT_CONTENT "dom.max_ext_content_script_run_time"
 
 class WatchdogManager : public nsIObserver
 {
   public:
 
     NS_DECL_ISUPPORTS
     explicit WatchdogManager(XPCJSContext* aContext) : mContext(aContext)
                                                      , mContextState(CONTEXT_INACTIVE)
@@ -245,17 +242,16 @@ class WatchdogManager : public nsIObserv
 
         // Enable the watchdog, if appropriate.
         RefreshWatchdog();
 
         // Register ourselves as an observer to get updates on the pref.
         mozilla::Preferences::AddStrongObserver(this, "dom.use_watchdog");
         mozilla::Preferences::AddStrongObserver(this, PREF_MAX_SCRIPT_RUN_TIME_CONTENT);
         mozilla::Preferences::AddStrongObserver(this, PREF_MAX_SCRIPT_RUN_TIME_CHROME);
-        mozilla::Preferences::AddStrongObserver(this, PREF_MAX_SCRIPT_RUN_TIME_EXT_CONTENT);
     }
 
   protected:
 
     virtual ~WatchdogManager()
     {
         // Shutting down the watchdog requires context-switching to the watchdog
         // thread, which isn't great to do in a destructor. So we require
@@ -265,17 +261,16 @@ class WatchdogManager : public nsIObserv
 
   public:
 
     void Shutdown()
     {
         mozilla::Preferences::RemoveObserver(this, "dom.use_watchdog");
         mozilla::Preferences::RemoveObserver(this, PREF_MAX_SCRIPT_RUN_TIME_CONTENT);
         mozilla::Preferences::RemoveObserver(this, PREF_MAX_SCRIPT_RUN_TIME_CHROME);
-        mozilla::Preferences::RemoveObserver(this, PREF_MAX_SCRIPT_RUN_TIME_EXT_CONTENT);
     }
 
     NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
                        const char16_t* aData) override
     {
         RefreshWatchdog();
         return NS_OK;
     }
@@ -341,20 +336,17 @@ class WatchdogManager : public nsIObserv
 
         if (mWatchdog) {
             int32_t contentTime = Preferences::GetInt(PREF_MAX_SCRIPT_RUN_TIME_CONTENT, 10);
             if (contentTime <= 0)
                 contentTime = INT32_MAX;
             int32_t chromeTime = Preferences::GetInt(PREF_MAX_SCRIPT_RUN_TIME_CHROME, 20);
             if (chromeTime <= 0)
                 chromeTime = INT32_MAX;
-            int32_t extTime = Preferences::GetInt(PREF_MAX_SCRIPT_RUN_TIME_EXT_CONTENT, 5);
-            if (extTime <= 0)
-                extTime = INT32_MAX;
-            mWatchdog->SetMinScriptRunTimeSeconds(std::min({contentTime, chromeTime, extTime}));
+            mWatchdog->SetMinScriptRunTimeSeconds(std::min(contentTime, chromeTime));
         }
     }
 
     void StartWatchdog()
     {
         MOZ_ASSERT(!mWatchdog);
         mWatchdog = new Watchdog(this);
         mWatchdog->Init();
@@ -466,43 +458,16 @@ XPCJSContext::ActivityCallback(void* arg
     if (!active) {
         ProcessHangMonitor::ClearHang();
     }
 
     XPCJSContext* self = static_cast<XPCJSContext*>(arg);
     self->mWatchdogManager->RecordContextActivity(active);
 }
 
-static inline bool
-IsWebExtensionPrincipal(nsIPrincipal* principal, nsAString& addonId)
-{
-    return (NS_SUCCEEDED(principal->GetAddonId(addonId)) &&
-            !addonId.IsEmpty());
-}
-
-static bool
-IsWebExtensionContentScript(BasePrincipal* principal, nsAString& addonId)
-{
-    if (!principal->Is<ExpandedPrincipal>()) {
-        return false;
-    }
-
-    auto expanded = principal->As<ExpandedPrincipal>();
-
-    nsTArray<nsCOMPtr<nsIPrincipal>>* principals;
-    expanded->GetWhiteList(&principals);
-    for (auto prin : *principals) {
-        if (IsWebExtensionPrincipal(prin, addonId)) {
-            return true;
-        }
-    }
-
-    return false;
-}
-
 // static
 bool
 XPCJSContext::InterruptCallback(JSContext* cx)
 {
     XPCJSContext* self = XPCJSContext::Get();
 
     // Now is a good time to turn on profiling if it's pending.
     profiler_js_interrupt_callback();
@@ -522,33 +487,20 @@ XPCJSContext::InterruptCallback(JSContex
     // has finished bootstrapping. Avoid crashing in nsContentUtils below.
     if (!nsContentUtils::IsInitialized())
         return true;
 
     // This is at least the second interrupt callback we've received since
     // returning to the event loop. See how long it's been, and what the limit
     // is.
     TimeDuration duration = TimeStamp::NowLoRes() - self->mSlowScriptCheckpoint;
-    int32_t limit;
-
-    nsString addonId;
-    const char* prefName;
-
-    auto principal = BasePrincipal::Cast(nsContentUtils::SubjectPrincipal(cx));
-    bool chrome = principal->Is<SystemPrincipal>();
-    if (chrome) {
-        prefName = PREF_MAX_SCRIPT_RUN_TIME_CHROME;
-        limit = Preferences::GetInt(prefName, 20);
-    } else if (IsWebExtensionContentScript(principal, addonId)) {
-        prefName = PREF_MAX_SCRIPT_RUN_TIME_EXT_CONTENT;
-        limit = Preferences::GetInt(prefName, 5);
-    } else {
-        prefName = PREF_MAX_SCRIPT_RUN_TIME_CONTENT;
-        limit = Preferences::GetInt(prefName, 10);
-    }
+    bool chrome = nsContentUtils::IsSystemCaller(cx);
+    const char* prefName = chrome ? PREF_MAX_SCRIPT_RUN_TIME_CHROME
+                                  : PREF_MAX_SCRIPT_RUN_TIME_CONTENT;
+    int32_t limit = Preferences::GetInt(prefName, chrome ? 20 : 10);
 
     // If there's no limit, or we're within the limit, let it go.
     if (limit == 0 || duration.ToSeconds() < limit / 2.0)
         return true;
 
     self->mSlowScriptActualWait += duration;
 
     // In order to guard against time changes or laptops going to sleep, we
@@ -605,44 +557,22 @@ XPCJSContext::InterruptCallback(JSContex
     // Accumulate slow script invokation delay.
     if (!chrome && !self->mTimeoutAccumulated) {
       uint32_t delay = uint32_t(self->mSlowScriptActualWait.ToMilliseconds() - (limit * 1000.0));
       Telemetry::Accumulate(Telemetry::SLOW_SCRIPT_NOTIFY_DELAY, delay);
       self->mTimeoutAccumulated = true;
     }
 
     // Show the prompt to the user, and kill if requested.
-    nsGlobalWindow::SlowScriptResponse response = win->ShowSlowScriptDialog(addonId);
+    nsGlobalWindow::SlowScriptResponse response = win->ShowSlowScriptDialog();
     if (response == nsGlobalWindow::KillSlowScript) {
         if (Preferences::GetBool("dom.global_stop_script", true))
             xpc::Scriptability::Get(global).Block();
         return false;
     }
-    if (response == nsGlobalWindow::KillScriptGlobal) {
-        nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-
-        if (!IsSandbox(global) || !obs)
-            return false;
-
-        // Notify the extensions framework that the sandbox should be killed.
-        nsIXPConnect* xpc = nsContentUtils::XPConnect();
-        JS::RootedObject wrapper(cx, JS_NewPlainObject(cx));
-        nsCOMPtr<nsISupports> supports;
-
-        // Store the sandbox object on the wrappedJSObject property of the
-        // subject so that JS recipients can access the JS value directly.
-        if (!wrapper ||
-            !JS_DefineProperty(cx, wrapper, "wrappedJSObject", global, JSPROP_ENUMERATE) ||
-            NS_FAILED(xpc->WrapJS(cx, wrapper, NS_GET_IID(nsISupports), getter_AddRefs(supports)))) {
-            return false;
-        }
-
-        obs->NotifyObservers(supports, "kill-content-script-sandbox", nullptr);
-        return false;
-    }
 
     // The user chose to continue the script. Reset the timer, and disable this
     // machinery with a pref of the user opted out of future slow-script dialogs.
     if (response != nsGlobalWindow::ContinueSlowScriptAndKeepNotifying)
         self->mSlowScriptCheckpoint = TimeStamp::NowLoRes();
 
     if (response == nsGlobalWindow::AlwaysContinueSlowScript)
         Preferences::SetInt(prefName, 0);
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -319,35 +319,35 @@ bool CompartmentPrivate::TryParseLocatio
 
 static bool
 PrincipalImmuneToScriptPolicy(nsIPrincipal* aPrincipal)
 {
     // System principal gets a free pass.
     if (nsXPConnect::SecurityManager()->IsSystemPrincipal(aPrincipal))
         return true;
 
-    auto principal = BasePrincipal::Cast(aPrincipal);
-
     // ExpandedPrincipal gets a free pass.
-    if (principal->Is<ExpandedPrincipal>()) {
+    nsCOMPtr<nsIExpandedPrincipal> ep = do_QueryInterface(aPrincipal);
+    if (ep)
         return true;
-    }
-
-    // WebExtension principals get a free pass.
-    nsString addonId;
-    if (IsWebExtensionPrincipal(principal, addonId)) {
-        return true;
-    }
 
     // Check whether our URI is an "about:" URI that allows scripts.  If it is,
     // we need to allow JS to run.
     nsCOMPtr<nsIURI> principalURI;
     aPrincipal->GetURI(getter_AddRefs(principalURI));
     MOZ_ASSERT(principalURI);
 
+    // WebExtension principals gets a free pass.
+    nsString addonId;
+    aPrincipal->GetAddonId(addonId);
+    bool isWebExtension = !addonId.IsEmpty();
+    if (isWebExtension) {
+        return true;
+    }
+
     bool isAbout;
     nsresult rv = principalURI->SchemeIs("about", &isAbout);
     if (NS_SUCCEEDED(rv) && isAbout) {
         nsCOMPtr<nsIAboutModule> module;
         rv = NS_GetAboutModule(principalURI, getter_AddRefs(module));
         if (NS_SUCCEEDED(rv)) {
             uint32_t flags;
             rv = module->GetURIFlags(principalURI, &flags);
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3162,17 +3162,16 @@ pref("viewmanager.do_doublebuffering", t
 pref("gestures.enable_single_finger_input", true);
 
 pref("editor.resizing.preserve_ratio",       true);
 pref("editor.positioning.offset",            0);
 
 pref("dom.use_watchdog", true);
 pref("dom.max_chrome_script_run_time", 20);
 pref("dom.max_script_run_time", 10);
-pref("dom.max_ext_content_script_run_time", 5);
 
 // Stop all scripts in a compartment when the "stop script" dialog is used.
 pref("dom.global_stop_script", true);
 
 // Time (milliseconds) between throttled idle callbacks.
 pref("dom.idle_period.throttled_length", 10000);
 
 // The amount of idle time (milliseconds) reserved for a long idle period
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -988,17 +988,16 @@ this.Extension = class extends Extension
 
   // Representation of the extension to send to content
   // processes. This should include anything the content process might
   // need.
   serialize() {
     return {
       id: this.id,
       uuid: this.uuid,
-      name: this.name,
       instanceId: this.instanceId,
       manifest: this.manifest,
       resourceURL: this.resourceURL,
       baseURL: this.baseURI.spec,
       contentScripts: this.contentScripts,
       webAccessibleResources: this.webAccessibleResources.map(res => res.glob),
       whiteListedHosts: this.whiteListedHosts.patterns.map(pat => pat.pattern),
       localeData: this.localeData.serialize(),
--- a/toolkit/components/extensions/ExtensionContent.jsm
+++ b/toolkit/components/extensions/ExtensionContent.jsm
@@ -431,18 +431,16 @@ class ContentScriptContextChild extends 
 
       Cu.evalInSandbox(`
         window.JSON = JSON;
         window.XMLHttpRequest = XMLHttpRequest;
         window.fetch = fetch;
       `, this.sandbox);
     }
 
-    DocumentManager.sandboxContexts.set(this.sandbox, this);
-
     Object.defineProperty(this, "principal", {
       value: Cu.getObjectPrincipal(this.sandbox),
       enumerable: true,
       configurable: true,
     });
 
     this.url = contentWindow.location.href;
 
@@ -477,18 +475,16 @@ class ContentScriptContextChild extends 
     if (script.requiresCleanup) {
       this.scripts.push(script);
     }
   }
 
   close() {
     super.unload();
 
-    DocumentManager.sandboxContexts.delete(this.sandbox);
-
     if (this.contentWindow) {
       for (let script of this.scripts) {
         script.cleanup(this.contentWindow);
       }
 
       // Overwrite the content script APIs with an empty object if the APIs objects are still
       // defined in the content window (bug 1214658).
       if (this.isExtensionPage) {
@@ -527,34 +523,30 @@ defineLazyGetter(ContentScriptContextChi
 });
 
 // Responsible for creating ExtensionContexts and injecting content
 // scripts into them when new documents are created.
 DocumentManager = {
   // Map[windowId -> Map[ExtensionChild -> ContentScriptContextChild]]
   contexts: new Map(),
 
-  sandboxContexts: new WeakMap(),
-
   initialized: false,
 
   lazyInit() {
     if (this.initialized) {
       return;
     }
     this.initialized = true;
 
     Services.obs.addObserver(this, "inner-window-destroyed");
-    Services.obs.addObserver(this, "kill-content-script-sandbox");
     Services.obs.addObserver(this, "memory-pressure");
   },
 
   uninit() {
     Services.obs.removeObserver(this, "inner-window-destroyed");
-    Services.obs.removeObserver(this, "kill-content-script-sandbox");
     Services.obs.removeObserver(this, "memory-pressure");
   },
 
   observers: {
     "inner-window-destroyed"(subject, topic, data) {
       let windowId = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
 
       MessageChannel.abortResponses({innerWindowID: windowId});
@@ -564,23 +556,16 @@ DocumentManager = {
         let extensions = this.contexts.get(windowId);
         for (let context of extensions.values()) {
           context.close();
         }
 
         this.contexts.delete(windowId);
       }
     },
-    "kill-content-script-sandbox"(subject) {
-      let sandbox = subject.wrappedJSObject;
-      let context = this.sandboxContexts.get(sandbox);
-      if (context) {
-        context.close();
-      }
-    },
     "memory-pressure"(subject, topic, data) {
       let timeout = data === "heap-minimize" ? 0 : undefined;
 
       for (let cache of ChromeUtils.nondeterministicGetWeakSetKeys(scriptCaches)) {
         cache.clear(timeout);
       }
     },
   },
--- a/toolkit/components/extensions/ExtensionPolicyService.cpp
+++ b/toolkit/components/extensions/ExtensionPolicyService.cpp
@@ -373,27 +373,16 @@ ExtensionPolicyService::AddonMayLoadURI(
   if (WebExtensionPolicy* policy = GetByID(aAddonId)) {
     *aResult = policy->CanAccessURI(aURI, aExplicit);
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 nsresult
-ExtensionPolicyService::GetExtensionName(const nsAString& aAddonId,
-                                         nsAString& aName)
-{
-  if (WebExtensionPolicy* policy = GetByID(aAddonId)) {
-    aName.Assign(policy->Name());
-    return NS_OK;
-  }
-  return NS_ERROR_INVALID_ARG;
-}
-
-nsresult
 ExtensionPolicyService::ExtensionURILoadableByAnyone(nsIURI* aURI, bool* aResult)
 {
   URLInfo url(aURI);
   if (WebExtensionPolicy* policy = GetByURL(url)) {
     *aResult = policy->IsPathWebAccessible(url.FilePath());
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
--- a/toolkit/components/extensions/WebExtensionPolicy.cpp
+++ b/toolkit/components/extensions/WebExtensionPolicy.cpp
@@ -84,17 +84,16 @@ Proto()
  * WebExtensionPolicy
  *****************************************************************************/
 
 WebExtensionPolicy::WebExtensionPolicy(GlobalObject& aGlobal,
                                        const WebExtensionInit& aInit,
                                        ErrorResult& aRv)
   : mId(NS_AtomizeMainThread(aInit.mId))
   , mHostname(aInit.mMozExtensionHostname)
-  , mName(aInit.mName)
   , mContentSecurityPolicy(aInit.mContentSecurityPolicy)
   , mLocalizeCallback(aInit.mLocalizeCallback)
   , mPermissions(new AtomSet(aInit.mPermissions))
   , mHostPermissions(aInit.mAllowedOrigins)
 {
   mWebAccessiblePaths.AppendElements(aInit.mWebAccessibleResources);
 
   if (!aInit.mBackgroundScripts.IsNull()) {
--- a/toolkit/components/extensions/WebExtensionPolicy.h
+++ b/toolkit/components/extensions/WebExtensionPolicy.h
@@ -77,25 +77,16 @@ public:
   {
     return mPermissions->Contains(aPermission);
   }
 
   nsCString BackgroundPageHTML() const;
 
   void Localize(const nsAString& aInput, nsString& aResult) const;
 
-  const nsString& Name() const
-  {
-    return mName;
-  }
-  void GetName(nsAString& aName) const
-  {
-    aName = mName;
-  }
-
   const nsString& ContentSecurityPolicy() const
   {
     return mContentSecurityPolicy;
   }
   void GetContentSecurityPolicy(nsAString& aCSP) const
   {
     aCSP = mContentSecurityPolicy;
   }
@@ -157,17 +148,16 @@ private:
   bool Disable();
 
   nsCOMPtr<nsISupports> mParent;
 
   nsCOMPtr<nsIAtom> mId;
   nsCString mHostname;
   nsCOMPtr<nsIURI> mBaseURI;
 
-  nsString mName;
   nsString mContentSecurityPolicy;
 
   bool mActive = false;
 
   RefPtr<WebExtensionLocalizeCallback> mLocalizeCallback;
 
   RefPtr<AtomSet> mPermissions;
   RefPtr<MatchPatternSet> mHostPermissions;
--- a/toolkit/components/extensions/extension-process-script.js
+++ b/toolkit/components/extensions/extension-process-script.js
@@ -312,17 +312,16 @@ ExtensionManager = {
         localizeCallback = str => extensions.get(policy).localize(str);
         allowedOrigins = new MatchPatternSet(extension.whiteListedHosts);
         webAccessibleResources = extension.webAccessibleResources.map(host => new MatchGlob(host));
       }
 
       policy = new WebExtensionPolicy({
         id: extension.id,
         mozExtensionHostname: extension.uuid,
-        name: extension.name,
         baseURL: extension.resourceURL,
 
         permissions: Array.from(extension.permissions),
         allowedOrigins,
         webAccessibleResources,
 
         contentSecurityPolicy: extension.manifest.content_security_policy,