[Bug 350693] "Character Encoding" in "View Source" window doesn't work p=Simon Montagu <smontagu@smontagu.org>, r=neil, sr=mscott, approval1.9=mtschrep
authormkmelin+mozilla@iki.fi
Fri, 09 May 2008 13:38:49 -0700
changeset 15091 999ed4d448e25e714d04dcc04c109413eff23cc2
parent 15090 b1110b90803088c6f0c938fe75b2277f0bea02e8
child 15092 185fc5ceb3b869e4872b65d9fb4f41af8f7b8514
push idunknown
push userunknown
push dateunknown
reviewersneil, mscott
bugs350693
milestone1.9pre
[Bug 350693] "Character Encoding" in "View Source" window doesn't work p=Simon Montagu <smontagu@smontagu.org>, r=neil, sr=mscott, approval1.9=mtschrep
toolkit/components/viewsource/content/viewSource.js
--- a/toolkit/components/viewsource/content/viewSource.js
+++ b/toolkit/components/viewsource/content/viewSource.js
@@ -176,22 +176,26 @@ function viewSource(url)
       } catch(ex) {
         // Ignore the failure.  The content will be loaded via the URL
         // that was supplied in arg[0].
       }
     }
   }
 
   if (loadFromURL) {
+    // We need to set up session history to give us a page descriptor.
+    //
+    var webNavigation = getBrowser().webNavigation;
+    webNavigation.sessionHistory = Components.classes["@mozilla.org/browser/shistory;1"].createInstance();
     //
     // Currently, an exception is thrown if the URL load fails...
     //
     var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
     var viewSrcUrl = "view-source:" + url;
-    getBrowser().webNavigation.loadURI(viewSrcUrl, loadFlags, null, null, null);
+    webNavigation.loadURI(viewSrcUrl, loadFlags, null, null, null);
   }
 
   //check the view_source.wrap_long_lines pref and set the menuitem's checked attribute accordingly
   if (gPrefs) {
     try {
       var wraplonglinesPrefValue = gPrefs.getBoolPref("view_source.wrap_long_lines");
 
       if (wraplonglinesPrefValue)