Bug 1327118 - Fix the charset encoding menu not being properly enabled when dragging tabs into a new window. r=mconley
authorBlake Kaplan <mrbkap@gmail.com>
Tue, 06 Jun 2017 17:04:54 -0700
changeset 413778 ae620d7e41e2d88e9145a3c744dda13eee92c26e
parent 413777 6c8c383edd02189f7a1e52d93e36b1be9d60197f
child 413779 f7450fa2d7aa1590ac6a4954dbfc4cd8a9557254
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1327118
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1327118 - Fix the charset encoding menu not being properly enabled when dragging tabs into a new window. r=mconley MozReview-Commit-ID: 15HVXsKHoYW
toolkit/content/tests/browser/browser.ini
toolkit/content/tests/browser/browser_charsetMenu_swapBrowsers.js
toolkit/content/widgets/browser.xml
--- a/toolkit/content/tests/browser/browser.ini
+++ b/toolkit/content/tests/browser/browser.ini
@@ -45,16 +45,17 @@ tags = audiochannel
 tags = audiochannel
 [browser_bug1170531.js]
 [browser_bug1198465.js]
 [browser_bug295977_autoscroll_overflow.js]
 [browser_bug451286.js]
 skip-if = !e10s
 [browser_bug594509.js]
 [browser_bug982298.js]
+[browser_charsetMenu_swapBrowsers.js]
 [browser_content_url_annotation.js]
 skip-if = !e10s || !crashreporter
 [browser_contentTitle.js]
 [browser_crash_previous_frameloader.js]
 run-if = e10s && crashreporter
 [browser_default_image_filename.js]
 [browser_f7_caret_browsing.js]
 [browser_findbar.js]
new file mode 100644
--- /dev/null
+++ b/toolkit/content/tests/browser/browser_charsetMenu_swapBrowsers.js
@@ -0,0 +1,28 @@
+/* Test that the charset menu is properly enabled when swapping browsers. */
+add_task(async function test() {
+  // NB: This test cheats and calls updateCharacterEncodingMenuState directly
+  // instead of opening the "View" menu.
+  function charsetMenuEnabled() {
+    updateCharacterEncodingMenuState();
+    return !document.getElementById("charsetMenu").hasAttribute("disabled");
+  }
+
+  const PAGE = "data:text/html;charset=utf-8,<!DOCTYPE html><body>hello";
+  let tab1 = await BrowserTestUtils.openNewForegroundTab({ gBrowser, url: PAGE });
+  ok(charsetMenuEnabled(), "should have a charset menu here");
+
+  let tab2 = await BrowserTestUtils.openNewForegroundTab({ gBrowser });
+  ok(!charsetMenuEnabled(), "about:blank shouldn't have a charset menu");
+
+  await BrowserTestUtils.switchTab(gBrowser, tab1);
+
+  let swapped = BrowserTestUtils.waitForEvent(tab2.linkedBrowser, "SwapDocShells");
+
+  // NB: Closes tab1.
+  gBrowser.swapBrowsersAndCloseOther(tab2, tab1);
+  await swapped;
+
+  ok(charsetMenuEnabled(), "should have a charset after the swap");
+
+  await BrowserTestUtils.removeTab(tab2);
+});
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -1367,16 +1367,17 @@
               "_remoteWebProgressManager",
               "_remoteWebProgress",
               "_remoteFinder",
               "_securityUI",
               "_documentURI",
               "_documentContentType",
               "_contentTitle",
               "_characterSet",
+              "_mayEnableCharacterEncodingMenu",
               "_contentPrincipal",
               "_imageDocument",
               "_fullZoom",
               "_textZoom",
               "_isSyntheticDocument",
               "_innerWindowID",
               "_manifestURI",
             ]);