Bug 473034 - Scrape the underscore off viewsource's content, r=gavin
authorPhil Ringnalda <philringnalda@gmail.com>
Thu, 15 Jan 2009 20:02:20 -0800
changeset 23776 ff19e9cd2dfdc34acb70df9c1eebb98616498d5e
parent 23775 745c0c2aa1fe3565012fc62e9daa164912f1d262
child 23777 7427249724077c3c3a9d59751406bbf9b211b2ea
push id4722
push userphilringnalda@gmail.com
push dateFri, 16 Jan 2009 04:03:22 +0000
treeherdermozilla-central@57e38d817e3f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs473034
milestone1.9.2a1pre
Bug 473034 - Scrape the underscore off viewsource's content, r=gavin
toolkit/components/viewsource/content/viewPartialSource.js
toolkit/components/viewsource/content/viewSource.js
--- a/toolkit/components/viewsource/content/viewPartialSource.js
+++ b/toolkit/components/viewsource/content/viewPartialSource.js
@@ -76,17 +76,17 @@ function onLoadViewPartialSource()
     document.getElementById("menu_highlightSyntax").setAttribute("hidden", "true");
   }
 
   if (window.arguments[3] == 'selection')
     viewPartialSourceForSelection(window.arguments[2]);
   else
     viewPartialSourceForFragment(window.arguments[2], window.arguments[3]);
 
-  window._content.focus();
+  window.content.focus();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // view-source of a selection with the special effect of remapping the selection
 // to the underlying view-source output
 function viewPartialSourceForSelection(selection)
 {
   var range = selection.getRangeAt(0);
--- a/toolkit/components/viewsource/content/viewSource.js
+++ b/toolkit/components/viewsource/content/viewSource.js
@@ -268,34 +268,34 @@ function viewSource(url)
       document.getElementById("menu_highlightSyntax").setAttribute("checked", gPrefs.getBoolPref("view_source.syntax_highlight"));
     } catch (ex) {
     }
   } else {
     document.getElementById("menu_highlightSyntax").setAttribute("hidden", "true");
   }
 
   window.addEventListener("AppCommand", HandleAppCommandEvent, true);
-  window._content.focus();
+  window.content.focus();
 
   return true;
 }
 
 function onLoadContent()
 {
   //
   // If the view source was opened with a "go to line" argument.
   //
   if (gGoToLine > 0) {
     goToLine(gGoToLine);
     gGoToLine = 0;
   }
   document.getElementById('cmd_goToLine').removeAttribute('disabled');
 
   // Register a listener so that we can show the caret position on the status bar.
-  window._content.getSelection()
+  window.content.getSelection()
    .QueryInterface(nsISelectionPrivate)
    .addSelectionListener(gSelectionListener);
 }
 
 function onUnloadContent()
 {
   //
   // Disable "go to line" while reloading due to e.g. change of charset
@@ -408,17 +408,17 @@ function ViewSourceGoToLine()
     promptService.alert(window,
         viewSourceBundle.getString("outOfRangeTitle"),
         viewSourceBundle.getString("outOfRangeText"));
   }
 }
 
 function goToLine(line)
 {
-  var viewsource = window._content.document.body;
+  var viewsource = window.content.document.body;
 
   //
   // The source document is made up of a number of pre elements with
   // id attributes in the format <pre id="line123">, meaning that
   // the first line in the pre element is number 123.
   // Do binary search to find the pre element containing the line.
   //
   var pre;
@@ -441,17 +441,17 @@ function goToLine(line)
 
   var result = {};
   var found = findLocation(pre, line, null, -1, false, result);
 
   if (!found) {
     return false;
   }
 
-  var selection = window._content.getSelection();
+  var selection = window.content.getSelection();
   selection.removeAllRanges();
 
   // In our case, the range's startOffset is after "\n" on the previous line.
   // Tune the selection at the beginning of the next line and do some tweaking
   // to position the focusNode and the caret at the beginning of the line.
 
   selection.QueryInterface(nsISelectionPrivate)
     .interlinePosition = true;
@@ -497,17 +497,17 @@ function goToLine(line)
 
 function updateStatusBar()
 {
   // Reset the coalesce flag.
   gSelectionListener.timeout = 0;
 
   var statusBarField = document.getElementById("statusbar-line-col");
 
-  var selection = window._content.getSelection();
+  var selection = window.content.getSelection();
   if (!selection.focusNode) {
     statusBarField.label = '';
     return;
   }
   if (selection.focusNode.nodeType != Node.TEXT_NODE) {
     return;
   }
 
@@ -551,17 +551,17 @@ function findLocation(pre, line, node, o
   // id attributes in the format <pre id="line123">, meaning that
   // the first line in the pre element is number 123.
   //
   var curLine = parseInt(pre.id.substring(4));
 
   //
   // Walk through each of the text nodes and count newlines.
   //
-  var treewalker = window._content.document
+  var treewalker = window.content.document
       .createTreeWalker(pre, NodeFilter.SHOW_TEXT, null, false);
 
   //
   // The column number of the first character in the current text node.
   //
   var firstCol = 1;
 
   var found = false;
@@ -643,17 +643,17 @@ function findLocation(pre, line, node, o
 
   return found || ("range" in result);
 }
 
 //function to toggle long-line wrapping and set the view_source.wrap_long_lines 
 //pref to persist the last state
 function wrapLongLines()
 {
-  var myWrap = window._content.document.body;
+  var myWrap = window.content.document.body;
 
   if (myWrap.className == '')
     myWrap.className = 'wrap';
   else myWrap.className = '';
 
   //since multiple viewsource windows are possible, another window could have 
   //affected the pref, so instead of determining the new pref value via the current
   //pref value, we use myWrap.className