mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 999293 - [e10s] Make charset menu work. r=adw
This commit is contained in:
parent
38421e75d7
commit
23d4ec028e
@ -30,7 +30,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "gDNSService",
|
||||
const nsIWebNavigation = Ci.nsIWebNavigation;
|
||||
|
||||
var gLastBrowserCharset = null;
|
||||
var gPrevCharset = null;
|
||||
var gProxyFavIcon = null;
|
||||
var gLastValidURLStr = "";
|
||||
var gInPrintPreviewMode = false;
|
||||
@ -242,7 +241,6 @@ XPCOMUtils.defineLazyGetter(this, "PageMenu", function() {
|
||||
* one listener that calls all real handlers.
|
||||
*/
|
||||
function pageShowEventHandlers(persisted) {
|
||||
charsetLoadListener();
|
||||
XULBrowserWindow.asyncUpdateUI();
|
||||
|
||||
// The PluginClickToPlay events are not fired when navigating using the
|
||||
@ -3511,9 +3509,7 @@ function updateCharacterEncodingMenuState()
|
||||
// gBrowser is null on Mac when the menubar shows in the context of
|
||||
// non-browser windows. The above elements may be null depending on
|
||||
// what parts of the menubar are present. E.g. no app menu on Mac.
|
||||
if (gBrowser &&
|
||||
gBrowser.docShell &&
|
||||
gBrowser.docShell.mayEnableCharacterEncodingMenu) {
|
||||
if (gBrowser && gBrowser.selectedBrowser.mayEnableCharacterEncodingMenu) {
|
||||
if (charsetMenu) {
|
||||
charsetMenu.removeAttribute("disabled");
|
||||
}
|
||||
@ -5358,8 +5354,7 @@ function handleDroppedLink(event, url, name)
|
||||
function BrowserSetForcedCharacterSet(aCharset)
|
||||
{
|
||||
if (aCharset) {
|
||||
gBrowser.docShell.gatherCharsetMenuTelemetry();
|
||||
gBrowser.docShell.charset = aCharset;
|
||||
gBrowser.selectedBrowser.characterSet = aCharset;
|
||||
// Save the forced character-set
|
||||
if (!PrivateBrowsingUtils.isWindowPrivate(window))
|
||||
PlacesUtils.setCharsetForURI(getWebNavigation().currentURI, aCharset);
|
||||
@ -5372,35 +5367,11 @@ function BrowserCharsetReload()
|
||||
BrowserReloadWithFlags(nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
|
||||
}
|
||||
|
||||
function charsetMenuGetElement(parent, charset) {
|
||||
return parent.getElementsByAttribute("charset", charset)[0];
|
||||
}
|
||||
|
||||
function UpdateCurrentCharset(target) {
|
||||
// extract the charset from DOM
|
||||
var wnd = document.commandDispatcher.focusedWindow;
|
||||
if ((window == wnd) || (wnd == null)) wnd = window.content;
|
||||
|
||||
// Uncheck previous item
|
||||
if (gPrevCharset) {
|
||||
var pref_item = charsetMenuGetElement(target, gPrevCharset);
|
||||
if (pref_item)
|
||||
pref_item.setAttribute('checked', 'false');
|
||||
}
|
||||
|
||||
var menuitem = charsetMenuGetElement(target, CharsetMenu.foldCharset(wnd.document.characterSet));
|
||||
if (menuitem) {
|
||||
menuitem.setAttribute('checked', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
function charsetLoadListener() {
|
||||
let currCharset = gBrowser.selectedBrowser.characterSet;
|
||||
let charset = CharsetMenu.foldCharset(currCharset);
|
||||
|
||||
if (charset.length > 0 && (charset != gLastBrowserCharset)) {
|
||||
gPrevCharset = gLastBrowserCharset;
|
||||
gLastBrowserCharset = charset;
|
||||
for (let menuItem of target.getElementsByTagName("menuitem")) {
|
||||
let isSelected = menuItem.getAttribute("charset") ===
|
||||
CharsetMenu.foldCharset(gBrowser.selectedBrowser.characterSet);
|
||||
menuItem.setAttribute("checked", isSelected);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,8 +735,7 @@ const CustomizableWidgets = [{
|
||||
maybeDisableMenu: function(aDocument) {
|
||||
let window = aDocument.defaultView;
|
||||
return !(window.gBrowser &&
|
||||
window.gBrowser.docShell &&
|
||||
window.gBrowser.docShell.mayEnableCharacterEncodingMenu);
|
||||
window.gBrowser.selectedBrowser.mayEnableCharacterEncodingMenu);
|
||||
},
|
||||
populateList: function(aDocument, aContainerId, aSection) {
|
||||
let containerElem = aDocument.getElementById(aContainerId);
|
||||
@ -756,8 +755,7 @@ const CustomizableWidgets = [{
|
||||
}
|
||||
},
|
||||
updateCurrentCharset: function(aDocument) {
|
||||
let content = aDocument.defaultView.content;
|
||||
let currentCharset = content && content.document && content.document.characterSet;
|
||||
let currentCharset = aDocument.defaultView.gBrowser.selectedBrowser.characterSet;
|
||||
currentCharset = CharsetMenu.foldCharset(currentCharset);
|
||||
|
||||
let pinnedContainer = aDocument.getElementById("PanelUI-characterEncodingView-pinned");
|
||||
|
@ -89,6 +89,7 @@ let WebProgressListener = {
|
||||
json.canGoForward = docShell.canGoForward;
|
||||
json.documentURI = content.document.documentURIObject.spec;
|
||||
json.charset = content.document.characterSet;
|
||||
json.mayEnableCharacterEncodingMenu = docShell.mayEnableCharacterEncodingMenu;
|
||||
}
|
||||
|
||||
sendAsyncMessage("Content:LocationChange", json, objects);
|
||||
@ -353,6 +354,11 @@ addEventListener("TextZoomChange", function (aEvent) {
|
||||
}
|
||||
}, false);
|
||||
|
||||
addMessageListener("UpdateCharacterSet", function (aMessage) {
|
||||
docShell.charset = aMessage.data.value;
|
||||
docShell.gatherCharsetMenuTelemetry();
|
||||
});
|
||||
|
||||
// The AddonsChild needs to be rooted so that it stays alive as long as
|
||||
// the tab.
|
||||
let AddonsChild;
|
||||
|
@ -427,7 +427,15 @@
|
||||
readonly="true"/>
|
||||
|
||||
<property name="characterSet"
|
||||
onget="return this.contentDocument.characterSet;"
|
||||
onget="return this.docShell.charset;">
|
||||
<setter><![CDATA[
|
||||
this.docShell.charset = val;
|
||||
this.docShell.gatherCharsetMenuTelemetry();
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="mayEnableCharacterEncodingMenu"
|
||||
onget="return this.docShell.mayEnableCharacterEncodingMenu;"
|
||||
readonly="true"/>
|
||||
|
||||
<property name="contentPrincipal"
|
||||
|
@ -108,7 +108,17 @@
|
||||
<field name="_characterSet">""</field>
|
||||
|
||||
<property name="characterSet"
|
||||
onget="return this._characterSet"
|
||||
onget="return this._characterSet">
|
||||
<setter><![CDATA[
|
||||
this.messageManager.sendAsyncMessage("UpdateCharacterSet", {value: val});
|
||||
this._characterSet = val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<field name="_mayEnableCharacterEncodingMenu">null</field>
|
||||
|
||||
<property name="mayEnableCharacterEncodingMenu"
|
||||
onget="return this._mayEnableCharacterEncodingMenu;"
|
||||
readonly="true"/>
|
||||
|
||||
<field name="_contentWindow">null</field>
|
||||
|
@ -173,6 +173,7 @@ RemoteWebProgressManager.prototype = {
|
||||
this._browser._characterSet = json.charset;
|
||||
this._browser._documentURI = newURI(json.documentURI);
|
||||
this._browser._imageDocument = null;
|
||||
this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;
|
||||
}
|
||||
|
||||
this._callProgressListeners("onLocationChange", webProgress, request, location, flags);
|
||||
|
Loading…
Reference in New Issue
Block a user