Bug 1088710 - part 2: make it work on e10s, r=mconley

MozReview-Commit-ID: FhlfqJ1gmjR
This commit is contained in:
Gijs Kruitbosch 2016-02-24 15:24:20 +00:00
parent ee1c45fc1a
commit e57a059f77
5 changed files with 19 additions and 23 deletions

View File

@ -99,7 +99,6 @@ skip-if = os == "linux" # Intermittent failures
[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]
@ -127,7 +126,6 @@ skip-if = os == "linux"
[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]

View File

@ -6,9 +6,6 @@
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");
@ -28,14 +25,15 @@ add_task(function*() {
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");
charEncodingButton.click();
let characterEncodingView = document.getElementById("PanelUI-characterEncodingView");
let subviewShownPromise = subviewShown(characterEncodingView);
charEncodingButton.click();
yield subviewShownPromise;
ok(characterEncodingView.hasAttribute("current"), "The Character encoding panel is displayed");
let pinnedEncodings = document.getElementById("PanelUI-characterEncodingView-pinned");
@ -53,14 +51,12 @@ add_task(function*() {
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);
});

View File

@ -5,7 +5,6 @@
"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");
@ -14,14 +13,15 @@ add_task(function*() {
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");
charEncodingButton.click();
let characterEncodingView = document.getElementById("PanelUI-characterEncodingView");
let subviewShownPromise = subviewShown(characterEncodingView);
charEncodingButton.click();
yield subviewShownPromise;
let checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
let initialEncoding = checkedButtons[0];
is(initialEncoding.getAttribute("label"), "Unicode", "The unicode encoding is initially selected");
@ -50,13 +50,11 @@ add_task(function*() {
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);
});

View File

@ -128,6 +128,8 @@ var WebProgressListener = {
// 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);

View File

@ -211,6 +211,10 @@ RemoteWebProgressManager.prototype = {
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) {
@ -232,11 +236,9 @@ RemoteWebProgressManager.prototype = {
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;