Merge mozilla-central to mozilla-inbound
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 29 Jan 2019 12:55:03 +0200
changeset 455977 00a1fd64f704a8e73502f5857b1c47b1ef0363ef
parent 455976 38b4179568c71c380cb83d26c54d4f088a7295d3 (current diff)
parent 455871 815f7149b30b27f79395d9a0155c1ebeb4fca8b5 (diff)
child 455978 a34a2ae476a2384c771523a8bcd703451b0ab18a
push id77062
push usershindli@mozilla.com
push dateTue, 29 Jan 2019 21:48:20 +0000
treeherderautoland@7418e2fbef99 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone67.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
Merge mozilla-central to mozilla-inbound
browser/base/content/test/plugins/xbl/.eslintrc.js
browser/base/content/test/plugins/xbl/blockNoPlugins.xml
browser/base/content/test/plugins/xbl/blockPluginHard.xml
browser/base/content/test/plugins/xbl/blockPluginInfoURL.xml
browser/base/content/test/plugins/xbl/blockPluginVulnerableNoUpdate.xml
browser/base/content/test/plugins/xbl/blockPluginVulnerableUpdatable.xml
browser/base/content/test/plugins/xbl/blocklist_proxy.js
browser/base/content/test/plugins/xbl/browser.ini
browser/base/content/test/plugins/xbl/browser_CTP_context_menu.js
browser/base/content/test/plugins/xbl/browser_CTP_crashreporting.js
browser/base/content/test/plugins/xbl/browser_CTP_drag_drop.js
browser/base/content/test/plugins/xbl/browser_CTP_favorfallback.js
browser/base/content/test/plugins/xbl/browser_CTP_hide_overlay.js
browser/base/content/test/plugins/xbl/browser_CTP_iframe.js
browser/base/content/test/plugins/xbl/browser_CTP_nonplugins.js
browser/base/content/test/plugins/xbl/browser_CTP_outsideScrollArea.js
browser/base/content/test/plugins/xbl/browser_CTP_overlay_styles.js
browser/base/content/test/plugins/xbl/browser_CTP_resize.js
browser/base/content/test/plugins/xbl/browser_CTP_shouldShowOverlay.js
browser/base/content/test/plugins/xbl/browser_CTP_zoom.js
browser/base/content/test/plugins/xbl/browser_blocking.js
browser/base/content/test/plugins/xbl/browser_blocklist_content.js
browser/base/content/test/plugins/xbl/browser_bug743421.js
browser/base/content/test/plugins/xbl/browser_bug744745.js
browser/base/content/test/plugins/xbl/browser_bug787619.js
browser/base/content/test/plugins/xbl/browser_bug797677.js
browser/base/content/test/plugins/xbl/browser_bug812562.js
browser/base/content/test/plugins/xbl/browser_bug818118.js
browser/base/content/test/plugins/xbl/browser_bug820497.js
browser/base/content/test/plugins/xbl/browser_clearplugindata.html
browser/base/content/test/plugins/xbl/browser_clearplugindata.js
browser/base/content/test/plugins/xbl/browser_clearplugindata_noage.html
browser/base/content/test/plugins/xbl/browser_enable_DRM_prompt.js
browser/base/content/test/plugins/xbl/browser_globalplugin_crashinfobar.js
browser/base/content/test/plugins/xbl/browser_iterate_hidden_plugins.js
browser/base/content/test/plugins/xbl/browser_pluginCrashCommentAndURL.js
browser/base/content/test/plugins/xbl/browser_pluginCrashReportNonDeterminism.js
browser/base/content/test/plugins/xbl/browser_plugin_reloading.js
browser/base/content/test/plugins/xbl/browser_pluginnotification.js
browser/base/content/test/plugins/xbl/browser_private_browsing_eme_persistent_state.js
browser/base/content/test/plugins/xbl/browser_private_clicktoplay.js
browser/base/content/test/plugins/xbl/browser_subframe_access_hidden_plugins.js
browser/base/content/test/plugins/xbl/empty_file.html
browser/base/content/test/plugins/xbl/plugin_add_dynamically.html
browser/base/content/test/plugins/xbl/plugin_alternate_content.html
browser/base/content/test/plugins/xbl/plugin_big.html
browser/base/content/test/plugins/xbl/plugin_both.html
browser/base/content/test/plugins/xbl/plugin_both2.html
browser/base/content/test/plugins/xbl/plugin_bug744745.html
browser/base/content/test/plugins/xbl/plugin_bug749455.html
browser/base/content/test/plugins/xbl/plugin_bug787619.html
browser/base/content/test/plugins/xbl/plugin_bug797677.html
browser/base/content/test/plugins/xbl/plugin_bug820497.html
browser/base/content/test/plugins/xbl/plugin_clickToPlayAllow.html
browser/base/content/test/plugins/xbl/plugin_clickToPlayDeny.html
browser/base/content/test/plugins/xbl/plugin_crashCommentAndURL.html
browser/base/content/test/plugins/xbl/plugin_favorfallback.html
browser/base/content/test/plugins/xbl/plugin_hidden_to_visible.html
browser/base/content/test/plugins/xbl/plugin_iframe.html
browser/base/content/test/plugins/xbl/plugin_outsideScrollArea.html
browser/base/content/test/plugins/xbl/plugin_overlay_styles.html
browser/base/content/test/plugins/xbl/plugin_shouldShowOverlay.html
browser/base/content/test/plugins/xbl/plugin_simple_blank.swf
browser/base/content/test/plugins/xbl/plugin_small.html
browser/base/content/test/plugins/xbl/plugin_small_2.html
browser/base/content/test/plugins/xbl/plugin_syncRemoved.html
browser/base/content/test/plugins/xbl/plugin_test.html
browser/base/content/test/plugins/xbl/plugin_test2.html
browser/base/content/test/plugins/xbl/plugin_test3.html
browser/base/content/test/plugins/xbl/plugin_two_types.html
browser/base/content/test/plugins/xbl/plugin_unknown.html
browser/base/content/test/plugins/xbl/plugin_zoom.html
browser/components/search/searchplugins/leo_ende_de-rm.xml
browser/locales/en-US/chrome/browser/aboutRobots.dtd
build/mozconfig.vs-common
build/win32/vswhere.exe
caps/nsScriptSecurityManager.cpp
devtools/server/tests/unit/test_protocol_formtype.js
dom/base/nsContentUtils.cpp
dom/base/nsGlobalWindowInner.cpp
dom/base/nsGlobalWindowOuter.cpp
dom/base/nsObjectLoadingContent.cpp
dom/html/nsIDateTimeInputArea.idl
dom/html/test/forms/xbl/chrome.ini
dom/html/test/forms/xbl/mochitest.ini
dom/html/test/forms/xbl/test_autocompleteinfo.html
dom/html/test/forms/xbl/test_input_attributes_reflection.html
dom/html/test/forms/xbl/test_input_date_bad_input.html
dom/html/test/forms/xbl/test_input_date_key_events.html
dom/html/test/forms/xbl/test_input_datetime_focus_blur.html
dom/html/test/forms/xbl/test_input_datetime_focus_blur_events.html
dom/html/test/forms/xbl/test_input_datetime_focus_state.html
dom/html/test/forms/xbl/test_input_datetime_input_change_events.html
dom/html/test/forms/xbl/test_input_datetime_tabindex.html
dom/html/test/forms/xbl/test_input_defaultValue.html
dom/html/test/forms/xbl/test_input_sanitization.html
dom/html/test/forms/xbl/test_input_textarea_set_value_no_scroll.html
dom/html/test/forms/xbl/test_input_time_key_events.html
dom/html/test/forms/xbl/test_input_time_sec_millisec_field.html
dom/html/test/forms/xbl/test_input_types_pref.html
dom/html/test/forms/xbl/test_input_typing_sanitization.html
dom/html/test/forms/xbl/test_label_input_controls.html
dom/html/test/forms/xbl/test_max_attribute.html
dom/html/test/forms/xbl/test_min_attribute.html
dom/html/test/forms/xbl/test_mozistextfield.html
dom/html/test/forms/xbl/test_novalidate_attribute.html
dom/html/test/forms/xbl/test_pattern_attribute.html
dom/html/test/forms/xbl/test_required_attribute.html
dom/html/test/forms/xbl/test_step_attribute.html
dom/html/test/forms/xbl/test_stepup_stepdown.html
dom/html/test/forms/xbl/test_textarea_attributes_reflection.html
dom/html/test/forms/xbl/test_validation.html
dom/html/test/forms/xbl/test_validation_not_in_doc.html
dom/html/test/forms/xbl/test_valueAsDate_pref.html
dom/html/test/forms/xbl/test_valueasdate_attribute.html
dom/html/test/forms/xbl/test_valueasnumber_attribute.html
dom/ipc/ContentParent.cpp
dom/ipc/tests/test_registerWindowActor.js
gfx/layers/apz/test/mochitest/test_fullscreen.html
layout/style/xbl-marquee/jar.mn
layout/style/xbl-marquee/moz.build
layout/style/xbl-marquee/xbl-marquee.css
layout/style/xbl-marquee/xbl-marquee.xml
modules/libpref/init/StaticPrefList.h
modules/libpref/init/all.js
netwerk/protocol/res/ExtensionProtocolHandler.cpp
taskcluster/ci/bouncer-locations-breakpoint/kind.yml
taskcluster/taskgraph/transforms/bouncer_locations_breakpoint.py
toolkit/content/tests/browser/xbl/browser.ini
toolkit/content/tests/browser/xbl/browser_datetime_datepicker.js
toolkit/content/tests/widgets/xbl/chrome.ini
toolkit/content/tests/widgets/xbl/head.js
toolkit/content/tests/widgets/xbl/mochitest.ini
toolkit/content/tests/widgets/xbl/test_audiocontrols_dimensions.html
toolkit/content/tests/widgets/xbl/test_bug898940.html
toolkit/content/tests/widgets/xbl/test_videocontrols.html
toolkit/content/tests/widgets/xbl/test_videocontrols_audio.html
toolkit/content/tests/widgets/xbl/test_videocontrols_audio_direction.html
toolkit/content/tests/widgets/xbl/test_videocontrols_error.html
toolkit/content/tests/widgets/xbl/test_videocontrols_iframe_fullscreen.html
toolkit/content/tests/widgets/xbl/test_videocontrols_jsdisabled.html
toolkit/content/tests/widgets/xbl/test_videocontrols_keyhandler.html
toolkit/content/tests/widgets/xbl/test_videocontrols_onclickplay.html
toolkit/content/tests/widgets/xbl/test_videocontrols_orientation.html
toolkit/content/tests/widgets/xbl/test_videocontrols_size.html
toolkit/content/tests/widgets/xbl/test_videocontrols_standalone.html
toolkit/content/tests/widgets/xbl/test_videocontrols_video_direction.html
toolkit/content/tests/widgets/xbl/test_videocontrols_video_noaudio.html
toolkit/content/tests/widgets/xbl/test_videocontrols_vtt.html
toolkit/content/widgets/datetimebox.xml
toolkit/content/widgets/menulist.xml
toolkit/content/widgets/videocontrols.xml
toolkit/modules/sessionstore/FormData.jsm
toolkit/moz.configure
toolkit/pluginproblem/content/pluginProblem.xml
uriloader/base/nsDocLoader.cpp
xpcom/build/XPCOMInit.cpp
--- a/accessible/base/MarkupMap.h
+++ b/accessible/base/MarkupMap.h
@@ -52,17 +52,76 @@ MARKUPMAP(caption,
           0)
 
 MARKUPMAP(dd, New_HTMLDtOrDd<HyperTextAccessibleWrap>, roles::DEFINITION)
 
 MARKUPMAP(del, New_HyperText, roles::CONTENT_DELETION)
 
 MARKUPMAP(details, New_HyperText, roles::DETAILS)
 
-MARKUPMAP(div, nullptr, roles::SECTION)
+MARKUPMAP(
+    div,
+    [](Element* aElement, Accessible* aContext) -> Accessible* {
+      // Never create an accessible if we're part of an anonymous
+      // subtree.
+      if (aElement->IsInAnonymousSubtree()) {
+        return nullptr;
+      }
+      // Always create an accessible if the div has an id.
+      if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::id)) {
+        return new HyperTextAccessibleWrap(aElement, aContext->Document());
+      }
+      // Never create an accessible if the div is not display:block; or
+      // display:inline-block;
+      nsAutoString displayValue;
+      StyleInfo styleInfo(aElement);
+      styleInfo.Display(displayValue);
+      if (displayValue != NS_LITERAL_STRING("block") &&
+          displayValue != NS_LITERAL_STRING("inline-block")) {
+        return nullptr;
+      }
+      // Check for various conditions to determine if this is a block
+      // break and needs to be rendered.
+      // If its previous sibling is an inline element, we probably want
+      // to break, so render.
+      nsIContent* prevSibling = aElement->GetPreviousSibling();
+      if (prevSibling) {
+        nsIFrame* prevSiblingFrame = prevSibling->GetPrimaryFrame();
+        if (prevSiblingFrame && prevSiblingFrame->IsInlineFrame()) {
+          return new HyperTextAccessibleWrap(aElement, aContext->Document());
+        }
+      }
+      // Now, check the children.
+      nsIContent* firstChild = aElement->GetFirstChild();
+      if (firstChild) {
+        // Render it if it is a text node.
+        if (firstChild->IsText()) {
+          return new HyperTextAccessibleWrap(aElement, aContext->Document());
+        }
+        // Check to see if first child has an inline frame.
+        nsIFrame* firstChildFrame = firstChild->GetPrimaryFrame();
+        if (firstChildFrame && firstChildFrame->IsInlineFrame()) {
+          return new HyperTextAccessibleWrap(aElement, aContext->Document());
+        }
+        nsIContent* lastChild = aElement->GetLastChild();
+        if (lastChild && lastChild != firstChild) {
+          // Render it if it is a text node.
+          if (lastChild->IsText()) {
+            return new HyperTextAccessibleWrap(aElement, aContext->Document());
+          }
+          // Check to see if last child has an inline frame.
+          nsIFrame* lastChildFrame = lastChild->GetPrimaryFrame();
+          if (lastChildFrame && lastChildFrame->IsInlineFrame()) {
+            return new HyperTextAccessibleWrap(aElement, aContext->Document());
+          }
+        }
+      }
+      return nullptr;
+    },
+    roles::SECTION)
 
 MARKUPMAP(dl,
           [](Element* aElement, Accessible* aContext) -> Accessible* {
             return new HTMLListAccessible(aElement, aContext->Document());
           },
           roles::DEFINITION_LIST)
 
 MARKUPMAP(dt, New_HTMLDtOrDd<HTMLLIAccessible>, roles::TERM)
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -15,16 +15,17 @@
 #include "HTMLElementAccessibles.h"
 #include "HTMLImageMapAccessible.h"
 #include "HTMLLinkAccessible.h"
 #include "HTMLListAccessible.h"
 #include "HTMLSelectAccessible.h"
 #include "HTMLTableAccessibleWrap.h"
 #include "HyperTextAccessibleWrap.h"
 #include "RootAccessible.h"
+#include "StyleInfo.h"
 #include "nsAccUtils.h"
 #include "nsArrayUtils.h"
 #include "nsAttrName.h"
 #include "nsDOMTokenList.h"
 #include "nsEventShell.h"
 #include "nsIURI.h"
 #include "nsTextFormatter.h"
 #include "OuterDocAccessible.h"
@@ -1403,18 +1404,20 @@ nsAccessibilityService::CreateAccessible
         }
       }
       break;
     }
     case eHTMLTextFieldType:
       newAcc = new HTMLTextFieldAccessible(aContent, document);
       break;
     case eHyperTextType:
-      if (!aContent->IsAnyOfHTMLElements(nsGkAtoms::dt, nsGkAtoms::dd))
+      if (!aContent->IsAnyOfHTMLElements(nsGkAtoms::dt, nsGkAtoms::dd,
+                                         nsGkAtoms::div)) {
         newAcc = new HyperTextAccessibleWrap(aContent, document);
+      }
       break;
 
     case eImageType:
       newAcc = new ImageAccessibleWrap(aContent, document);
       break;
     case eOuterDocType:
       newAcc = new OuterDocAccessible(aContent, document);
       break;
--- a/accessible/ipc/DocAccessibleParent.cpp
+++ b/accessible/ipc/DocAccessibleParent.cpp
@@ -780,18 +780,23 @@ mozilla::ipc::IPCResult DocAccessiblePar
   // Only do something in Android. We can't ifdef the entire protocol out in
   // the ipdl because it doesn't allow preprocessing.
 #  if defined(ANDROID)
   nsTArray<ProxyAccessible*> proxies(aData.Length());
   for (size_t i = 0; i < aData.Length(); i++) {
     DocAccessibleParent* doc = static_cast<DocAccessibleParent*>(
         aData.ElementAt(i).Document().get_PDocAccessibleParent());
     MOZ_ASSERT(doc);
+
     ProxyAccessible* proxy = doc->GetAccessible(aData.ElementAt(i).ID());
-    MOZ_ASSERT(proxy);
+    if (!proxy) {
+      MOZ_ASSERT_UNREACHABLE("No proxy found!");
+      continue;
+    }
+
     proxies.AppendElement(proxy);
   }
   ProxyBatch(this, aBatchType, proxies, aData);
 #  endif  // defined(XP_WIN)
   return IPC_OK();
 }
 #endif  // !defined(XP_WIN)
 
