Bug 1543077 part 4 - Have only one item for Japanese in the Text Encoding menu. r=Gijs,emk.

Differential Revision: https://phabricator.services.mozilla.com/D28634
This commit is contained in:
Henri Sivonen
2019-04-17 14:36:52 +03:00
parent 406dbef55e
commit 22be3f1c4f
18 changed files with 184 additions and 95 deletions

View File

@@ -1276,7 +1276,6 @@ nsDocShell::GatherCharsetMenuTelemetry() {
case kCharsetFromDocTypeDefault:
case kCharsetFromCache:
case kCharsetFromParentFrame:
case kCharsetFromHintPrevDoc:
// Changing charset on an unlabeled doc.
if (isFileURL) {
Telemetry::AccumulateCategorical(
@@ -1892,6 +1891,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,
@@ -8372,11 +8391,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;
@@ -10188,6 +10207,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)