Bug 1088710 - part 2: make it work on e10s, r?mconley
MozReview-Commit-ID: FhlfqJ1gmjR
--- a/browser/components/customizableui/test/browser.ini
+++ b/browser/components/customizableui/test/browser.ini
@@ -94,17 +94,16 @@ skip-if = os == "linux" # Intermittent f
[browser_947987_removable_default.js]
[browser_948985_non_removable_defaultArea.js]
[browser_952963_areaType_getter_no_area.js]
[browser_956602_remove_special_widget.js]
[browser_962069_drag_to_overflow_chevron.js]
[browser_962884_opt_in_disable_hyphens.js]
[browser_963639_customizing_attribute_non_customizable_toolbar.js]
[browser_967000_button_charEncoding.js]
-skip-if = e10s # Bug 1088710
[browser_967000_button_feeds.js]
[browser_967000_button_sync.js]
[browser_968447_bookmarks_toolbar_items_in_panel.js]
skip-if = os == "linux" # Intemittent failures - bug 979207
[browser_968565_insert_before_hidden_items.js]
[browser_969427_recreate_destroyed_widget_after_reset.js]
[browser_969661_character_encoding_navbar_disabled.js]
[browser_970511_undo_restore_default.js]
@@ -122,17 +121,16 @@ skip-if = os == "linux"
[browser_984455_bookmarks_items_reparenting.js]
skip-if = os == "linux"
[browser_985815_propagate_setToolbarVisibility.js]
[browser_987177_destroyWidget_xul.js]
[browser_987177_xul_wrapper_updating.js]
[browser_987185_syncButton.js]
[browser_987492_window_api.js]
[browser_987640_charEncoding.js]
-skip-if = e10s # Bug 1088710
[browser_988072_sidebar_events.js]
[browser_989338_saved_placements_not_resaved.js]
[browser_989751_subviewbutton_class.js]
[browser_992747_toggle_noncustomizable_toolbar.js]
[browser_993322_widget_notoolbar.js]
[browser_995164_registerArea_during_customize_mode.js]
[browser_996364_registerArea_different_properties.js]
[browser_996635_remove_non_widgets.js]
--- a/browser/components/customizableui/test/browser_967000_button_charEncoding.js
+++ b/browser/components/customizableui/test/browser_967000_button_charEncoding.js
@@ -1,19 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const TEST_PAGE = "http://mochi.test:8888/browser/browser/components/customizableui/test/support/test_967000_charEncoding_page.html";
-var newTab;
-var initialLocation = gBrowser.currentURI.spec;
-
add_task(function*() {
info("Check Character Encoding button functionality");
// add the Character Encoding button to the panel
CustomizableUI.addWidgetToArea("characterencoding-button",
CustomizableUI.AREA_PANEL);
// check the button's functionality
@@ -23,24 +20,25 @@ add_task(function*() {
ok(charEncodingButton, "The Character Encoding button was added to the Panel Menu");
is(charEncodingButton.getAttribute("disabled"), "true",
"The Character encoding button is initially disabled");
let panelHidePromise = promisePanelHidden(window);
PanelUI.hide();
yield panelHidePromise;
- newTab = gBrowser.selectedTab;
- yield promiseTabLoadEvent(newTab, TEST_PAGE)
+ let newTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE, true);
yield PanelUI.show();
ok(!charEncodingButton.hasAttribute("disabled"), "The Character encoding button gets enabled");
+ let characterEncodingView = document.getElementById("PanelUI-characterEncodingView");
+ let subviewShownPromise = subviewShown(characterEncodingView);
charEncodingButton.click();
+ yield subviewShownPromise;
- let characterEncodingView = document.getElementById("PanelUI-characterEncodingView");
ok(characterEncodingView.hasAttribute("current"), "The Character encoding panel is displayed");
let pinnedEncodings = document.getElementById("PanelUI-characterEncodingView-pinned");
let charsetsList = document.getElementById("PanelUI-characterEncodingView-charsets");
ok(pinnedEncodings, "Pinned charsets are available");
ok(charsetsList, "Charsets list is available");
let checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
@@ -48,19 +46,17 @@ add_task(function*() {
is(checkedButtons[0].getAttribute("label"), "Unicode", "The unicode encoding is correctly selected");
is(characterEncodingView.querySelectorAll("#PanelUI-characterEncodingView-autodetect toolbarbutton[checked='true']").length,
1,
"There should be 1 checked detector.");
panelHidePromise = promisePanelHidden(window);
PanelUI.hide();
yield panelHidePromise;
+
+ yield BrowserTestUtils.removeTab(newTab);
});
add_task(function* asyncCleanup() {
// reset the panel to the default state
yield resetCustomization();
ok(CustomizableUI.inDefaultState, "The UI is in default state again.");
-
- // restore the initial location
- gBrowser.addTab(initialLocation);
- gBrowser.removeTab(newTab);
});
--- a/browser/components/customizableui/test/browser_987640_charEncoding.js
+++ b/browser/components/customizableui/test/browser_987640_charEncoding.js
@@ -1,32 +1,32 @@
/* 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 TEST_PAGE = "http://mochi.test:8888/browser/browser/components/customizableui/test/support/test_967000_charEncoding_page.html";
-var newTab = null;
add_task(function*() {
info("Check Character Encoding panel functionality");
// add the Character Encoding button to the panel
CustomizableUI.addWidgetToArea("characterencoding-button",
CustomizableUI.AREA_PANEL);
- newTab = gBrowser.addTab(TEST_PAGE);
- yield promiseTabLoadEvent(gBrowser.selectedTab, TEST_PAGE);
+ let newTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PAGE, true);
yield PanelUI.show();
let charEncodingButton = document.getElementById("characterencoding-button");
+ let characterEncodingView = document.getElementById("PanelUI-characterEncodingView");
+ let subviewShownPromise = subviewShown(characterEncodingView);
charEncodingButton.click();
+ yield subviewShownPromise;
- let characterEncodingView = document.getElementById("PanelUI-characterEncodingView");
let checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
let initialEncoding = checkedButtons[0];
is(initialEncoding.getAttribute("label"), "Unicode", "The unicode encoding is initially selected");
// change the encoding
let encodings = characterEncodingView.querySelectorAll("toolbarbutton");
let newEncoding = encodings[0].hasAttribute("checked") ? encodings[1] : encodings[0];
let tabLoadPromise = promiseTabLoadEvent(gBrowser.selectedTab, TEST_PAGE);
@@ -45,18 +45,16 @@ add_task(function*() {
charEncodingButton.click();
tabLoadPromise = promiseTabLoadEvent(gBrowser.selectedTab, TEST_PAGE);
initialEncoding.click();
yield tabLoadPromise;
yield PanelUI.show();
charEncodingButton.click();
checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
is(checkedButtons[0].getAttribute("label"), "Unicode", "The encoding was reset to Unicode");
+ yield BrowserTestUtils.removeTab(newTab);
});
add_task(function* asyncCleanup() {
// reset the panel to the default state
yield resetCustomization();
ok(CustomizableUI.inDefaultState, "The UI is in default state again.");
-
- // remove the added tab
- gBrowser.removeTab(newTab);
});
--- a/toolkit/content/browser-child.js
+++ b/toolkit/content/browser-child.js
@@ -123,16 +123,18 @@ var WebProgressListener = {
json.status = aStatus;
// It's possible that this state change was triggered by
// loading an internal error page, for which the parent
// will want to know some details, so we'll update it with
// the documentURI.
if (aWebProgress && aWebProgress.isTopLevel) {
json.documentURI = content.document.documentURIObject.spec;
+ json.charset = content.document.characterSet;
+ json.mayEnableCharacterEncodingMenu = docShell.mayEnableCharacterEncodingMenu;
}
this._send("Content:StateChange", json, objects);
},
onProgressChange: function onProgressChange(aWebProgress, aRequest, aCurSelf, aMaxSelf, aCurTotal, aMaxTotal) {
let json = this._setupJSON(aWebProgress, aRequest);
let objects = this._setupObjects(aWebProgress, aRequest);
--- a/toolkit/modules/RemoteWebProgress.jsm
+++ b/toolkit/modules/RemoteWebProgress.jsm
@@ -206,16 +206,20 @@ RemoteWebProgressManager.prototype = {
request = new RemoteWebProgressRequest(json.requestURI,
json.originalRequestURI,
objects.request);
}
if (isTopLevel) {
this._browser._contentWindow = objects.contentWindow;
this._browser._documentContentType = json.documentContentType;
+ if (json.charset) {
+ this._browser._characterSet = json.charset;
+ this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;
+ }
}
switch (aMessage.name) {
case "Content:StateChange":
if (isTopLevel) {
this._browser._documentURI = newURI(json.documentURI);
}
this._callProgressListeners("onStateChange", webProgress, request, json.stateFlags, json.status);
@@ -227,21 +231,19 @@ RemoteWebProgressManager.prototype = {
let remoteWebNav = this._browser._remoteWebNavigationImpl;
// These properties can change even for a sub-frame navigation.
remoteWebNav.canGoBack = json.canGoBack;
remoteWebNav.canGoForward = json.canGoForward;
if (isTopLevel) {
remoteWebNav._currentURI = location;
- this._browser._characterSet = json.charset;
this._browser._documentURI = newURI(json.documentURI);
this._browser._contentTitle = json.title;
this._browser._imageDocument = null;
- this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;
this._browser._contentPrincipal = json.principal;
this._browser._isSyntheticDocument = json.synthetic;
this._browser._innerWindowID = json.innerWindowID;
}
this._callProgressListeners("onLocationChange", webProgress, request, location, flags);
break;