--- a/accessible/tests/browser/e10s/browser_treeupdate_cssoverflow.js
+++ b/accessible/tests/browser/e10s/browser_treeupdate_cssoverflow.js
@@ -42,17 +42,21 @@ addAccessibleTask(`
       } ]
     }, {
       ENTRY: [ ] // inserted input
     } ]
   };
   testAccessibleTree(container, tree);
 
   /* ================= Change scrollbar styles ============================== */
-  tree = { SECTION: [ ] };
+  tree = {
+    SECTION: [ // container2
+      { SECTION: [] } // scroll area because of its ID
+    ]
+  };
   testAccessibleTree(container2, tree);
 
   onReorder = waitForEvent(EVENT_REORDER, id2);
   await invokeSetStyle(browser, "scrollarea2", "overflow", "auto");
   await onReorder;
 
   tree = {
     SECTION: [ // container
--- a/accessible/tests/mochitest/events/test_text.html
+++ b/accessible/tests/mochitest/events/test_text.html
@@ -119,16 +119,20 @@
     /**
      * Insert child embedded accessible.
      */
     function insertChildDiv(aID) {
       this.__proto__ = new textInsertInvoker(aID, 5, 6, kEmbedChar);
 
       this.invoke = function insertChildDiv_invoke() {
         var childDiv = document.createElement("div");
+        // Note after bug 646216, a sole div without text won't be accessible
+        // and would not result in an embedded character.
+        // Therefore, add some text.
+        childDiv.textContent = "hello";
         this.DOMNode.insertBefore(childDiv, this.DOMNode.childNodes[1]);
       };
 
       this.getID = function insertChildDiv_getID() {
         return "Insert accessible div into the middle of text accessible " +
           prettyName(aID);
       };
     }
--- a/accessible/tests/mochitest/states/test_stale.html
+++ b/accessible/tests/mochitest/states/test_stale.html
@@ -23,16 +23,20 @@
       this.childNode = null;
 
       this.eventSeq = [
         new invokerChecker(EVENT_REORDER, this.containerNode),
       ];
 
       this.invoke = function addChild_invoke() {
         this.childNode = document.createElement("div");
+        // Note after bug 646216, a sole div without text won't be accessible
+        // and would not result in an embedded character.
+        // Therefore, add some text.
+        this.childNode.textContent = "hello";
         this.containerNode.appendChild(this.childNode);
       };
 
       this.finalCheck = function addChild_finalCheck() {
         // no stale state should be set
         testStates(this.childNode, 0, 0, 0, EXT_STATE_STALE);
       };
 
--- a/accessible/tests/mochitest/tree/a11y.ini
+++ b/accessible/tests/mochitest/tree/a11y.ini
@@ -21,16 +21,17 @@ skip-if = true # Bug 561508
 [test_aria_table.html]
 [test_brokencontext.html]
 [test_button.xul]
 [test_canvas.html]
 [test_combobox.xul]
 [test_cssflexbox.html]
 [test_cssoverflow.html]
 [test_display_contents.html]
+[test_divs.html]
 [test_dochierarchy.html]
 [test_dockids.html]
 [test_filectrl.html]
 [test_formctrl.html]
 [test_formctrl.xul]
 [test_gencontent.html]
 [test_groupbox.xul]
 [test_iframe.html]
new file mode 100644
--- /dev/null
+++ b/accessible/tests/mochitest/tree/test_divs.html
@@ -0,0 +1,235 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+<title>div element creation tests</title>
+<link rel="stylesheet" type="text/css"
+      href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+<script type="application/javascript"
+        src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<script type="application/javascript"
+        src="../common.js"></script>
+<script type="application/javascript"
+        src="../role.js"></script>
+<script type="application/javascript"
+        src="../attributes.js"></script>
+
+<script type="application/javascript">
+function doTest() {
+  // All below test cases are wrapped in a div which always gets rendered.
+  // c1 through c10 are the containers, the actual test cases are inside.
+
+  // c1: Expose the div with text content
+  let tree =
+    { role: ROLE_SECTION, // outer div with ID
+      children: [
+        { role: ROLE_SECTION, // inner div
+          children: [
+            { TEXT_LEAF: [] },
+          ], // end children inner div
+        }, // end inner div
+      ], // end children outer div
+    };
+  testAccessibleTree("c1", tree);
+
+  // c2: Only the outermost and innermost divs are exposed.
+  // The middle one is skipped. This is identical to the above tree.
+  testAccessibleTree("c2", tree);
+
+  // c3: Make sure the inner div with ID is exposed, but the middle one is
+  // skipped.
+  tree =
+    { role: ROLE_SECTION, // outer div with ID
+      children: [
+        { role: ROLE_SECTION, // inner div
+          attributes: { id: "b" },
+          children: [
+            { TEXT_LEAF: [] },
+          ], // end children inner div
+        }, // end inner div
+      ], // end children outer div
+    };
+  testAccessibleTree("c3", tree);
+
+  // c4: Expose all three divs including the middle one due to its ID.
+  tree =
+    { role: ROLE_SECTION, // outer div with ID
+      children: [
+        { role: ROLE_SECTION, // middle div
+          attributes: { id: "a" },
+          children: [
+            { role: ROLE_SECTION, // inner div
+              attributes: { id: "b" },
+              children: [
+                { TEXT_LEAF: [] },
+              ], // end children inner div
+            }, // end inner div
+          ], // end children middle div
+        }, // end middle div
+      ], // end children outer div
+    };
+  testAccessibleTree("c4", tree);
+
+  // c5: Expose the inner div with class b due to its text contents.
+  tree =
+    { role: ROLE_SECTION, // outer div with ID
+      children: [
+        { role: ROLE_SECTION, // inner div with class and text
+          attributes: { class: "b" },
+          children: [
+            { TEXT_LEAF: [] },
+          ], // end children inner div
+        }, // end inner div
+      ], // end children outer div
+    };
+  testAccessibleTree("c5", tree);
+
+  // c6: Expose the outer div due to its ID, and the two inner divs due to
+  // their text contents. Skip the middle one.
+  tree =
+    { role: ROLE_SECTION, // outer div with ID
+      children: [
+        { role: ROLE_SECTION, // first inner div
+          children: [
+            { TEXT_LEAF: [] },
+          ], // end children first inner div
+        }, // end first inner div
+        { role: ROLE_SECTION, // second inner div
+          children: [
+            { TEXT_LEAF: [] },
+          ], // end children second inner div
+        }, // end second inner div
+      ], // end children outer div
+    };
+  testAccessibleTree("c6", tree);
+
+  // c7: Expose all three divs including the middle one due to it being block
+  // breaking.
+  tree =
+    { role: ROLE_SECTION, // outer div with ID
+      children: [
+        { role: ROLE_SECTION, // middle div
+          children: [
+            { TEXT_LEAF: [] }, // foo
+            { role: ROLE_SECTION, // inner div
+              children: [
+                { TEXT_LEAF: [] }, // bar
+              ], // end children inner div
+            }, // end inner div
+            { TEXT_LEAF: [] }, // baz
+          ], // end children middle div
+        }, // end middle div
+      ], // end children outer div
+    };
+  testAccessibleTree("c7", tree);
+
+  // c8: Expose all divs due to them all being text block breakers.
+  tree =
+    { role: ROLE_SECTION, // outer div with ID
+      children: [
+        { role: ROLE_SECTION, // foo div
+          children: [
+            { TEXT_LEAF: [] }, // foo
+            { role: ROLE_SECTION, // baz div
+              children: [
+                { role: ROLE_SECTION, // bar div
+                  children: [
+                    { TEXT_LEAF: [] }, // bar
+                  ], // end children bar div
+                }, // end bar div
+                { TEXT_LEAF: [] }, // baz
+              ], // end children baz div
+            }, // end baz div
+          ], // end children foo div
+        }, // end foo div
+      ], // end children outer div
+    };
+  testAccessibleTree("c8", tree);
+
+  // c9: The same, but in a different nesting order.
+  tree =
+    { role: ROLE_SECTION, // outer div with ID
+      children: [
+        { role: ROLE_SECTION, // c div
+          children: [
+            { role: ROLE_SECTION, // b div
+              children: [
+                { role: ROLE_SECTION, // a div
+                  children: [
+                    { TEXT_LEAF: [] }, // a
+                  ], // end children a div
+                }, // end a div
+                { TEXT_LEAF: [] }, // b
+              ], // end children b div
+            }, // end b div
+            { TEXT_LEAF: [] }, // c
+          ], // end children c div
+        }, // end foo div
+      ], // end children outer div
+    };
+  testAccessibleTree("c9", tree);
+
+  // c10: Both inner divs must be exposed so there is a break after b.
+  tree =
+    { role: ROLE_SECTION, // outer div with ID
+      children: [
+        { role: ROLE_SECTION, // first inner div
+          children: [
+            { TEXT_LEAF: [] }, // a
+            { TEXT_LEAF: [] }, // b
+          ], // end children first inner div
+        }, // end first inner div
+        { role: ROLE_SECTION, // second inner div
+          children: [
+            { TEXT_LEAF: [] }, // c
+            { TEXT_LEAF: [] }, // d
+          ], // end children second inner div
+        }, // end second inner div
+      ], // end children outer div
+    };
+  testAccessibleTree("c10", tree);
+
+  SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+addA11yLoadEvent(doTest);
+</script>
+</head>
+<body>
+  <p id="display"></p>
+  <div id="content" style="display: none"></div>
+  <pre id="test">
+  </pre>
+
+  <!-- Expose the div if it has plain text contents -->
+  <div id="c1"><div>foo</div></div>
+
+  <!-- Expose the outer and inner div, skip the middle one. -->
+  <div id="c2"><div><div>foo</div></div></div>
+
+  <!-- Expose the outer and inner divs due to the ID, but skip the middle one. -->
+  <div id="c3"><div><div id="b">foo</div></div></div>
+
+  <!-- Expose all three divs and their IDs. -->
+  <div id="c4"><div id="a"><div id="b">foo</div></div></div>
+
+  <!-- Expose outer and inner divs, due to text content, not class. -->
+  <div id="c5"><div class="a"><div class="b">foo</div></div></div>
+
+  <!-- Expose the outer and two inner divs, skip the single middle one. -->
+  <div id="c6"><div><div>foo</div><div>bar</div></div></div>
+
+  <!-- Expose all divs due to the middle one being block breaking. -->
+  <div id="c7"><div>foo<div>bar</div>baz</div></div>
+
+  <!-- Expose all divs due to them all being text block breakers. -->
+  <div id="c8"><div>foo<div><div>bar</div>baz</div></div></div>
+  <div id="c9"><div><div><div>a</div>b</div>c</div></div>
+
+  <!-- Both inner divs need to be rendered so there is a break after b. -->
+  <div id="c10"><div><b>a</b>b</div><div><b>c</b><b>d</b></div></div>
+</body>
+</html>
--- a/accessible/tests/mochitest/tree/test_list.html
+++ b/accessible/tests/mochitest/tree/test_list.html
@@ -146,31 +146,27 @@
       testAccessibleTree("list8", tree);
 
       // span having display:list-item style
       testAccessibleTree("list9", discAccTree);
 
       // dl with div grouping dt/dd
       tree =
         { DEFINITION_LIST: [ // dl
-          { SECTION: [ // div
-            { TERM: [ // dt
-              { TEXT_LEAF: [] },
-            ] },
-            { DEFINITION: [ // dd
-              { TEXT_LEAF: [] },
-            ] },
+          { TERM: [ // dt
+            { TEXT_LEAF: [] },
+          ] },
+          { DEFINITION: [ // dd
+            { TEXT_LEAF: [] },
           ] },
-          { SECTION: [ // div
-            { TERM: [ // dt
-              { TEXT_LEAF: [] },
-            ] },
-            { DEFINITION: [ // dd
-              { TEXT_LEAF: [] },
-            ] },
+          { TERM: [ // dt
+            { TEXT_LEAF: [] },
+          ] },
+          { DEFINITION: [ // dd
+            { TEXT_LEAF: [] },
           ] },
         ] };
 
       testAccessibleTree("list10", tree);
 
       SimpleTest.finish();
     }
 
--- a/accessible/tests/mochitest/treeupdate/test_cssoverflow.html
+++ b/accessible/tests/mochitest/treeupdate/test_cssoverflow.html
@@ -9,16 +9,18 @@
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../role.js"></script>
   <script type="application/javascript"
+          src="../states.js"></script>
+  <script type="application/javascript"
           src="../events.js"></script>
 
   <script type="application/javascript">
 
     // //////////////////////////////////////////////////////////////////////////
     // Invokers
     // //////////////////////////////////////////////////////////////////////////
 
@@ -55,31 +57,33 @@
       };
 
       this.getID = function changeScrollRange_getID() {
         return "change scroll range for " + prettyName(aScrollAreaID);
       };
     }
 
     /**
-     * Change scrollbar styles from hidden to auto. That makes us to create an
-     * accessible for scroll area.
+     * Change scrollbar styles from hidden to auto. That causes us to create a
+     * new accessible for scroll area.
      */
     function changeScrollbarStyles(aContainerID, aScrollAreaID) {
       this.container = getAccessible(aContainerID);
       this.scrollAreaNode = getNode(aScrollAreaID);
 
       this.eventSeq = [
         new invokerChecker(EVENT_SHOW, getAccessible, this.scrollAreaNode),
         new invokerChecker(EVENT_REORDER, this.container),
       ];
 
       this.invoke = function changeScrollbarStyles_invoke() {
         var accTree =
-          { SECTION: [] };
+          { SECTION: [ // container
+            { SECTION: [] }, // scroll area
+          ] };
         testAccessibleTree(this.container, accTree);
 
         this.scrollAreaNode.style.overflow = "auto";
       };
 
       this.finalCheck = function changeScrollbarStyles_finalCheck() {
         var accTree =
           { SECTION: [ // container
@@ -88,29 +92,78 @@
         testAccessibleTree(this.container, accTree);
       };
 
       this.getID = function changeScrollbarStyles_getID() {
         return "change scrollbar styles " + prettyName(aScrollAreaID);
       };
     }
 
+    /**
+     * Change scrollbar styles from hidden to auto to make the scroll area focusable.
+     * That causes us to create an accessible for it.
+     * Make sure the tree stays intact.
+     * The scroll area has no ID on purpose to make it inaccessible initially.
+     */
+    function makeFocusableByScrollbarStyles(aContainerID) {
+      this.container = getAccessible(aContainerID);
+      this.scrollAreaNode = getNode(aContainerID).firstChild;
+
+      this.eventSeq = [
+        new invokerChecker(EVENT_SHOW, getAccessible, this.scrollAreaNode),
+        new invokerChecker(EVENT_REORDER, this.container),
+      ];
+
+      this.invoke = function makeFocusableByScrollbarStyles_invoke() {
+        var accTree =
+          { SECTION: [ // container
+            { PARAGRAPH: [ // paragraph
+              { TEXT_LEAF: [] },
+            ] },
+          ] };
+        testAccessibleTree(this.container, accTree);
+
+        this.scrollAreaNode.style.overflow = "auto";
+      };
+
+      this.finalCheck = function makeFocusableByScrollbarStyles_finalCheck() {
+        var accTree =
+          { SECTION: [ // container
+            { role: ROLE_SECTION,  // focusable scroll area
+              states: STATE_FOCUSABLE,
+              children: [
+                { PARAGRAPH: [ // paragraph
+                  { TEXT_LEAF: [] }, // text leaf
+                ] },
+              ],
+            }, // focusable scroll area
+          ] };
+        testAccessibleTree(this.container, accTree);
+      };
+
+      this.getID = function makeFocusableByScrollbarStyles_getID() {
+        return "make div focusable through scrollbar styles "
+               + prettyName(aContainerID);
+      };
+    }
+
     // //////////////////////////////////////////////////////////////////////////
     // Do tests
     // //////////////////////////////////////////////////////////////////////////
 
     var gQueue = null;
     // gA11yEventDumpID = "eventdump"; // debug stuff
     // gA11yEventDumpToConsole = true;
 
     function doTests() {
       gQueue = new eventQueue();
 
       gQueue.push(new changeScrollRange("container", "scrollarea"));
       gQueue.push(new changeScrollbarStyles("container2", "scrollarea2"));
+      gQueue.push(new makeFocusableByScrollbarStyles("container3"));
 
       gQueue.invoke(); // Will call SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTests);
   </script>
 </head>
@@ -125,10 +178,11 @@
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
   <div id="eventdump"></div>
 
   <div id="container"><div id="scrollarea" style="overflow:auto;"><input></div></div>
   <div id="container2"><div id="scrollarea2" style="overflow:hidden;"></div></div>
+  <div id="container3"><div style="overflow: hidden; height: 1px;"><p>foo</p></div></div>
 </body>
 </html>
--- a/browser/actors/PluginChild.jsm
+++ b/browser/actors/PluginChild.jsm
@@ -119,18 +119,17 @@ class PluginChild extends ActorChild {
     this.haveShownNotification = false;
   }
 
   getPluginUI(plugin, anonid) {
     if (plugin.openOrClosedShadowRoot &&
         plugin.openOrClosedShadowRoot.isUAWidget()) {
       return plugin.openOrClosedShadowRoot.getElementById(anonid);
     }
-    return plugin.ownerDocument.
-      getAnonymousElementByAttribute(plugin, "anonid", anonid);
+    return null;
   }
 
   _getPluginInfo(pluginElement) {
     let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
     pluginElement.QueryInterface(Ci.nsIObjectLoadingContent);
 
     let tagMimetype;
     let pluginName = gNavigatorBundle.GetStringFromName("pluginInfo.unknownPlugin");
--- a/browser/base/content/aboutRobots.xhtml
+++ b/browser/base/content/aboutRobots.xhtml
@@ -4,73 +4,68 @@
    - 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/. -->
 
 <!DOCTYPE html [
   <!ENTITY % htmlDTD
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "DTD/xhtml1-strict.dtd">
   %htmlDTD;
-  <!ENTITY % netErrorDTD
-    SYSTEM "chrome://global/locale/netError.dtd">
-  %netErrorDTD;
-  <!ENTITY % globalDTD
-    SYSTEM "chrome://global/locale/global.dtd">
-  %globalDTD;
-  <!ENTITY % aboutrobotsDTD
-    SYSTEM "chrome://browser/locale/aboutRobots.dtd">
-  %aboutrobotsDTD;
 ]>
 
 <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Security-Policy" content="default-src chrome:" />
-    <title>&robots.pagetitle;</title>
+    <title data-l10n-id="page-title"></title>
     <link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" />
     <link rel="icon" type="image/png" id="favicon" href="chrome://browser/content/robot.ico"/>
     <link rel="stylesheet" href="chrome://browser/content/aboutRobots.css" type="text/css"/>
+    <linkset>
+      <link rel="localization" href="browser/aboutRobots.ftl"/>
+    </linkset>
   </head>
 
-  <body dir="&locale.dir;">
+  <body>
 
     <!-- PAGE CONTAINER (for styling purposes only) -->
     <div id="errorPageContainer">
 
       <!-- Error Title -->
       <div id="errorTitle">
-        <h1 id="errorTitleText">&robots.errorTitleText;</h1>
+        <h1 id="errorTitleText" data-l10n-id="error-title-text"></h1>
       </div>
 
       <!-- LONG CONTENT (the section most likely to require scrolling) -->
       <div id="errorLongContent">
 
         <!-- Short Description -->
         <div id="errorShortDesc">
-          <p id="errorShortDescText">&robots.errorShortDescText;</p>
+          <p id="errorShortDescText" data-l10n-id="error-short-desc-text"></p>
         </div>
 
         <!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
         <div id="errorLongDesc">
           <ul>
-            <li>&robots.errorLongDesc1;</li>
-            <li>&robots.errorLongDesc2;</li>
-            <li>&robots.errorLongDesc3;</li>
-            <li>&robots.errorLongDesc4;</li>
+            <li data-l10n-id="error-long-desc1"></li>
+            <li data-l10n-id="error-long-desc2"></li>
+            <li data-l10n-id="error-long-desc3"></li>
+            <li data-l10n-id="error-long-desc4"></li>
           </ul>
         </div>
 
         <!-- Short Description -->
         <div id="errorTrailerDesc">
-          <p id="errorTrailerDescText">&robots.errorTrailerDescText;</p>
+          <p id="errorTrailerDescText" data-l10n-id="error-trailer-desc-text"></p>
         </div>
 
       </div>
 
       <!-- Button -->
       <button id="errorTryAgain"
-              label2="&robots.dontpress;">&retry.label;</button>
+              data-l10n-id="error-try-again"
+              data-l10n-attrs="label2"></button>
 
       <img id="widget1" src="chrome://browser/content/aboutRobots-widget-left.png"/>
       <img id="widget2" src="chrome://browser/content/aboutRobots-widget-left.png"/>
     </div>
   </body>
   <script type="application/javascript" src="chrome://browser/content/aboutRobots.js"/>
 </html>
--- a/browser/base/content/browser-sidebar.js
+++ b/browser/base/content/browser-sidebar.js
@@ -384,47 +384,62 @@ var SidebarUI = {
   /**
    * Show the sidebar.
    *
    * This wraps the internal method, including a ping to telemetry.
    *
    * @param {string}  commandID     ID of the sidebar to use.
    * @param {DOMNode} [triggerNode] Node, usually a button, that triggered the
    *                                showing of the sidebar.
+   * @return {Promise<boolean>}
    */
-  show(commandID, triggerNode) {
+  async show(commandID, triggerNode) {
+    // Extensions without private window access wont be in the
+    // sidebars map.
+    if (!this.sidebars.has(commandID)) {
+      return false;
+    }
     return this._show(commandID).then(() => {
       this._loadSidebarExtension(commandID);
 
       if (triggerNode) {
         updateToggleControlLabel(triggerNode);
       }
 
       this._fireFocusedEvent();
+      return true;
     });
   },
 
   /**
    * Show the sidebar, without firing the focused event or logging telemetry.
    * This is intended to be used when the sidebar is opened automatically
    * when a window opens (not triggered by user interaction).
    *
    * @param {string} commandID ID of the sidebar.
+   * @return {Promise<boolean>}
    */
-  showInitially(commandID) {
+  async showInitially(commandID) {
+    // Extensions without private window access wont be in the
+    // sidebars map.
+    if (!this.sidebars.has(commandID)) {
+      return false;
+    }
     return this._show(commandID).then(() => {
       this._loadSidebarExtension(commandID);
+      return true;
     });
   },
 
   /**
    * Implementation for show. Also used internally for sidebars that are shown
    * when a window is opened and we don't want to ping telemetry.
    *
    * @param {string} commandID ID of the sidebar.
+   * @return {Promise<void>}
    */
   _show(commandID) {
     return new Promise(resolve => {
       this.selectMenuItem(commandID);
 
       this._box.hidden = this._splitter.hidden = false;
       this.setPosition();
 
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1744,16 +1744,21 @@ var gBrowserInit = {
       // setup history swipe animation
       gHistorySwipeAnimation.init();
     });
 
     scheduleIdleTask(() => {
       gBrowserThumbnails.init();
     });
 
+    // Show the addons private browsing panel the first time a private window.
+    scheduleIdleTask(() => {
+      ExtensionsUI.showPrivateBrowsingNotification(window);
+    });
+
     scheduleIdleTask(() => {
       // Initialize the download manager some time after the app starts so that
       // auto-resume downloads begin (such as after crashing or quitting with
       // active downloads) and speeds up the first-load of the download manager UI.
       // If the user manually opens the download manager before the timeout, the
       // downloads will start right away, and initializing again won't hurt.
       try {
         DownloadsCommon.initializeAllDataLinks();
@@ -2158,16 +2163,22 @@ function BrowserHome(aEvent) {
   if (where == "current" &&
       gBrowser &&
       gBrowser.selectedTab.pinned)
     where = "tab";
 
   // openTrustedLinkIn in utilityOverlay.js doesn't handle loading multiple pages
   switch (where) {
   case "current":
+    // If we're going to load an initial page in the current tab as the
+    // home page, we set initialPageLoadedFromURLBar so that the URL
+    // bar is cleared properly (even during a remoteness flip).
+    if (isInitialPage(homePage)) {
+      gBrowser.selectedBrowser.initialPageLoadedFromUserAction = homePage;
+    }
     loadOneOrMoreURIs(homePage, Services.scriptSecurityManager.getSystemPrincipal());
     if (isBlankPageURL(homePage)) {
       focusAndSelectUrlBar();
     } else {
       gBrowser.selectedBrowser.focus();
     }
     notifyObservers = true;
     break;
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -4962,32 +4962,32 @@ class TabProgressListener {
     if (aStateFlags & Ci.nsIWebProgressListener.STATE_START &&
         aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
       if (aWebProgress.isTopLevel) {
         // Need to use originalLocation rather than location because things
         // like about:home and about:privatebrowsing arrive with nsIRequest
         // pointing to their resolved jar: or file: URIs.
         if (!(originalLocation && gInitialPages.includes(originalLocation.spec) &&
             originalLocation != "about:blank" &&
-            this.mBrowser.initialPageLoadedFromURLBar != originalLocation.spec &&
+            this.mBrowser.initialPageLoadedFromUserAction != originalLocation.spec &&
             this.mBrowser.currentURI && this.mBrowser.currentURI.spec == "about:blank")) {
           // Indicating that we started a load will allow the location
           // bar to be cleared when the load finishes.
           // In order to not overwrite user-typed content, we avoid it
           // (see if condition above) in a very specific case:
           // If the load is of an 'initial' page (e.g. about:privatebrowsing,
           // about:newtab, etc.), was not explicitly typed in the location
           // bar by the user, is not about:blank (because about:blank can be
           // loaded by websites under their principal), and the current
           // page in the browser is about:blank (indicating it is a newly
           // created or re-created browser, e.g. because it just switched
           // remoteness or is a new tab/window).
           this.mBrowser.urlbarChangeTracker.startedLoad();
         }
-        delete this.mBrowser.initialPageLoadedFromURLBar;
+        delete this.mBrowser.initialPageLoadedFromUserAction;
         // If the browser is loading it must not be crashed anymore
         this.mTab.removeAttribute("crashed");
       }
 
       if (this._shouldShowProgress(aRequest)) {
         if (!(aStateFlags & Ci.nsIWebProgressListener.STATE_RESTORING) &&
             aWebProgress && aWebProgress.isTopLevel) {
           this.mTab.setAttribute("busy", "true");
--- a/browser/base/content/test/general/browser_e10s_switchbrowser.js
+++ b/browser/base/content/test/general/browser_e10s_switchbrowser.js
@@ -43,17 +43,17 @@ var check_history = async function() {
   let sessionHistory = await get_remote_history(gBrowser.selectedBrowser);
 
   let count = sessionHistory.entries.length;
   is(count, gExpectedHistory.entries.length, "Should have the right number of history entries");
   is(sessionHistory.index, gExpectedHistory.index, "Should have the right history index");
 
   for (let i = 0; i < count; i++) {
     let entry = sessionHistory.entries[i];
-    info("Checking History Entry:", entry.uri);
+    info("Checking History Entry: " + entry.uri);
     is(entry.uri, gExpectedHistory.entries[i].uri, "Should have the right URI");
     is(entry.title, gExpectedHistory.entries[i].title, "Should have the right title");
   }
 };
 
 function clear_history() {
   gExpectedHistory.index = -1;
   gExpectedHistory.entries = [];
@@ -132,16 +132,18 @@ add_task(async function test_navigation(
   await waitForLoad("http://example.com/" + DUMMY_PATH);
   is(gBrowser.selectedBrowser.isRemoteBrowser, expectedRemote, "Remote attribute should be correct");
   is(gBrowser.selectedBrowser.permanentKey, permanentKey, "browser.permanentKey is still the same");
   await check_history();
 
   info("3");
   // Load a non-remote page
   await waitForLoad("about:robots");
+  await TestUtils.waitForCondition(() => gBrowser.selectedBrowser.contentTitle != "about:robots",
+    "Waiting for about:robots title to update");
   is(gBrowser.selectedBrowser.isRemoteBrowser, false, "Remote attribute should be correct");
   is(gBrowser.selectedBrowser.permanentKey, permanentKey, "browser.permanentKey is still the same");
   await check_history();
 
   info("4");
   // Load a remote page
   await waitForLoad("http://example.org/" + DUMMY_PATH);
   is(gBrowser.selectedBrowser.isRemoteBrowser, expectedRemote, "Remote attribute should be correct");
@@ -235,28 +237,32 @@ add_task(async function test_synchronous
 // normal loads
 add_task(async function test_loadflags() {
   let expectedRemote = gMultiProcessBrowser;
 
   info("1");
   // Create a tab and load a remote page in it
   gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:blank", {skipAnimation: true});
   await waitForLoadWithFlags("about:robots");
+  await TestUtils.waitForCondition(() => gBrowser.selectedBrowser.contentTitle != "about:robots",
+    "Waiting for about:robots title to update");
   is(gBrowser.selectedBrowser.isRemoteBrowser, false, "Remote attribute should be correct");
   await check_history();
 
   info("2");
   // Load a page in the remote process with some custom flags
   await waitForLoadWithFlags("http://example.com/" + DUMMY_PATH, Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY);
   is(gBrowser.selectedBrowser.isRemoteBrowser, expectedRemote, "Remote attribute should be correct");
   await check_history();
 
   info("3");
   // Load a non-remote page
   await waitForLoadWithFlags("about:robots");
+  await TestUtils.waitForCondition(() => gBrowser.selectedBrowser.contentTitle != "about:robots",
+    "Waiting for about:robots title to update");
   is(gBrowser.selectedBrowser.isRemoteBrowser, false, "Remote attribute should be correct");
   await check_history();
 
   info("4");
   // Load another remote page
   await waitForLoadWithFlags("http://example.org/" + DUMMY_PATH, Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY);
   is(gBrowser.selectedBrowser.isRemoteBrowser, expectedRemote, "Remote attribute should be correct");
   await check_history();
--- a/browser/base/content/test/plugins/browser.ini
+++ b/browser/base/content/test/plugins/browser.ini
@@ -1,10 +1,9 @@
 [DEFAULT]
-prefs = dom.ua_widget.enabled=true
 support-files =
   blocklist_proxy.js
   blockNoPlugins.xml
   blockPluginHard.xml
   blockPluginInfoURL.xml
   blockPluginVulnerableNoUpdate.xml
   blockPluginVulnerableUpdatable.xml
   browser_clearplugindata.html
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
-  "extends": [
-    "plugin:mozilla/browser-test"
-  ]
-};
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/blockNoPlugins.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310001">
-  <emItems>
-  </emItems>
-  <pluginItems>
-  </pluginItems>
-</blocklist>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/blockPluginHard.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
-  <emItems>
-  </emItems>
-  <pluginItems>
-    <pluginItem blockID="p9999">
-      <match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
-      <versionRange severity="2"></versionRange>
-    </pluginItem>
-  </pluginItems>
-</blocklist>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/blockPluginInfoURL.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
-  <emItems>
-  </emItems>
-  <pluginItems>
-    <pluginItem blockID="p9999">
-      <match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
-      <versionRange severity="2"></versionRange>
-      <infoURL>http://test.url.com/</infoURL>
-    </pluginItem>
-  </pluginItems>
-</blocklist>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/blockPluginVulnerableNoUpdate.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
-  <emItems>
-  </emItems>
-  <pluginItems>
-    <pluginItem blockID="p9999">
-      <match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
-      <versionRange severity="0" vulnerabilitystatus="2"></versionRange>
-    </pluginItem>
-  </pluginItems>
-</blocklist>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/blockPluginVulnerableUpdatable.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
-  <emItems>
-  </emItems>
-  <pluginItems>
-    <pluginItem blockID="p9999">
-      <match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
-      <versionRange severity="0" vulnerabilitystatus="1"></versionRange>
-    </pluginItem>
-  </pluginItems>
-</blocklist>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/blocklist_proxy.js
+++ /dev/null
@@ -1,68 +0,0 @@
-var Cm = Components.manager;
-
-const kBlocklistServiceUUID = "{66354bc9-7ed1-4692-ae1d-8da97d6b205e}";
-const kBlocklistServiceContractID = "@mozilla.org/extensions/blocklist;1";
-const kBlocklistServiceFactory = Cm.getClassObject(Cc[kBlocklistServiceContractID], Ci.nsIFactory);
-
-const {setTimeout} = ChromeUtils.import("resource://gre/modules/Timer.jsm");
-
-SimpleTest.requestFlakyTimeout("Need to simulate blocklist calls actually taking non-0 time to return");
-
-/*
- * A lightweight blocklist proxy for the testing purposes.
- */
-var BlocklistProxy = {
-  _uuid: null,
-
-  QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver,
-                                          Ci.nsIBlocklistService,
-                                          Ci.nsITimerCallback]),
-
-  init() {
-    if (!this._uuid) {
-      this._uuid =
-        Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator)
-                                           .generateUUID();
-      Cm.nsIComponentRegistrar.registerFactory(this._uuid, "",
-                                               "@mozilla.org/extensions/blocklist;1",
-                                               this);
-    }
-  },
-
-  uninit() {
-    if (this._uuid) {
-      Cm.nsIComponentRegistrar.unregisterFactory(this._uuid, this);
-      Cm.nsIComponentRegistrar.registerFactory(Components.ID(kBlocklistServiceUUID),
-                                               "Blocklist Service",
-                                               "@mozilla.org/extensions/blocklist;1",
-                                               kBlocklistServiceFactory);
-      this._uuid = null;
-    }
-  },
-
-  notify(aTimer) {
-  },
-
-  observe(aSubject, aTopic, aData) {
-  },
-
-  async getAddonBlocklistState(aAddon, aAppVersion, aToolkitVersion) {
-    await new Promise(r => setTimeout(r, 150));
-    return 0; // STATE_NOT_BLOCKED
-  },
-
-  async getPluginBlocklistState(aPluginTag, aAppVersion, aToolkitVersion) {
-    await new Promise(r => setTimeout(r, 150));
-    return 0; // STATE_NOT_BLOCKED
-  },
-
-  async getPluginBlockURL(aPluginTag) {
-    await new Promise(r => setTimeout(r, 150));
-    return "";
-  },
-};
-
-BlocklistProxy.init();
-addEventListener("unload", () => {
-  BlocklistProxy.uninit();
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser.ini
+++ /dev/null
@@ -1,98 +0,0 @@
-[DEFAULT]
-prefs = dom.ua_widget.enabled=false
-support-files =
-  blocklist_proxy.js
-  blockNoPlugins.xml
-  blockPluginHard.xml
-  blockPluginInfoURL.xml
-  blockPluginVulnerableNoUpdate.xml
-  blockPluginVulnerableUpdatable.xml
-  browser_clearplugindata.html
-  browser_clearplugindata_noage.html
-  empty_file.html
-  ../head.js
-  plugin_add_dynamically.html
-  plugin_alternate_content.html
-  plugin_big.html
-  plugin_both.html
-  plugin_both2.html
-  plugin_bug744745.html
-  plugin_bug749455.html
-  plugin_bug787619.html
-  plugin_bug797677.html
-  plugin_bug820497.html
-  plugin_clickToPlayAllow.html
-  plugin_clickToPlayDeny.html
-  plugin_favorfallback.html
-  plugin_hidden_to_visible.html
-  plugin_iframe.html
-  plugin_outsideScrollArea.html
-  plugin_overlay_styles.html
-  plugin_simple_blank.swf
-  plugin_shouldShowOverlay.html
-  plugin_small.html
-  plugin_small_2.html
-  plugin_syncRemoved.html
-  plugin_test.html
-  plugin_test2.html
-  plugin_test3.html
-  plugin_two_types.html
-  plugin_unknown.html
-  plugin_crashCommentAndURL.html
-  plugin_zoom.html
-
-[browser_bug743421.js]
-tags = blocklist
-[browser_bug744745.js]
-[browser_bug787619.js]
-[browser_bug797677.js]
-[browser_bug812562.js]
-tags = blocklist
-[browser_bug818118.js]
-[browser_bug820497.js]
-[browser_clearplugindata.js]
-tags = blocklist
-[browser_CTP_context_menu.js]
-skip-if = toolkit == "gtk3"   # fails intermittently on Linux (bug 909342)
-tags = blocklist
-[browser_CTP_crashreporting.js]
-skip-if = !crashreporter || verify
-tags = blocklist
-[browser_CTP_drag_drop.js]
-tags = blocklist
-[browser_CTP_favorfallback.js]
-[browser_CTP_hide_overlay.js]
-tags = blocklist
-[browser_CTP_iframe.js]
-tags = blocklist
-[browser_CTP_nonplugins.js]
-skip-if = verify
-tags = blocklist
-[browser_CTP_outsideScrollArea.js]
-tags = blocklist
-[browser_CTP_overlay_styles.js]
-[browser_CTP_resize.js]
-tags = blocklist
-[browser_CTP_shouldShowOverlay.js]
-[browser_CTP_zoom.js]
-tags = blocklist
-[browser_blocking.js]
-tags = blocklist
-[browser_iterate_hidden_plugins.js]
-[browser_pluginnotification.js]
-tags = blocklist
-[browser_plugin_reloading.js]
-tags = blocklist
-[browser_blocklist_content.js]
-skip-if = !e10s
-tags = blocklist
-[browser_enable_DRM_prompt.js]
-[browser_private_browsing_eme_persistent_state.js]
-[browser_globalplugin_crashinfobar.js]
-skip-if = !crashreporter
-[browser_pluginCrashCommentAndURL.js]
-skip-if = !crashreporter
-[browser_pluginCrashReportNonDeterminism.js]
-skip-if = !crashreporter
-[browser_private_clicktoplay.js]
-[browser_subframe_access_hidden_plugins.js]
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_context_menu.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* import-globals-from ../head.js */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    gBrowser.removeCurrentTab();
-    window.focus();
-  });
-});
-
-// Test that the activate action in content menus for CTP plugins works
-add_task(async function() {
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-  let bindingPromise = BrowserTestUtils.waitForContentEvent(gBrowser.selectedBrowser, "PluginBindingAttached", true, null, true);
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-  await promiseUpdatePluginBindings(gBrowser.selectedBrowser);
-  await bindingPromise;
-
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
-  ok(popupNotification, "Test 1, Should have a click-to-play notification");
-
-  // check plugin state
-  let pluginInfo = await promiseForPluginInfo("test", gBrowser.selectedBrowser);
-  ok(!pluginInfo.activated, "plugin should not be activated");
-
-  // Display a context menu on the test plugin so we can test
-  // activation menu options.
-  await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
-    let plugin = content.document.getElementById("test");
-    let bounds = plugin.getBoundingClientRect();
-    let left = (bounds.left + bounds.right) / 2;
-    let top = (bounds.top + bounds.bottom) / 2;
-    let utils = content.windowUtils;
-    utils.sendMouseEvent("contextmenu", left, top, 2, 1, 0);
-  });
-
-  popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
-  ok(popupNotification, "Should have a click-to-play notification");
-  ok(popupNotification.dismissed, "notification should be dismissed");
-
-  // fixes a occasional test timeout on win7 opt
-  await promiseForCondition(() => document.getElementById("context-ctp-play"));
-
-  let actMenuItem = document.getElementById("context-ctp-play");
-  ok(actMenuItem, "Should have a context menu entry for activating the plugin");
-
-  // Activate the plugin via the context menu
-  EventUtils.synthesizeMouseAtCenter(actMenuItem, {});
-
-  await promiseForCondition(() => !PopupNotifications.panel.dismissed && PopupNotifications.panel.firstElementChild);
-
-  // Activate the plugin
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  // check plugin state
-  pluginInfo = await promiseForPluginInfo("test", gBrowser.selectedBrowser);
-  ok(pluginInfo.activated, "plugin should not be activated");
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_crashreporting.js
+++ /dev/null
@@ -1,234 +0,0 @@
-/* import-globals-from ../head.js */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
-const PLUGIN_PAGE = gTestRoot + "plugin_big.html";
-const PLUGIN_SMALL_PAGE = gTestRoot + "plugin_small.html";
-
-/**
- * Takes an nsIPropertyBag and converts it into a JavaScript Object. It
- * will also convert any nsIPropertyBag's within the nsIPropertyBag
- * recursively.
- *
- * @param aBag
- *        The nsIPropertyBag to convert.
- * @return Object
- *        Keyed on the names of the nsIProperty's within the nsIPropertyBag,
- *        and mapping to their values.
- */
-function convertPropertyBag(aBag) {
-  let result = {};
-  for (let { name, value } of aBag.enumerator) {
-    if (value instanceof Ci.nsIPropertyBag) {
-      value = convertPropertyBag(value);
-    }
-    result[name] = value;
-  }
-  return result;
-}
-
-add_task(async function setup() {
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  // The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables plugin
-  // crash reports.  This test needs them enabled.  The test also needs a mock
-  // report server, and fortunately one is already set up by toolkit/
-  // crashreporter/test/Makefile.in.  Assign its URL to MOZ_CRASHREPORTER_URL,
-  // which CrashSubmit.jsm uses as a server override.
-  let env = Cc["@mozilla.org/process/environment;1"].
-            getService(Ci.nsIEnvironment);
-  let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
-  let serverURL = env.get("MOZ_CRASHREPORTER_URL");
-  env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
-  env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
-
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
-  registerCleanupFunction(function cleanUp() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
-    env.set("MOZ_CRASHREPORTER_URL", serverURL);
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    window.focus();
-  });
-});
-
-/**
- * Test that plugin crash submissions still work properly after
- * click-to-play activation.
- */
-add_task(async function() {
-  await BrowserTestUtils.withNewTab({
-    gBrowser,
-    url: PLUGIN_PAGE,
-  }, async function(browser) {
-    // Work around for delayed PluginBindingAttached
-    await promiseUpdatePluginBindings(browser);
-
-    let pluginInfo = await promiseForPluginInfo("test", browser);
-    ok(!pluginInfo.activated, "Plugin should not be activated");
-
-    // Simulate clicking the "Allow Always" button.
-    let notification = PopupNotifications.getNotification("click-to-play-plugins", browser);
-    await promiseForNotificationShown(notification, browser);
-    PopupNotifications.panel.firstElementChild.button.click();
-
-    // Prepare a crash report topic observer that only returns when
-    // the crash report has been successfully sent.
-    let crashReportChecker = (subject, data) => {
-      return (data == "success");
-    };
-    let crashReportPromise = TestUtils.topicObserved("crash-report-status",
-                                                     crashReportChecker);
-
-    await ContentTask.spawn(browser, null, async function() {
-      let plugin = content.document.getElementById("test");
-      plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-
-      await ContentTaskUtils.waitForCondition(() => {
-        return plugin.activated;
-      }, "Waited too long for plugin to activate.");
-
-      try {
-        Cu.waiveXrays(plugin).crash();
-      } catch (e) {
-      }
-
-      let doc = plugin.ownerDocument;
-
-      let getUI = (anonid) => {
-        return doc.getAnonymousElementByAttribute(plugin, "anonid", anonid);
-      };
-
-      // Now wait until the plugin crash report UI shows itself, which is
-      // asynchronous.
-      let statusDiv;
-
-      await ContentTaskUtils.waitForCondition(() => {
-        statusDiv = getUI("submitStatus");
-        return statusDiv.getAttribute("status") == "please";
-      }, "Waited too long for plugin to show crash report UI");
-
-      // Make sure the UI matches our expectations...
-      let style = content.getComputedStyle(getUI("pleaseSubmit"));
-      if (style.display != "block") {
-        throw new Error(`Submission UI visibility is not correct. ` +
-                        `Expected block style, got ${style.display}.`);
-      }
-
-      // Fill the crash report in with some test values that we'll test for in
-      // the parent.
-      getUI("submitComment").value = "a test comment";
-      let optIn = getUI("submitURLOptIn");
-      if (!optIn.checked) {
-        throw new Error("URL opt-in should default to true.");
-      }
-
-      // Submit the report.
-      optIn.click();
-      getUI("submitButton").click();
-
-      // And wait for the parent to say that the crash report was submitted
-      // successfully. This can take time on debug builds.
-      await ContentTaskUtils.waitForCondition(() => {
-        return statusDiv.getAttribute("status") == "success";
-      }, "Timed out waiting for plugin binding to be in success state",
-      100, 200);
-    });
-
-    let [subject ] = await crashReportPromise;
-
-    ok(subject instanceof Ci.nsIPropertyBag,
-       "The crash report subject should be an nsIPropertyBag.");
-
-    let crashData = convertPropertyBag(subject);
-    ok(crashData.serverCrashID, "Should have a serverCrashID set.");
-
-    // Remove the submitted report file after ensuring it exists.
-    let file = Cc["@mozilla.org/file/local;1"]
-                 .createInstance(Ci.nsIFile);
-    file.initWithPath(Services.crashmanager._submittedDumpsDir);
-    file.append(crashData.serverCrashID + ".txt");
-    ok(file.exists(), "Submitted report file should exist");
-    file.remove(false);
-
-    ok(crashData.extra, "Extra data should exist");
-    is(crashData.extra.PluginUserComment, "a test comment",
-       "Comment in extra data should match comment in textbox");
-
-    is(crashData.extra.PluginContentURL, undefined,
-       "URL should be absent from extra data when opt-in not checked");
-  });
-});
-
-/**
- * Test that plugin crash submissions still work properly after
- * click-to-play with the notification bar.
- */
-add_task(async function() {
-  await BrowserTestUtils.withNewTab({
-    gBrowser,
-    url: PLUGIN_SMALL_PAGE,
-  }, async function(browser) {
-    // Work around for delayed PluginBindingAttached
-    await promiseUpdatePluginBindings(browser);
-
-    let pluginInfo = await promiseForPluginInfo("test", browser);
-    ok(pluginInfo.activated, "Plugin should be activated from previous test");
-
-    // Prepare a crash report topic observer that only returns when
-    // the crash report has been successfully sent.
-    let crashReportChecker = (subject, data) => {
-      return (data == "success");
-    };
-    let crashReportPromise = TestUtils.topicObserved("crash-report-status",
-                                                     crashReportChecker);
-
-    await ContentTask.spawn(browser, null, async function() {
-      let plugin = content.document.getElementById("test");
-      plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-
-      await ContentTaskUtils.waitForCondition(() => {
-        return plugin.activated;
-      }, "Waited too long for plugin to activate.");
-
-      try {
-        Cu.waiveXrays(plugin).crash();
-      } catch (e) {}
-    });
-
-    // Wait for the notification bar to be displayed.
-    let notification = await waitForNotificationBar("plugin-crashed", browser);
-
-    // Then click the button to submit the crash report.
-    let buttons = notification.querySelectorAll(".notification-button");
-    is(buttons.length, 2, "Should have two buttons.");
-
-    // The "Submit Crash Report" button should be the second one.
-    let submitButton = buttons[1];
-    submitButton.click();
-
-    let [subject ] = await crashReportPromise;
-
-    ok(subject instanceof Ci.nsIPropertyBag,
-       "The crash report subject should be an nsIPropertyBag.");
-
-    let crashData = convertPropertyBag(subject);
-    ok(crashData.serverCrashID, "Should have a serverCrashID set.");
-
-    // Remove the submitted report file after ensuring it exists.
-    let file = Cc["@mozilla.org/file/local;1"]
-                 .createInstance(Ci.nsIFile);
-    file.initWithPath(Services.crashmanager._submittedDumpsDir);
-    file.append(crashData.serverCrashID + ".txt");
-    ok(file.exists(), "Submitted report file should exist");
-    file.remove(false);
-
-    is(crashData.extra.PluginContentURL, undefined,
-       "URL should be absent from extra data when opt-in not checked");
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_drag_drop.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gNewWindow = null;
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    gNewWindow.close();
-    gNewWindow = null;
-    window.focus();
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gBrowser.selectedBrowser);
-
-  await promisePopupNotification("click-to-play-plugins");
-});
-
-add_task(async function() {
-  gNewWindow = gBrowser.replaceTabWithWindow(gBrowser.selectedTab);
-
-  // XXX technically can't load fire before we get this call???
-  await BrowserTestUtils.waitForEvent(gNewWindow, "load", true);
-
-  await promisePopupNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser);
-
-  ok(PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser), "Should have a click-to-play notification in the tab in the new window");
-  ok(!PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should not have a click-to-play notification in the old window now");
-});
-
-add_task(async function() {
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, gNewWindow.gBrowser.selectedTab);
-
-  await promisePopupNotification("click-to-play-plugins", gBrowser.selectedBrowser);
-
-  ok(PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should have a click-to-play notification in the initial tab again");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gBrowser.selectedBrowser);
-});
-
-add_task(async function() {
-  await promisePopupNotification("click-to-play-plugins");
-
-  gNewWindow = gBrowser.replaceTabWithWindow(gBrowser.selectedTab);
-
-  await promiseWaitForFocus(gNewWindow);
-
-  await promisePopupNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser);
-});
-
-add_task(async function() {
-  ok(PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser), "Should have a click-to-play notification in the tab in the new window");
-  ok(!PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser), "Should not have a click-to-play notification in the old window now");
-
-  let pluginInfo = await promiseForPluginInfo("test", gNewWindow.gBrowser.selectedBrowser);
-  ok(!pluginInfo.activated, "plugin should not be activated");
-
-  await ContentTask.spawn(gNewWindow.gBrowser.selectedBrowser, {}, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let bounds = plugin.getBoundingClientRect();
-    let left = (bounds.left + bounds.right) / 2;
-    let top = (bounds.top + bounds.bottom) / 2;
-    let utils = content.windowUtils;
-    utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
-  });
-
-  let condition = () => !PopupNotifications.getNotification("click-to-play-plugins", gNewWindow.gBrowser.selectedBrowser).dismissed && gNewWindow.PopupNotifications.panel.firstElementChild;
-  await promiseForCondition(condition);
-});
-
-add_task(async function() {
-  // Click the activate button on doorhanger to make sure it works
-  gNewWindow.PopupNotifications.panel.firstElementChild.button.click();
-
-  let pluginInfo = await promiseForPluginInfo("test", gNewWindow.gBrowser.selectedBrowser);
-  ok(pluginInfo.activated, "plugin should be activated");
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_favorfallback.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* import-globals-from ../head.js */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Shockwave Flash");
-    Services.prefs.clearUserPref("plugins.favorfallback.mode");
-    Services.prefs.clearUserPref("plugins.favorfallback.rules");
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setCharPref("plugins.favorfallback.mode", "follow-ctp");
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Shockwave Flash");
-});
-
-/* The expected behavior of each testcase is documented with its markup
- * in plugin_favorfallback.html.
- *
- *  - "name" is the name of the testcase in the test file.
- *  - "rule" is how the plugins.favorfallback.rules must be configured
- *           for this testcase.
- */
-const testcases = [
-  {
-    name: "video",
-    rule: "video",
-  },
-
-  {
-    name: "nosrc",
-    rule: "nosrc",
-  },
-
-  {
-    name: "embed",
-    rule: "embed,true",
-  },
-
-  {
-    name: "adobelink",
-    rule: "adobelink,true",
-  },
-
-  {
-    name: "installinstructions",
-    rule: "installinstructions,true",
-  },
-
-];
-
-add_task(async function() {
-  for (let testcase of Object.values(testcases)) {
-    info(`Running testcase ${testcase.name}`);
-
-    Services.prefs.setCharPref("plugins.favorfallback.rules", testcase.rule);
-
-    let tab = await BrowserTestUtils.openNewForegroundTab(
-      gBrowser,
-      `${gTestRoot}plugin_favorfallback.html?testcase=${testcase.name}`
-    );
-
-    await ContentTask.spawn(tab.linkedBrowser, testcase.name, async function testPlugins(name) {
-      let testcaseDiv = content.document.getElementById(`testcase_${name}`);
-      let ctpPlugins = testcaseDiv.querySelectorAll(".expected_ctp");
-
-      for (let ctpPlugin of ctpPlugins) {
-        ok(ctpPlugin instanceof Ci.nsIObjectLoadingContent, "This is a plugin object");
-        is(ctpPlugin.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "Plugin is CTP");
-      }
-
-      let fallbackPlugins = testcaseDiv.querySelectorAll(".expected_fallback");
-
-      for (let fallbackPlugin of fallbackPlugins) {
-        ok(fallbackPlugin instanceof Ci.nsIObjectLoadingContent, "This is a plugin object");
-        is(fallbackPlugin.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_ALTERNATE, "Plugin fallback content was used");
-      }
-    });
-
-    BrowserTestUtils.removeTab(tab);
-  }
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_hide_overlay.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/* import-globals-from ../head.js */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    gBrowser.removeCurrentTab();
-    window.focus();
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gBrowser.selectedBrowser);
-
-  // Tests that the overlay can be hidden for plugins using the close icon.
-  await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    let closeIcon = doc.getAnonymousElementByAttribute(plugin, "anonid", "closeIcon");
-    let bounds = closeIcon.getBoundingClientRect();
-    let left = (bounds.left + bounds.right) / 2;
-    let top = (bounds.top + bounds.bottom) / 2;
-    let utils = content.windowUtils;
-    utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
-
-    Assert.ok(!overlay.classList.contains("visible"), "overlay should be hidden.");
-  });
-});
-
-// Test that the overlay cannot be interacted with after the user closes the overlay
-add_task(async function() {
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gBrowser.selectedBrowser);
-
-  await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    let closeIcon = doc.getAnonymousElementByAttribute(plugin, "anonid", "closeIcon");
-    let closeIconBounds = closeIcon.getBoundingClientRect();
-    let overlayBounds = overlay.getBoundingClientRect();
-    let overlayLeft = (overlayBounds.left + overlayBounds.right) / 2;
-    let overlayTop = (overlayBounds.left + overlayBounds.right) / 2 ;
-    let closeIconLeft = (closeIconBounds.left + closeIconBounds.right) / 2;
-    let closeIconTop = (closeIconBounds.top + closeIconBounds.bottom) / 2;
-    let utils = content.windowUtils;
-    // Simulate clicking on the close icon.
-    utils.sendMouseEvent("mousedown", closeIconLeft, closeIconTop, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", closeIconLeft, closeIconTop, 0, 1, 0, false, 0, 0);
-
-    // Simulate clicking on the overlay.
-    utils.sendMouseEvent("mousedown", overlayLeft, overlayTop, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", overlayLeft, overlayTop, 0, 1, 0, false, 0, 0);
-
-    Assert.ok(overlay.hasAttribute("dismissed") && !overlay.classList.contains("visible"),
-      "Overlay should be hidden");
-  });
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins");
-
-  ok(notification.dismissed, "No notification should be shown");
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_iframe.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* import-globals-from ../head.js */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    gBrowser.removeCurrentTab();
-    window.focus();
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_iframe.html");
-
-  // Tests that the overlays are visible and actionable if the plugin is in an iframe.
-
-  await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
-    let frame = content.document.getElementById("frame");
-    let doc = frame.contentDocument;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(plugin && overlay.classList.contains("visible"),
-      "Test 1, Plugin overlay should exist, not be hidden");
-
-    let closeIcon = doc.getAnonymousElementByAttribute(plugin, "anonid", "closeIcon");
-    let bounds = closeIcon.getBoundingClientRect();
-    let left = (bounds.left + bounds.right) / 2;
-    let top = (bounds.top + bounds.bottom) / 2;
-    let utils = doc.defaultView.windowUtils;
-    utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
-    Assert.ok(!overlay.classList.contains("visible"),
-      "Test 1, Plugin overlay should exist, be hidden");
-  });
-});
-
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_nonplugins.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* import-globals-from ../head.js */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    gBrowser.removeCurrentTab();
-    window.focus();
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_DISABLED, "Test Plug-in");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_two_types.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gBrowser.selectedBrowser);
-
-  // Test that the click-to-play notification is not shown for non-plugin object elements
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
-  ok(popupNotification, "Test 1, Should have a click-to-play notification");
-
-  let pluginRemovedPromise = BrowserTestUtils.waitForContentEvent(gBrowser.selectedBrowser, "PluginRemoved", true, null, true);
-  await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
-    let plugin = content.document.getElementById("secondtestA");
-    plugin.remove();
-    plugin = content.document.getElementById("secondtestB");
-    plugin.remove();
-
-    let image = content.document.createElement("object");
-    image.type = "image/png";
-    image.data = "moz.png";
-    content.document.body.appendChild(image);
-  });
-  await pluginRemovedPromise;
-
-  popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
-  ok(popupNotification, "Test 2, Should have a click-to-play notification");
-
-  await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
-    let plugin = content.document.getElementById("test");
-    plugin.remove();
-  });
-
-  popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gBrowser.selectedBrowser);
-  ok(popupNotification, "Test 3, Should still have a click-to-play notification");
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_outsideScrollArea.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/* import-globals-from ../head.js */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
-  let newTab = BrowserTestUtils.addTab(gBrowser);
-  gBrowser.selectedTab = newTab;
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(!popupNotification, "Test 1, Should not have a click-to-play notification");
-});
-
-// Test that the click-to-play overlay is not hidden for elements
-// partially or fully outside the viewport.
-
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_outsideScrollArea.html");
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let doc = content.document;
-    let p = doc.createElement("embed");
-
-    p.setAttribute("id", "test");
-    p.setAttribute("type", "application/x-test");
-    p.style.left = "0";
-    p.style.bottom = "200px";
-
-    doc.getElementById("container").appendChild(p);
-  });
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await promisePopupNotification("click-to-play-plugins");
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let plugin = content.document.getElementById("test");
-    let doc = content.document;
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(overlay && overlay.classList.contains("visible") &&
-              overlay.getAttribute("sizing") != "blank",
-              "Test 2, overlay should be visible.");
-  });
-});
-
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_outsideScrollArea.html");
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let doc = content.document;
-    let p = doc.createElement("embed");
-
-    p.setAttribute("id", "test");
-    p.setAttribute("type", "application/x-test");
-    p.style.left = "0";
-    p.style.bottom = "-410px";
-
-    doc.getElementById("container").appendChild(p);
-  });
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await promisePopupNotification("click-to-play-plugins");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let plugin = content.document.getElementById("test");
-    let doc = content.document;
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(overlay && overlay.classList.contains("visible") &&
-              overlay.getAttribute("sizing") != "blank",
-              "Test 3, overlay should be visible.");
-  });
-});
-
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_outsideScrollArea.html");
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let doc = content.document;
-    let p = doc.createElement("embed");
-
-    p.setAttribute("id", "test");
-    p.setAttribute("type", "application/x-test");
-    p.style.left = "-600px";
-    p.style.bottom = "0";
-
-    doc.getElementById("container").appendChild(p);
-  });
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await promisePopupNotification("click-to-play-plugins");
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let plugin = content.document.getElementById("test");
-    let doc = content.document;
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(!overlay || overlay.getAttribute("sizing") == "blank",
-      "Test 4, overlay should be blank.");
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_overlay_styles.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* import-globals-from ../head.js */
-
-/* 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/. */
-
-"use strict";
-
-/* This test ensures that the click-to-play "Activate Plugin" overlay
- * is shown in the right style (which is dependent on its size).
- */
-
-const rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-
-var gTestBrowser = null;
-
-const gTestcases = {
-
-  // 10x10
-  testcase1: {
-    sizing: "blank",
-    notext: null,
-  },
-
-  // 40x40
-  testcase2: {
-    sizing: "tiny",
-    notext: "notext",
-  },
-
-  // 100x70
-  testcase3: {
-    sizing: "reduced",
-    notext: "notext",
-  },
-
-  // 200x200
-  testcase4: {
-    sizing: null,
-    notext: "notext",
-  },
-
-  // 300x300
-  testcase5: {
-    sizing: null,
-    notext: null,
-  },
-};
-
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    gBrowser.removeCurrentTab();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(!popupNotification, "Sanity check, should not have a click-to-play notification");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_overlay_styles.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await ContentTask.spawn(gTestBrowser, gTestcases, async function(testcases) {
-    let doc = content.document;
-
-    for (let testcaseId of Object.keys(testcases)) {
-      let plugin = doc.querySelector(`#${testcaseId} > object`);
-      let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-      Assert.ok(overlay, `overlay exists in ${testcaseId}`);
-
-      let expectations = testcases[testcaseId];
-
-      Assert.ok(overlay.classList.contains("visible"),
-                `The expected visibility is correct in ${testcaseId}`);
-
-      Assert.ok(overlay.getAttribute("sizing") == expectations.sizing,
-                `The expected sizing is correct in ${testcaseId}`);
-
-      Assert.ok(overlay.getAttribute("notext") == expectations.notext,
-                `The expected notext is correct in ${testcaseId}`);
-    }
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_resize.js
+++ /dev/null
@@ -1,132 +0,0 @@
-/* import-globals-from ../head.js */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
-  let newTab = BrowserTestUtils.addTab(gBrowser);
-  gBrowser.selectedTab = newTab;
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(!popupNotification, "Test 1, Should not have a click-to-play notification");
-
-  await promiseTabLoadEvent(newTab, gTestRoot + "plugin_small.html"); // 10x10 plugin
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await promisePopupNotification("click-to-play-plugins");
-});
-
-// Test that the overlay is hidden for "small" plugin elements and is shown
-// once they are resized to a size that can hold the overlay
-add_task(async function() {
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(popupNotification, "Test 2, Should have a click-to-play notification");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(!overlay || overlay.getAttribute("sizing") == "blank",
-      "Test 2, overlay should be blank.");
-  });
-});
-
-add_task(async function() {
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let plugin = content.document.getElementById("test");
-    plugin.style.width = "300px";
-  });
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(!overlay || overlay.getAttribute("sizing") == "blank",
-      "Test 3, overlay should be blank.");
-  });
-});
-
-
-add_task(async function() {
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let plugin = content.document.getElementById("test");
-    plugin.style.height = "300px";
-  });
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    content.document.getElementById("test").clientTop;
-  });
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(overlay && overlay.getAttribute("sizing") != "blank",
-      "Test 4, overlay should be visible.");
-  });
-});
-
-add_task(async function() {
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let plugin = content.document.getElementById("test");
-    plugin.style.width = "10px";
-    plugin.style.height = "10px";
-  });
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    content.document.getElementById("test").clientTop;
-  });
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(!overlay || overlay.getAttribute("sizing") == "blank",
-      "Test 5, overlay should be blank.");
-  });
-});
-
-add_task(async function() {
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let plugin = content.document.getElementById("test");
-    plugin.style.height = "300px";
-    plugin.style.width = "300px";
-  });
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    content.document.getElementById("test").clientTop;
-  });
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(overlay && overlay.getAttribute("sizing") != "blank",
-      "Test 6, overlay should be visible.");
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_shouldShowOverlay.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* import-globals-from ../head.js */
-
-/* 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/. */
-
-"use strict";
-
-/* This test ensures that the click-to-play "Activate Plugin" overlay
- * is shown when expected.
- * All testcases are in the plugin_shouldShowOverlay.html file.
- *
- * Note: Technically, the overlay is *always* shown. When this test was
- * originally written, the meaning of "shown" was "shown with the contents",
- * as opposed to "shown as blank". The behavior hasn't changed, but the naming
- * has: now, a "shown as blank" overlay no longer receives a ".hidden" class.
- * It receives a sizing="blank" attribute.
- */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-
-var gTestBrowser = null;
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    gBrowser.removeCurrentTab();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(!popupNotification, "Sanity check, should not have a click-to-play notification");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_shouldShowOverlay.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let testcases = doc.querySelectorAll(".testcase");
-
-    for (let testcase of testcases) {
-      let plugin = testcase.querySelector("object");
-      Assert.ok(plugin, `plugin exists in ${testcase.id}`);
-
-      let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-      Assert.ok(overlay, `overlay exists in ${testcase.id}`);
-
-      let expectedVisibility = (testcase.getAttribute("shouldshow") == "true");
-      Assert.ok((overlay.getAttribute("sizing") != "blank") == expectedVisibility,
-                `The expected visibility is correct in ${testcase.id}`);
-    }
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_CTP_zoom.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* import-globals-from ../head.js */
-
-"use strict";
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-
-var gTestBrowser = null;
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    FullZoom.reset(); // must be called before closing the tab we zoomed!
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(!popupNotification, "Test 1, Should not have a click-to-play notification");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_zoom.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await promisePopupNotification("click-to-play-plugins");
-});
-
-// Enlarges the zoom level 4 times and tests that the overlay is
-// visible after each enlargement.
-add_task(async function() {
-  for (let count = 0; count < 4; count++) {
-
-    FullZoom.enlarge();
-
-    // Reload the page
-    await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_zoom.html");
-    await promiseUpdatePluginBindings(gTestBrowser);
-    await ContentTask.spawn(gTestBrowser, { count }, async function(args) {
-      let doc = content.document;
-      let plugin = doc.getElementById("test");
-      let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-      Assert.ok(overlay && overlay.classList.contains("visible"),
-        "Overlay should be visible for zoom change count " + args.count);
-    });
-  }
-});
-
-
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_blocking.js
+++ /dev/null
@@ -1,309 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-
-function updateAllTestPlugins(aState) {
-  setTestPluginEnabledState(aState, "Test Plug-in");
-  setTestPluginEnabledState(aState, "Second Test Plug-in");
-}
-
-add_task(async function() {
-  registerCleanupFunction(async function() {
-    clearAllPluginPermissions();
-    updateAllTestPlugins(Ci.nsIPluginTag.STATE_ENABLED);
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-    resetBlocklist();
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-
-  // Prime the content process
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html>hi</html>");
-});
-
-// Tests a vulnerable, updatable plugin
-
-add_task(async function() {
-  // enable hard blocklisting of test
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginVulnerableUpdatable.xml", gTestBrowser);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await promisePopupNotification("click-to-play-plugins");
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE,
-     "Test 18a, plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
-  ok(!pluginInfo.activated, "Test 18a, Plugin should not be activated");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(overlay && overlay.classList.contains("visible"),
-      "Test 18a, Plugin overlay should exist, not be hidden");
-
-    let updateLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "checkForUpdatesLink");
-    Assert.ok(updateLink.style.visibility != "hidden",
-      "Test 18a, Plugin should have an update link");
-  });
-
-  let promise = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen", true);
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let updateLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "checkForUpdatesLink");
-    let bounds = updateLink.getBoundingClientRect();
-    let left = (bounds.left + bounds.right) / 2;
-    let top = (bounds.top + bounds.bottom) / 2;
-    let utils = content.windowUtils;
-    utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
-  });
-  await promise;
-
-  promise = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabClose", true);
-  gBrowser.removeCurrentTab();
-  await promise;
-});
-
-add_task(async function() {
-  // clicking the update link should not activate the plugin
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE,
-     "Test 18a, plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
-  ok(!pluginInfo.activated, "Test 18b, Plugin should not be activated");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(overlay && overlay.classList.contains("visible"),
-      "Test 18b, Plugin overlay should exist, not be hidden");
-  });
-});
-
-// Tests a vulnerable plugin with no update
-add_task(async function() {
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginVulnerableNoUpdate.xml", gTestBrowser);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(notification, "Test 18c, Should have a click-to-play notification");
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE,
-     "Test 18c, plugin fallback type should be PLUGIN_VULNERABLE_NO_UPDATE");
-  ok(!pluginInfo.activated, "Test 18c, Plugin should not be activated");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(overlay && overlay.classList.contains("visible"),
-      "Test 18c, Plugin overlay should exist, not be hidden");
-
-    let updateLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "checkForUpdatesLink");
-    Assert.ok(updateLink && updateLink.style.display != "block",
-      "Test 18c, Plugin should not have an update link");
-  });
-
-  // check that click "Allow" works with blocked plugins
-  await promiseForNotificationShown(notification);
-
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE,
-     "Test 18c, plugin fallback type should be PLUGIN_VULNERABLE_NO_UPDATE");
-  ok(pluginInfo.activated, "Test 18c, Plugin should be activated");
-  let enabledState = getTestPluginEnabledState();
-  ok(enabledState, "Test 18c, Plugin enabled state should be STATE_CLICKTOPLAY");
-});
-
-// continue testing "Always allow", make sure it sticks.
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  ok(pluginInfo.activated, "Test 18d, Waited too long for plugin to activate");
-
-  clearAllPluginPermissions();
-});
-
-// clicking the in-content overlay of a vulnerable plugin should bring
-// up the notification and not directly activate the plugin
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(notification, "Test 18f, Should have a click-to-play notification");
-  ok(notification.dismissed, "Test 18f, notification should start dismissed");
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  ok(!pluginInfo.activated, "Test 18f, Waited too long for plugin to activate");
-
-  var oldEventCallback = notification.options.eventCallback;
-  let promise = promiseForCondition(() => oldEventCallback == null);
-  notification.options.eventCallback = function() {
-    if (oldEventCallback) {
-      oldEventCallback();
-    }
-    oldEventCallback = null;
-  };
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let bounds = plugin.getBoundingClientRect();
-    let left = (bounds.left + bounds.right) / 2;
-    let top = (bounds.top + bounds.bottom) / 2;
-    let utils = content.windowUtils;
-    utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
-  });
-  await promise;
-
-  ok(notification, "Test 18g, Should have a click-to-play notification");
-  ok(!notification.dismissed, "Test 18g, notification should be open");
-
-  pluginInfo = await promiseForPluginInfo("test");
-  ok(!pluginInfo.activated, "Test 18g, Plugin should not be activated");
-});
-
-// Test that "always allow"-ing a plugin will not allow it when it becomes
-// blocklisted.
-add_task(async function() {
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(notification, "Test 24a, Should have a click-to-play notification");
-
-  // Plugin should start as CTP
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
-     "Test 24a, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
-  ok(!pluginInfo.activated, "Test 24a, Plugin should not be active.");
-
-  // simulate "allow"
-  await promiseForNotificationShown(notification);
-
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  pluginInfo = await promiseForPluginInfo("test");
-  ok(pluginInfo.activated, "Test 24a, Plugin should be active.");
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginVulnerableUpdatable.xml", gTestBrowser);
-});
-
-// the plugin is now blocklisted, so it should not automatically load
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(notification, "Test 24b, Should have a click-to-play notification");
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE,
-     "Test 24b, plugin fallback type should be PLUGIN_VULNERABLE_UPDATABLE");
-  ok(!pluginInfo.activated, "Test 24b, Plugin should not be active.");
-
-  // simulate "allow"
-  await promiseForNotificationShown(notification);
-
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  pluginInfo = await promiseForPluginInfo("test");
-  ok(pluginInfo.activated, "Test 24b, Plugin should be active.");
-
-  clearAllPluginPermissions();
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-});
-
-// Plugin sync removal test. Note this test produces a notification drop down since
-// the plugin we add has zero dims.
-add_task(async function() {
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_syncRemoved.html");
-
-  // Maybe there some better trick here, we need to wait for the page load, then
-  // wait for the js to execute in the page.
-  await waitForMs(500);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins");
-  ok(notification, "Test 25: There should be a plugin notification even if the plugin was immediately removed");
-  ok(notification.dismissed, "Test 25: The notification should be dismissed by default");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html>hi</html>");
-});
-
-// Tests a page with a blocked plugin in it and make sure the infoURL property
-// the blocklist file gets used.
-add_task(async function() {
-  clearAllPluginPermissions();
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginInfoURL.xml", gTestBrowser);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins");
-
-  // Since the plugin notification is dismissed by default, reshow it.
-  await promiseForNotificationShown(notification);
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED,
-     "Test 26, plugin fallback type should be PLUGIN_BLOCKLISTED");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let plugin = content.document.getElementById("test");
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    Assert.ok(!objLoadingContent.activated, "Plugin should not be activated.");
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_blocklist_content.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestBrowser = null;
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gChromeRoot = getRootDirectory(gTestPath);
-
-add_task(async function() {
-  registerCleanupFunction(async function() {
-    clearAllPluginPermissions();
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-    resetBlocklist();
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-
-  // Prime the blocklist service, the remote service doesn't launch on startup.
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html></html>");
-});
-
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let test = content.document.getElementById("test");
-    Assert.ok(test.activated, "task 1a: test plugin should be activated!");
-  });
-});
-
-// Load a fresh page, load a new plugin blocklist, then load the same page again.
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html>GO!</html>");
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginHard.xml", gTestBrowser);
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let test = content.document.getElementById("test");
-    ok(!test.activated, "task 2a: test plugin shouldn't activate!");
-  });
-});
-
-// Unload the block list and lets do this again, only this time lets
-// hack around in the content blocklist service maliciously.
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html>GO!</html>");
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-
-  // Hack the planet! Load our blocklist shim, so we can mess with blocklist
-  // return results in the content process. Active until we close our tab.
-  let mm = gTestBrowser.messageManager;
-  info("test 3a: loading " + gChromeRoot + "blocklist_proxy.js\n");
-  mm.loadFrameScript(gChromeRoot + "blocklist_proxy.js", true);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let test = content.document.getElementById("test");
-    Assert.ok(test.activated, "task 3a: test plugin should be activated!");
-  });
-});
-
-// Load a fresh page, load a new plugin blocklist, then load the same page again.
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html>GO!</html>");
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginHard.xml", gTestBrowser);
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let test = content.document.getElementById("test");
-    Assert.ok(!test.activated, "task 4a: test plugin shouldn't activate!");
-  });
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_bug743421.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-
-add_task(async function() {
-  registerCleanupFunction(async function() {
-    clearAllPluginPermissions();
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-    resetBlocklist();
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  let newTab = BrowserTestUtils.addTab(gBrowser);
-  gBrowser.selectedTab = newTab;
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in");
-
-  // Prime the blocklist service, the remote service doesn't launch on startup.
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html></html>");
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-});
-
-// Tests that navigation within the page and the window.history API doesn't break click-to-play state.
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_add_dynamically.html");
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(!notification, "Test 1a, Should not have a click-to-play notification");
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    new XPCNativeWrapper(XPCNativeWrapper.unwrap(content).addPlugin());
-  });
-
-  await promisePopupNotification("click-to-play-plugins");
-});
-
-add_task(async function() {
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let plugin = content.document.getElementsByTagName("embed")[0];
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    Assert.ok(!objLoadingContent.activated, "Test 1b, Plugin should not be activated");
-  });
-
-  // Click the activate button on doorhanger to make sure it works
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-
-  await promiseForNotificationShown(notification);
-
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let plugin = content.document.getElementsByTagName("embed")[0];
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    Assert.ok(objLoadingContent.activated, "Test 1b, Plugin should be activated");
-  });
-});
-
-add_task(async function() {
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(notification, "Test 1c, Should still have a click-to-play notification");
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    new XPCNativeWrapper(XPCNativeWrapper.unwrap(content).addPlugin());
-    let plugin = content.document.getElementsByTagName("embed")[1];
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    Assert.ok(objLoadingContent.activated,
-      "Test 1c, Newly inserted plugin in activated page should be activated");
-  });
-});
-
-add_task(async function() {
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let plugin = content.document.getElementsByTagName("embed")[1];
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    Assert.ok(objLoadingContent.activated, "Test 1d, Plugin should be activated");
-
-    let promise = ContentTaskUtils.waitForEvent(content, "hashchange");
-    content.location += "#anchorNavigation";
-    await promise;
-  });
-});
-
-add_task(async function() {
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    new XPCNativeWrapper(XPCNativeWrapper.unwrap(content).addPlugin());
-    let plugin = content.document.getElementsByTagName("embed")[2];
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    Assert.ok(objLoadingContent.activated, "Test 1e, Plugin should be activated");
-  });
-});
-
-add_task(async function() {
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let plugin = content.document.getElementsByTagName("embed")[2];
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    Assert.ok(objLoadingContent.activated, "Test 1f, Plugin should be activated");
-
-    content.history.replaceState({}, "", "replacedState");
-    new XPCNativeWrapper(XPCNativeWrapper.unwrap(content).addPlugin());
-    plugin = content.document.getElementsByTagName("embed")[3];
-    objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    Assert.ok(objLoadingContent.activated, "Test 1g, Plugin should be activated");
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_bug744745.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-var gNumPluginBindingsAttached = 0;
-
-function pluginBindingAttached() {
-  gNumPluginBindingsAttached++;
-  if (gNumPluginBindingsAttached != 1) {
-    ok(false, "if we've gotten here, something is quite wrong");
-  }
-}
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    gTestBrowser.removeEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
-    clearAllPluginPermissions();
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  BrowserTestUtils.addContentEventListener(gTestBrowser, "PluginBindingAttached", pluginBindingAttached, true, null, true);
-
-  let testRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-  await promiseTabLoadEvent(gBrowser.selectedTab, testRoot + "plugin_bug744745.html");
-
-  await promiseForCondition(function() { return gNumPluginBindingsAttached == 1; });
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let plugin = content.document.getElementById("test");
-    if (!plugin) {
-      Assert.ok(false, "plugin element not available.");
-      return;
-    }
-    // We can't use MochiKit's routine
-    let style = content.getComputedStyle(plugin);
-    Assert.ok(("opacity" in style) && style.opacity == 1, "plugin style properly configured.");
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_bug787619.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-var gWrapperClickCount = 0;
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  let testRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-  await promiseTabLoadEvent(gBrowser.selectedTab, testRoot + "plugin_bug787619.html");
-
-  // Due to layout being async, "PluginBindAttached" may trigger later.
-  // This forces a layout flush, thus triggering it, and schedules the
-  // test so it is definitely executed afterwards.
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  // check plugin state
-  let pluginInfo = await promiseForPluginInfo("plugin");
-  ok(!pluginInfo.activated, "1a plugin should not be activated");
-
-  // click the overlay to prompt
-  let promise = promisePopupNotification("click-to-play-plugins");
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    let plugin = content.document.getElementById("plugin");
-    let bounds = plugin.getBoundingClientRect();
-    let left = (bounds.left + bounds.right) / 2;
-    let top = (bounds.top + bounds.bottom) / 2;
-    let utils = content.windowUtils;
-    utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
-  });
-  await promise;
-
-  // check plugin state
-  pluginInfo = await promiseForPluginInfo("plugin");
-  ok(!pluginInfo.activated, "1b plugin should not be activated");
-
-  let condition = () => !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed &&
-    PopupNotifications.panel.firstElementChild;
-  await promiseForCondition(condition);
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  // check plugin state
-  pluginInfo = await promiseForPluginInfo("plugin");
-  ok(pluginInfo.activated, "plugin should be activated");
-
-  is(gWrapperClickCount, 0, "wrapper should not have received any clicks");
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_bug797677.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-var gConsoleErrors = 0;
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    Services.console.unregisterListener(errorListener);
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  let errorListener = {
-    observe(aMessage) {
-      if (aMessage.message.includes("NS_ERROR_FAILURE"))
-        gConsoleErrors++;
-    },
-  };
-  Services.console.registerListener(errorListener);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_bug797677.html");
-
-  let pluginInfo = await promiseForPluginInfo("plugin");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_UNSUPPORTED, "plugin should not have been found.");
-
-  // simple cpows
-  await ContentTask.spawn(gTestBrowser, null, function() {
-    let plugin = content.document.getElementById("plugin");
-    ok(plugin, "plugin should be in the page");
-  });
-  is(gConsoleErrors, 0, "should have no console errors");
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_bug812562.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-
-add_task(async function() {
-  registerCleanupFunction(async function() {
-    clearAllPluginPermissions();
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-    resetBlocklist();
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  // Prime the blocklist service, the remote service doesn't launch on startup.
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html></html>");
-});
-
-// Tests that the going back will reshow the notification for click-to-play
-// blocklisted plugins
-add_task(async function() {
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginVulnerableUpdatable.xml", gTestBrowser);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(popupNotification, "test part 1: Should have a click-to-play notification");
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE, "plugin should be marked as VULNERABLE");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    Assert.ok(!!content.document.getElementById("test"),
-      "test part 1: plugin should not be activated");
-  });
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html></html>");
-});
-
-add_task(async function() {
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(!popupNotification, "test part 2: Should not have a click-to-play notification");
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    Assert.ok(!content.document.getElementById("test"),
-      "test part 2: plugin should not be activated");
-  });
-
-  let obsPromise = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
-  let overlayPromise = promisePopupNotification("click-to-play-plugins");
-  gTestBrowser.goBack();
-  await obsPromise;
-  await overlayPromise;
-});
-
-add_task(async function() {
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(popupNotification, "test part 3: Should have a click-to-play notification");
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE, "plugin should be marked as VULNERABLE");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    Assert.ok(!!content.document.getElementById("test"),
-      "test part 3: plugin should not be activated");
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_bug818118.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_both.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(popupNotification, "should have a click-to-play notification");
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "plugin should be click to play");
-  ok(!pluginInfo.activated, "plugin should not be activated");
-
-  await ContentTask.spawn(gTestBrowser, null, () => {
-    let unknown = content.document.getElementById("unknown");
-    ok(unknown, "should have unknown plugin in page");
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_bug820497.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-var gNumPluginBindingsAttached = 0;
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    gBrowser.removeCurrentTab();
-    window.focus();
-    gTestBrowser = null;
-  });
-});
-
-add_task(async function() {
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in");
-
-  BrowserTestUtils.addContentEventListener(gTestBrowser, "PluginBindingAttached", function() { gNumPluginBindingsAttached++; }, true, null, true);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_bug820497.html");
-
-  await promiseForCondition(function() { return gNumPluginBindingsAttached == 1; });
-
-  await ContentTask.spawn(gTestBrowser, null, () => {
-    // Note we add the second plugin in the code farther down, so there's
-    // no way we got here with anything but one plugin loaded.
-    let doc = content.document;
-    let testplugin = doc.getElementById("test");
-    ok(testplugin, "should have test plugin");
-    let secondtestplugin = doc.getElementById("secondtest");
-    ok(!secondtestplugin, "should not yet have second test plugin");
-  });
-
-  await promisePopupNotification("click-to-play-plugins");
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(notification, "should have a click-to-play notification");
-
-  await promiseForNotificationShown(notification);
-
-  is(notification.options.pluginData.size, 1, "should be 1 type of plugin in the popup notification");
-
-  await ContentTask.spawn(gTestBrowser, {}, async function() {
-    XPCNativeWrapper.unwrap(content).addSecondPlugin();
-  });
-
-  await promiseForCondition(function() { return gNumPluginBindingsAttached == 2; });
-
-  await ContentTask.spawn(gTestBrowser, null, () => {
-    let doc = content.document;
-    let testplugin = doc.getElementById("test");
-    ok(testplugin, "should have test plugin");
-    let secondtestplugin = doc.getElementById("secondtest");
-    ok(secondtestplugin, "should have second test plugin");
-  });
-
-  notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-
-  ok(notification, "should have popup notification");
-
-  await promiseForNotificationShown(notification);
-
-  is(notification.options.pluginData.size, 2, "aited too long for 2 types of plugins in popup notification");
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_clearplugindata.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<html>
-  <head>
-    <title>Plugin Clear Site Data sanitize test</title>
-
-    <embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
-
-    <script type="application/javascript">
-      function testSteps() {
-        // Make sure clearing by timerange is supported.
-        var p = document.getElementById("plugin1");
-        p.setSitesWithDataCapabilities(true);
-
-        p.setSitesWithData(
-          "foo.com:0:5," +
-          "bar.com:0:100," +
-          "baz.com:1:5," +
-          "qux.com:1:100"
-        );
-      }
-    </script>
-  </head>
-
-  <body onload="testSteps();"></body>
-
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_clearplugindata.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-var gTestBrowser = null;
-
-// Test clearing plugin data using Sanitizer.jsm.
-const testURL1 = gTestRoot + "browser_clearplugindata.html";
-const testURL2 = gTestRoot + "browser_clearplugindata_noage.html";
-
-const {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm");
-
-const pluginHostIface = Ci.nsIPluginHost;
-var pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-pluginHost.QueryInterface(pluginHostIface);
-
-var pluginTag = getTestPlugin();
-
-function stored(needles) {
-  let something = pluginHost.siteHasData(this.pluginTag, null);
-  if (!needles)
-    return something;
-
-  if (!something)
-    return false;
-
-  for (let i = 0; i < needles.length; ++i) {
-    if (!pluginHost.siteHasData(this.pluginTag, needles[i]))
-      return false;
-  }
-  return true;
-}
-
-add_task(async function() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    if (gTestBrowser) {
-      gBrowser.removeCurrentTab();
-    }
-    window.focus();
-    gTestBrowser = null;
-  });
-
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-});
-
-function setPrefs(cookies, pluginData) {
-  let itemPrefs = Services.prefs.getBranch("privacy.cpd.");
-  itemPrefs.setBoolPref("history", false);
-  itemPrefs.setBoolPref("downloads", false);
-  itemPrefs.setBoolPref("cache", false);
-  itemPrefs.setBoolPref("cookies", cookies);
-  itemPrefs.setBoolPref("formdata", false);
-  itemPrefs.setBoolPref("offlineApps", false);
-  itemPrefs.setBoolPref("passwords", false);
-  itemPrefs.setBoolPref("sessions", false);
-  itemPrefs.setBoolPref("siteSettings", false);
-  itemPrefs.setBoolPref("pluginData", pluginData);
-}
-
-async function testClearingData(url) {
-  // Load page to set data for the plugin.
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, url);
-
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  ok(stored(["foo.com", "bar.com", "baz.com", "qux.com"]),
-    "Data stored for sites");
-
-  // Clear 20 seconds ago.
-  // In the case of testURL2 the plugin will throw
-  // NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED, which should result in us
-  // clearing all data regardless of age.
-  let now_uSec = Date.now() * 1000;
-  let range = [now_uSec - 20 * 1000000, now_uSec];
-  await Sanitizer.sanitize(null, {range, ignoreTimespan: false});
-
-  if (url == testURL1) {
-    ok(stored(["bar.com", "qux.com"]), "Data stored for sites");
-    ok(!stored(["foo.com"]), "Data cleared for foo.com");
-    ok(!stored(["baz.com"]), "Data cleared for baz.com");
-
-    // Clear everything.
-    await Sanitizer.sanitize(null, {ignoreTimespan: false});
-  }
-
-  ok(!stored(null), "All data cleared");
-
-  gBrowser.removeCurrentTab();
-  gTestBrowser = null;
-}
-
-add_task(async function() {
-  // Test when sanitizing cookies.
-  await setPrefs(true, false);
-  await testClearingData(testURL1);
-  await testClearingData(testURL2);
-
-  // Test when sanitizing pluginData.
-  await setPrefs(false, true);
-  await testClearingData(testURL1);
-  await testClearingData(testURL2);
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_clearplugindata_noage.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<html>
-  <head>
-    <title>Plugin Clear Site Data sanitize test without age</title>
-
-    <embed id="plugin1" type="application/x-test" width="200" height="200"></embed>
-
-    <script type="application/javascript">
-      function testSteps() {
-        // Make sure clearing by timerange is disabled.
-        var p = document.getElementById("plugin1");
-        p.setSitesWithDataCapabilities(false);
-
-        p.setSitesWithData(
-          "foo.com:0:5," +
-          "bar.com:0:100," +
-          "baz.com:1:5," +
-          "qux.com:1:100"
-        );
-      }
-    </script>
-  </head>
-
-  <body onload="testSteps();"></body>
-
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_enable_DRM_prompt.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Bug 1366167 - Tests that the "Enable DRM" prompt shows if EME is requested while EME is disabled.
- */
-
-const TEST_URL =
-  getRootDirectory(gTestPath).replace("chrome://mochitests/content",
-  "https://example.com") + "empty_file.html";
-
-add_task(async function() {
-  await BrowserTestUtils.withNewTab(TEST_URL, async function(browser) {
-    // Note: SpecialPowers.pushPrefEnv has problems with the "Enable DRM"
-    // button on the notification box toggling the prefs. So manually
-    // set/unset the prefs the UI we're testing toggles.
-    let emeWasEnabled = Services.prefs.getBoolPref("media.eme.enabled", false);
-    let cdmWasEnabled = Services.prefs.getBoolPref("media.gmp-widevinecdm.enabled", false);
-
-    // Restore the preferences to their pre-test state on test finish.
-    registerCleanupFunction(function() {
-        Services.prefs.setBoolPref("media.eme.enabled", emeWasEnabled);
-        Services.prefs.setBoolPref("media.gmp-widevinecdm.enabled", cdmWasEnabled);
-    });
-
-    // Turn off EME and Widevine CDM.
-    Services.prefs.setBoolPref("media.eme.enabled", false);
-    Services.prefs.setBoolPref("media.gmp-widevinecdm.enabled", false);
-
-    // Have content request access to Widevine, UI should drop down to
-    // prompt user to enable DRM.
-    let result = await ContentTask.spawn(browser, {}, async function() {
-      try {
-        let config = [{
-          initDataTypes: ["webm"],
-          videoCapabilities: [{contentType: 'video/webm; codecs="vp9"'}],
-        }];
-        await content.navigator.requestMediaKeySystemAccess("com.widevine.alpha", config);
-      } catch (ex) {
-        return {rejected: true};
-      }
-      return {rejected: false};
-    });
-    is(result.rejected, true, "EME request should be denied because EME disabled.");
-
-    // Verify the UI prompt showed.
-    let box = gBrowser.getNotificationBox(browser);
-    let notification = box.currentNotification;
-
-    ok(notification, "Notification should be visible");
-    is(notification.getAttribute("value"), "drmContentDisabled",
-       "Should be showing the right notification");
-
-    // Verify the "Enable DRM" button is there.
-    let buttons = notification.querySelectorAll(".notification-button");
-    is(buttons.length, 1, "Should have one button.");
-
-    // Prepare a Promise that should resolve when the "Enable DRM" button's
-    // page reload completes.
-    let refreshPromise = BrowserTestUtils.browserLoaded(browser);
-    buttons[0].click();
-
-    // Wait for the reload to complete.
-    await refreshPromise;
-
-    // Verify clicking the "Enable DRM" button enabled DRM.
-    let enabled = Services.prefs.getBoolPref("media.eme.enabled", true);
-    is(enabled, true, "EME should be enabled after click on 'Enable DRM' button");
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_globalplugin_crashinfobar.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* import-globals-from ../head.js */
-
-/**
- * Test that the notification bar for crashed GMPs works.
- */
-add_task(async function() {
-  await BrowserTestUtils.withNewTab({
-    gBrowser,
-    url: "about:blank",
-  }, async function(browser) {
-    await ContentTask.spawn(browser, null, async function() {
-      const GMP_CRASH_EVENT = {
-        pluginID: 1,
-        pluginName: "GlobalTestPlugin",
-        submittedCrashReport: false,
-        bubbles: true,
-        cancelable: true,
-        gmpPlugin: true,
-      };
-
-      let crashEvent = new content.PluginCrashedEvent("PluginCrashed",
-                                                      GMP_CRASH_EVENT);
-      content.dispatchEvent(crashEvent);
-    });
-
-    let notification = await waitForNotificationBar("plugin-crashed", browser);
-
-    let notificationBox = gBrowser.getNotificationBox(browser);
-    ok(notification, "Infobar was shown.");
-    is(notification.priority, notificationBox.PRIORITY_WARNING_MEDIUM,
-       "Correct priority.");
-    is(notification.messageText.textContent,
-       "The GlobalTestPlugin plugin has crashed.",
-       "Correct message.");
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_iterate_hidden_plugins.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* import-globals-from ../head.js */
-
-"use strict";
-
-const TEST_PLUGIN_NAME = "Test Plug-in";
-const HIDDEN_CTP_PLUGIN_PREF = "plugins.navigator.hidden_ctp_plugin";
-
-/**
- * If a plugin is click-to-play and named in HIDDEN_CTP_PLUGIN_PREF,
- * then the plugin should be hidden in the navigator.plugins list by default
- * when iterating.
- */
-
-add_task(async function setup() {
-  // We'll make the Test Plugin click-to-play.
-  let originalPluginState = getTestPluginEnabledState();
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-  registerCleanupFunction(() => {
-    setTestPluginEnabledState(originalPluginState);
-  });
-
-  // And then make the plugin hidden.
-  await SpecialPowers.pushPrefEnv({
-    set: [
-      [HIDDEN_CTP_PLUGIN_PREF, TEST_PLUGIN_NAME],
-      ["plugins.show_infobar", true],
-    ],
-  });
-});
-
-/**
- * Tests that if a plugin is click-to-play and in the
- * HIDDEN_CTP_PLUGIN_PREF list, then it shouldn't be visible
- * when iterating navigator.plugins.
- */
-add_task(async function test_plugin_is_hidden_on_iteration() {
-  // The plugin should not be visible when we iterate
-  // navigator.plugins.
-  await BrowserTestUtils.withNewTab({
-    gBrowser,
-    url: "http://example.com",
-  }, async function(browser) {
-    await ContentTask.spawn(browser, TEST_PLUGIN_NAME, async function(pluginName) {
-      let plugins = Array.from(content.navigator.plugins);
-      Assert.ok(plugins.every(p => p.name != pluginName),
-                "Should not find Test Plugin");
-    });
-  });
-
-  // Now clear the HIDDEN_CTP_PLUGIN_PREF temporarily and
-  // make sure we can see the plugin again.
-  await SpecialPowers.pushPrefEnv({
-    set: [[HIDDEN_CTP_PLUGIN_PREF, ""]],
-  });
-
-  // Note that I have to do this in a new tab since navigator
-  // caches navigator.plugins after an initial read.
-  await BrowserTestUtils.withNewTab({
-    gBrowser,
-    url: "http://example.com",
-  }, async function(browser) {
-    await ContentTask.spawn(browser, TEST_PLUGIN_NAME, async function(pluginName) {
-      let plugins = Array.from(content.navigator.plugins);
-      Assert.ok(plugins.some(p => p.name == pluginName),
-                "Should have found the Test Plugin");
-    });
-  });
-
-  await SpecialPowers.popPrefEnv();
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_pluginCrashCommentAndURL.js
+++ /dev/null
@@ -1,249 +0,0 @@
-/* import-globals-from ../head.js */
-
-/* global gBrowser */
-ChromeUtils.import("resource://gre/modules/CrashSubmit.jsm", this);
-
-const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gTestBrowser = null;
-var config = {};
-
-add_task(async function() {
-  // The test harness sets MOZ_CRASHREPORTER_NO_REPORT, which disables plugin
-  // crash reports.  This test needs them enabled.  The test also needs a mock
-  // report server, and fortunately one is already set up by toolkit/
-  // crashreporter/test/Makefile.in.  Assign its URL to MOZ_CRASHREPORTER_URL,
-  // which CrashSubmit.jsm uses as a server override.
-  let env = Cc["@mozilla.org/process/environment;1"]
-              .getService(Ci.nsIEnvironment);
-  let noReport = env.get("MOZ_CRASHREPORTER_NO_REPORT");
-  let serverUrl = env.get("MOZ_CRASHREPORTER_URL");
-  env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
-  env.set("MOZ_CRASHREPORTER_URL", SERVER_URL);
-
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  // Crash immediately
-  Services.prefs.setIntPref("dom.ipc.plugins.timeoutSecs", 0);
-
-  registerCleanupFunction(async function() {
-    Services.prefs.clearUserPref("dom.ipc.plugins.timeoutSecs");
-    env.set("MOZ_CRASHREPORTER_NO_REPORT", noReport);
-    env.set("MOZ_CRASHREPORTER_URL", serverUrl);
-    env = null;
-    config = null;
-    gTestBrowser = null;
-    gBrowser.removeCurrentTab();
-    window.focus();
-  });
-});
-
-add_task(async function() {
-  config = {
-    shouldSubmissionUIBeVisible: true,
-    comment: "",
-    urlOptIn: false,
-  };
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED);
-
-  let pluginCrashed = promisePluginCrashed();
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_crashCommentAndURL.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  // Wait for the plugin to crash
-  await pluginCrashed;
-
-  let crashReportStatus = TestUtils.topicObserved("crash-report-status", onSubmitStatus);
-
-  // Test that the crash submission UI is actually visible and submit the crash report.
-  await ContentTask.spawn(gTestBrowser, config, async function(aConfig) {
-    let doc = content.document;
-    let plugin = doc.getElementById("plugin");
-    let pleaseSubmit = doc.getAnonymousElementByAttribute(plugin, "anonid", "pleaseSubmit");
-    let submitButton = doc.getAnonymousElementByAttribute(plugin, "anonid", "submitButton");
-    // Test that we don't send the URL when urlOptIn is false.
-    doc.getAnonymousElementByAttribute(plugin, "anonid", "submitURLOptIn").checked = aConfig.urlOptIn;
-    submitButton.click();
-    Assert.equal(content.getComputedStyle(pleaseSubmit).display == "block",
-      aConfig.shouldSubmissionUIBeVisible, "The crash UI should be visible");
-  });
-
-  await crashReportStatus;
-});
-
-add_task(async function() {
-  config = {
-    shouldSubmissionUIBeVisible: true,
-    comment: "a test comment",
-    urlOptIn: true,
-  };
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED);
-
-  let pluginCrashed = promisePluginCrashed();
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_crashCommentAndURL.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  // Wait for the plugin to crash
-  await pluginCrashed;
-
-  let crashReportStatus = TestUtils.topicObserved("crash-report-status", onSubmitStatus);
-
-  // Test that the crash submission UI is actually visible and submit the crash report.
-  await ContentTask.spawn(gTestBrowser, config, async function(aConfig) {
-    let doc = content.document;
-    let plugin = doc.getElementById("plugin");
-    let pleaseSubmit = doc.getAnonymousElementByAttribute(plugin, "anonid", "pleaseSubmit");
-    let submitButton = doc.getAnonymousElementByAttribute(plugin, "anonid", "submitButton");
-    // Test that we send the URL when urlOptIn is true.
-    doc.getAnonymousElementByAttribute(plugin, "anonid", "submitURLOptIn").checked = aConfig.urlOptIn;
-    doc.getAnonymousElementByAttribute(plugin, "anonid", "submitComment").value = aConfig.comment;
-    submitButton.click();
-    Assert.equal(content.getComputedStyle(pleaseSubmit).display == "block",
-      aConfig.shouldSubmissionUIBeVisible, "The crash UI should be visible");
-  });
-
-  await crashReportStatus;
-});
-
-add_task(async function() {
-  config = {
-    shouldSubmissionUIBeVisible: false,
-    comment: "",
-    urlOptIn: true,
-  };
-
-  // Deferred promise object used by the test to wait for the crash handler
-  let crashDeferred = PromiseUtils.defer();
-
-  // Clear out any minidumps we create from plugin crashes, this is needed
-  // because we do not submit the crash otherwise the submission process would
-  // have deleted the crash dump files for us.
-  let crashObserver = (subject, topic, data) => {
-    if (topic != "plugin-crashed") {
-      return;
-    }
-
-    let propBag = subject.QueryInterface(Ci.nsIPropertyBag2);
-    let minidumpID = propBag.getPropertyAsAString("pluginDumpID");
-
-    Services.crashmanager.ensureCrashIsPresent(minidumpID).then(() => {
-      let minidumpDir = Services.dirsvc.get("UAppData", Ci.nsIFile);
-      minidumpDir.append("Crash Reports");
-      minidumpDir.append("pending");
-
-      let pluginDumpFile = minidumpDir.clone();
-      pluginDumpFile.append(minidumpID + ".dmp");
-
-      let extraFile = minidumpDir.clone();
-      extraFile.append(minidumpID + ".extra");
-
-      pluginDumpFile.remove(false);
-      extraFile.remove(false);
-      crashDeferred.resolve();
-    });
-  };
-
-  Services.obs.addObserver(crashObserver, "plugin-crashed");
-
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED);
-
-  let pluginCrashed = promisePluginCrashed();
-
-  // Make sure that the plugin container is too small to display the crash submission UI
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_crashCommentAndURL.html?" +
-                            encodeURIComponent(JSON.stringify({width: 300, height: 300})));
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  // Wait for the plugin to crash
-  await pluginCrashed;
-
-  // Test that the crash submission UI is not visible and do not submit a crash report.
-  await ContentTask.spawn(gTestBrowser, config, async function(aConfig) {
-    let doc = content.document;
-    let plugin = doc.getElementById("plugin");
-    let pleaseSubmit = doc.getAnonymousElementByAttribute(plugin, "anonid", "pleaseSubmit");
-    Assert.equal(!!pleaseSubmit && content.getComputedStyle(pleaseSubmit).display == "block",
-      aConfig.shouldSubmissionUIBeVisible, "Plugin crash UI should not be visible");
-  });
-
-  await crashDeferred.promise;
-  Services.obs.removeObserver(crashObserver, "plugin-crashed");
-});
-
-function promisePluginCrashed() {
-  return new ContentTask.spawn(gTestBrowser, {}, async function() {
-    await new Promise((resolve) => {
-      addEventListener("PluginCrashReporterDisplayed", function onPluginCrashed() {
-        removeEventListener("PluginCrashReporterDisplayed", onPluginCrashed);
-        resolve();
-      });
-    });
-  });
-}
-
-function onSubmitStatus(aSubject, aData) {
-  if (aData === "submitting") {
-    return false;
-  }
-
-  is(aData, "success", "The crash report should be submitted successfully");
-
-  let propBag = aSubject.QueryInterface(Ci.nsIPropertyBag);
-  if (aData == "success") {
-    let remoteID = getPropertyBagValue(propBag, "serverCrashID");
-    ok(!!remoteID, "serverCrashID should be set");
-
-    // Remove the submitted report file.
-    let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
-    file.initWithPath(Services.crashmanager._submittedDumpsDir);
-    file.append(remoteID + ".txt");
-    ok(file.exists(), "Submitted report file should exist");
-    file.remove(false);
-  }
-
-  let extra = getPropertyBagValue(propBag, "extra");
-  ok(extra instanceof Ci.nsIPropertyBag, "Extra data should be property bag");
-
-  let val = getPropertyBagValue(extra, "PluginUserComment");
-  if (config.comment) {
-    is(val, config.comment,
-       "Comment in extra data should match comment in textbox");
-  } else {
-    ok(val === undefined,
-       "Comment should be absent from extra data when textbox is empty");
-  }
-
-  val = getPropertyBagValue(extra, "PluginContentURL");
-  if (config.urlOptIn) {
-    is(val, gBrowser.currentURI.spec,
-       "URL in extra data should match browser URL when opt-in checked");
-  } else {
-    ok(val === undefined,
-       "URL should be absent from extra data when opt-in not checked");
-  }
-
-  return true;
-}
-
-function getPropertyBagValue(bag, key) {
-  try {
-    var val = bag.getProperty(key);
-  } catch (e) {
-    if (e.result != Cr.NS_ERROR_FAILURE) {
-      throw e;
-    }
-  }
-  return val;
-}
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_pluginCrashReportNonDeterminism.js
+++ /dev/null
@@ -1,270 +0,0 @@
-/* import-globals-from ../head.js */
-
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const {PromiseUtils} = ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
-
-/**
- * With e10s, plugins must run in their own process. This means we have
- * three processes at a minimum when we're running a plugin:
- *
- * 1) The main browser, or "chrome" process
- * 2) The content process hosting the plugin instance
- * 3) The plugin process
- *
- * If the plugin process crashes, we cannot be sure if the chrome process
- * will hear about it first, or the content process will hear about it
- * first. Because of how IPC works, that's really up to the operating system,
- * and we assume any guarantees about it, so we have to account for both
- * possibilities.
- *
- * This test exercises the browser's reaction to both possibilities.
- */
-
-const CRASH_URL = "http://example.com/browser/browser/base/content/test/plugins/plugin_crashCommentAndURL.html";
-const CRASHED_MESSAGE = "BrowserPlugins:NPAPIPluginProcessCrashed";
-
-/**
- * In order for our test to work, we need to be able to put a plugin
- * in a very specific state. Specifically, we need it to match the
- * :-moz-handler-crashed pseudoselector. The only way I can find to
- * do that is by actually crashing the plugin. So we wait for the
- * plugin to crash and show the "please" state (since that will
- * only show if both the message from the parent has been received
- * AND the PluginCrashed event has fired).
- *
- * Once in that state, we try to rewind the clock a little bit - we clear
- * out the crashData cache in the PluginContent with a message, and we also
- * override the pluginFallbackState of the <object> to fool PluginContent
- * into believing that the plugin is in a particular state.
- *
- * @param browser
- *        The browser that has loaded the CRASH_URL that we need to
- *        prepare to be in the special state.
- * @param pluginFallbackState
- *        The value we should override the <object>'s pluginFallbackState
- *        with.
- * @return Promise
- *        The Promise resolves when the plugin has officially been put into
- *        the crash reporter state, and then "rewound" to have the "status"
- *        attribute of the statusDiv removed. The resolved Promise returns
- *        the run ID for the crashed plugin. It rejects if we never get into
- *        the crash reporter state.
- */
-function preparePlugin(browser, pluginFallbackState) {
-  return ContentTask.spawn(browser, pluginFallbackState, async function(contentPluginFallbackState) {
-    let plugin = content.document.getElementById("plugin");
-    plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    // CRASH_URL will load a plugin that crashes immediately. We
-    // wait until the plugin has finished being put into the crash
-    // state.
-    let statusDiv;
-    await ContentTaskUtils.waitForCondition(() => {
-      statusDiv = plugin.ownerDocument
-                        .getAnonymousElementByAttribute(plugin, "anonid",
-                                                        "submitStatus");
-      return statusDiv && statusDiv.getAttribute("status") == "please";
-    }, "Timed out waiting for plugin to be in crash report state");
-
-    // "Rewind", by wiping out the status attribute...
-    statusDiv.removeAttribute("status");
-    // Somehow, I'm able to get away with overriding the getter for
-    // this XPCOM object. Probably because I've got chrome privledges.
-    Object.defineProperty(plugin, "pluginFallbackType", {
-      get() {
-        return contentPluginFallbackState;
-      },
-    });
-    return plugin.runID;
-  }).then((runID) => {
-    browser.messageManager.sendAsyncMessage("BrowserPlugins:Test:ClearCrashData");
-    return runID;
-  });
-}
-
-// Bypass click-to-play
-setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED);
-
-// Deferred promise object used by the test to wait for the crash handler
-let crashDeferred = null;
-
-// Clear out any minidumps we create from plugins - we really don't care
-// about them.
-let crashObserver = (subject, topic, data) => {
-  if (topic != "plugin-crashed") {
-    return;
-  }
-
-  let propBag = subject.QueryInterface(Ci.nsIPropertyBag2);
-  let minidumpID = propBag.getPropertyAsAString("pluginDumpID");
-
-  Services.crashmanager.ensureCrashIsPresent(minidumpID).then(() => {
-    let minidumpDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
-    minidumpDir.append("minidumps");
-
-    let pluginDumpFile = minidumpDir.clone();
-    pluginDumpFile.append(minidumpID + ".dmp");
-
-    let extraFile = minidumpDir.clone();
-    extraFile.append(minidumpID + ".extra");
-
-    ok(pluginDumpFile.exists(), "Found minidump");
-    ok(extraFile.exists(), "Found extra file");
-
-    pluginDumpFile.remove(false);
-    extraFile.remove(false);
-    crashDeferred.resolve();
-  });
-};
-
-Services.obs.addObserver(crashObserver, "plugin-crashed");
-// plugins.testmode will make BrowserPlugins:Test:ClearCrashData work.
-Services.prefs.setBoolPref("plugins.testmode", true);
-registerCleanupFunction(() => {
-  Services.prefs.clearUserPref("plugins.testmode");
-  Services.obs.removeObserver(crashObserver, "plugin-crashed");
-});
-
-/**
- * In this case, the chrome process hears about the crash first.
- */
-add_task(async function testChromeHearsPluginCrashFirst() {
-  // Setup the crash observer promise
-  crashDeferred = PromiseUtils.defer();
-
-  // Open a remote window so that we can run this test even if e10s is not
-  // enabled by default.
-  let win = await BrowserTestUtils.openNewBrowserWindow({remote: true});
-  let browser = win.gBrowser.selectedBrowser;
-
-  BrowserTestUtils.loadURI(browser, CRASH_URL);
-  await BrowserTestUtils.browserLoaded(browser);
-
-  // In this case, we want the <object> to match the -moz-handler-crashed
-  // pseudoselector, but we want it to seem still active, because the
-  // content process is not yet supposed to know that the plugin has
-  // crashed.
-  let runID = await preparePlugin(browser,
-                                  Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE);
-
-  // Send the message down to PluginContent.jsm saying that the plugin has
-  // crashed, and that we have a crash report.
-  let mm = browser.messageManager;
-  mm.sendAsyncMessage(CRASHED_MESSAGE,
-                      { pluginName: "", runID, state: "please" });
-
-  await ContentTask.spawn(browser, null, async function() {
-    // At this point, the content process should have heard the
-    // plugin crash message from the parent, and we are OK to emit
-    // the PluginCrashed event.
-    let plugin = content.document.getElementById("plugin");
-    plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    let statusDiv = plugin.ownerDocument
-                          .getAnonymousElementByAttribute(plugin, "anonid",
-                                                          "submitStatus");
-
-    if (statusDiv.getAttribute("status") == "please") {
-      Assert.ok(false, "Did not expect plugin to be in crash report mode yet.");
-      return;
-    }
-
-    // Now we need the plugin to seem crashed to PluginContent.jsm, without
-    // actually crashing the plugin again. We hack around this by overriding
-    // the pluginFallbackType again.
-    Object.defineProperty(plugin, "pluginFallbackType", {
-      get() {
-        return Ci.nsIObjectLoadingContent.PLUGIN_CRASHED;
-      },
-    });
-
-    let event = new content.PluginCrashedEvent("PluginCrashed", {
-      pluginName: "",
-      pluginDumpID: "",
-      browserDumpID: "",
-      submittedCrashReport: false,
-      bubbles: true,
-      cancelable: true,
-    });
-
-    plugin.dispatchEvent(event);
-    Assert.equal(statusDiv.getAttribute("status"), "please",
-      "Should have been showing crash report UI");
-  });
-  await BrowserTestUtils.closeWindow(win);
-  await crashDeferred.promise;
-});
-
-/**
- * In this case, the content process hears about the crash first.
- */
-add_task(async function testContentHearsCrashFirst() {
-  // Setup the crash observer promise
-  crashDeferred = PromiseUtils.defer();
-
-  // Open a remote window so that we can run this test even if e10s is not
-  // enabled by default.
-  let win = await BrowserTestUtils.openNewBrowserWindow({remote: true});
-  let browser = win.gBrowser.selectedBrowser;
-
-  BrowserTestUtils.loadURI(browser, CRASH_URL);
-  await BrowserTestUtils.browserLoaded(browser);
-
-  // In this case, we want the <object> to match the -moz-handler-crashed
-  // pseudoselector, and we want the plugin to seem crashed, since the
-  // content process in this case has heard about the crash first.
-  let runID = await preparePlugin(browser,
-                                  Ci.nsIObjectLoadingContent.PLUGIN_CRASHED);
-
-  await ContentTask.spawn(browser, null, async function() {
-    // At this point, the content process has not yet heard from the
-    // parent about the crash report. Let's ensure that by making sure
-    // we're not showing the plugin crash report UI.
-    let plugin = content.document.getElementById("plugin");
-    plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    let statusDiv = plugin.ownerDocument
-                          .getAnonymousElementByAttribute(plugin, "anonid",
-                                                          "submitStatus");
-
-    if (statusDiv.getAttribute("status") == "please") {
-      Assert.ok(false, "Did not expect plugin to be in crash report mode yet.");
-    }
-
-    let event = new content.PluginCrashedEvent("PluginCrashed", {
-      pluginName: "",
-      pluginDumpID: "",
-      browserDumpID: "",
-      submittedCrashReport: false,
-      bubbles: true,
-      cancelable: true,
-    });
-
-    plugin.dispatchEvent(event);
-
-    Assert.notEqual(statusDiv.getAttribute("status"), "please",
-      "Should not yet be showing crash report UI");
-  });
-
-  // Now send the message down to PluginContent.jsm that the plugin has
-  // crashed...
-  let mm = browser.messageManager;
-  mm.sendAsyncMessage(CRASHED_MESSAGE,
-                      { pluginName: "", runID, state: "please"});
-
-  await ContentTask.spawn(browser, null, async function() {
-    // At this point, the content process will have heard the message
-    // from the parent and reacted to it. We should be showing the plugin
-    // crash report UI now.
-    let plugin = content.document.getElementById("plugin");
-    plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    let statusDiv = plugin.ownerDocument
-                          .getAnonymousElementByAttribute(plugin, "anonid",
-                                                          "submitStatus");
-
-    Assert.equal(statusDiv.getAttribute("status"), "please",
-      "Should have been showing crash report UI");
-  });
-
-  await BrowserTestUtils.closeWindow(win);
-  await crashDeferred.promise;
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_plugin_reloading.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-var gTestBrowser = null;
-
-function updateAllTestPlugins(aState) {
-  setTestPluginEnabledState(aState, "Test Plug-in");
-  setTestPluginEnabledState(aState, "Second Test Plug-in");
-}
-
-add_task(async function() {
-  registerCleanupFunction(async function() {
-    clearAllPluginPermissions();
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-    resetBlocklist();
-    gTestBrowser = null;
-    gBrowser.removeCurrentTab();
-    window.focus();
-  });
-});
-
-add_task(async function() {
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  // Prime the blocklist service, the remote service doesn't launch on startup.
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html></html>");
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-});
-
-// Tests that a click-to-play plugin retains its activated state upon reloading
-add_task(async function() {
-  clearAllPluginPermissions();
-
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(notification, "Test 1, Should have a click-to-play notification");
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
-     "Test 2, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
-
-  // run the plugin
-  await promisePlayObject("test");
-
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 3, plugin should have started");
-  ok(pluginInfo.activated, "Test 4, plugin node should not be activated");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let plugin = content.document.getElementById("test");
-    let npobj1 = Cu.waiveXrays(plugin).getObjectValue();
-    // eslint-disable-next-line no-self-assign
-    plugin.src = plugin.src;
-    let pluginsDiffer = false;
-    try {
-      Cu.waiveXrays(plugin).checkObjectValue(npobj1);
-    } catch (e) {
-      pluginsDiffer = true;
-    }
-
-     Assert.ok(pluginsDiffer, "Test 5, plugins differ.");
-  });
-
-  pluginInfo = await promiseForPluginInfo("test");
-  ok(pluginInfo.activated, "Test 6, Plugin should have retained activated state.");
-  is(pluginInfo.displayedType, Ci.nsIObjectLoadingContent.TYPE_PLUGIN, "Test 7, plugin should have started");
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_pluginnotification.js
+++ /dev/null
@@ -1,480 +0,0 @@
-/* import-globals-from ../head.js */
-
-var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-var gTestBrowser = null;
-
-function updateAllTestPlugins(aState) {
-  setTestPluginEnabledState(aState, "Test Plug-in");
-  setTestPluginEnabledState(aState, "Second Test Plug-in");
-}
-
-add_task(async function() {
-  registerCleanupFunction(async function() {
-    clearAllPluginPermissions();
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
-    await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-    resetBlocklist();
-    gTestBrowser = null;
-    gBrowser.removeCurrentTab();
-    window.focus();
-  });
-});
-
-add_task(async function() {
-  gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  // Prime the blocklist service, the remote service doesn't launch on startup.
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html></html>");
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-});
-
-// Tests a page with an unknown plugin in it.
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_unknown.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let pluginInfo = await promiseForPluginInfo("unknown");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_UNSUPPORTED,
-     "Test 1a, plugin fallback type should be PLUGIN_UNSUPPORTED");
-});
-
-// Test that the doorhanger is shown when the user clicks on the overlay
-// after having previously blocked the plugin.
-add_task(async function() {
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await promisePopupNotification("click-to-play-plugins");
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  ok(!pluginInfo.activated, "Plugin should not be activated");
-
-  // Simulate clicking the "Allow" button.
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-
-  await promiseForNotificationShown(notification);
-
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  pluginInfo = await promiseForPluginInfo("test");
-  ok(pluginInfo.activated, "Plugin should be activated");
-
-  // Simulate clicking the "Block" button.
-  await promiseForNotificationShown(notification);
-
-  PopupNotifications.panel.firstElementChild.secondaryButton.click();
-
-  pluginInfo = await promiseForPluginInfo("test");
-  ok(!pluginInfo.activated, "Plugin should not be activated");
-
-  let browserLoaded = BrowserTestUtils.browserLoaded(gTestBrowser);
-  gTestBrowser.reload();
-  await browserLoaded;
-  notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-
-  // Simulate clicking the overlay
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let bounds = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
-    let left = (bounds.left + bounds.right) / 2;
-    let top = (bounds.top + bounds.bottom) / 2;
-    let utils = content.windowUtils;
-    utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
-  });
-
-  ok(!notification.dismissed, "A plugin notification should be shown.");
-
-  clearAllPluginPermissions();
-});
-
-// Tests that going back will reshow the notification for click-to-play plugins
-add_task(async function() {
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await promisePopupNotification("click-to-play-plugins");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html>hi</html>");
-
-  // make sure the notification is gone
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(!notification, "Test 11b, Should not have a click-to-play notification");
-
-  gTestBrowser.webNavigation.goBack();
-
-  await promisePopupNotification("click-to-play-plugins");
-});
-
-// Tests that the "Allow Always" permission works for click-to-play plugins
-add_task(async function() {
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await promisePopupNotification("click-to-play-plugins");
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  ok(!pluginInfo.activated, "Test 12a, Plugin should not be activated");
-
-  // Simulate clicking the "Allow" button.
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-
-  await promiseForNotificationShown(notification);
-
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  pluginInfo = await promiseForPluginInfo("test");
-  ok(pluginInfo.activated, "Test 12a, Plugin should be activated");
-});
-
-// Test that the "Always" permission, when set for just the Test plugin,
-// does not also allow the Second Test plugin.
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_two_types.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  await promisePopupNotification("click-to-play-plugins");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let test = content.document.getElementById("test");
-    let secondtestA = content.document.getElementById("secondtestA");
-    let secondtestB = content.document.getElementById("secondtestB");
-    Assert.ok(test.activated && !secondtestA.activated && !secondtestB.activated,
-      "Content plugins are set up");
-  });
-
-  clearAllPluginPermissions();
-});
-
-// Tests that the plugin's "activated" property is true for working plugins
-// with click-to-play disabled.
-add_task(async function() {
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_ENABLED);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test2.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let pluginInfo = await promiseForPluginInfo("test1");
-  ok(pluginInfo.activated, "Test 14, Plugin should be activated");
-});
-
-// Tests that the overlay is shown instead of alternate content when
-// plugins are click to play.
-add_task(async function() {
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_alternate_content.html");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let mainBox = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(!!mainBox, "Test 15, Plugin overlay should exist");
-  });
-});
-
-// Tests that mContentType is used for click-to-play plugins, and not the
-// inspected type.
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_bug749455.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(notification, "Test 17, Should have a click-to-play notification");
-});
-
-// Tests that clicking the icon of the overlay activates the doorhanger
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  ok(!pluginInfo.activated, "Test 18g, Plugin should not be activated");
-
-  ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed,
-     "Test 19a, Doorhanger should start out dismissed");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let icon = doc.getAnonymousElementByAttribute(plugin, "class", "icon");
-    let bounds = icon.getBoundingClientRect();
-    let left = (bounds.left + bounds.right) / 2;
-    let top = (bounds.top + bounds.bottom) / 2;
-    let utils = content.windowUtils;
-    utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
-  });
-
-  let condition = () => !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed;
-  await promiseForCondition(condition);
-});
-
-// Tests that clicking the text of the overlay activates the plugin
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  ok(!pluginInfo.activated, "Test 18g, Plugin should not be activated");
-
-  ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed,
-     "Test 19c, Doorhanger should start out dismissed");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let text = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgClickToPlay");
-    let bounds = text.getBoundingClientRect();
-    let left = (bounds.left + bounds.right) / 2;
-    let top = (bounds.top + bounds.bottom) / 2;
-    let utils = content.windowUtils;
-    utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
-  });
-
-  let condition = () => !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed;
-  await promiseForCondition(condition);
-});
-
-// Tests that clicking the box of the overlay activates the doorhanger
-// (just to be thorough)
-add_task(async function() {
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  ok(!pluginInfo.activated, "Test 18g, Plugin should not be activated");
-
-  ok(PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed,
-     "Test 19e, Doorhanger should start out dismissed");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let utils = content.windowUtils;
-    utils.sendMouseEvent("mousedown", 50, 50, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", 50, 50, 0, 1, 0, false, 0, 0);
-  });
-
-  let condition = () => !PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser).dismissed &&
-    PopupNotifications.panel.firstElementChild;
-  await promiseForCondition(condition);
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  pluginInfo = await promiseForPluginInfo("test");
-  ok(pluginInfo.activated, "Test 19e, Plugin should not be activated");
-
-  clearAllPluginPermissions();
-});
-
-// Tests that a plugin in a div that goes from style="display: none" to
-// "display: block" can be clicked to activate.
-add_task(async function() {
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_hidden_to_visible.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(notification, "Test 20a, Should have a click-to-play notification");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    Assert.ok(!!overlay, "Test 20a, Plugin overlay should exist");
-  });
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let mainBox = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    let overlayRect = mainBox.getBoundingClientRect();
-    Assert.ok(overlayRect.width == 0 && overlayRect.height == 0,
-      "Test 20a, plugin should have an overlay with 0px width and height");
-  });
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  ok(!pluginInfo.activated, "Test 20b, plugin should not be activated");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let div = doc.getElementById("container");
-    Assert.equal(div.style.display, "none",
-      "Test 20b, container div should be display: none");
-  });
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let div = doc.getElementById("container");
-    div.style.display = "block";
-  });
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let mainBox = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
-    let overlayRect = mainBox.getBoundingClientRect();
-    Assert.ok(overlayRect.width == 200 && overlayRect.height == 200,
-      "Test 20c, plugin should have overlay dims of 200px");
-  });
-
-  pluginInfo = await promiseForPluginInfo("test");
-  ok(!pluginInfo.activated, "Test 20b, plugin should not be activated");
-
-  ok(notification.dismissed, "Test 20c, Doorhanger should start out dismissed");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let bounds = plugin.getBoundingClientRect();
-    let left = (bounds.left + bounds.right) / 2;
-    let top = (bounds.top + bounds.bottom) / 2;
-    let utils = content.windowUtils;
-    utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
-    utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
-  });
-
-  let condition = () => !notification.dismissed && !!PopupNotifications.panel.firstElementChild;
-  await promiseForCondition(condition);
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  pluginInfo = await promiseForPluginInfo("test");
-  ok(pluginInfo.activated, "Test 20c, plugin should be activated");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
-    Assert.ok(overlayRect.width == 0 && overlayRect.height == 0,
-      "Test 20c, plugin should have overlay dims of 0px");
-  });
-
-  clearAllPluginPermissions();
-});
-
-// Tests that a click-to-play plugin resets its activated state when changing types
-add_task(async function() {
-  clearAllPluginPermissions();
-
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(notification, "Test 22, Should have a click-to-play notification");
-
-  // Plugin should start as CTP
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
-     "Test 23, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    plugin.type = null;
-    // We currently don't properly change state just on type change,
-    // so rebind the plugin to tree. bug 767631
-    plugin.parentNode.appendChild(plugin);
-  });
-
-  pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.displayedType, Ci.nsIObjectLoadingContent.TYPE_NULL, "Test 23, plugin should be TYPE_NULL");
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let doc = content.document;
-    let plugin = doc.getElementById("test");
-    plugin.type = "application/x-test";
-    plugin.parentNode.appendChild(plugin);
-  });
-
-  pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.displayedType, Ci.nsIObjectLoadingContent.TYPE_NULL, "Test 23, plugin should be TYPE_NULL");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
-     "Test 23, plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
-  ok(!pluginInfo.activated, "Test 23, plugin node should not be activated");
-});
-
-// Plugin sync removal test. Note this test produces a notification drop down since
-// the plugin we add has zero dims.
-add_task(async function() {
-  updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_syncRemoved.html");
-
-  // Maybe there some better trick here, we need to wait for the page load, then
-  // wait for the js to execute in the page.
-  await waitForMs(500);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins");
-  ok(notification, "Test 25: There should be a plugin notification even if the plugin was immediately removed");
-  ok(notification.dismissed, "Test 25: The notification should be dismissed by default");
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html>hi</html>");
-});
-
-// Tests a page with a blocked plugin in it and make sure the infoURL property
-// the blocklist file gets used.
-add_task(async function() {
-  clearAllPluginPermissions();
-
-  await asyncSetAndUpdateBlocklist(gTestRoot + "blockPluginInfoURL.xml", gTestBrowser);
-
-  await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  // Work around for delayed PluginBindingAttached
-  await promiseUpdatePluginBindings(gTestBrowser);
-
-  let notification = PopupNotifications.getNotification("click-to-play-plugins");
-
-  // Since the plugin notification is dismissed by default, reshow it.
-  await promiseForNotificationShown(notification);
-
-  let pluginInfo = await promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED,
-     "Test 26, plugin fallback type should be PLUGIN_BLOCKLISTED");
-  ok(!pluginInfo.activated, "Plugin should be activated.");
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_private_browsing_eme_persistent_state.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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/. */
-
-/*
- * This test ensures that navigator.requestMediaKeySystemAccess() requests
- * to run EME with persistent state are rejected in private browsing windows.
- * Bug 1334111.
- */
-
-const TEST_URL =
-  getRootDirectory(gTestPath).replace("chrome://mochitests/content",
-  "https://example.com") + "empty_file.html";
-
-async function isEmePersistentStateSupported(mode) {
-  let win = await BrowserTestUtils.openNewBrowserWindow(mode);
-  let tab = await BrowserTestUtils.openNewForegroundTab(win.gBrowser, TEST_URL);
-  let persistentStateSupported = await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
-    try {
-      let config = [{
-        initDataTypes: ["webm"],
-        videoCapabilities: [{contentType: 'video/webm; codecs="vp9"'}],
-        persistentState: "required",
-      }];
-      await content.navigator.requestMediaKeySystemAccess("org.w3.clearkey", config);
-    } catch (ex) {
-      return false;
-    }
-    return true;
-  });
-
-  await BrowserTestUtils.closeWindow(win);
-
-  return persistentStateSupported;
-}
-
-add_task(async function test() {
-  is(await isEmePersistentStateSupported({private: true}),
-     false,
-     "EME persistentState should *NOT* be supported in private browsing window.");
-  is(await isEmePersistentStateSupported({private: false}),
-     true,
-     "EME persistentState *SHOULD* be supported in non private browsing window.");
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_private_clicktoplay.js
+++ /dev/null
@@ -1,228 +0,0 @@
-/* import-globals-from ../head.js */
-
-var rootDir = getRootDirectory(gTestPath);
-const gTestRoot = rootDir;
-const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
-
-var gTestBrowser = null;
-var gNextTest = null;
-var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-
-var gPrivateWindow = null;
-var gPrivateBrowser = null;
-
-function finishTest() {
-  clearAllPluginPermissions();
-  gBrowser.removeCurrentTab();
-  if (gPrivateWindow) {
-    gPrivateWindow.close();
-  }
-  window.focus();
-}
-
-let createPrivateWindow = async function createPrivateWindow(url) {
-  gPrivateWindow = await BrowserTestUtils.openNewBrowserWindow({private: true});
-  ok(!!gPrivateWindow, "should have created a private window.");
-  gPrivateBrowser = gPrivateWindow.getBrowser().selectedBrowser;
-
-  BrowserTestUtils.loadURI(gPrivateBrowser, url);
-  await BrowserTestUtils.browserLoaded(gPrivateBrowser, false, url);
-  info("loaded " + url);
-};
-
-add_task(async function test() {
-  registerCleanupFunction(function() {
-    clearAllPluginPermissions();
-    getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
-    getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_ENABLED;
-  });
-
-  let newTab = BrowserTestUtils.addTab(gBrowser);
-  gBrowser.selectedTab = newTab;
-  gTestBrowser = gBrowser.selectedBrowser;
-  let promise = BrowserTestUtils.browserLoaded(gTestBrowser);
-
-  Services.prefs.setBoolPref("plugins.click_to_play", true);
-  getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-  getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
-  await promise;
-});
-
-add_task(async function test1a() {
-  await createPrivateWindow(gHttpTestRoot + "plugin_test.html");
-});
-
-add_task(async function test1b() {
-  let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
-  ok(popupNotification, "Test 1b, Should have a click-to-play notification");
-
-  await ContentTask.spawn(gPrivateBrowser, null, function() {
-    let plugin = content.document.getElementById("test");
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    ok(!objLoadingContent.activated, "Test 1b, Plugin should not be activated");
-  });
-
-  // Check the button status
-  let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
-                                                   "Shown");
-  popupNotification.reshow();
-
-  await promiseShown;
-  is(gPrivateWindow.PopupNotifications.panel.firstElementChild.checkbox.hidden, true, "'Remember' checkbox should be hidden in private windows");
-
-  let promises = [
-    BrowserTestUtils.browserLoaded(gTestBrowser, false, gHttpTestRoot + "plugin_test.html"),
-    BrowserTestUtils.waitForEvent(window, "activate"),
-  ];
-  gPrivateWindow.close();
-  BrowserTestUtils.loadURI(gTestBrowser, gHttpTestRoot + "plugin_test.html");
-  await Promise.all(promises);
-  await SimpleTest.promiseFocus(window);
-});
-
-add_task(async function test2a() {
-  // enable test plugin on this site
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(popupNotification, "Test 2a, Should have a click-to-play notification");
-
-  await ContentTask.spawn(gTestBrowser, null, function() {
-    let plugin = content.document.getElementById("test");
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    ok(!objLoadingContent.activated, "Test 2a, Plugin should not be activated");
-  });
-
-  // Simulate clicking the "Allow Now" button.
-  let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
-                                                   "Shown");
-  popupNotification.reshow();
-  await promiseShown;
-
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let plugin = content.document.getElementById("test");
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    let condition = () => objLoadingContent.activated;
-    await ContentTaskUtils.waitForCondition(condition, "Test 2a, Waited too long for plugin to activate");
-  });
-});
-
-add_task(async function test2c() {
-  let topicObserved = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
-  await createPrivateWindow(gHttpTestRoot + "plugin_test.html");
-  await topicObserved;
-
-  let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
-  ok(popupNotification, "Test 2c, Should have a click-to-play notification");
-
-  await ContentTask.spawn(gPrivateBrowser, null, function() {
-    let plugin = content.document.getElementById("test");
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    ok(objLoadingContent.activated, "Test 2c, Plugin should be activated");
-  });
-
-  // Check the button status
-  let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
-                                                   "Shown");
-  popupNotification.reshow();
-  await promiseShown;
-  is(gPrivateWindow.PopupNotifications.panel.firstElementChild.secondaryButton.hidden, true,
-     "Test 2c, Activated plugin in a private window should not have visible 'Block' button.");
-  is(gPrivateWindow.PopupNotifications.panel.firstElementChild.checkbox.hidden, true,
-     "Test 2c, Activated plugin in a private window should not have visible 'Remember' checkbox.");
-
-  clearAllPluginPermissions();
-
-  let promises = [
-    BrowserTestUtils.browserLoaded(gTestBrowser, false, gHttpTestRoot + "plugin_test.html"),
-    BrowserTestUtils.waitForEvent(window, "activate"),
-  ];
-  gPrivateWindow.close();
-  BrowserTestUtils.loadURI(gTestBrowser, gHttpTestRoot + "plugin_test.html");
-  await Promise.all(promises);
-  await SimpleTest.promiseFocus(window);
-});
-
-add_task(async function test3a() {
-  // enable test plugin on this site
-  let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
-  ok(popupNotification, "Test 3a, Should have a click-to-play notification");
-
-  await ContentTask.spawn(gTestBrowser, null, function() {
-    let plugin = content.document.getElementById("test");
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    ok(!objLoadingContent.activated, "Test 3a, Plugin should not be activated");
-  });
-
-  // Simulate clicking the "Allow" button.
-  let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
-                                                   "Shown");
-  popupNotification.reshow();
-  await promiseShown;
-  PopupNotifications.panel.firstElementChild.button.click();
-
-  await ContentTask.spawn(gTestBrowser, null, async function() {
-    let plugin = content.document.getElementById("test");
-    let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
-    let condition = () => objLoadingContent.activated;
-    await ContentTaskUtils.waitForCondition(condition, "Test 3a, Waited too long for plugin to activate");
-  });
-});
-
-add_task(async function test3c() {
-  let topicObserved = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
-  await createPrivateWindow(gHttpTestRoot + "plugin_test.html");
-  await topicObserved;
-
-  let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
-  ok(popupNotification, "Test 3c, Should have a click-to-play notification");
-
-  // Check the button status
-  let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
-                                                   "Shown");
-  popupNotification.reshow();
-  await promiseShown;
-  is(gPrivateWindow.PopupNotifications.panel.firstElementChild.secondaryButton.hidden, true,
-     "Test 2c, Activated plugin in a private window should not have visible 'Block' button.");
-  is(gPrivateWindow.PopupNotifications.panel.firstElementChild.checkbox.hidden, true,
-     "Test 2c, Activated plugin in a private window should not have visible 'Remember' checkbox.");
-
-  BrowserTestUtils.loadURI(gPrivateBrowser, gHttpTestRoot + "plugin_two_types.html");
-  await BrowserTestUtils.browserLoaded(gPrivateBrowser);
-});
-
-add_task(async function test3d() {
-  let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
-  ok(popupNotification, "Test 3d, Should have a click-to-play notification");
-
-  // Check the list item status
-  let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
-                                                   "Shown");
-  popupNotification.reshow();
-  await promiseShown;
-  let doc = gPrivateWindow.document;
-  for (let item of gPrivateWindow.PopupNotifications.panel.firstElementChild.children) {
-    let allowalways = doc.getAnonymousElementByAttribute(item, "anonid", "allowalways");
-    ok(allowalways, "Test 3d, should have list item for allow always");
-    let allownow = doc.getAnonymousElementByAttribute(item, "anonid", "allownow");
-    ok(allownow, "Test 3d, should have list item for allow now");
-    let block = doc.getAnonymousElementByAttribute(item, "anonid", "block");
-    ok(block, "Test 3d, should have list item for block");
-
-    if (item.action.pluginName === "Test") {
-      is(item.value, "allowalways", "Test 3d, Plugin should bet set to 'allow always'");
-      ok(!allowalways.hidden, "Test 3d, Plugin set to 'always allow' should have a visible 'always allow' action.");
-      ok(allownow.hidden, "Test 3d, Plugin set to 'always allow' should have an invisible 'allow now' action.");
-      ok(block.hidden, "Test 3d, Plugin set to 'always allow' should have an invisible 'block' action.");
-    } else if (item.action.pluginName === "Second Test") {
-      is(item.value, "block", "Test 3d, Second plugin should bet set to 'block'");
-      ok(allowalways.hidden, "Test 3d, Plugin set to 'block' should have a visible 'always allow' action.");
-      ok(!allownow.hidden, "Test 3d, Plugin set to 'block' should have a visible 'allow now' action.");
-      ok(!block.hidden, "Test 3d, Plugin set to 'block' should have a visible 'block' action.");
-    } else {
-      ok(false, "Test 3d, Unexpected plugin '" + item.action.pluginName + "'");
-    }
-  }
-
-  finishTest();
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/browser_subframe_access_hidden_plugins.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/* import-globals-from ../head.js */
-
-"use strict";
-
-const TEST_PLUGIN_NAME = "Test Plug-in";
-const HIDDEN_CTP_PLUGIN_PREF = "plugins.navigator.hidden_ctp_plugin";
-const DOMAIN_1 = "http://example.com";
-const DOMAIN_2 = "http://mochi.test:8888";
-
-/**
- * If a plugin is click-to-play and named in HIDDEN_CTP_PLUGIN_PREF,
- * then the plugin should be hidden in the navigator.plugins list by
- * default. However, if a plugin has been allowed on a top-level
- * document, we should let subframes of that document access
- * navigator.plugins.
- */
-add_task(async function setup() {
-  // We'll make the Test Plugin click-to-play.
-  let originalPluginState = getTestPluginEnabledState();
-  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-  registerCleanupFunction(() => {
-    setTestPluginEnabledState(originalPluginState);
-    clearAllPluginPermissions();
-  });
-
-  // And then make the plugin hidden.
-  await SpecialPowers.pushPrefEnv({
-    set: [[HIDDEN_CTP_PLUGIN_PREF, TEST_PLUGIN_NAME]],
-  });
-});
-
-add_task(async function test_plugin_accessible_in_subframe() {
-  // Let's make it so that DOMAIN_1 allows the test plugin to
-  // be activated. This permission will be cleaned up inside
-  // our registerCleanupFunction when the test ends.
-  let ssm = Services.scriptSecurityManager;
-  let principal = ssm.createCodebasePrincipalFromOrigin(DOMAIN_1);
-  let pluginHost = Cc["@mozilla.org/plugin/host;1"]
-                     .getService(Ci.nsIPluginHost);
-  let permString = pluginHost.getPermissionStringForType("application/x-test");
-  Services.perms.addFromPrincipal(principal, permString,
-                                  Ci.nsIPermissionManager.ALLOW_ACTION,
-                                  Ci.nsIPermissionManager.EXPIRE_NEVER,
-                                  0 /* expireTime */);
-
-  await BrowserTestUtils.withNewTab({
-    gBrowser,
-    url: DOMAIN_1,
-  }, async function(browser) {
-    await ContentTask.spawn(browser, [TEST_PLUGIN_NAME, DOMAIN_2],
-                            async function([pluginName, domain2]) {
-      Assert.ok(content.navigator.plugins[pluginName],
-                "Top-level document should find Test Plugin");
-
-      // Now manually create a subframe hosted at domain2...
-      let subframe = content.document.createElement("iframe");
-      subframe.src = domain2;
-      let loadedPromise = ContentTaskUtils.waitForEvent(subframe, "load");
-      content.document.body.appendChild(subframe);
-      await loadedPromise;
-
-      // Make sure that the HiddenPlugin event never fires in content.
-      let sawEvent = false;
-      addEventListener("HiddenPlugin", function onHiddenPlugin(e) {
-        sawEvent = true;
-        removeEventListener("HiddenPlugin", onHiddenPlugin, true);
-      }, true);
-
-      Assert.ok(subframe.contentWindow.navigator.plugins[pluginName],
-                "Subframe should find Test Plugin");
-      Assert.ok(!sawEvent, "Should not have seen the HiddenPlugin event.");
-    });
-  });
-});
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/empty_file.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="UTF-8">
-  </head>
-  <body>
-    This page is intentionally left blank.
-  </body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_add_dynamically.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<script>
-function addPlugin(aId, aType = "application/x-test") {
-  var embed = document.createElement("embed");
-  embed.setAttribute("id", aId);
-  embed.style.width = "200px";
-  embed.style.height = "200px";
-  embed.setAttribute("type", aType);
-  return document.body.appendChild(embed);
-}
-</script>
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_alternate_content.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!-- bug 739575 -->
-<html>
-<head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
-</head>
-<body>
-<object id="test" type="application/x-test" style="height: 200px; width:200px">
-<p><a href="about:blank">you should not see this link when plugins are click-to-play</a></p>
-</object>
-</body></html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_big.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 500px; height: 500px" type="application/x-test">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_both.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="unknown" style="width: 100px; height: 100px" type="application/x-unknown">
-<embed id="test" style="width: 100px; height: 100px" type="application/x-test">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_both2.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 100px; height: 100px" type="application/x-test">
-<embed id="unknown" style="width: 100px; height: 100px" type="application/x-unknown">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_bug744745.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><meta charset="utf-8"/></head>
-<body>
-<style>
-.x {
-  opacity: 0 !important;
-}
-</style>
-<object id="test" class="x" type="application/x-test" width=200 height=200></object>
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_bug749455.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!-- bug 749455 -->
-<html>
-<head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
-</head>
-<body>
-<embed src="plugin_bug749455.html" type="application/x-test" width="100px" height="100px"></embed>
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_bug787619.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><meta charset="utf-8"/></head>
-<body>
-  <a id="wrapper">
-    <embed id="plugin" style="width: 200px; height: 200px" type="application/x-test">
-  </a>
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_bug797677.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><meta charset="utf-8"/></head>
-<body><embed id="plugin" type="9000"></embed></body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_bug820497.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><meta charset="utf-8"/></head>
-<body>
-<object id="test" type="application/x-test" width=200 height=200></object>
-<script>
-  function addSecondPlugin() {
-    var object = document.createElement("object");
-    object.type = "application/x-second-test";
-    object.width = 200;
-    object.height = 200;
-    object.id = "secondtest";
-    document.body.appendChild(object);
-  }
-</script>
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_clickToPlayAllow.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 200px; height: 200px" type="application/x-test">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_clickToPlayDeny.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 200px; height: 200px" type="application/x-test">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_crashCommentAndURL.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <script type="text/javascript">
-      function crash() {
-        var plugin = document.getElementById("plugin");
-        var argStr = decodeURIComponent(window.location.search.substr(1));
-        if (argStr) {
-          var args = JSON.parse(argStr);
-          for (var key in args)
-            plugin.setAttribute(key, args[key]);
-        }
-        try {
-          plugin.crash();
-        } catch (err) {}
-      }
-    </script>
-  </head>
-  <body onload="crash();">
-    <embed id="plugin" type="application/x-test"
-           width="400" height="400"
-           drawmode="solid" color="FF00FFFF">
-    </embed>
-  </body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_favorfallback.html
+++ /dev/null
@@ -1,96 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><meta charset="utf-8"/></head>
-<body>
-<style>
-.testcase {
-    display: none;
-}
-object {
-    width: 200px;
-    height: 200px;
-}
-</style>
-
-<!-- Tests that a <video> tag in the fallback content favors the fallback content -->
-<div id="testcase_video" class="testcase">
-    <object class="expected_ctp" type="application/x-shockwave-flash-test">
-        Unexpected fallback
-    </object>
-    <object class="expected_fallback" type="application/x-shockwave-flash-test">
-        <video></video>
-        Expected fallback
-    </object>
-</div>
-
-<!-- Tests that an object with no src specified (no data="") favors the fallback content -->
-<div id="testcase_nosrc" class="testcase">
-    <!-- We must use an existing and valid file here because otherwise the failed load
-         triggers the plugin's alternate content, indepedent of the favor-fallback code path -->
-    <object class="expected_ctp" type="application/x-shockwave-flash-test" data="plugin_simple_blank.swf">
-        Unexpected fallback
-    </object>
-    <object class="expected_fallback" type="application/x-shockwave-flash-test">
-        Expected fallback
-    </object>
-</div>
-
-<!-- Tests that an <embed> tag in the fallback content forces the plugin content,
-     when fallback is defaulting to true -->
-<div id="testcase_embed" class="testcase">
-    <object class="expected_ctp" type="application/x-shockwave-flash-test">
-        <embed></embed>
-        Unexpected fallback
-    </object>
-    <object class="expected_fallback" type="application/x-shockwave-flash-test">
-        Expected fallback
-    </object>
-</div>
-
-<!-- Tests that links to adobe.com inside the fallback content forces the plugin content,
-     when fallback is defaulting to true -->
-<div id="testcase_adobelink" class="testcase">
-    <object class="expected_ctp" type="application/x-shockwave-flash-test">
-        <a href="https://www.adobe.com">Go to adobe.com</a>
-        Unexpected fallback
-    </object>
-    <object class="expected_ctp" type="application/x-shockwave-flash-test">
-        <a href="https://adobe.com">Go to adobe.com</a>
-        Unexpected fallback
-    </object>
-    <object class="expected_fallback" type="application/x-shockwave-flash-test">
-        Expected fallback
-    </object>
-</div>
-
-<!-- Tests that instructions to download or install flash inside the fallback content
-     forces the plugin content, when fallback is defaulting to true -->
-<div id="testcase_installinstructions" class="testcase">
-    <object class="expected_ctp" type="application/x-shockwave-flash-test">
-        Install -- Unexpected fallback
-    </object>
-    <object class="expected_ctp" type="application/x-shockwave-flash-test">
-        Flash -- Unexpected fallback
-    </object>
-    <object class="expected_ctp" type="application/x-shockwave-flash-test">
-        Download -- Unexpected fallback
-    </object>
-    <object class="expected_fallback" type="application/x-shockwave-flash-test">
-        <!-- Tests that the words Install, Flash or Download do not trigger
-             this behavior if it's just inside a comment, and not part of
-             the text content -->
-        Expected Fallback
-    </object>
-    <object class="expected_fallback" type="application/x-shockwave-flash-test">
-        Expected fallback
-    </object>
-</div>
-
-<script>
-    let queryString = location.search;
-    let match = /^\?testcase=([a-z]+)$/.exec(queryString);
-    let testcase = match[1];
-    document.getElementById(`testcase_${testcase}`).style.display = "block";
-</script>
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_hidden_to_visible.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-  <div id="container" style="display: none">
-    <object id="test" type="application/x-test" style="width: 200px; height: 200px;"></object>
-  </div>
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_iframe.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<iframe id="frame" with="400" height="400" src="plugin_test.html">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_outsideScrollArea.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<style type="text/css">
-#container {
-  position: fixed;
-  top: 0;
-  bottom: 0;
-  width: 100%;
-  height: 100%;
-  background: blue;
-}
-
-#test {
-  width: 400px;
-  height: 400px;
-  position: absolute;
-}
-</style>
-</head>
-<body>
-  <div id="container"></div>
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_overlay_styles.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-
-  <div id="testcase1" class="testcase">
-    <object width="10" height="10" type="application/x-test"></object>
-  </div>
-
-  <div id="testcase2" class="testcase">
-    <object width="40" height="40" type="application/x-test"></object>
-  </div>
-
-  <div id="testcase3" class="testcase">
-    <object width="100" height="70" type="application/x-test"></object>
-  </div>
-
-  <div id="testcase4" class="testcase">
-    <object width="200" height="200" type="application/x-test"></object>
-  </div>
-
-  <div id="testcase5" class="testcase">
-    <object width="300" height="300" type="application/x-test"></object>
-  </div>
-
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_shouldShowOverlay.html
+++ /dev/null
@@ -1,116 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<style>
-object {
-  width: 200px;
-  height: 200px;
-}
-
-.testcase {
-  position: relative;
-  margin-bottom: 5px;
-}
-
-.cover {
-  position: absolute;
-  width: 20px;
-  height: 20px;
-  background-color: green;
-}
-</style>
-</head>
-<body>
-
-  <div id="testcase1" class="testcase" shouldshow="true"
-       style="top: -100px">
-    <!-- Should show overlay even though the top part is outside
-       of the page. -->
-    <object type="application/x-test"></object>
-  </div>
-
-  <div id="testcase2" class="testcase" shouldshow="true"
-       style="left: -100px">
-    <!-- Should show overlay even though the left part is outside
-       of the page. -->
-    <object type="application/x-test"></object>
-  </div>
-
-  <div id="testcase3" class="testcase" shouldshow="false"
-       style="left: -210px">
-    <!-- The object is entirely outside of the page, so the overlay
-         should NOT show. -->
-    <object type="application/x-test"></object>
-  </div>
-
-  <div id="testcase4" class="testcase" shouldshow="true">
-    <!-- Should show overlay even though the top-left corner is covered. -->
-    <div class="cover" style="top: 0; left: 0"></div>
-    <object type="application/x-test"></object>
-  </div>
-
-  <div id="testcase5" class="testcase" shouldshow="true">
-    <!-- Should show overlay even though the top-right corner is covered. -->
-    <div class="cover" style="top: 0; left: 180px"></div>
-    <object type="application/x-test"></object>
-  </div>
-
-  <div id="testcase6" class="testcase" shouldshow="true">
-    <!-- Should show overlay even though the bottom-left corner is covered. -->
-    <div class="cover" style="top: 180px; left: 0"></div>
-    <object type="application/x-test"></object>
-  </div>
-
-
-  <div id="testcase7" class="testcase" shouldshow="true">
-    <!-- Should show overlay even though the bottom-right corner is covered. -->
-    <div class="cover" style="top: 180px; left: 180px"></div>
-    <object type="application/x-test"></object>
-  </div>
-
-  <div id="testcase8" class="testcase" shouldshow="true">
-    <!-- Should show overlay even though the center is covered. -->
-    <div class="cover" style="top: 90px; left: 90px"></div>
-    <object type="application/x-test"></object>
-  </div>
-
-  <div id="testcase9" class="testcase" shouldshow="true">
-    <!-- Should show overlay even though multiple points are covered,
-       but not all of them. -->
-    <div class="cover" style="top: 0; left: 0"></div>
-    <div class="cover" style="top: 0; left: 180px"></div>
-    <div class="cover" style="top: 180px; left: 0"></div>
-    <div class="cover" style="top: 180px; left: 180px"></div>
-    <object type="application/x-test"></object>
-  </div>
-
-  <div id="testcase10" class="testcase" shouldshow="true">
-    <!-- Another case where 4 are covered, but not all. -->
-    <div class="cover" style="top: 90px; left: 90px"></div>
-    <div class="cover" style="top: 0; left: 180px"></div>
-    <div class="cover" style="top: 180px; left: 0"></div>
-    <div class="cover" style="top: 180px; left: 180px"></div>
-    <object type="application/x-test"></object>
-  </div>
-
-  <div id="testcase11" class="testcase" shouldshow="false">
-    <!-- All corners and center are covered here, so in this
-         case the overlay should NOT show. -->
-    <div class="cover" style="top: 0; left: 0"></div>
-    <div class="cover" style="top: 0; left: 180px"></div>
-    <div class="cover" style="top: 180px; left: 0"></div>
-    <div class="cover" style="top: 180px; left: 180px"></div>
-    <div class="cover" style="top: 90px; left: 90px"></div>
-    <object type="application/x-test"></object>
-  </div>
-
-  <div id="testcase12" class="testcase" shouldshow="false">
-        <!-- All corners and center are covered here, by a single
-        element. In this case the overlay should NOT show. -->
-    <div class="cover" style="width: 200px; height:200px"></div>
-    <object type="application/x-test"></object>
-  </div>
-
-</body>
-</html>
deleted file mode 100644
index b846387eb8b81ed7528d2ec13b153b74e34a1882..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_small.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 10px; height: 10px" type="application/x-test">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_small_2.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 10px; height: 10px" type="application/x-second-test">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_syncRemoved.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<body>
-<script type="text/javascript">
-  // create an embed, insert it in the doc and immediately remove it
-  var embed = document.createElement("embed");
-  embed.setAttribute("id", "test");
-  embed.setAttribute("type", "application/x-test");
-  embed.setAttribute("style", "width: 0px; height: 0px;");
-  document.body.appendChild(embed);
-  window.getComputedStyle(embed).top;
-  document.body.remove(embed);
-</script>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_test.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 300px; height: 300px" type="application/x-test">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_test2.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test1" style="width: 200px; height: 200px" type="application/x-test">
-<embed id="test2" style="width: 200px; height: 200px" type="application/x-test">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_test3.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="test" style="width: 0px; height: 0px" type="application/x-test">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_two_types.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head><meta charset="utf-8"/></head>
-<body>
-<embed id="test" style="width: 200px; height: 200px" type="application/x-test"/>
-<embed id="secondtestA" style="width: 200px; height: 200px" type="application/x-second-test"/>
-<embed id="secondtestB" style="width: 200px; height: 200px" type="application/x-second-test"/>
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_unknown.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<embed id="unknown" style="width: 100px; height: 100px" type="application/x-unknown">
-</body>
-</html>
deleted file mode 100644
--- a/browser/base/content/test/plugins/xbl/plugin_zoom.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-</head>
-<body>
-<!-- The odd width and height are here to trigger bug 972237. -->
-<embed id="test" style="width: 99.789%; height: 99.123%" type="application/x-test">
-</body>
-</html>
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -836,17 +836,17 @@ file, You can obtain one at http://mozil
         <parameter name="openUILinkWhere"/>
         <parameter name="openUILinkParams"/>
         <parameter name="mayInheritPrincipal"/>
         <parameter name="triggeringPrincipal"/>
         <body><![CDATA[
           this.value = url;
           browser.userTypedValue = url;
           if (gInitialPages.includes(url)) {
-            browser.initialPageLoadedFromURLBar = url;
+            browser.initialPageLoadedFromUserAction = url;
           }
           try {
             UrlbarUtils.addToUrlbarHistory(url, window);
           } catch (ex) {
             // Things may go wrong when adding url to session history,
             // but don't let that interfere with the loading of the url.
             Cu.reportError(ex);
           }
--- a/browser/base/moz.build
+++ b/browser/base/moz.build
@@ -34,17 +34,16 @@ BROWSER_CHROME_MANIFESTS += [
     'content/test/metaTags/browser.ini',
     'content/test/pageActions/browser.ini',
     'content/test/pageinfo/browser.ini',
     'content/test/performance/browser.ini',
     'content/test/performance/hidpi/browser.ini',
     'content/test/performance/lowdpi/browser.ini',
     'content/test/permissions/browser.ini',
     'content/test/plugins/browser.ini',
-    'content/test/plugins/xbl/browser.ini',
     'content/test/popupNotifications/browser.ini',
     'content/test/popups/browser.ini',
     'content/test/referrer/browser.ini',
     'content/test/sanitize/browser.ini',
     'content/test/sidebar/browser.ini',
     'content/test/siteIdentity/browser.ini',
     'content/test/static/browser.ini',
     'content/test/statuspanel/browser.ini',
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -1446,16 +1446,19 @@ var CustomizableUIInternal = {
       throw new Error("buildWidget was called for a non-browser window!");
     }
     if (typeof aWidget == "string") {
       aWidget = gPalette.get(aWidget);
     }
     if (!aWidget) {
       throw new Error("buildWidget was passed a non-widget to build.");
     }
+    if (!aWidget.showInPrivateBrowsing && PrivateBrowsingUtils.isWindowPrivate(aDocument.defaultView)) {
+      return null;
+    }
 
     log.debug("Building " + aWidget.id + " of type " + aWidget.type);
 
     let node;
     if (aWidget.type == "custom") {
       if (aWidget.onBuild) {
         node = aWidget.onBuild(aDocument);
       }
@@ -4022,18 +4025,17 @@ function WidgetGroupWrapper(aWidget) {
     } else {
       wrapperMap = gSingleWrapperCache.get(aWindow);
     }
     if (wrapperMap.has(aWidget.id)) {
       return wrapperMap.get(aWidget.id);
     }
 
     let instance = aWidget.instances.get(aWindow.document);
-    if (!instance &&
-        (aWidget.showInPrivateBrowsing || !PrivateBrowsingUtils.isWindowPrivate(aWindow))) {
+    if (!instance) {
       instance = CustomizableUIInternal.buildWidget(aWindow.document,
                                                     aWidget);
     }
 
     let wrapper = new WidgetSingleWrapper(aWidget, instance);
     wrapperMap.set(aWidget.id, wrapper);
     return wrapper;
   };
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -155,16 +155,34 @@
                      dropmarkerhidden="true"
                      checkboxhidden="true"
                      buttonhighlight="true"
                      hidden="true">
     <popupnotificationcontent class="addon-installed-notification-content" orient="vertical">
       <description>&addonPostInstallMessage.label;</description>
     </popupnotificationcontent>
   </popupnotification>
+
+  <popupnotification id="appMenu-addon-private-browsing-notification"
+                     popupid="addon-private-browsing"
+                     label="&addonPrivateBrowsing.header.label;"
+                     closebuttonhidden="true"
+                     secondarybuttonhidden="false"
+                     buttonlabel="&addonPrivateBrowsing.manageButton.label;"
+                     buttonaccesskey="&addonPrivateBrowsing.manageButton.accesskey;"
+                     secondarybuttonlabel="&addonPrivateBrowsing.okButton.label;"
+                     secondarybuttonaccesskey="&addonPrivateBrowsing.okButton.accesskey;"
+                     dropmarkerhidden="true"
+                     checkboxhidden="true"
+                     buttonhighlight="true"
+                     hidden="true">
+    <popupnotificationcontent class="addon-private-browsing-notification-content" orient="vertical">
+      <description>&addonPrivateBrowsing.body.label;</description>
+    </popupnotificationcontent>
+  </popupnotification>
 </panel>
 
 <menupopup id="customizationPaletteItemContextMenu"
            onpopupshowing="gCustomizeMode.onPaletteContextMenuShowing(event)">
   <menuitem oncommand="gCustomizeMode.addToToolbar(document.popupNode)"
             class="customize-context-addToToolbar"
             accesskey="&customizeMenu.addToToolbar.accesskey;"
             label="&customizeMenu.addToToolbar.label;"/>
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_popup_blocker.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_popup_blocker.js
@@ -19,17 +19,17 @@ registerCleanupFunction(async function c
   if (ORIGINAL_PREF_VALUE === undefined) {
     Services.prefs.clearUserPref("dom.disable_open_during_load");
   } else {
     Services.prefs.setBoolPref("dom.disable_open_during_load", ORIGINAL_PREF_VALUE);
   }
 });
 
 async function test_popup_blocker_disabled({disabled, locked}) {
-  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
+  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences#privacy");
   // eslint-disable-next-line no-shadow
   await ContentTask.spawn(tab.linkedBrowser, {disabled, locked}, async function({disabled, locked}) {
     let checkbox = content.document.getElementById("popupPolicy");
     is(checkbox.checked, !disabled,
        "Checkbox checked state should match policy's Block status");
     is(checkbox.disabled, locked,
        "Checkbox disabled state should match policy's Locked status");
   });
--- a/browser/components/enterprisepolicies/tests/browser/browser_policy_search_engine.js
+++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_search_engine.js
@@ -130,17 +130,17 @@ add_task(async function setup_prevent_in
       },
     },
   });
 });
 
 add_task(async function test_prevent_install_ui() {
   // Check that about:preferences does not prompt user to install search engines
   // if that feature is disabled
-  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences");
+  let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences#search");
   await ContentTask.spawn(tab.linkedBrowser, null, async function() {
     let linkContainer = content.document.getElementById("addEnginesBox");
     if (!linkContainer.hidden) {
       await new Promise(resolve => {
         let mut = new linkContainer.ownerGlobal.MutationObserver(mutations => {
           mut.disconnect();
           resolve();
         });
--- a/browser/components/extensions/parent/ext-sidebarAction.js
+++ b/browser/components/extensions/parent/ext-sidebarAction.js
@@ -135,16 +135,19 @@ this.sidebarAction = class extends Exten
       if ((install && this.extension.manifest.sidebar_action.open_at_install) ||
           SidebarUI.lastOpenedId == this.id) {
         SidebarUI.show(this.id);
       }
     }
   }
 
   createMenuItem(window, details) {
+    if (!this.extension.canAccessWindow(window)) {
+      return;
+    }
     let {document, SidebarUI} = window;
     let keyId = `ext-key-id-${this.id}`;
 
     SidebarUI.sidebars.set(this.id, {
       title: details.title,
       url: sidebarURL,
       menuId: this.menuId,
       buttonId: this.buttonId,
@@ -236,16 +239,19 @@ this.sidebarAction = class extends Exten
 
   /**
    * Update the menu items for a given window.
    *
    * @param {ChromeWindow} window
    *        Browser chrome window.
    */
   updateWindow(window) {
+    if (!this.extension.canAccessWindow(window)) {
+      return;
+    }
     let nativeTab = window.gBrowser.selectedTab;
     this.updateButton(window, this.tabContext.get(nativeTab));
   }
 
   /**
    * Update the menu items when the extension changes the icon,
    * title, url, etc. If it only changes a parameter for a single tab, `target`
    * will be that tab. If it only changes a parameter for a single window,
@@ -278,22 +284,29 @@ this.sidebarAction = class extends Exten
    *        If a `tabId` was specified, the corresponding XULElement tab.
    *        If a `windowId` was specified, the corresponding ChromeWindow.
    *        Otherwise, `null`.
    */
   getTargetFromDetails({tabId, windowId}) {
     if (tabId != null && windowId != null) {
       throw new ExtensionError("Only one of tabId and windowId can be specified.");
     }
+    let target = null;
     if (tabId != null) {
-      return tabTracker.getTab(tabId);
+      target = tabTracker.getTab(tabId);
+      if (!this.extension.canAccessWindow(target.ownerGlobal)) {
+        throw new ExtensionError(`Invalid tab ID: ${tabId}`);
+      }
     } else if (windowId != null) {
-      return windowTracker.getWindow(windowId);
+      target = windowTracker.getWindow(windowId);
+      if (!this.extension.canAccessWindow(target)) {
+        throw new ExtensionError(`Invalid window ID: ${windowId}`);
+      }
     }
-    return null;
+    return target;
   }
 
   /**
    * Gets the data associated with a tab, window, or the global one.
    *
    * @param {XULElement|ChromeWindow|null} target
    *        A XULElement tab, a ChromeWindow, or null for the global data.
    * @returns {Object}
@@ -352,29 +365,29 @@ this.sidebarAction = class extends Exten
   /**
    * Triggers this sidebar action for the given window, with the same effects as
    * if it were toggled via menu or toolbarbutton by a user.
    *
    * @param {ChromeWindow} window
    */
   triggerAction(window) {
     let {SidebarUI} = window;
-    if (SidebarUI) {
+    if (SidebarUI && this.extension.canAccessWindow(window)) {
       SidebarUI.toggle(this.id);
     }
   }
 
   /**
    * Opens this sidebar action for the given window.
    *
    * @param {ChromeWindow} window
    */
   open(window) {
     let {SidebarUI} = window;
-    if (SidebarUI) {
+    if (SidebarUI && this.extension.canAccessWindow(window)) {
       SidebarUI.show(this.id);
     }
   }
 
   /**
    * Closes this sidebar action for the given window if this sidebar action is open.
    *
    * @param {ChromeWindow} window
@@ -434,22 +447,26 @@ this.sidebarAction = class extends Exten
         },
 
         getPanel(details) {
           return sidebarAction.getPropertyFromDetails(details, "panel");
         },
 
         open() {
           let window = windowTracker.topWindow;
-          sidebarAction.open(window);
+          if (context.canAccessWindow(window)) {
+            sidebarAction.open(window);
+          }
         },
 
         close() {
           let window = windowTracker.topWindow;
-          sidebarAction.close(window);
+          if (context.canAccessWindow(window)) {
+            sidebarAction.close(window);
+          }
         },
 
         isOpen(details) {
           let {windowId} = details;
           if (windowId == null) {
             windowId = Window.WINDOW_ID_CURRENT;
           }
           let window = windowTracker.getWindow(windowId, context);
--- a/browser/components/extensions/test/browser/browser-common.ini
+++ b/browser/components/extensions/test/browser/browser-common.ini
@@ -1,14 +1,15 @@
 [DEFAULT]
 prefs =
     dom.animations-api.core.enabled=true
     dom.animations-api.timelines.enabled=true
 support-files =
   silence.ogg
+  head_browserAction.js
   head_pageAction.js
   head_sessions.js
   head_webNavigation.js
   context.html
   context_frame.html
   ctxmenu-image.png
   context_tabs_onUpdated_page.html
   context_tabs_onUpdated_iframe.html
@@ -55,17 +56,18 @@ skip-if = os == 'linux'
 [browser_ext_browserAction_pageAction_icon.js]
 [browser_ext_browserAction_pageAction_icon_permissions.js]
 [browser_ext_browserAction_popup.js]
 skip-if = (debug && os == 'linux' && bits == 32) || (os == 'win' && !debug) # Bug 1313372, win: Bug 1285500
 [browser_ext_browserAction_popup_port.js]
 [browser_ext_browserAction_popup_preload.js]
 skip-if = (os == 'win' && !debug) || (verify && debug && (os == 'mac')) # bug 1352668
 [browser_ext_browserAction_popup_resize.js]
-skip-if = (os == 'mac' || os == 'win' || os == 'linux') || (verify && debug) #Bug 1482004,1483701
+[browser_ext_browserAction_popup_resize_bottom.js]
+skip-if = debug # Bug 1522164
 [browser_ext_browserAction_simple.js]
 [browser_ext_browserAction_telemetry.js]
 [browser_ext_browserAction_theme_icons.js]
 [browser_ext_browsingData_formData.js]
 [browser_ext_browsingData_history.js]
 [browser_ext_browsingData_indexedDB.js]
 [browser_ext_browsingData_localStorage.js]
 [browser_ext_browsingData_pluginData.js]
@@ -166,16 +168,17 @@ skip-if = !e10s || !crashreporter # the 
 [browser_ext_sessions_restoreTab.js]
 [browser_ext_sessions_window_tab_value.js]
 [browser_ext_settings_overrides_default_search.js]
 [browser_ext_sidebarAction.js]
 [browser_ext_sidebarAction_browser_style.js]
 [browser_ext_sidebarAction_click.js]
 [browser_ext_sidebarAction_context.js]
 [browser_ext_sidebarAction_contextMenu.js]
+[browser_ext_sidebarAction_incognito.js]
 [browser_ext_sidebarAction_runtime.js]
 [browser_ext_sidebarAction_tabs.js]
 [browser_ext_sidebarAction_windows.js]
 [browser_ext_simple.js]
 [browser_ext_slow_script.js]
 skip-if = !e10s || debug || asan
 [browser_ext_tab_runtimeConnect.js]
 [browser_ext_tabs_attention.js]
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_incognito.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_incognito.js
@@ -1,43 +1,52 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({set: [
+    ["extensions.allowPrivateBrowsingByDefault", false],
+  ]});
+});
+
 async function testIncognito(incognitoOverride) {
-  let privateAllowed = incognitoOverride != "not_allowed";
-
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       "browser_action": {},
     },
     incognitoOverride,
   });
 
+  // We test three windows, the public window, a private window prior
+  // to extension start, and one created after.  This tests that CUI
+  // creates the widgets (or not) as it should.
+  let p1 = await BrowserTestUtils.openNewBrowserWindow({private: true});
   await extension.startup();
-  await showBrowserAction(extension);
+  let p2 = await BrowserTestUtils.openNewBrowserWindow({private: true});
 
-  let privateWindow = await BrowserTestUtils.openNewBrowserWindow({private: true});
-  await showBrowserAction(extension, privateWindow);
-
-  let widgetId = makeWidgetId(extension.id) + "-browser-action";
+  let action = getBrowserActionWidget(extension);
+  await showBrowserAction(extension);
+  await showBrowserAction(extension, p1);
+  await showBrowserAction(extension, p2);
 
-  let node = window.document.getElementById(widgetId);
-  ok(!!node, "popup exists in non-private window");
+  ok(!!action.forWindow(window).node, "popup exists in non-private window");
 
-  node = privateWindow.document.getElementById(widgetId);
-  if (privateAllowed) {
-    ok(!!node, "popup exists in private window");
-  } else {
-    ok(!node, "popup does not exist in private window");
+  for (let win of [p1, p2]) {
+    let node = action.forWindow(win).node;
+    if (incognitoOverride == "spanning") {
+      ok(!!node, "popup exists in private window");
+    } else {
+      ok(!node, "popup does not exist in private window");
+    }
+
+    await BrowserTestUtils.closeWindow(win);
   }
-
-  await BrowserTestUtils.closeWindow(privateWindow);
   await extension.unload();
 }
 
 add_task(async function test_browserAction_not_allowed() {
-  await testIncognito("not_allowed");
+  await testIncognito();
 });
 
 add_task(async function test_browserAction_allowed() {
-  await testIncognito();
+  await testIncognito("spanning");
 });
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
@@ -1,17 +1,14 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
-function openPanel(extension, win = window, awaitLoad = false) {
-  clickBrowserAction(extension, win);
-
-  return awaitExtensionPanel(extension, win, awaitLoad);
-}
+Services.scriptloader.loadSubScript(new URL("head_browserAction.js", gTestPath).href,
+                                    this);
 
 add_task(async function testSetup() {
   Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", false);
 });
 
 add_task(async function testBrowserActionPopupResize() {
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
@@ -23,17 +20,17 @@ add_task(async function testBrowserActio
 
     files: {
       "popup.html": '<!DOCTYPE html><html><head><meta charset="utf-8"></head></html>',
     },
   });
 
   await extension.startup();
 
-  let browser = await openPanel(extension, undefined, true);
+  let browser = await openBrowserActionPanel(extension, undefined, true);
 
   async function checkSize(expected) {
     let dims = await promiseContentDimensions(browser);
 
     Assert.lessOrEqual(Math.abs(dims.window.innerHeight - expected), 1,
                        `Panel window should be ${expected}px tall (was ${dims.window.innerHeight})`);
     is(dims.body.clientHeight, dims.body.scrollHeight,
        "Panel body should be tall enough to fit its contents");
@@ -56,267 +53,27 @@ add_task(async function testBrowserActio
     300,
   ];
 
   for (let size of sizes) {
     await alterContent(browser, setSize, size);
     await checkSize(size);
   }
 
+  let popup = getBrowserActionPopup(extension);
   await closeBrowserAction(extension);
+  is(popup.state, "closed", "browserAction popup has been closed");
+
   await extension.unload();
 });
 
-async function testPopupSize(standardsMode, browserWin = window, arrowSide = "top") {
-  let docType = standardsMode ? "<!DOCTYPE html>" : "";
-
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      "browser_action": {
-        "default_popup": "popup.html",
-        "browser_style": false,
-      },
-    },
-
-    files: {
-      "popup.html": `${docType}
-        <html>
-          <head>
-            <meta charset="utf-8">
-            <style type="text/css">
-              body > span {
-                display: inline-block;
-                width: 10px;
-                height: 150px;
-                border: 2px solid black;
-              }
-              .big > span {
-                width: 300px;
-                height: 100px;
-              }
-              .bigger > span {
-                width: 150px;
-                height: 150px;
-              }
-              .huge > span {
-                height: ${2 * screen.height}px;
-              }
-            </style>
-          </head>
-          <body>
-            <span></span>
-            <span></span>
-            <span></span>
-            <span></span>
-          </body>
-        </html>`,
-    },
-  });
-
-  await extension.startup();
-
-  if (arrowSide == "top") {
-    // Test the standalone panel for a toolbar button.
-    let browser = await openPanel(extension, browserWin, true);
-
-    let dims = await promiseContentDimensions(browser);
-
-    is(dims.isStandards, standardsMode, "Document has the expected compat mode");
-
-    let {innerWidth, innerHeight} = dims.window;
-
-    dims = await alterContent(browser, () => {
-      content.document.body.classList.add("bigger");
-    });
-
-    let win = dims.window;
-    is(win.innerHeight, innerHeight, "Window height should not change");
-    ok(win.innerWidth > innerWidth, `Window width should increase (${win.innerWidth} > ${innerWidth})`);
-
-
-    dims = await alterContent(browser, () => {
-      content.document.body.classList.remove("bigger");
-    });
-
-    win = dims.window;
-    is(win.innerHeight, innerHeight, "Window height should not change");
-
-    // The getContentSize calculation is not always reliable to single-pixel
-    // precision.
-    ok(Math.abs(win.innerWidth - innerWidth) <= 1,
-       `Window width should return to approximately its original value (${win.innerWidth} ~= ${innerWidth})`);
-
-    await closeBrowserAction(extension, browserWin);
-  }
-
-
-  // Test the PanelUI panel for a menu panel button.
-  let widget = getBrowserActionWidget(extension);
-  CustomizableUI.addWidgetToArea(widget.id, getCustomizableUIPanelID());
-
-  let panel = browserWin.PanelUI.overflowPanel;
-  panel.setAttribute("animate", "false");
-
-  let panelMultiView = panel.firstElementChild;
-  let widgetId = makeWidgetId(extension.id);
-  // The 'ViewShown' event is the only way to correctly determine when the extensions'
-  // panelview has finished transitioning and is fully in view.
-  let shownPromise = BrowserTestUtils.waitForEvent(panelMultiView, "ViewShown",
-                                                   e => (e.originalTarget.id || "").includes(widgetId));
-  let browser = await openPanel(extension, browserWin);
-  let origPanelRect = panel.getBoundingClientRect();
-
-  // Check that the panel is still positioned as expected.
-  let checkPanelPosition = () => {
-    is(panel.getAttribute("side"), arrowSide, "Panel arrow is positioned as expected");
-
-    let panelRect = panel.getBoundingClientRect();
-    if (arrowSide == "top") {
-      is(panelRect.top, origPanelRect.top, "Panel has not moved downwards");
-      ok(panelRect.bottom >= origPanelRect.bottom, `Panel has not shrunk from original size (${panelRect.bottom} >= ${origPanelRect.bottom})`);
-
-      let screenBottom = browserWin.screen.availTop + browserWin.screen.availHeight;
-      let panelBottom = browserWin.mozInnerScreenY + panelRect.bottom;
-      ok(Math.round(panelBottom) <= screenBottom, `Bottom of popup should be on-screen. (${panelBottom} <= ${screenBottom})`);
-    } else {
-      is(panelRect.bottom, origPanelRect.bottom, "Panel has not moved upwards");
-      ok(panelRect.top <= origPanelRect.top, `Panel has not shrunk from original size (${panelRect.top} <= ${origPanelRect.top})`);
-
-      let panelTop = browserWin.mozInnerScreenY + panelRect.top;
-      ok(panelTop >= browserWin.screen.availTop, `Top of popup should be on-screen. (${panelTop} >= ${browserWin.screen.availTop})`);
-    }
-  };
-
-  await awaitBrowserLoaded(browser);
-  await shownPromise;
-
-  // Wait long enough to make sure the initial resize debouncing timer has
-  // expired.
-  await delay(500);
-
-  let dims = await promiseContentDimensions(browser);
-
-  is(dims.isStandards, standardsMode, "Document has the expected compat mode");
-
-  // If the browser's preferred height is smaller than the initial height of the
-  // panel, then it will still take up the full available vertical space. Even
-  // so, we need to check that we've gotten the preferred height calculation
-  // correct, so check that explicitly.
-  let getHeight = () => parseFloat(browser.style.height);
-
-  let {innerWidth, innerHeight} = dims.window;
-  let height = getHeight();
-
-
-  let setClass = className => {
-    content.document.body.className = className;
-  };
-
-  info("Increase body children's width. " +
-       "Expect them to wrap, and the frame to grow vertically rather than widen.");
-
-  dims = await alterContent(browser, setClass, "big");
-  let win = dims.window;
-
-  ok(getHeight() > height, `Browser height should increase (${getHeight()} > ${height})`);
-
-  is(win.innerWidth, innerWidth, "Window width should not change");
-  ok(win.innerHeight >= innerHeight, `Window height should increase (${win.innerHeight} >= ${innerHeight})`);
-  Assert.lessOrEqual(win.scrollMaxY, 1, "Document should not be vertically scrollable");
-
-  checkPanelPosition();
-
-
-  info("Increase body children's width and height. " +
-       "Expect them to wrap, and the frame to grow vertically rather than widen.");
-
-  dims = await alterContent(browser, setClass, "bigger");
-  win = dims.window;
-
-  ok(getHeight() > height, `Browser height should increase (${getHeight()} > ${height})`);
-
-  is(win.innerWidth, innerWidth, "Window width should not change");
-  ok(win.innerHeight >= innerHeight, `Window height should increase (${win.innerHeight} >= ${innerHeight})`);
-  Assert.lessOrEqual(win.scrollMaxY, 1, "Document should not be vertically scrollable");
-
-  checkPanelPosition();
-
-
-  info("Increase body height beyond the height of the screen. " +
-       "Expect the panel to grow to accommodate, but not larger than the height of the screen.");
-
-  dims = await alterContent(browser, setClass, "huge");
-  win = dims.window;
-
-  ok(getHeight() > height, `Browser height should increase (${getHeight()} > ${height})`);
-
-  is(win.innerWidth, innerWidth, "Window width should not change");
-  ok(win.innerHeight > innerHeight, `Window height should increase (${win.innerHeight} > ${innerHeight})`);
-  // Commented out check for the window height here which mysteriously breaks
-  // on infra but not locally. bug 1396843 covers re-enabling this.
-  // ok(win.innerHeight < screen.height, `Window height be less than the screen height (${win.innerHeight} < ${screen.height})`);
-  ok(win.scrollMaxY > 0, `Document should be vertically scrollable (${win.scrollMaxY} > 0)`);
-
-  checkPanelPosition();
-
-
-  info("Restore original styling. Expect original dimensions.");
-  dims = await alterContent(browser, setClass, "");
-  win = dims.window;
-
-  is(getHeight(), height, "Browser height should return to its original value");
-
-  is(win.innerWidth, innerWidth, "Window width should not change");
-  is(win.innerHeight, innerHeight, "Window height should return to its original value");
-  Assert.lessOrEqual(win.scrollMaxY, 1, "Document should not be vertically scrollable");
-
-  checkPanelPosition();
-
-  await closeBrowserAction(extension, browserWin);
-
-  await extension.unload();
-}
 
 add_task(async function testBrowserActionMenuResizeStandards() {
   await testPopupSize(true);
 });
 
 add_task(async function testBrowserActionMenuResizeQuirks() {
   await testPopupSize(false);
 });
 
-// Test that we still make reasonable maximum size calculations when the window
-// is close enough to the bottom of the screen that the menu panel opens above,
-// rather than below, its button.
-add_task(async function testBrowserActionMenuResizeBottomArrow() {
-  const WIDTH = 800;
-  const HEIGHT = 80;
-
-  let left = screen.availLeft + screen.availWidth - WIDTH;
-  let top = screen.availTop + screen.availHeight - HEIGHT;
-
-  let win = await BrowserTestUtils.openNewBrowserWindow();
-
-  win.resizeTo(WIDTH, HEIGHT);
-
-  // Sometimes we run into problems on Linux with resizing being asynchronous
-  // and window managers not allowing us to move the window so that any part of
-  // it is off-screen, so we need to try more than once.
-  for (let i = 0; i < 20; i++) {
-    win.moveTo(left, top);
-
-    if (win.screenX == left && win.screenY == top) {
-      break;
-    }
-
-    await delay(100);
-  }
-
-  await SimpleTest.promiseFocus(win);
-
-  await testPopupSize(true, win, "bottom");
-
-  await BrowserTestUtils.closeWindow(win);
-});
-
 add_task(async function testTeardown() {
   Services.prefs.clearUserPref("toolkit.cosmeticAnimations.enabled");
 });
copy from browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
copy to browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize_bottom.js
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize_bottom.js
@@ -1,293 +1,19 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
-function openPanel(extension, win = window, awaitLoad = false) {
-  clickBrowserAction(extension, win);
-
-  return awaitExtensionPanel(extension, win, awaitLoad);
-}
+Services.scriptloader.loadSubScript(new URL("head_browserAction.js", gTestPath).href,
+                                    this);
 
 add_task(async function testSetup() {
   Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", false);
 });
 
-add_task(async function testBrowserActionPopupResize() {
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      "browser_action": {
-        "default_popup": "popup.html",
-        "browser_style": true,
-      },
-    },
-
-    files: {
-      "popup.html": '<!DOCTYPE html><html><head><meta charset="utf-8"></head></html>',
-    },
-  });
-
-  await extension.startup();
-
-  let browser = await openPanel(extension, undefined, true);
-
-  async function checkSize(expected) {
-    let dims = await promiseContentDimensions(browser);
-
-    Assert.lessOrEqual(Math.abs(dims.window.innerHeight - expected), 1,
-                       `Panel window should be ${expected}px tall (was ${dims.window.innerHeight})`);
-    is(dims.body.clientHeight, dims.body.scrollHeight,
-       "Panel body should be tall enough to fit its contents");
-
-    // Tolerate if it is 1px too wide, as that may happen with the current resizing method.
-    Assert.lessOrEqual(Math.abs(dims.window.innerWidth - expected), 1,
-                       `Panel window should be ${expected}px wide`);
-    is(dims.body.clientWidth, dims.body.scrollWidth,
-       "Panel body should be wide enough to fit its contents");
-  }
-
-  function setSize(size) {
-    content.document.body.style.height = `${size}px`;
-    content.document.body.style.width = `${size}px`;
-  }
-
-  let sizes = [
-    200,
-    400,
-    300,
-  ];
-
-  for (let size of sizes) {
-    await alterContent(browser, setSize, size);
-    await checkSize(size);
-  }
-
-  await closeBrowserAction(extension);
-  await extension.unload();
-});
-
-async function testPopupSize(standardsMode, browserWin = window, arrowSide = "top") {
-  let docType = standardsMode ? "<!DOCTYPE html>" : "";
-
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      "browser_action": {
-        "default_popup": "popup.html",
-        "browser_style": false,
-      },
-    },
-
-    files: {
-      "popup.html": `${docType}
-        <html>
-          <head>
-            <meta charset="utf-8">
-            <style type="text/css">
-              body > span {
-                display: inline-block;
-                width: 10px;
-                height: 150px;
-                border: 2px solid black;
-              }
-              .big > span {
-                width: 300px;
-                height: 100px;
-              }
-              .bigger > span {
-                width: 150px;
-                height: 150px;
-              }
-              .huge > span {
-                height: ${2 * screen.height}px;
-              }
-            </style>
-          </head>
-          <body>
-            <span></span>
-            <span></span>
-            <span></span>
-            <span></span>
-          </body>
-        </html>`,
-    },
-  });
-
-  await extension.startup();
-
-  if (arrowSide == "top") {
-    // Test the standalone panel for a toolbar button.
-    let browser = await openPanel(extension, browserWin, true);
-
-    let dims = await promiseContentDimensions(browser);
-
-    is(dims.isStandards, standardsMode, "Document has the expected compat mode");
-
-    let {innerWidth, innerHeight} = dims.window;
-
-    dims = await alterContent(browser, () => {
-      content.document.body.classList.add("bigger");
-    });
-
-    let win = dims.window;
-    is(win.innerHeight, innerHeight, "Window height should not change");
-    ok(win.innerWidth > innerWidth, `Window width should increase (${win.innerWidth} > ${innerWidth})`);
-
-
-    dims = await alterContent(browser, () => {
-      content.document.body.classList.remove("bigger");
-    });
-
-    win = dims.window;
-    is(win.innerHeight, innerHeight, "Window height should not change");
-
-    // The getContentSize calculation is not always reliable to single-pixel
-    // precision.
-    ok(Math.abs(win.innerWidth - innerWidth) <= 1,
-       `Window width should return to approximately its original value (${win.innerWidth} ~= ${innerWidth})`);
-
-    await closeBrowserAction(extension, browserWin);
-  }
-
-
-  // Test the PanelUI panel for a menu panel button.
-  let widget = getBrowserActionWidget(extension);
-  CustomizableUI.addWidgetToArea(widget.id, getCustomizableUIPanelID());
-
-  let panel = browserWin.PanelUI.overflowPanel;
-  panel.setAttribute("animate", "false");
-
-  let panelMultiView = panel.firstElementChild;
-  let widgetId = makeWidgetId(extension.id);
-  // The 'ViewShown' event is the only way to correctly determine when the extensions'
-  // panelview has finished transitioning and is fully in view.
-  let shownPromise = BrowserTestUtils.waitForEvent(panelMultiView, "ViewShown",
-                                                   e => (e.originalTarget.id || "").includes(widgetId));
-  let browser = await openPanel(extension, browserWin);
-  let origPanelRect = panel.getBoundingClientRect();
-
-  // Check that the panel is still positioned as expected.
-  let checkPanelPosition = () => {
-    is(panel.getAttribute("side"), arrowSide, "Panel arrow is positioned as expected");
-
-    let panelRect = panel.getBoundingClientRect();
-    if (arrowSide == "top") {
-      is(panelRect.top, origPanelRect.top, "Panel has not moved downwards");
-      ok(panelRect.bottom >= origPanelRect.bottom, `Panel has not shrunk from original size (${panelRect.bottom} >= ${origPanelRect.bottom})`);
-
-      let screenBottom = browserWin.screen.availTop + browserWin.screen.availHeight;
-      let panelBottom = browserWin.mozInnerScreenY + panelRect.bottom;
-      ok(Math.round(panelBottom) <= screenBottom, `Bottom of popup should be on-screen. (${panelBottom} <= ${screenBottom})`);
-    } else {
-      is(panelRect.bottom, origPanelRect.bottom, "Panel has not moved upwards");
-      ok(panelRect.top <= origPanelRect.top, `Panel has not shrunk from original size (${panelRect.top} <= ${origPanelRect.top})`);
-
-      let panelTop = browserWin.mozInnerScreenY + panelRect.top;
-      ok(panelTop >= browserWin.screen.availTop, `Top of popup should be on-screen. (${panelTop} >= ${browserWin.screen.availTop})`);
-    }
-  };
-
-  await awaitBrowserLoaded(browser);
-  await shownPromise;
-
-  // Wait long enough to make sure the initial resize debouncing timer has
-  // expired.
-  await delay(500);
-
-  let dims = await promiseContentDimensions(browser);
-
-  is(dims.isStandards, standardsMode, "Document has the expected compat mode");
-
-  // If the browser's preferred height is smaller than the initial height of the
-  // panel, then it will still take up the full available vertical space. Even
-  // so, we need to check that we've gotten the preferred height calculation
-  // correct, so check that explicitly.
-  let getHeight = () => parseFloat(browser.style.height);
-
-  let {innerWidth, innerHeight} = dims.window;
-  let height = getHeight();
-
-
-  let setClass = className => {
-    content.document.body.className = className;
-  };
-
-  info("Increase body children's width. " +
-       "Expect them to wrap, and the frame to grow vertically rather than widen.");
-
-  dims = await alterContent(browser, setClass, "big");
-  let win = dims.window;
-
-  ok(getHeight() > height, `Browser height should increase (${getHeight()} > ${height})`);
-
-  is(win.innerWidth, innerWidth, "Window width should not change");
-  ok(win.innerHeight >= innerHeight, `Window height should increase (${win.innerHeight} >= ${innerHeight})`);
-  Assert.lessOrEqual(win.scrollMaxY, 1, "Document should not be vertically scrollable");
-
-  checkPanelPosition();
-
-
-  info("Increase body children's width and height. " +
-       "Expect them to wrap, and the frame to grow vertically rather than widen.");
-
-  dims = await alterContent(browser, setClass, "bigger");
-  win = dims.window;
-
-  ok(getHeight() > height, `Browser height should increase (${getHeight()} > ${height})`);
-
-  is(win.innerWidth, innerWidth, "Window width should not change");
-  ok(win.innerHeight >= innerHeight, `Window height should increase (${win.innerHeight} >= ${innerHeight})`);
-  Assert.lessOrEqual(win.scrollMaxY, 1, "Document should not be vertically scrollable");
-
-  checkPanelPosition();
-
-
-  info("Increase body height beyond the height of the screen. " +
-       "Expect the panel to grow to accommodate, but not larger than the height of the screen.");
-
-  dims = await alterContent(browser, setClass, "huge");
-  win = dims.window;
-
-  ok(getHeight() > height, `Browser height should increase (${getHeight()} > ${height})`);
-
-  is(win.innerWidth, innerWidth, "Window width should not change");
-  ok(win.innerHeight > innerHeight, `Window height should increase (${win.innerHeight} > ${innerHeight})`);
-  // Commented out check for the window height here which mysteriously breaks
-  // on infra but not locally. bug 1396843 covers re-enabling this.
-  // ok(win.innerHeight < screen.height, `Window height be less than the screen height (${win.innerHeight} < ${screen.height})`);
-  ok(win.scrollMaxY > 0, `Document should be vertically scrollable (${win.scrollMaxY} > 0)`);
-
-  checkPanelPosition();
-
-
-  info("Restore original styling. Expect original dimensions.");
-  dims = await alterContent(browser, setClass, "");
-  win = dims.window;
-
-  is(getHeight(), height, "Browser height should return to its original value");
-
-  is(win.innerWidth, innerWidth, "Window width should not change");
-  is(win.innerHeight, innerHeight, "Window height should return to its original value");
-  Assert.lessOrEqual(win.scrollMaxY, 1, "Document should not be vertically scrollable");
-
-  checkPanelPosition();
-
-  await closeBrowserAction(extension, browserWin);
-
-  await extension.unload();
-}
-
-add_task(async function testBrowserActionMenuResizeStandards() {
-  await testPopupSize(true);
-});
-
-add_task(async function testBrowserActionMenuResizeQuirks() {
-  await testPopupSize(false);
-});
-
 // Test that we still make reasonable maximum size calculations when the window
 // is close enough to the bottom of the screen that the menu panel opens above,
 // rather than below, its button.
 add_task(async function testBrowserActionMenuResizeBottomArrow() {
   const WIDTH = 800;
   const HEIGHT = 80;
 
   let left = screen.availLeft + screen.availWidth - WIDTH;
--- a/browser/components/extensions/test/browser/browser_ext_incognito_popup.js
+++ b/browser/components/extensions/test/browser/browser_ext_incognito_popup.js
@@ -103,26 +103,29 @@ add_task(async function testIncognitoPop
   });
 
   await extension.startup();
   await extension.awaitFinish("incognito");
   await extension.unload();
 });
 
 add_task(async function test_pageAction_incognito_not_allowed() {
+  SpecialPowers.pushPrefEnv({set: [
+    ["extensions.allowPrivateBrowsingByDefault", false],
+  ]});
+
   const URL = "http://example.com/";
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       "permissions": ["*://example.com/*"],
       "page_action": {
         "show_matches": ["<all_urls>"],
         "pinned": true,
       },
     },
-    incognitoOverride: "not_allowed",
   });
 
   await extension.startup();
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL, true, true);
   let privateWindow = await BrowserTestUtils.openNewBrowserWindow({private: true});
   await BrowserTestUtils.openNewForegroundTab(privateWindow.gBrowser, URL, true, true);
 
   let elem = await getPageActionButton(extension, window);
--- a/browser/components/extensions/test/browser/browser_ext_menus_events.js
+++ b/browser/components/extensions/test/browser/browser_ext_menus_events.js
@@ -1,24 +1,25 @@
 /* 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/. */
 "use strict";
 
+const {GlobalManager} = ChromeUtils.import("resource://gre/modules/Extension.jsm", null);
+const {ExtensionPermissions} = ChromeUtils.import("resource://gre/modules/ExtensionPermissions.jsm");
+
 const PAGE = "http://mochi.test:8888/browser/browser/components/extensions/test/browser/context.html";
 const PAGE_BASE = PAGE.replace("context.html", "");
 const PAGE_HOST_PATTERN = "http://mochi.test/*";
 
 const EXPECT_TARGET_ELEMENT = 13337;
 
 async function grantOptionalPermission(extension, permissions) {
-  const {GlobalManager} = ChromeUtils.import("resource://gre/modules/Extension.jsm", null);
-  const {ExtensionPermissions} = ChromeUtils.import("resource://gre/modules/ExtensionPermissions.jsm");
   let ext = GlobalManager.extensionMap.get(extension.id);
-  return ExtensionPermissions.add(ext, permissions);
+  return ExtensionPermissions.add(extension.id, permissions, ext);
 }
 
 // Registers a context menu using menus.create(menuCreateParams) and checks
 // whether the menus.onShown and menus.onHidden events are fired as expected.
 // doOpenMenu must open the menu and its returned promise must resolve after the
 // menu is shown. Similarly, doCloseMenu must hide the menu.
 async function testShowHideEvent({menuCreateParams, doOpenMenu, doCloseMenu,
                                   expectedShownEvent,
new file mode 100644
--- /dev/null
+++ b/browser/components/extensions/test/browser/browser_ext_sidebarAction_incognito.js
@@ -0,0 +1,106 @@
+/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set sts=2 sw=2 et tw=80: */
+"use strict";
+
+async function testIncognito(incognitoOverride) {
+  SpecialPowers.pushPrefEnv({set: [
+    ["extensions.allowPrivateBrowsingByDefault", false],
+  ]});
+
+  let extension = ExtensionTestUtils.loadExtension({
+    incognitoOverride,
+    manifest: {
+      sidebar_action: {
+        default_panel: "sidebar.html",
+      },
+    },
+    background() {
+      browser.test.onMessage.addListener(async pbw => {
+        await browser.test.assertRejects(browser.sidebarAction.setTitle({
+          windowId: pbw.windowId, title: "test",
+        }), /Invalid window ID/, "should not be able to set title");
+        await browser.test.assertRejects(browser.sidebarAction.setTitle({
+          tabId: pbw.tabId, title: "test",
+        }), /Invalid tab ID/, "should not be able to set title");
+        await browser.test.assertRejects(browser.sidebarAction.getTitle({
+          windowId: pbw.windowId,
+        }), /Invalid window ID/, "should not be able to get title");
+        await browser.test.assertRejects(browser.sidebarAction.getTitle({
+          tabId: pbw.tabId,
+        }), /Invalid tab ID/, "should not be able to get title");
+
+        await browser.test.assertRejects(browser.sidebarAction.setIcon({
+          windowId: pbw.windowId, path: "test",
+        }), /Invalid window ID/, "should not be able to set icon");
+        await browser.test.assertRejects(browser.sidebarAction.setIcon({
+          tabId: pbw.tabId, path: "test",
+        }), /Invalid tab ID/, "should not be able to set icon");
+
+        await browser.test.assertRejects(browser.sidebarAction.setPanel({
+          windowId: pbw.windowId, panel: "test",
+        }), /Invalid window ID/, "should not be able to set panel");
+        await browser.test.assertRejects(browser.sidebarAction.setPanel({
+          tabId: pbw.tabId, panel: "test",
+        }), /Invalid tab ID/, "should not be able to set panel");
+        await browser.test.assertRejects(browser.sidebarAction.getPanel({
+          windowId: pbw.windowId,
+        }), /Invalid window ID/, "should not be able to get panel");
+        await browser.test.assertRejects(browser.sidebarAction.getPanel({
+          tabId: pbw.tabId,
+        }), /Invalid tab ID/, "should not be able to get panel");
+
+        await browser.test.assertRejects(browser.sidebarAction.isOpen({
+          windowId: pbw.windowId,
+        }), /Invalid window ID/, "should not be able to determine openness");
+
+        browser.test.notifyPass("pass");
+      });
+    },
+    files: {
+      "sidebar.html": `
+        <!DOCTYPE html>
+        <html>
+        <head><meta charset="utf-8"/>
+        <script src="sidebar.js"></script>
+        </head>
+        <body>
+          A Test Sidebar
+        </body>
+        </html>
+      `,
+
+      "sidebar.js": function() {
+        window.onload = () => {
+          browser.test.sendMessage("sidebar");
+        };
+      },
+    },
+  });
+
+  await extension.startup();
+  let sidebarID = `${makeWidgetId(extension.id)}-sidebar-action`;
+  ok(SidebarUI.sidebars.has(sidebarID), "sidebar exists in non-private window");
+
+  let winData = await getIncognitoWindow("about:blank");
+
+  let hasSidebar = winData.win.SidebarUI.sidebars.has(sidebarID);
+  if (incognitoOverride == "spanning") {
+    ok(hasSidebar, "sidebar exists in private window");
+  } else {
+    ok(!hasSidebar, "sidebar does not exist in private window");
+    // Test API access to private window data.
+    extension.sendMessage(winData.details);
+    await extension.awaitFinish("pass");
+  }
+
+  await BrowserTestUtils.closeWindow(winData.win);
+  await extension.unload();
+}
+
+add_task(async function test_sidebarAction_not_allowed() {
+  await testIncognito();
+});
+
+add_task(async function test_sidebarAction_allowed() {
+  await testIncognito("spanning");
+});
--- a/browser/components/extensions/test/browser/browser_ext_tabs_events.js
+++ b/browser/components/extensions/test/browser/browser_ext_tabs_events.js
@@ -2,16 +2,19 @@
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 
 // A single monitor for the tests.  If it receives any
 // incognito data in event listeners it will fail.
 let monitor;
 add_task(async function startup() {
+  SpecialPowers.pushPrefEnv({set: [
+    ["extensions.allowPrivateBrowsingByDefault", false],
+  ]});
   monitor = await startIncognitoMonitorExtension();
 });
 registerCleanupFunction(async function finish() {
   await monitor.unload();
 });
 
 // Test tab events from private windows, the monitor above will fail
 // if it receives any.
@@ -190,16 +193,17 @@ add_task(async function test_tab_events_
     }
   }
 
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       "permissions": ["tabs"],
     },
     background,
+    incognitoOverride: "spanning",
   });
 
   await extension.startup();
   await extension.awaitFinish("tabs-events");
   await extension.unload();
 });
 
 add_task(async function testTabEventsSize() {
--- a/browser/components/extensions/test/browser/browser_ext_tabs_incognito_not_allowed.js
+++ b/browser/components/extensions/test/browser/browser_ext_tabs_incognito_not_allowed.js
@@ -1,17 +1,20 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 add_task(async function testExecuteScriptIncognitoNotAllowed() {
+  SpecialPowers.pushPrefEnv({set: [
+    ["extensions.allowPrivateBrowsingByDefault", false],
+  ]});
+
   const url = "http://mochi.test:8888/browser/browser/components/extensions/test/browser/file_iframe_document.html";
 
   let extension = ExtensionTestUtils.loadExtension({
-    incognitoOverride: "not_allowed",
     manifest: {
       // captureTab requires all_urls permission
       "permissions": ["<all_urls>", "tabs", "tabHide"],
     },
     background() {
       browser.test.onMessage.addListener(async pbw => {
         // expect one tab from the non-pb window
         let tabs = await browser.tabs.query({windowId: pbw.windowId});
--- a/browser/components/extensions/test/browser/browser_ext_tabs_zoom.js
+++ b/browser/components/extensions/test/browser/browser_ext_tabs_zoom.js
@@ -3,16 +3,19 @@
 "use strict";
 
 const SITE_SPECIFIC_PREF = "browser.zoom.siteSpecific";
 
 // A single monitor for the tests.  If it receives any
 // incognito data in event listeners it will fail.
 let monitor;
 add_task(async function startup() {
+  SpecialPowers.pushPrefEnv({set: [
+    ["extensions.allowPrivateBrowsingByDefault", false],
+  ]});
   monitor = await startIncognitoMonitorExtension();
 });
 registerCleanupFunction(async function finish() {
   await monitor.unload();
 });
 
 add_task(async function test_zoom_api() {
   async function background() {
@@ -189,17 +192,17 @@ add_task(async function test_zoom_api() 
       browser.test.notifyFail("tab-zoom");
     }
   }
 
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       "permissions": ["tabs"],
     },
-
+    incognitoOverride: "spanning",
     background,
   });
 
   extension.onMessage("msg", (id, msg, ...args) => {
     let {Management: {global: {tabTracker}}} = ChromeUtils.import("resource://gre/modules/Extension.jsm", null);
 
     let resp;
     if (msg == "get-zoom") {
--- a/browser/components/extensions/test/browser/browser_ext_windows_events.js
+++ b/browser/components/extensions/test/browser/browser_ext_windows_events.js
@@ -1,15 +1,18 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 SimpleTest.requestCompleteLog();
 
 add_task(async function test_windows_events_not_allowed() {
+  SpecialPowers.pushPrefEnv({set: [
+    ["extensions.allowPrivateBrowsingByDefault", false],
+  ]});
   let monitor = await startIncognitoMonitorExtension();
 
   function background() {
     browser.windows.onCreated.addListener(window => {
       browser.test.log(`onCreated: windowId=${window.id}`);
 
       browser.test.assertTrue(Number.isInteger(window.id),
                               "Window object's id is an integer");
@@ -42,16 +45,17 @@ add_task(async function test_windows_eve
     });
 
     browser.test.sendMessage("ready", browser.windows.WINDOW_ID_NONE);
   }
 
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {},
     background,
+    incognitoOverride: "spanning",
   });
 
   await extension.startup();
   const WINDOW_ID_NONE = await extension.awaitMessage("ready");
 
   async function awaitFocusChanged() {
     let windowInfo = await extension.awaitMessage("window-focus-changed");
     if (windowInfo.winId === WINDOW_ID_NONE) {
--- a/browser/components/extensions/test/browser/browser_ext_windows_incognito.js
+++ b/browser/components/extensions/test/browser/browser_ext_windows_incognito.js
@@ -1,20 +1,23 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 add_task(async function test_window_incognito() {
+  SpecialPowers.pushPrefEnv({set: [
+    ["extensions.allowPrivateBrowsingByDefault", false],
+  ]});
+
   const url = "http://mochi.test:8888/browser/browser/components/extensions/test/browser/file_iframe_document.html";
 
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       "permissions": ["http://mochi.test/"],
     },
-    incognitoOverride: "not_allowed",
     background() {
       browser.test.onMessage.addListener(async pbw => {
         await browser.test.assertRejects(browser.windows.get(pbw.windowId),
                                          /Invalid window ID/,
                                          "should not be able to get incognito window");
         await browser.test.assertRejects(browser.windows.remove(pbw.windowId),
                                          /Invalid window ID/,
                                          "should not be able to remove incognito window");
--- a/browser/components/extensions/test/browser/head.js
+++ b/browser/components/extensions/test/browser/head.js
@@ -1,16 +1,17 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 /* exported CustomizableUI makeWidgetId focusWindow forceGC
  *          getBrowserActionWidget
  *          clickBrowserAction clickPageAction
  *          getBrowserActionPopup getPageActionPopup getPageActionButton
+ *          openBrowserActionPanel
  *          closeBrowserAction closePageAction
  *          promisePopupShown promisePopupHidden
  *          toggleBookmarksToolbar
  *          openContextMenu closeContextMenu
  *          openContextMenuInSidebar openContextMenuInPopup
  *          openExtensionContextMenu closeExtensionContextMenu
  *          openActionContextMenu openSubmenu closeActionContextMenu
  *          openTabContextMenu closeTabContextMenu
@@ -258,16 +259,19 @@ function getBrowserActionPopup(extension
     return win.document.getElementById("customizationui-widget-panel");
   }
   return win.PanelUI.overflowPanel;
 }
 
 var showBrowserAction = async function(extension, win = window) {
   let group = getBrowserActionWidget(extension);
   let widget = group.forWindow(win);
+  if (!widget.node) {
+    return;
+  }
 
   if (group.areaType == CustomizableUI.TYPE_TOOLBAR) {
     ok(!widget.overflowed, "Expect widget not to be overflowed");
   } else if (group.areaType == CustomizableUI.TYPE_MENU_PANEL) {
     await win.document.getElementById("nav-bar").overflowable.show();
   }
 };
 
@@ -283,16 +287,22 @@ function closeBrowserAction(extension, w
   let group = getBrowserActionWidget(extension);
 
   let node = win.document.getElementById(group.viewId);
   CustomizableUI.hidePanelForNode(node);
 
   return Promise.resolve();
 }
 
+function openBrowserActionPanel(extension, win = window, awaitLoad = false) {
+  clickBrowserAction(extension, win);
+
+  return awaitExtensionPanel(extension, win, awaitLoad);
+}
+
 async function toggleBookmarksToolbar(visible = true) {
   let bookmarksToolbar = document.getElementById("PersonalToolbar");
   let transitionPromise =
     BrowserTestUtils.waitForEvent(bookmarksToolbar, "transitionend",
                                   e => e.propertyName == "max-height");
 
   setToolbarVisibility(bookmarksToolbar, visible);
   await transitionPromise;
@@ -544,19 +554,20 @@ async function locationChange(tab, url, 
 function navigateTab(tab, url) {
   return locationChange(tab, url, (url) => { content.location.href = url; });
 }
 
 function historyPushState(tab, url) {
   return locationChange(tab, url, (url) => { content.history.pushState(null, null, url); });
 }
 
-// A monitoring extension that fails if it receives data it should not.
-async function startIncognitoMonitorExtension(failOnIncognitoEvent = true) {
-  function background(expectIncognito) {
+// This monitor extension runs with incognito: not_allowed, if it receives any
+// events with incognito data it fails.
+async function startIncognitoMonitorExtension() {
+  function background() {
     // Bug 1513220 - We're unable to get the tab during onRemoved, so we track
     // valid tabs in "seen" so we can at least validate tabs that we have "seen"
     // during onRemoved.  This means that the monitor extension must be started
     // prior to creating any tabs that will be removed.
 
     // Map<tabId -> tab>
     let seenTabs = new Map();
     function getTabById(tabId) {
@@ -569,17 +580,17 @@ async function startIncognitoMonitorExte
         let tabId = tabOrId;
         try {
           tab = await getTabById(tabId);
         } catch (e) {
           browser.test.fail(`tabs.${eventName} for id ${tabOrId} unexpected failure ${e}\n`);
           return;
         }
       }
-      browser.test.assertEq(tab.incognito, expectIncognito, `tabs.${eventName} ${tab.id}: monitor extension got expected incognito value`);
+      browser.test.assertFalse(tab.incognito, `tabs.${eventName} ${tab.id}: monitor extension got expected incognito value`);
       seenTabs.set(tab.id, tab);
     }
     async function testTabInfo(tabInfo, eventName) {
       if (typeof tabInfo == "number") {
         await testTab(tabInfo, eventName);
       } else if (typeof tabInfo == "object") {
         if (tabInfo.id !== undefined) {
           await testTab(tabInfo, eventName);
@@ -605,52 +616,52 @@ async function startIncognitoMonitorExte
 
     // Map<windowId -> window>
     let seenWindows = new Map();
     function getWindowById(windowId) {
       return seenWindows.has(windowId) ? seenWindows.get(windowId) : browser.windows.get(windowId);
     }
 
     browser.windows.onCreated.addListener(window => {
-      browser.test.assertEq(window.incognito, expectIncognito, `windows.onCreated monitor extension got expected incognito value`);
+      browser.test.assertFalse(window.incognito, `windows.onCreated monitor extension got expected incognito value`);
       seenWindows.set(window.id, window);
     });
     browser.windows.onRemoved.addListener(async (windowId) => {
       let window;
       try {
         window = await getWindowById(windowId);
       } catch (e) {
         browser.test.fail(`windows.onCreated for id ${windowId} unexpected failure ${e}\n`);
         return;
       }
-      browser.test.assertEq(window.incognito, expectIncognito, `windows.onRemoved ${window.id}: monitor extension got expected incognito value`);
+      browser.test.assertFalse(window.incognito, `windows.onRemoved ${window.id}: monitor extension got expected incognito value`);
     });
     browser.windows.onFocusChanged.addListener(async (windowId) => {
       if (windowId == browser.windows.WINDOW_ID_NONE) {
         return;
       }
       // onFocusChanged will also fire for blur so check actual window.incognito value.
       let window;
       try {
         window = await getWindowById(windowId);
       } catch (e) {
         browser.test.fail(`windows.onFocusChanged for id ${windowId} unexpected failure ${e}\n`);
         return;
       }
-      browser.test.assertEq(window.incognito, expectIncognito, `windows.onFocusChanged ${window.id}: monitor extesion got expected incognito value`);
+      browser.test.assertFalse(window.incognito, `windows.onFocusChanged ${window.id}: monitor extesion got expected incognito value`);
       seenWindows.set(window.id, window);
     });
   }
 
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       "permissions": ["tabs"],
     },
-    incognitoOverride: failOnIncognitoEvent ? "not_allowed" : undefined,
-    background: `(${background})(${!failOnIncognitoEvent})`,
+    incognitoOverride: "not_allowed",
+    background,
   });
   await extension.startup();
   return extension;
 }
 
 async function getIncognitoWindow(url) {
   // Since events will be limited based on incognito, we need a
   // spanning extension to get the tab id so we can test access failure.
@@ -665,16 +676,17 @@ async function getIncognitoWindow(url) {
     });
   }
 
   let windowWatcher = ExtensionTestUtils.loadExtension({
     manifest: {
       "permissions": ["tabs"],
     },
     background: `(${background})("${url}")`,
+    incognitoOverride: "spanning",
   });
 
   await windowWatcher.startup();
   let data = windowWatcher.awaitMessage("data");
 
   let win = await BrowserTestUtils.openNewBrowserWindow({private: true, url});
   let browser = win.getBrowser().selectedBrowser;
   BrowserTestUtils.loadURI(browser, url);
copy from browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
copy to browser/components/extensions/test/browser/head_browserAction.js
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_resize.js
+++ b/browser/components/extensions/test/browser/head_browserAction.js
@@ -1,74 +1,38 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
-function openPanel(extension, win = window, awaitLoad = false) {
-  clickBrowserAction(extension, win);
-
-  return awaitExtensionPanel(extension, win, awaitLoad);
-}
-
-add_task(async function testSetup() {
-  Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", false);
-});
+/* exported testPopupSize */
 
-add_task(async function testBrowserActionPopupResize() {
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      "browser_action": {
-        "default_popup": "popup.html",
-        "browser_style": true,
-      },
-    },
+// This file is imported into the same scope as head.js.
 
-    files: {
-      "popup.html": '<!DOCTYPE html><html><head><meta charset="utf-8"></head></html>',
-    },
-  });
-
-  await extension.startup();
-
-  let browser = await openPanel(extension, undefined, true);
-
-  async function checkSize(expected) {
-    let dims = await promiseContentDimensions(browser);
+/* import-globals-from head.js */
 
-    Assert.lessOrEqual(Math.abs(dims.window.innerHeight - expected), 1,
-                       `Panel window should be ${expected}px tall (was ${dims.window.innerHeight})`);
-    is(dims.body.clientHeight, dims.body.scrollHeight,
-       "Panel body should be tall enough to fit its contents");
-
-    // Tolerate if it is 1px too wide, as that may happen with the current resizing method.
-    Assert.lessOrEqual(Math.abs(dims.window.innerWidth - expected), 1,
-                       `Panel window should be ${expected}px wide`);
-    is(dims.body.clientWidth, dims.body.scrollWidth,
-       "Panel body should be wide enough to fit its contents");
-  }
+// A test helper that retrives an old and new value after a given delay
+// and then check that calls an `isCompleted` callback to check that
+// the value has reached the expected value.
+function waitUntilValue({getValue, isCompleted, message, delay: delayTime, times = 1} = {}) {
+  let i = 0;
+  return BrowserTestUtils.waitForCondition(async () => {
+    const oldVal = await getValue();
+    await delay(delayTime);
+    const newVal = await getValue();
 
-  function setSize(size) {
-    content.document.body.style.height = `${size}px`;
-    content.document.body.style.width = `${size}px`;
-  }
+    const done = isCompleted(oldVal, newVal);
 
-  let sizes = [
-    200,
-    400,
-    300,
-  ];
+    // Reset the counter if the value wasn't the expected one.
+    if (!done) {
+      i = 0;
+    }
 
-  for (let size of sizes) {
-    await alterContent(browser, setSize, size);
-    await checkSize(size);
-  }
-
-  await closeBrowserAction(extension);
-  await extension.unload();
-});
+    return done && times === ++i;
+  }, message);
+}
 
 async function testPopupSize(standardsMode, browserWin = window, arrowSide = "top") {
   let docType = standardsMode ? "<!DOCTYPE html>" : "";
 
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       "browser_action": {
         "default_popup": "popup.html",
@@ -110,17 +74,17 @@ async function testPopupSize(standardsMo
         </html>`,
     },
   });
 
   await extension.startup();
 
   if (arrowSide == "top") {
     // Test the standalone panel for a toolbar button.
-    let browser = await openPanel(extension, browserWin, true);
+    let browser = await openBrowserActionPanel(extension, browserWin, true);
 
     let dims = await promiseContentDimensions(browser);
 
     is(dims.isStandards, standardsMode, "Document has the expected compat mode");
 
     let {innerWidth, innerHeight} = dims.window;
 
     dims = await alterContent(browser, () => {
@@ -156,17 +120,30 @@ async function testPopupSize(standardsMo
   panel.setAttribute("animate", "false");
 
   let panelMultiView = panel.firstElementChild;
   let widgetId = makeWidgetId(extension.id);
   // The 'ViewShown' event is the only way to correctly determine when the extensions'
   // panelview has finished transitioning and is fully in view.
   let shownPromise = BrowserTestUtils.waitForEvent(panelMultiView, "ViewShown",
                                                    e => (e.originalTarget.id || "").includes(widgetId));
-  let browser = await openPanel(extension, browserWin);
+  let browser = await openBrowserActionPanel(extension, browserWin);
+
+  // Wait long enough to make sure the initial popup positioning has been completed (
+  // by waiting until the value stays the same for 20 times in a row).
+  await waitUntilValue({
+    getValue: () => panel.getBoundingClientRect().top,
+    isCompleted: (oldVal, newVal) => {
+      return oldVal === newVal;
+    },
+    times: 20,
+    message: "Wait the popup opening to be completed",
+    delay: 500,
+  });
+
   let origPanelRect = panel.getBoundingClientRect();
 
   // Check that the panel is still positioned as expected.
   let checkPanelPosition = () => {
     is(panel.getAttribute("side"), arrowSide, "Panel arrow is positioned as expected");
 
     let panelRect = panel.getBoundingClientRect();
     if (arrowSide == "top") {
@@ -185,32 +162,39 @@ async function testPopupSize(standardsMo
     }
   };
 
   await awaitBrowserLoaded(browser);
   await shownPromise;
 
   // Wait long enough to make sure the initial resize debouncing timer has
   // expired.
-  await delay(500);
+  await waitUntilValue({
+    getValue: () => promiseContentDimensions(browser),
+    isCompleted: (oldDims, newDims) => {
+      return oldDims.window.innerWidth === newDims.window.innerWidth &&
+        oldDims.window.innerHeight === newDims.window.innerHeight;
+    },
+    message: "Wait the popup resize to be completed",
+    delay: 500,
+  });
 
   let dims = await promiseContentDimensions(browser);
 
   is(dims.isStandards, standardsMode, "Document has the expected compat mode");
 
   // If the browser's preferred height is smaller than the initial height of the
   // panel, then it will still take up the full available vertical space. Even
   // so, we need to check that we've gotten the preferred height calculation
   // correct, so check that explicitly.
   let getHeight = () => parseFloat(browser.style.height);
 
   let {innerWidth, innerHeight} = dims.window;
   let height = getHeight();
 
-
   let setClass = className => {
     content.document.body.className = className;
   };
 
   info("Increase body children's width. " +
        "Expect them to wrap, and the frame to grow vertically rather than widen.");
 
   dims = await alterContent(browser, setClass, "big");
@@ -269,54 +253,8 @@ async function testPopupSize(standardsMo
   Assert.lessOrEqual(win.scrollMaxY, 1, "Document should not be vertically scrollable");
 
   checkPanelPosition();
 
   await closeBrowserAction(extension, browserWin);
 
   await extension.unload();
 }
-
-add_task(async function testBrowserActionMenuResizeStandards() {
-  await testPopupSize(true);
-});
-
-add_task(async function testBrowserActionMenuResizeQuirks() {
-  await testPopupSize(false);
-});
-
-// Test that we still make reasonable maximum size calculations when the window
-// is close enough to the bottom of the screen that the menu panel opens above,
-// rather than below, its button.
-add_task(async function testBrowserActionMenuResizeBottomArrow() {
-  const WIDTH = 800;
-  const HEIGHT = 80;
-
-  let left = screen.availLeft + screen.availWidth - WIDTH;
-  let top = screen.availTop + screen.availHeight - HEIGHT;
-
-  let win = await BrowserTestUtils.openNewBrowserWindow();
-
-  win.resizeTo(WIDTH, HEIGHT);
-
-  // Sometimes we run into problems on Linux with resizing being asynchronous
-  // and window managers not allowing us to move the window so that any part of
-  // it is off-screen, so we need to try more than once.
-  for (let i = 0; i < 20; i++) {
-    win.moveTo(left, top);
-
-    if (win.screenX == left && win.screenY == top) {
-      break;
-    }
-
-    await delay(100);
-  }
-
-  await SimpleTest.promiseFocus(win);
-
-  await testPopupSize(true, win, "bottom");
-
-  await BrowserTestUtils.closeWindow(win);
-});
-
-add_task(async function testTeardown() {
-  Services.prefs.clearUserPref("toolkit.cosmeticAnimations.enabled");
-});
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_remember_folders.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_remember_folders.js
@@ -42,17 +42,17 @@ async function assertRecentFolders(expec
 
   Assert.deepEqual(diskGuids, expectedGuids, `Should match the disk GUIDS for ${msg}`);
 
   await clickBookmarkStar();
 
   let actualGuids = [];
   function getGuids() {
     actualGuids = [];
-    const folderMenuPopup = document.getElementById("editBMPanel_folderMenuList").children[0];
+    const folderMenuPopup = document.getElementById("editBMPanel_folderMenuList").menupopup;
 
     let separatorFound = false;
     // The list of folders goes from editBMPanel_foldersSeparator to the end.
     for (let child of folderMenuPopup.children) {
       if (separatorFound) {
         actualGuids.push(child.folderGuid);
       } else if (child.id == "editBMPanel_foldersSeparator") {
         separatorFound = true;
--- a/browser/components/preferences/browserLanguages.js
+++ b/browser/components/preferences/browserLanguages.js
@@ -176,17 +176,17 @@ class OrderedListBox {
 
     return listitem;
   }
 }
 
 class SortedItemSelectList {
   constructor({menulist, button, onSelect, onChange, compareFn}) {
     this.menulist = menulist;
-    this.popup = menulist.firstElementChild;
+    this.popup = menulist.menupopup;
     this.button = button;
     this.compareFn = compareFn;
     this.items = [];
 
     // This will register the "command" listener.
     new SelectionChangedMenulist(this.menulist, () => {
       button.disabled = !menulist.selectedItem;
       if (menulist.selectedItem) {
--- a/browser/components/preferences/in-content/home.xul
+++ b/browser/components/preferences/in-content/home.xul
@@ -1,17 +1,17 @@
 # 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/.
 
 <!-- Home panel -->
 
 <script type="application/javascript"
         src="chrome://browser/content/preferences/in-content/home.js"/>
-
+<box id="template-paneHome" hidden="true"><![CDATA[
 <hbox id="firefoxHomeCategory"
       class="subcategory"
       hidden="true"
       data-category="paneHome">
   <html:h1 style="-moz-box-flex: 1;" data-l10n-id="pane-home-title"/>
   <button id="restoreDefaultHomePageBtn"
           class="homepage-button check-home-page-controlled"
           data-preference-related="browser.startup.homepage"
@@ -93,8 +93,9 @@
   <hbox id="browserNewTabExtensionContent"
         align="center" hidden="true" class="extension-controlled">
     <description control="disableNewTabExtension" flex="1" />
     <button id="disableNewTabExtension"
             class="extension-controlled-button accessory-button"
             data-l10n-id="disable-extension" />
   </hbox>
 </groupbox>
+]]></box>
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -392,16 +392,30 @@ var gMainPane = {
       row.removeAttribute("hidden");
       // Showing attribution only for Bing Translator.
       var {Translation} = ChromeUtils.import("resource:///modules/translation/Translation.jsm");
       if (Translation.translationEngine == "Bing") {
         document.getElementById("bingAttribution").removeAttribute("hidden");
       }
     }
 
+    let drmInfoURL =
+      Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
+    document.getElementById("playDRMContentLink").setAttribute("href", drmInfoURL);
+    let emeUIEnabled = Services.prefs.getBoolPref("browser.eme.ui.enabled");
+    // Force-disable/hide on WinXP:
+    if (navigator.platform.toLowerCase().startsWith("win")) {
+      emeUIEnabled = emeUIEnabled && parseFloat(Services.sysinfo.get("version")) >= 6;
+    }
+    if (!emeUIEnabled) {
+      // Don't want to rely on .hidden for the toplevel groupbox because
+      // of the pane hiding/showing code potentially interfering:
+      document.getElementById("drmGroup").setAttribute("style", "display: none !important");
+    }
+
     if (AppConstants.MOZ_DEV_EDITION) {
       let uAppData = OS.Constants.Path.userApplicationDataDir;
       let ignoreSeparateProfile = OS.Path.join(uAppData, "ignore-dev-edition-profile");
 
       setEventListener("separateProfileMode", "command", gMainPane.separateProfileModeChange);
       let separateProfileModeCheckbox = document.getElementById("separateProfileMode");
       setEventListener("getStarted", "click", gMainPane.onGetStarted);
 
@@ -470,17 +484,23 @@ var gMainPane = {
       if (distroAbout) {
         let distroField = document.getElementById("distribution");
         distroField.value = distroAbout;
         distroField.hidden = false;
       }
     }
 
     if (AppConstants.MOZ_UPDATER) {
-      gAppUpdater = new appUpdater();
+      // XXX Workaround bug 1523453 -- changing selectIndex of a <deck> before
+      // frame construction could confuse nsDeckFrame::RemoveFrame().
+      window.requestAnimationFrame(() => {
+        window.requestAnimationFrame(() => {
+          gAppUpdater = new appUpdater();
+        });
+      });
       setEventListener("showUpdateHistory", "command",
         gMainPane.showUpdates);
 
       if (Services.policies && !Services.policies.isAllowed("appUpdate")) {
         document.getElementById("updateAllowDescription").hidden = true;
         document.getElementById("updateRadioGroup").hidden = true;
         if (AppConstants.MOZ_MAINTENANCE_SERVICE) {
           document.getElementById("useService").hidden = true;
@@ -565,24 +585,27 @@ var gMainPane = {
       browserBundle.getString("userContextPersonal.label"),
       browserBundle.getString("userContextWork.label"),
       browserBundle.getString("userContextBanking.label"),
       browserBundle.getString("userContextShopping.label"),
     ]);
 
     // Notify observers that the UI is now ready
     Services.obs.notifyObservers(window, "main-pane-loaded");
+
+    this.setInitialized();
   },
 
   preInit() {
     promiseLoadHandlersList = new Promise((resolve, reject) => {
       // Load the data and build the list of handlers for applications pane.
       // By doing this after pageshow, we ensure it doesn't delay painting
       // of the preferences page.
       window.addEventListener("pageshow", async () => {
+        await this.initialized;
         try {
           this._initListEventHandlers();
           this._loadData();
           await this._rebuildVisibleTypes();
           this._sortVisibleTypes();
           this._rebuildView();
           resolve();
         } catch (ex) {
@@ -2477,16 +2500,20 @@ var gMainPane = {
       case 1:
         return this._getDownloadsFolder("Downloads");
     }
     var currentDirPref = Preferences.get("browser.download.dir");
     return currentDirPref.value;
   },
 };
 
+gMainPane.initialized = new Promise(res => {
+  gMainPane.setInitialized = res;
+});
+
 // Utilities
 
 function getFileDisplayName(file) {
   if (AppConstants.platform == "win") {
     if (file instanceof Ci.nsILocalFileWin) {
       try {
         return file.getVersionInfoField("FileDescription");
       } catch (e) { }
--- a/browser/components/preferences/in-content/main.xul
+++ b/browser/components/preferences/in-content/main.xul
@@ -11,16 +11,17 @@
   <script type="application/javascript" src="chrome://browser/content/aboutDialog-appUpdater.js"/>
 #endif
 
 <script type="application/javascript"
         src="chrome://mozapps/content/preferences/fontbuilder.js"/>
 
 <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences.properties"/>
 
+<box id="template-paneGeneral" hidden="true"><![CDATA[
 <hbox id="generalCategory"
       class="subcategory"
       hidden="true"
       data-category="paneGeneral">
   <html:h1 data-l10n-id="pane-general-title"/>
 </hbox>
 
 <!-- Startup -->
@@ -707,8 +708,9 @@
                 connection-proxy-socks-remote-dns.label,
                 connection-dns-over-https,
                 connection-dns-over-https-url-custom,
                 connection-dns-over-https-url-default,
             " />
     </hbox>
   </hbox>
 </groupbox>
+]]></box>
--- a/browser/components/preferences/in-content/preferences.js
+++ b/browser/components/preferences/in-content/preferences.js
@@ -8,25 +8,27 @@
 /* import-globals-from home.js */
 /* import-globals-from search.js */
 /* import-globals-from containers.js */
 /* import-globals-from privacy.js */
 /* import-globals-from sync.js */
 /* import-globals-from findInPage.js */
 /* import-globals-from ../../../base/content/utilityOverlay.js */
 /* import-globals-from ../../../../toolkit/content/preferencesBindings.js */
+/* global MozXULElement */
 
 "use strict";
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 ChromeUtils.defineModuleGetter(this, "formAutofillParent",
                                "resource://formautofill/FormAutofillParent.jsm");
 
 var gLastHash = "";
+const gXULDOMParser = new DOMParser();
 
 var gCategoryInits = new Map();
 function init_category_if_required(category) {
   let categoryInfo = gCategoryInits.get(category);
   if (!categoryInfo) {
     throw "Unknown in-content prefs category! Can't init " + category;
   }
   if (categoryInfo.inited) {
@@ -34,16 +36,55 @@ function init_category_if_required(categ
   }
   categoryInfo.init();
 }
 
 function register_module(categoryName, categoryObject) {
   gCategoryInits.set(categoryName, {
     inited: false,
     init() {
+      let template = document.getElementById("template-" + categoryName);
+      if (template) {
+        // Replace the template element with the nodes from the parsed comment
+        // string.
+        let frag = MozXULElement.parseXULToFragment(template.firstChild.data);
+
+        // Gather the to-be-translated elements so that we could pass them to
+        // l10n.translateElements() and get a translated promise.
+        // Here we loop through the first level elements (<hbox>/<groupbox>/<deck>/etc)
+        // because we know that they are not implemented by XBL bindings,
+        // so it's ok to get a reference of them before inserting the node
+        // to the DOM.
+        //
+        // If we don't have to worry about XBL, this can simply be
+        // let l10nUpdatedElements = Array.from(frag.querySelectorAll("[data-l10n-id]"))
+        //
+        // If we can get a translated promise after insertion, this can all be
+        // removed (see bug 1520659.)
+        let firstLevelElements = Array.from(frag.children);
+
+        // Actually insert them into the DOM.
+        template.replaceWith(frag);
+
+        let l10nUpdatedElements = [];
+        // Collect the elements from the newly inserted first level elements.
+        for (let el of firstLevelElements) {
+          l10nUpdatedElements = l10nUpdatedElements.concat(
+            Array.from(el.querySelectorAll("[data-l10n-id]")));
+        }
+
+        // Set a promise on the categoryInfo object that the highlight code can await on.
+        this.translated = document.l10n.translateElements(l10nUpdatedElements)
+          .then(() => this.translated = undefined);
+
+        // Asks Preferences to update the attribute value of the entire
+        // document again (this can be simplified if we could seperate the
+        // preferences of each pane.)
+        Preferences.updateAllElements();
+      }
       categoryObject.init();
       this.inited = true;
     },
   });
 }
 
 document.addEventListener("DOMContentLoaded", init_all, {once: true});
 
@@ -53,17 +94,16 @@ function init_all() {
   gSubDialog.init();
   register_module("paneGeneral", gMainPane);
   register_module("paneHome", gHomePane);
   register_module("paneSearch", gSearchPane);
   register_module("panePrivacy", gPrivacyPane);
   register_module("paneContainers", gContainersPane);
   if (Services.prefs.getBoolPref("identity.fxaccounts.enabled")) {
     document.getElementById("category-sync").hidden = false;
-    document.getElementById("weavePrefsDeck").removeAttribute("data-hidden-from-search");
     register_module("paneSync", gSyncPane);
   }
   register_module("paneSearchResults", gSearchResultsPane);
   gSearchResultsPane.init();
   gMainPane.preInit();
 
   let categories = document.getElementById("categories");
   categories.addEventListener("select", event => gotoPref(event.target.value));
@@ -181,17 +221,17 @@ function gotoPref(aCategory) {
     categories.clearSelection();
   }
   window.history.replaceState(category, document.title);
   search(category, "data-category");
 
   let mainContent = document.querySelector(".main-content");
   mainContent.scrollTop = 0;
 
-  spotlight(subcategory);
+  spotlight(subcategory, category);
 }
 
 function search(aQuery, aAttribute) {
   let mainPrefPane = document.getElementById("mainPrefPane");
   let elements = mainPrefPane.children;
   for (let element of elements) {
     // If the "data-hidden-from-search" is "true", the
     // element will not get considered during search.
@@ -215,102 +255,51 @@ function search(aQuery, aAttribute) {
     let attributeValue = element.getAttribute(aAttribute);
     if (attributeValue == aQuery)
       element.removeAttribute("disabled");
     else
       element.setAttribute("disabled", true);
   }
 }
 
-async function spotlight(subcategory) {
+async function spotlight(subcategory, category) {
   let highlightedElements = document.querySelectorAll(".spotlight");
   if (highlightedElements.length) {
     for (let element of highlightedElements) {
       element.classList.remove("spotlight");
     }
   }
   if (subcategory) {
-    if (!gSearchResultsPane.categoriesInitialized) {
-      await waitForSystemAddonInjectionsFinished([{
-        isGoingToInject: formAutofillParent.initialized,
-        elementId: "formAutofillGroup",
-      }]);
-    }
-    scrollAndHighlight(subcategory);
-  }
-
-  /**
-   * Wait for system addons finished their dom injections.
-   * @param {Array} addons - The system addon information array.
-   * For example, the element is looked like
-   * { isGoingToInject: true, elementId: "formAutofillGroup" }.
-   * The `isGoingToInject` means the system addon will be visible or not,
-   * and the `elementId` means the id of the element will be injected into the dom
-   * if the `isGoingToInject` is true.
-   * @returns {Promise} Will resolve once all injections are finished.
-   */
-  function waitForSystemAddonInjectionsFinished(addons) {
-    return new Promise(resolve => {
-      let elementIdSet = new Set();
-      for (let addon of addons) {
-        if (addon.isGoingToInject) {
-          elementIdSet.add(addon.elementId);
-        }
-      }
-      if (elementIdSet.size) {
-        let observer = new MutationObserver(mutations => {
-          for (let mutation of mutations) {
-            for (let node of mutation.addedNodes) {
-              elementIdSet.delete(node.id);
-              if (elementIdSet.size === 0) {
-                observer.disconnect();
-                resolve();
-              }
-            }
-          }
-        });
-        let mainContent = document.querySelector(".main-content");
-        observer.observe(mainContent, {childList: true, subtree: true});
-        // Disconnect the mutation observer once there is any user input.
-        mainContent.addEventListener("scroll", disconnectMutationObserver);
-        window.addEventListener("mousedown", disconnectMutationObserver);
-        window.addEventListener("keydown", disconnectMutationObserver);
-        function disconnectMutationObserver() {
-          mainContent.removeEventListener("scroll", disconnectMutationObserver);
-          window.removeEventListener("mousedown", disconnectMutationObserver);
-          window.removeEventListener("keydown", disconnectMutationObserver);
-          observer.disconnect();
-        }
-      } else {
-        resolve();
-      }
-    });
+    scrollAndHighlight(subcategory, category);
   }
 }
 
-function scrollAndHighlight(subcategory) {
+async function scrollAndHighlight(subcategory, category) {
   let element = document.querySelector(`[data-subcategory="${subcategory}"]`);
-  if (element) {
-    let header = getClosestDisplayedHeader(element);
-    scrollContentTo(header);
-    element.classList.add("spotlight");
+  if (!element) {
+    return;
   }
+  let header = getClosestDisplayedHeader(element);
+  await gCategoryInits.get(category).translated;
+
+  scrollContentTo(header);
+  element.classList.add("spotlight");
 }
 
 /**
  * If there is no visible second level header it will return first level header,
  * otherwise return second level header.
  * @returns {Element} - The closest displayed header.
  */
 function getClosestDisplayedHeader(element) {
   let header = element.closest("groupbox");
   let searchHeader = header.querySelector(".search-header");
   if (searchHeader && searchHeader.hidden &&
-      header.previousSibling.classList.contains("subcategory")) {
-    header = header.previousSibling;
+      header.previousElementSibling.classList.contains("subcategory")) {
+    header = header.previousElementSibling;
   }
   return header;
 }
 
 function scrollContentTo(element) {
   const STICKY_CONTAINER_HEIGHT = document.querySelector(".sticky-container").clientHeight;
   let mainContent = document.querySelector(".main-content");
   let top = element.getBoundingClientRect().top - STICKY_CONTAINER_HEIGHT;
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -378,29 +378,16 @@ var gPrivacyPane = {
       gPrivacyPane.showSiteDataSettings);
     let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "storage-permissions";
     document.getElementById("siteDataLearnMoreLink").setAttribute("href", url);
 
     let notificationInfoURL =
       Services.urlFormatter.formatURLPref("app.support.baseURL") + "push";
     document.getElementById("notificationPermissionsLearnMore").setAttribute("href",
       notificationInfoURL);
-    let drmInfoURL =
-      Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
-    document.getElementById("playDRMContentLink").setAttribute("href", drmInfoURL);
-    let emeUIEnabled = Services.prefs.getBoolPref("browser.eme.ui.enabled");
-    // Force-disable/hide on WinXP:
-    if (navigator.platform.toLowerCase().startsWith("win")) {
-      emeUIEnabled = emeUIEnabled && parseFloat(Services.sysinfo.get("version")) >= 6;
-    }
-    if (!emeUIEnabled) {
-      // Don't want to rely on .hidden for the toplevel groupbox because
-      // of the pane hiding/showing code potentially interfering:
-      document.getElementById("drmGroup").setAttribute("style", "display: none !important");
-    }
 
     if (AppConstants.MOZ_DATA_REPORTING) {
       this.initDataCollection();
       if (AppConstants.MOZ_CRASHREPORTER) {
         this.initSubmitCrashes();
       }
       this.initSubmitHealthReport();
       setEventListener("submitHealthReportBox", "command",
--- a/browser/components/preferences/in-content/privacy.xul
+++ b/browser/components/preferences/in-content/privacy.xul
@@ -3,17 +3,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 <!-- Privacy panel -->
 
 <script type="application/javascript"
         src="chrome://browser/content/preferences/in-content/privacy.js"/>
 <stringbundle id="bundlePreferences" src="chrome://browser/locale/preferences/preferences.properties"/>
 <stringbundle id="signonBundle" src="chrome://passwordmgr/locale/passwordmgr.properties"/>
-
+<box id="template-panePrivacy" hidden="true"><![CDATA[
 <hbox id="browserPrivacyCategory"
       class="subcategory"
       hidden="true"
       data-category="panePrivacy">
   <html:h1 data-l10n-id="privacy-header"/>
 </hbox>
 
 <!-- Tracking / Content Blocking -->
@@ -317,17 +317,17 @@
     </hbox>
   </hbox>
 </groupbox>
 
 <!-- The form autofill section is inserted in to this box
      after the form autofill extension has initialized. -->
 <groupbox id="formAutofillGroupBox"
           data-category="panePrivacy"
-          data-subcategory="form-autofill"></groupbox>
+          data-subcategory="form-autofill" hidden="true"></groupbox>
 
 <!-- History -->
 <groupbox id="historyGroup" data-category="panePrivacy" hidden="true">
   <label><html:h2 data-l10n-id="history-header"/></label>
   <hbox align="center">
     <label id="historyModeLabel"
            control="historyMode"
            data-l10n-id="history-remember-label"/>
@@ -790,8 +790,9 @@
                   devmgr-button-changepw.label,
                   devmgr-button-load.label,
                   devmgr-button-unload.label
                 "/>
       </hbox>
     </vbox>
   </hbox>
 </groupbox>
+]]></box>
--- a/browser/components/preferences/in-content/search.xul
+++ b/browser/components/preferences/in-content/search.xul
@@ -1,30 +1,30 @@
     <script type="application/javascript"
             src="chrome://browser/content/preferences/in-content/search.js"/>
-
+    <box id="template-paneSearch" hidden="true"><![CDATA[
     <hbox id="searchCategory"
           class="subcategory"
           hidden="true"
           data-category="paneSearch">
       <html:h1 data-l10n-id="pane-search-title"/>
     </hbox>
 
-    <groupbox id="searchbarGroup" data-category="paneSearch">
+    <groupbox id="searchbarGroup" data-category="paneSearch" hidden="true">
       <label control="searchBarVisibleGroup"><html:h2 data-l10n-id="search-bar-header"/></label>
       <radiogroup id="searchBarVisibleGroup" preference="browser.search.widget.inNavBar">
         <radio id="searchBarHiddenRadio" value="false" data-l10n-id="search-bar-hidden"/>
         <image class="searchBarImage searchBarHiddenImage" role="presentation"/>
         <radio id="searchBarShownRadio" value="true" data-l10n-id="search-bar-shown"/>
         <image class="searchBarImage searchBarShownImage" role="presentation"/>
       </radiogroup>
     </groupbox>
 
     <!-- Default Search Engine -->
-    <groupbox id="defaultEngineGroup" data-category="paneSearch">
+    <groupbox id="defaultEngineGroup" data-category="paneSearch" hidden="true">
       <label><html:h2 data-l10n-id="search-engine-default-header" /></label>
       <description data-l10n-id="search-engine-default-desc" />
 
       <hbox id="browserDefaultSearchExtensionContent"
             align="center" hidden="true" class="extension-controlled">
         <description control="disableDefaultSearchExtension" flex="1"/>
       </hbox>
 
@@ -46,17 +46,17 @@
                   data-l10n-id="search-show-suggestions-above-history-option"/>
         <hbox id="urlBarSuggestionPermanentPBLabel"
               align="center" class="indent">
           <label flex="1" data-l10n-id="search-suggestions-cant-show" />
         </hbox>
       </vbox>
     </groupbox>
 
-    <groupbox id="oneClickSearchProvidersGroup" data-category="paneSearch">
+    <groupbox id="oneClickSearchProvidersGroup" data-category="paneSearch" hidden="true">
       <label><html:h2 data-l10n-id="search-one-click-header" /></label>
       <description data-l10n-id="search-one-click-desc" />
 
       <tree id="engineList" flex="1" rows="8" hidecolumnpicker="true" editable="true"
             seltype="single" allowunderflowscroll="true">
         <treechildren id="engineChildren" flex="1"/>
         <treecols>
           <treecol id="engineShown" type="checkbox" editable="true" sortable="false"/>
@@ -76,8 +76,9 @@
                 data-l10n-id="search-remove-engine"
                 disabled="true"
                 />
       </hbox>
       <hbox id="addEnginesBox" pack="start">
         <label id="addEngines" class="text-link" data-l10n-id="search-find-more-link"></label>
       </hbox>
     </groupbox>
+    ]]></box>
--- a/browser/components/preferences/in-content/sync.js
+++ b/browser/components/preferences/in-content/sync.js
@@ -47,16 +47,18 @@ var gSyncPane = {
   set page(val) {
     document.getElementById("weavePrefsDeck").selectedIndex = val;
   },
 
   init() {
     this._setupEventListeners();
     this._adjustForPrefs();
 
+    document.getElementById("weavePrefsDeck").removeAttribute("data-hidden-from-search");
+
     // If the Service hasn't finished initializing, wait for it.
     let xps = Cc["@mozilla.org/weave/service;1"]
       .getService(Ci.nsISupports)
       .wrappedJSObject;
 
     if (xps.ready) {
       this._init();
       return;
--- a/browser/components/preferences/in-content/sync.xul
+++ b/browser/components/preferences/in-content/sync.xul
@@ -1,17 +1,17 @@
 # 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/.
 
 <!-- Sync panel -->
 
 <script type="application/javascript"
         src="chrome://browser/content/preferences/in-content/sync.js"/>
-
+<box id="template-paneSync" hidden="true"><![CDATA[
 <hbox id="firefoxAccountCategory"
       class="subcategory"
       hidden="true"
       data-category="paneSync">
   <html:h1 data-l10n-id="pane-sync-title"/>
 </hbox>
 
 <deck id="weavePrefsDeck" data-category="paneSync" hidden="true"
@@ -191,8 +191,9 @@
              class="text-link fxaMobilePromo" data-l10n-id="sync-mobilepromo-multi"/>
     </vbox>
     <vbox id="tosPP-small" align="start">
       <label id="tosPP-small-ToS" class="text-link" data-l10n-id="sync-tos-link"/>
       <label id="tosPP-small-PP" class="text-link" data-l10n-id="sync-fxa-privacy-notice"/>
     </vbox>
   </vbox>
 </deck>
+]]></box>
--- a/browser/components/preferences/in-content/tests/browser_browser_languages_subdialog.js
+++ b/browser/components/preferences/in-content/tests/browser_browser_languages_subdialog.js
@@ -136,17 +136,17 @@ async function createDictionaryBrowseRes
 function assertLocaleOrder(list, locales) {
   is(list.itemCount, locales.split(",").length,
      "The right number of locales are selected");
   is(Array.from(list.children).map(child => child.value).join(","),
      locales, "The selected locales are in order");
 }
 
 function assertAvailableLocales(list, locales) {
-  let items = Array.from(list.firstElementChild.children);
+  let items = Array.from(list.menupopup.children);
   let listLocales = items
     .filter(item => item.value && item.value != "search");
   is(listLocales.length, locales.length, "The right number of locales are available");
   is(listLocales.map(item => item.value).sort(),
      locales.sort().join(","), "The available locales match");
   is(items[0].getAttribute("class"), "label-item", "The first row is a label");
 }
 
@@ -166,27 +166,27 @@ function assertTelemetryRecorded(events)
     .filter(([timestamp, category]) => category == TELEMETRY_CATEGORY)
     .map(relatedEvent => relatedEvent.slice(2, 6));
 
   // Events are now an array of: method, object[, value[, extra]] as expected.
   Assert.deepEqual(relatedEvents, events, "The events are recorded correctly");
 }
 
 function selectLocale(localeCode, available, dialogDoc) {
-  let [locale] = Array.from(available.firstElementChild.children)
+  let [locale] = Array.from(available.menupopup.children)
     .filter(item => item.value == localeCode);
   available.selectedItem = locale;
   dialogDoc.getElementById("add").doCommand();
 }
 
 async function openDialog(doc, search = false) {
   let dialogLoaded = promiseLoadSubDialog(BROWSER_LANGUAGES_URL);
   if (search) {
     doc.getElementById("defaultBrowserLanguageSearch").doCommand();
-    doc.getElementById("defaultBrowserLanguage").firstElementChild.hidePopup();
+    doc.getElementById("defaultBrowserLanguage").menupopup.hidePopup();
   } else {
     doc.getElementById("manageBrowserLanguagesButton").doCommand();
   }
   let dialogWin = await dialogLoaded;
   let dialogDoc = dialogWin.document;
   return {
     dialog: dialogDoc.getElementById("BrowserLanguagesDialog"),
     dialogDoc,
@@ -237,23 +237,23 @@ add_task(async function testDisabledBrow
   is(pl.userDisabled, true, "pl is disabled");
   is(pl.version, "1.0", "pl is the old 1.0 version");
   assertLocaleOrder(selected, "en-US,he");
 
   // Only fr is enabled and not selected, so it's the only locale available.
   assertAvailableLocales(available, ["fr"]);
 
   // Search for more languages.
-  available.firstElementChild.lastElementChild.doCommand();
-  available.firstElementChild.hidePopup();
+  available.menupopup.lastElementChild.doCommand();
+  available.menupopup.hidePopup();
   await waitForMutation(
-    available.firstElementChild,
+    available.menupopup,
     {childList: true},
     target =>
-      Array.from(available.firstElementChild.children)
+      Array.from(available.menupopup.children)
         .some(locale => locale.value == "pl"));
 
   // pl is now available since it is available remotely.
   assertAvailableLocales(available, ["fr", "pl"]);
 
   // Add pl.
   selectLocale("pl", available, dialogDoc);
 
@@ -481,17 +481,17 @@ add_task(async function testInstallFromA
   let {dialog, dialogDoc, available, selected} = await openDialog(doc, true);
   let firstDialogId = getDialogId(dialogDoc);
 
   // Make sure the message bar is still hidden.
   is(messageBar.hidden, true, "The message bar is still hidden after searching");
 
   if (available.itemCount == 1) {
     await waitForMutation(
-      available.firstElementChild,
+      available.menupopup,
       {childList: true},
       target => available.itemCount > 1);
   }
 
   // The initial order is set by the pref.
   assertLocaleOrder(selected, "en-US");
   assertAvailableLocales(available, ["fr", "he", "pl"]);
   is(Services.locale.availableLocales.join(","),
@@ -549,17 +549,17 @@ add_task(async function testInstallFromA
   await langpack.disable();
 
   ({dialogDoc, available, selected} = await openDialog(doc, true));
   let secondDialogId = getDialogId(dialogDoc);
 
   // Wait for the available langpacks to load.
   if (available.itemCount == 1) {
     await waitForMutation(
-      available.firstElementChild,
+      available.menupopup,
       {childList: true},
       target => available.itemCount > 1);
   }
   assertLocaleOrder(selected, "en-US");
   assertAvailableLocales(available, ["fr", "he", "pl"]);
 
   // Uninstall the langpack and dictionary.
   let installs = await AddonManager.getAddonsByTypes(["locale", "dictionary"]);
@@ -594,20 +594,20 @@ add_task(async function testDownloadEnab
       ["intl.multilingual.downloadEnabled", true],
     ],
   });
 
   await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
   let doc = gBrowser.contentDocument;
 
   let defaultMenulist = doc.getElementById("defaultBrowserLanguage");
-  ok(hasSearchOption(defaultMenulist.firstChild), "There's a search option in the General pane");
+  ok(hasSearchOption(defaultMenulist.menupopup), "There's a search option in the General pane");
 
   let { available } = await openDialog(doc, false);
-  ok(hasSearchOption(available.firstChild), "There's a search option in the dialog");
+  ok(hasSearchOption(available.menupopup), "There's a search option in the dialog");
 
   BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
 
 
 add_task(async function testDownloadDisabled() {
   await SpecialPowers.pushPrefEnv({
     set: [
@@ -615,20 +615,20 @@ add_task(async function testDownloadDisa
       ["intl.multilingual.downloadEnabled", false],
     ],
   });
 
   await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
   let doc = gBrowser.contentDocument;
 
   let defaultMenulist = doc.getElementById("defaultBrowserLanguage");
-  ok(!hasSearchOption(defaultMenulist.firstChild), "There's no search option in the General pane");
+  ok(!hasSearchOption(defaultMenulist.menupopup), "There's no search option in the General pane");
 
   let { available } = await openDialog(doc, false);
-  ok(!hasSearchOption(available.firstChild), "There's no search option in the dialog");
+  ok(!hasSearchOption(available.menupopup), "There's no search option in the dialog");
 
   BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
 
 add_task(async function testReorderMainPane() {
   await SpecialPowers.pushPrefEnv({
     set: [
       ["intl.multilingual.enabled", true],
@@ -649,26 +649,26 @@ add_task(async function testReorderMainP
 
   await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
   let doc = gBrowser.contentDocument;
 
   let messageBar = doc.getElementById("confirmBrowserLanguage");
   is(messageBar.hidden, true, "The message bar is hidden at first");
 
   let available = doc.getElementById("defaultBrowserLanguage");
-  let availableLocales = Array.from(available.firstElementChild.children);
+  let availableLocales = Array.from(available.menupopup.children);
   let availableCodes = availableLocales.map(item => item.value).sort().join(",");
   is(availableCodes, "en-US,fr,he,pl",
      "All of the available locales are listed");
 
   is(available.selectedItem.value, "en-US", "English is selected");
 
   let hebrew = availableLocales[availableLocales.findIndex(item => item.value == "he")];
   hebrew.click();
-  available.firstElementChild.hidePopup();
+  available.menupopup.hidePopup();
 
   await BrowserTestUtils.waitForCondition(
     () => !messageBar.hidden, "Wait for message bar to show");
 
   is(messageBar.hidden, false, "The message bar is now shown");
   is(messageBar.querySelector("button").getAttribute("locales"), "he,en-US",
      "The locales are set on the message bar button");
 
--- a/browser/components/preferences/in-content/tests/browser_change_app_handler.js
+++ b/browser/components/preferences/in-content/tests/browser_change_app_handler.js
@@ -25,17 +25,17 @@ add_task(async function() {
   let ourItem = container.querySelector("richlistitem[type='text/x-test-handler']");
   ok(ourItem, "handlersView is present");
   ourItem.scrollIntoView();
   container.selectItem(ourItem);
   ok(ourItem.selected, "Should be able to select our item.");
 
   let list = ourItem.querySelector(".actionsMenu");
 
-  let chooseItem = list.firstElementChild.querySelector(".choose-app-item");