Loading browser/base/content/browser.js +5 −1 Original line number Diff line number Diff line Loading @@ -6620,6 +6620,9 @@ function handleDroppedLink(event, urlOrLinks, nameOrTriggeringPrincipal, trigger function BrowserSetForcedCharacterSet(aCharset) { if (aCharset) { if (aCharset == "Japanese") { aCharset = "Shift_JIS"; } gBrowser.selectedBrowser.characterSet = aCharset; // Save the forced character-set PlacesUIUtils.setCharsetForPage(getWebNavigation().currentURI, Loading @@ -6634,7 +6637,8 @@ function BrowserCharsetReload() { } function UpdateCurrentCharset(target) { let selectedCharset = CharsetMenu.foldCharset(gBrowser.selectedBrowser.characterSet); let selectedCharset = CharsetMenu.foldCharset(gBrowser.selectedBrowser.characterSet, gBrowser.selectedBrowser.charsetAutodetected); for (let menuItem of target.getElementsByTagName("menuitem")) { let isSelected = menuItem.getAttribute("charset") === selectedCharset; menuItem.setAttribute("checked", isSelected); Loading browser/components/customizableui/CustomizableWidgets.jsm +2 −1 Original line number Diff line number Diff line Loading @@ -358,7 +358,8 @@ const CustomizableWidgets = [ }, updateCurrentCharset(aDocument) { let currentCharset = aDocument.defaultView.gBrowser.selectedBrowser.characterSet; currentCharset = CharsetMenu.foldCharset(currentCharset); let {charsetAutodetected} = aDocument.defaultView.gBrowser.selectedBrowser; currentCharset = CharsetMenu.foldCharset(currentCharset, charsetAutodetected); let pinnedContainer = aDocument.getElementById("PanelUI-characterEncodingView-pinned"); let charsetContainer = aDocument.getElementById("PanelUI-characterEncodingView-charsets"); Loading docshell/base/nsDocShell.cpp +27 −6 Original line number Diff line number Diff line Loading @@ -1275,7 +1275,6 @@ nsDocShell::GatherCharsetMenuTelemetry() { case kCharsetFromDocTypeDefault: case kCharsetFromCache: case kCharsetFromParentFrame: case kCharsetFromHintPrevDoc: // Changing charset on an unlabeled doc. if (isFileURL) { Telemetry::AccumulateCategorical( Loading Loading @@ -1891,6 +1890,26 @@ nsDocShell::GetMayEnableCharacterEncodingMenu( return NS_OK; } NS_IMETHODIMP nsDocShell::GetCharsetAutodetected(bool* aCharsetAutodetected) { *aCharsetAutodetected = false; if (!mContentViewer) { return NS_OK; } Document* doc = mContentViewer->GetDocument(); if (!doc) { return NS_OK; } int32_t source = doc->GetDocumentCharacterSetSource(); if (source == kCharsetFromAutoDetection || source == kCharsetFromUserForcedAutoDetection) { *aCharsetAutodetected = true; } return NS_OK; } NS_IMETHODIMP nsDocShell::GetDocShellEnumerator(int32_t aItemType, DocShellEnumeratorDirection aDirection, Loading Loading @@ -8365,11 +8384,11 @@ nsresult nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer) { const Encoding* forceCharset = nullptr; const Encoding* hintCharset = nullptr; int32_t hintCharsetSource; float textZoom; float pageZoom; float overrideDPPX; bool styleDisabled; int32_t hintCharsetSource = kCharsetUninitialized; float textZoom = 1.0; float pageZoom = 1.0; float overrideDPPX = 1.0; bool styleDisabled = false; // |newMUDV| also serves as a flag to set the data from the above vars nsCOMPtr<nsIContentViewer> newCv; Loading Loading @@ -10181,6 +10200,8 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState, MOZ_ASSERT(NS_SUCCEEDED(rv)); } Unused << rv; // Keep Coverity happy nsCOMPtr<nsIWritablePropertyBag2> props(do_QueryInterface(channel)); if (props) { // save true referrer for those who need it (e.g. xpinstall whitelisting) Loading docshell/base/nsIDocShell.idl +5 −0 Original line number Diff line number Diff line Loading @@ -878,6 +878,11 @@ interface nsIDocShell : nsIDocShellTreeItem */ [infallible] readonly attribute boolean mayEnableCharacterEncodingMenu; /** * Indicates that the character encoding was autodetected. */ [infallible] readonly attribute boolean charsetAutodetected; attribute nsIEditor editor; readonly attribute boolean editable; /* this docShell is editable */ readonly attribute boolean hasEditingSession; /* this docShell has an editing session */ Loading dom/interfaces/base/nsIBrowser.idl +6 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,12 @@ interface nsIBrowser : nsISupports */ attribute boolean mayEnableCharacterEncodingMenu; /** * Whether or not the character encoding was detected by analyzing * content (as opposed to reading a protocol label). */ attribute boolean charsetAutodetected; /** * Called by Gecko to update the browser when its state changes. * Loading Loading
browser/base/content/browser.js +5 −1 Original line number Diff line number Diff line Loading @@ -6620,6 +6620,9 @@ function handleDroppedLink(event, urlOrLinks, nameOrTriggeringPrincipal, trigger function BrowserSetForcedCharacterSet(aCharset) { if (aCharset) { if (aCharset == "Japanese") { aCharset = "Shift_JIS"; } gBrowser.selectedBrowser.characterSet = aCharset; // Save the forced character-set PlacesUIUtils.setCharsetForPage(getWebNavigation().currentURI, Loading @@ -6634,7 +6637,8 @@ function BrowserCharsetReload() { } function UpdateCurrentCharset(target) { let selectedCharset = CharsetMenu.foldCharset(gBrowser.selectedBrowser.characterSet); let selectedCharset = CharsetMenu.foldCharset(gBrowser.selectedBrowser.characterSet, gBrowser.selectedBrowser.charsetAutodetected); for (let menuItem of target.getElementsByTagName("menuitem")) { let isSelected = menuItem.getAttribute("charset") === selectedCharset; menuItem.setAttribute("checked", isSelected); Loading
browser/components/customizableui/CustomizableWidgets.jsm +2 −1 Original line number Diff line number Diff line Loading @@ -358,7 +358,8 @@ const CustomizableWidgets = [ }, updateCurrentCharset(aDocument) { let currentCharset = aDocument.defaultView.gBrowser.selectedBrowser.characterSet; currentCharset = CharsetMenu.foldCharset(currentCharset); let {charsetAutodetected} = aDocument.defaultView.gBrowser.selectedBrowser; currentCharset = CharsetMenu.foldCharset(currentCharset, charsetAutodetected); let pinnedContainer = aDocument.getElementById("PanelUI-characterEncodingView-pinned"); let charsetContainer = aDocument.getElementById("PanelUI-characterEncodingView-charsets"); Loading
docshell/base/nsDocShell.cpp +27 −6 Original line number Diff line number Diff line Loading @@ -1275,7 +1275,6 @@ nsDocShell::GatherCharsetMenuTelemetry() { case kCharsetFromDocTypeDefault: case kCharsetFromCache: case kCharsetFromParentFrame: case kCharsetFromHintPrevDoc: // Changing charset on an unlabeled doc. if (isFileURL) { Telemetry::AccumulateCategorical( Loading Loading @@ -1891,6 +1890,26 @@ nsDocShell::GetMayEnableCharacterEncodingMenu( return NS_OK; } NS_IMETHODIMP nsDocShell::GetCharsetAutodetected(bool* aCharsetAutodetected) { *aCharsetAutodetected = false; if (!mContentViewer) { return NS_OK; } Document* doc = mContentViewer->GetDocument(); if (!doc) { return NS_OK; } int32_t source = doc->GetDocumentCharacterSetSource(); if (source == kCharsetFromAutoDetection || source == kCharsetFromUserForcedAutoDetection) { *aCharsetAutodetected = true; } return NS_OK; } NS_IMETHODIMP nsDocShell::GetDocShellEnumerator(int32_t aItemType, DocShellEnumeratorDirection aDirection, Loading Loading @@ -8365,11 +8384,11 @@ nsresult nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer) { const Encoding* forceCharset = nullptr; const Encoding* hintCharset = nullptr; int32_t hintCharsetSource; float textZoom; float pageZoom; float overrideDPPX; bool styleDisabled; int32_t hintCharsetSource = kCharsetUninitialized; float textZoom = 1.0; float pageZoom = 1.0; float overrideDPPX = 1.0; bool styleDisabled = false; // |newMUDV| also serves as a flag to set the data from the above vars nsCOMPtr<nsIContentViewer> newCv; Loading Loading @@ -10181,6 +10200,8 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState, MOZ_ASSERT(NS_SUCCEEDED(rv)); } Unused << rv; // Keep Coverity happy nsCOMPtr<nsIWritablePropertyBag2> props(do_QueryInterface(channel)); if (props) { // save true referrer for those who need it (e.g. xpinstall whitelisting) Loading
docshell/base/nsIDocShell.idl +5 −0 Original line number Diff line number Diff line Loading @@ -878,6 +878,11 @@ interface nsIDocShell : nsIDocShellTreeItem */ [infallible] readonly attribute boolean mayEnableCharacterEncodingMenu; /** * Indicates that the character encoding was autodetected. */ [infallible] readonly attribute boolean charsetAutodetected; attribute nsIEditor editor; readonly attribute boolean editable; /* this docShell is editable */ readonly attribute boolean hasEditingSession; /* this docShell has an editing session */ Loading
dom/interfaces/base/nsIBrowser.idl +6 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,12 @@ interface nsIBrowser : nsISupports */ attribute boolean mayEnableCharacterEncodingMenu; /** * Whether or not the character encoding was detected by analyzing * content (as opposed to reading a protocol label). */ attribute boolean charsetAutodetected; /** * Called by Gecko to update the browser when its state changes. * Loading