Bug 871161 comm-central part - Stop inheriting charset where other browsers do not inherit it. r=neil, a=lsblakk to land on beta, a=mcsmurf to land on CLOSED TREE.
authorHenri Sivonen <hsivonen@hsivonen.fi>
Mon, 14 Oct 2013 16:35:41 +0300
changeset 16574 4585547772a0f2db95386737e355017830d23286
parent 16573 c43dd7dfaa8fb53c4244afc3937f05ab2be28c0f
child 16575 d5cf740774c3cff97e17fa511db6b3465c3fa4d0
push id1021
push userhsivonen@mozilla.com
push dateFri, 01 Nov 2013 09:16:29 +0000
treeherdercomm-beta@4585547772a0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersneil, lsblakk, mcsmurf
bugs871161
Bug 871161 comm-central part - Stop inheriting charset where other browsers do not inherit it. r=neil, a=lsblakk to land on beta, a=mcsmurf to land on CLOSED TREE.
editor/ui/composer/content/editingOverlay.js
mailnews/compose/src/nsMsgCompose.cpp
suite/browser/navigator.js
--- a/editor/ui/composer/content/editingOverlay.js
+++ b/editor/ui/composer/content/editingOverlay.js
@@ -110,17 +110,16 @@ function EditorStartup(aUrl, aCharset)
   gCSSPrefListener = new nsPrefListener(kUseCssPref);
   gReturnInParagraphPrefListener = new nsPrefListener(kCRInParagraphsPref);
   Services.obs.addObserver(EditorCanClose, "quit-application-requested", false);
 
   // Get url for editor content and load it. The editor gets instantiated by
   // the editingSession when the URL has finished loading.
   try {
     var contentViewer = GetCurrentEditorElement().markupDocumentViewer;
-    contentViewer.defaultCharacterSet = aCharset;
     contentViewer.forceCharacterSet = aCharset;
   } catch (e) {}
   EditorLoadUrl(aUrl);
 }
 
 function EditorShutdown()
 {
   Services.obs.removeObserver(EditorCanClose, "quit-application-requested");
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -1553,17 +1553,16 @@ NS_IMETHODIMP nsMsgCompose::InitEditor(n
   NS_ENSURE_TRUE(docShell, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIContentViewer> childCV;
   NS_ENSURE_SUCCESS(docShell->GetContentViewer(getter_AddRefs(childCV)), NS_ERROR_FAILURE);
   if (childCV)
   {
     nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
     if (markupCV) {
-      NS_ENSURE_SUCCESS(markupCV->SetDefaultCharacterSet(msgCharSet), NS_ERROR_FAILURE);
       NS_ENSURE_SUCCESS(markupCV->SetForceCharacterSet(msgCharSet), NS_ERROR_FAILURE);
     }
   }
 
   // This is what used to be done in mDocumentListener,
   //   nsMsgDocumentStateListener::NotifyDocumentCreated()
   bool quotingToFollow = false;
   GetQuotingToFollow(&quotingToFollow);
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -516,27 +516,16 @@ function Startup()
   //  so we'll be notified when onloads complete.
   var contentArea = document.getElementById("appcontent");
   contentArea.addEventListener("pageshow", function callPageShowHandlers(aEvent) {
     // Filter out events that are not about the document load we are interested in.
     if (aEvent.originalTarget == content.document)
       setTimeout(pageShowEventHandlers, 0, aEvent);
   }, true);
 
-  // set default character set if provided
-  if ("arguments" in window && window.arguments.length > 1 && window.arguments[1]) {
-    if (window.arguments[1].indexOf("charset=") != -1) {
-      var arrayArgComponents = window.arguments[1].split("=");
-      if (arrayArgComponents) {
-        //we should "inherit" the charset menu setting in a new window
-        getMarkupDocumentViewer().defaultCharacterSet = arrayArgComponents[1];
-      }
-    }
-  }
-
   // Set a sane starting width/height for all resolutions on new profiles.
   if (!document.documentElement.hasAttribute("width")) {
     var defaultHeight = screen.availHeight;
     var defaultWidth= screen.availWidth;
 
     // Create a narrower window for large or wide-aspect displays, to suggest
     // side-by-side page view.
     if (screen.availWidth >= 1440)
@@ -1921,17 +1910,20 @@ function hiddenWindowStartup()
   gNavigatorRegionBundle = document.getElementById("bundle_navigator_region");
   gBrandBundle = document.getElementById("bundle_brand");
 }
 
 function checkForDirectoryListing()
 {
   if ( "HTTPIndex" in content &&
        content.HTTPIndex instanceof Components.interfaces.nsIHTTPIndex ) {
-    content.defaultCharacterset = getMarkupDocumentViewer().defaultCharacterSet;
+    var forced = getBrowser().docShell.forcedCharset;
+    if (forced) {
+      content.defaultCharacterset = forced;
+    }
   }
 }
 
 function URLBarSetURI(aURI, aValid) {
   var uri = aURI || getWebNavigation().currentURI;
   var value;
 
   // If the url has "wyciwyg://" as the protocol, strip it off.