bug 411754 - Overlay suite features onto toolkit view source window and use that instead of an own implementation, r=Neil
authorRobert Kaiser <kairo@kairo.at>
Thu, 27 May 2010 14:58:28 +0200
changeset 5740 d9a57a60f0804de28496a956e34ceb338f2b1567
parent 5739 c3b77a8373b549aa81d5f07752381525fb0af446
child 5741 7c3fdb5ad7cb5dff1d263c4bfd7246727ab93d57
push idunknown
push userunknown
push dateunknown
reviewersNeil
bugs411754
bug 411754 - Overlay suite features onto toolkit view source window and use that instead of an own implementation, r=Neil
suite/browser/jar.mn
suite/browser/navigator.js
suite/browser/viewPartialSource.js
suite/browser/viewPartialSource.xul
suite/browser/viewSource.xul
suite/browser/viewSourceOverlay.xul
suite/browser/viewsource.js
suite/common/jar.mn
suite/common/nsContextMenu.js
suite/common/viewSourceOverlay.js
suite/common/viewSourceOverlay.xul
suite/locales/en-US/chrome/browser/viewSource.dtd
suite/locales/en-US/chrome/browser/viewSource.properties
suite/locales/jar.mn
suite/mailnews/mailCommands.js
suite/mailnews/msgHdrViewOverlay.js
suite/themes/classic/communicator/viewSourceOverlay.css
suite/themes/classic/jar.mn
suite/themes/modern/communicator/viewSourceOverlay.css
suite/themes/modern/jar.mn
--- a/suite/browser/jar.mn
+++ b/suite/browser/jar.mn
@@ -19,21 +19,16 @@ comm.jar:
    content/navigator/navigatorDD.js
    content/navigator/navigatorOverlay.xul
    content/navigator/nsBrowserContentListener.js
    content/navigator/nsBrowserStatusHandler.js
    content/navigator/searchconfig.properties
    content/navigator/sessionHistoryUI.js
    content/navigator/tabbrowser.xml
    content/navigator/urlbarBindings.xml
-   content/navigator/viewsource.js
-   content/navigator/viewSource.xul
-   content/navigator/viewSourceOverlay.xul
-   content/navigator/viewPartialSource.js
-   content/navigator/viewPartialSource.xul
 #ifdef XP_MACOSX
    content/navigator/platformNavigationBindings.xul                 (mac/platformNavigationBindings.xul)
    content/navigator/platformMailOverlay.xul                        (mac/platformMailOverlay.xul)
 #else
 #ifdef XP_WIN32
    content/navigator/platformNavigationBindings.xul                 (win/platformNavigationBindings.xul)
    content/navigator/platformMailOverlay.xul                        (win/platformMailOverlay.xul)
 #else
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -1696,17 +1696,17 @@ function BrowserViewSourceOfDocument(aDo
   }
 
   BrowserViewSourceOfURL(webNav.currentURI.spec, docCharset, pageCookie);
 }
 
 function BrowserViewSourceOfURL(url, charset, pageCookie)
 {
   // try to open a view-source window while inheriting the charset (if any)
-  openDialog("chrome://navigator/content/viewSource.xul",
+  openDialog("chrome://global/content/viewSource.xul",
              "_blank",
              "all,dialog=no",
              url, charset, pageCookie);
 }
 
 // doc - document to use for source, or null for the current tab
 // initialTab - id of the initial tab to display, or null for the first tab
 function BrowserPageInfo(doc, initialTab)
deleted file mode 100644
--- a/suite/browser/viewPartialSource.js
+++ /dev/null
@@ -1,506 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org view-source front-end.
- *
- * The Initial Developer of the Original Code is mozilla.org.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Roger B. Sidje <rbs@maths.uq.edu.au> (Original Author)
- *   Steve Swanson <steve.swanson@mackichan.com>
- *   Doron Rosenberg <doronr@naboonline.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-var gDebug = 0;
-var gLineCount = 0;
-var gStartTargetLine = 0;
-var gEndTargetLine = 0;
-var gTargetNode = null;
-
-var gEntityConverter = null;
-var gWrapLongLines = false;
-const gViewSourceCSS = 'resource://gre-resources/viewsource.css';
-const NS_XHTML = 'http://www.w3.org/1999/xhtml';
-
-// These are markers used to delimit the selection during processing. They
-// are removed from the final rendering, but we pick space-like characters for
-// safety (and futhermore, these are known to be mapped to a 0-length string
-// in transliterate.properties). It is okay to set start=end, we use findNext()
-// U+200B ZERO WIDTH SPACE
-const MARK_SELECTION_START = '\u200B\u200B\u200B\u200B\u200B';
-const MARK_SELECTION_END = '\u200B\u200B\u200B\u200B\u200B';
-
-function onLoadViewPartialSource()
-{
-  // 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) {
-        document.getElementById('menu_wrapLongLines').setAttribute('checked', 'true');
-        gWrapLongLines = true;
-      }
-    } catch (e) { }
-    try {
-      document.getElementById("menu_highlightSyntax").setAttribute("checked", gPrefs.getBoolPref("view_source.syntax_highlight"));
-    } catch (e) {
-    }
-  } else {
-    document.getElementById("menu_highlightSyntax").setAttribute("hidden", "true");
-  }
-
-  // disable menu items that don't work since the selection is munged and
-  // the editor doesn't work for MathML
-  document.getElementById('cmd_savePage').setAttribute('disabled', 'true');
-  document.getElementById('cmd_editPage').setAttribute('disabled', 'true');
-
-  if (window.arguments[3] == 'selection')
-    viewPartialSourceForSelection(window.arguments[2]);
-  else
-    viewPartialSourceForFragment(window.arguments[2], window.arguments[3]);
-
-  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);
-  var ancestorContainer = range.commonAncestorContainer;
-  var doc = ancestorContainer.ownerDocument;
-
-  var startContainer = range.startContainer;
-  var endContainer = range.endContainer;
-  var startOffset = range.startOffset;
-  var endOffset = range.endOffset;
-
-  // let the ancestor be an element
-  if (ancestorContainer.nodeType == Node.TEXT_NODE ||
-      ancestorContainer.nodeType == Node.CDATA_SECTION_NODE)
-    ancestorContainer = ancestorContainer.parentNode;
-
-  // for selectAll, let's use the entire document, including <html>...</html>
-  // @see DocumentViewerImpl::SelectAll() for how selectAll is implemented
-  try {
-    if (ancestorContainer == doc.body)
-      ancestorContainer = doc.documentElement;
-  } catch (e) { }
-
-  // each path is a "child sequence" (a.k.a. "tumbler") that
-  // descends from the ancestor down to the boundary point
-  var startPath = getPath(ancestorContainer, startContainer);
-  var endPath = getPath(ancestorContainer, endContainer);
-
-  // clone the fragment of interest and reset everything to be relative to it
-  // note: it is with the clone that we operate/munge from now on
-  ancestorContainer = ancestorContainer.cloneNode(true);
-  startContainer = ancestorContainer;
-  endContainer = ancestorContainer;
-
-  // Only bother with the selection if it can be remapped. Don't mess with
-  // leaf elements (such as <isindex>) that secretly use anynomous content
-  // for their display appearance.
-  var canDrawSelection = ancestorContainer.hasChildNodes();
-  if (canDrawSelection) {
-    var i;
-    for (i = startPath ? startPath.length-1 : -1; i >= 0; i--) {
-      startContainer = startContainer.childNodes.item(startPath[i]);
-    }
-    for (i = endPath ? endPath.length-1 : -1; i >= 0; i--) {
-      endContainer = endContainer.childNodes.item(endPath[i]);
-    }
-
-    // add special markers to record the extent of the selection
-    // note: |startOffset| and |endOffset| are interpreted either as
-    // offsets in the text data or as child indices (see the Range spec)
-    // (here, munging the end point first to keep the start point safe...)
-    var tmpNode;
-    if (endContainer.nodeType == Node.TEXT_NODE ||
-        endContainer.nodeType == Node.CDATA_SECTION_NODE) {
-      // do some extra tweaks to try to avoid the view-source output to look like
-      // ...<tag>]... or ...]</tag>... (where ']' marks the end of the selection).
-      // To get a neat output, the idea here is to remap the end point from:
-      // 1. ...<tag>]...   to   ...]<tag>...
-      // 2. ...]</tag>...  to   ...</tag>]...
-      if ((endOffset > 0 && endOffset < endContainer.data.length) ||
-          !endContainer.parentNode || !endContainer.parentNode.parentNode)
-        endContainer.insertData(endOffset, MARK_SELECTION_END);
-      else {
-        tmpNode = doc.createTextNode(MARK_SELECTION_END);
-        endContainer = endContainer.parentNode;
-        if (endOffset == 0)
-          endContainer.parentNode.insertBefore(tmpNode, endContainer);
-        else
-          endContainer.parentNode.insertBefore(tmpNode, endContainer.nextSibling);
-      }
-    }
-    else {
-      tmpNode = doc.createTextNode(MARK_SELECTION_END);
-      endContainer.insertBefore(tmpNode, endContainer.childNodes.item(endOffset));
-    }
-
-    if (startContainer.nodeType == Node.TEXT_NODE ||
-        startContainer.nodeType == Node.CDATA_SECTION_NODE) {
-      // do some extra tweaks to try to avoid the view-source output to look like
-      // ...<tag>[... or ...[</tag>... (where '[' marks the start of the selection).
-      // To get a neat output, the idea here is to remap the start point from:
-      // 1. ...<tag>[...   to   ...[<tag>...
-      // 2. ...[</tag>...  to   ...</tag>[...
-      if ((startOffset > 0 && startOffset < startContainer.data.length) ||
-          !startContainer.parentNode || !startContainer.parentNode.parentNode ||
-          startContainer != startContainer.parentNode.lastChild)
-        startContainer.insertData(startOffset, MARK_SELECTION_START);
-      else {
-        tmpNode = doc.createTextNode(MARK_SELECTION_START);
-        startContainer = startContainer.parentNode;
-        if (startOffset == 0)
-          startContainer.parentNode.insertBefore(tmpNode, startContainer);
-        else
-          startContainer.parentNode.insertBefore(tmpNode, startContainer.nextSibling);
-      }
-    }
-    else {
-      tmpNode = doc.createTextNode(MARK_SELECTION_START);
-      startContainer.insertBefore(tmpNode, startContainer.childNodes.item(startOffset));
-    }
-  }
-
-  // now extract and display the syntax highlighted source
-  tmpNode = doc.createElementNS(NS_XHTML, 'div');
-  tmpNode.appendChild(ancestorContainer);
-
-  // the load is aynchronous and so we will wait until the view-source DOM is done
-  // before drawing the selection.
-  if (canDrawSelection) {
-    window.document.getElementById("appcontent").addEventListener("load", drawSelection, true);
-  }
-
-  // all our content is held by the data:URI and URIs are internally stored as utf-8 (see nsIURI.idl)
-  var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
-  getBrowser().webNavigation
-              .loadURI("view-source:data:text/html;charset=utf-8," + encodeURIComponent(tmpNode.innerHTML),
-                       loadFlags, null, null, null);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// helper to get a path like FIXptr, but with an array instead of the "tumbler" notation
-// see FIXptr: http://lists.w3.org/Archives/Public/www-xml-linking-comments/2001AprJun/att-0074/01-NOTE-FIXptr-20010425.htm
-function getPath(ancestor, node)
-{
-  var n = node;
-  var p = n.parentNode;
-  if (n == ancestor || !p)
-    return null;
-  var path = new Array();
-  if (!path)
-    return null;
-  do {
-    for (var i = 0; i < p.childNodes.length; i++) {
-      if (p.childNodes.item(i) == n) {
-        path.push(i);
-        break;
-      }
-    }
-    n = p;
-    p = n.parentNode;
-  } while (n != ancestor && p);
-  return path;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// using special markers left in the serialized source, this helper makes the
-// underlying markup of the selected fragment to automatically appear as selected
-// on the inflated view-source DOM
-function drawSelection()
-{
-  // find the special selection markers that we added earlier, and
-  // draw the selection between the two...
-  var findService = null;
-  try {
-    // get the find service which stores the global find state
-    findService = Components.classes["@mozilla.org/find/find_service;1"]
-                            .getService(Components.interfaces.nsIFindService);
-  } catch(e) { }
-  if (!findService)
-    return;
-
-  // cache the current global find state
-  var matchCase     = findService.matchCase;
-  var entireWord    = findService.entireWord;
-  var wrapFind      = findService.wrapFind;
-  var findBackwards = findService.findBackwards;
-  var searchString  = findService.searchString;
-  var replaceString = findService.replaceString;
-
-  // setup our find instance
-  var findInst = getBrowser().webBrowserFind;
-  findInst.matchCase = true;
-  findInst.entireWord = false;
-  findInst.wrapFind = true;
-  findInst.findBackwards = false;
-
-  // ...lookup the start mark
-  findInst.searchString = MARK_SELECTION_START;
-  var startLength = MARK_SELECTION_START.length;
-  findInst.findNext();
-
-  var contentWindow = getBrowser().contentDocument.defaultView;
-  var selection = contentWindow.getSelection();
-  var range = selection.getRangeAt(0);
-
-  var startContainer = range.startContainer;
-  var startOffset = range.startOffset;
-
-  // ...lookup the end mark
-  findInst.searchString = MARK_SELECTION_END;
-  var endLength = MARK_SELECTION_END.length;
-  findInst.findNext();
-
-  var endContainer = selection.anchorNode;
-  var endOffset = selection.anchorOffset;
-
-  // reset the selection that find has left
-  selection.removeAllRanges();
-
-  // delete the special markers now...
-  endContainer.deleteData(endOffset, endLength);
-  startContainer.deleteData(startOffset, startLength);
-  if (startContainer == endContainer)
-    endOffset -= startLength; // has shrunk if on same text node...
-  range.setEnd(endContainer, endOffset);
-
-  // show the selection and scroll it into view
-  selection.addRange(range);
-  // the default behavior of the selection is to scroll at the end of
-  // the selection, whereas in this situation, it is more user-friendly
-  // to scroll at the beginning. So we override the default behavior here
-  try {
-    getBrowser().docShell
-                .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-                .getInterface(Components.interfaces.nsISelectionDisplay)
-                .QueryInterface(Components.interfaces.nsISelectionController)
-                .scrollSelectionIntoView(Components.interfaces.nsISelectionController.SELECTION_NORMAL,
-                                         Components.interfaces.nsISelectionController.SELECTION_ANCHOR_REGION,
-                                         true);
-  }
-  catch(e) { }
-
-  // restore the current find state
-  findService.matchCase     = matchCase;
-  findService.entireWord    = entireWord;
-  findService.wrapFind      = wrapFind;
-  findService.findBackwards = findBackwards;
-  findService.searchString  = searchString;
-  findService.replaceString = replaceString;
-
-  findInst.matchCase     = matchCase;
-  findInst.entireWord    = entireWord;
-  findInst.wrapFind      = wrapFind;
-  findInst.findBackwards = findBackwards;
-  findInst.searchString  = searchString;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// special handler for markups such as MathML where reformatting the output is
-// helpful
-function viewPartialSourceForFragment(node, context)
-{
-  gTargetNode = node;
-  if (gTargetNode && gTargetNode.nodeType == Node.TEXT_NODE)
-    gTargetNode = gTargetNode.parentNode;
-
-  // walk up the tree to the top-level element (e.g., <math>, <svg>)
-  var topTag;
-  if (context == 'mathml')
-    topTag = 'math';
-  else
-    throw 'not reached';
-  var topNode = gTargetNode;
-  while (topNode && topNode.localName != topTag)
-    topNode = topNode.parentNode;
-  if (!topNode)
-    return;
-
-  // serialize (note: the main window overrides the title set here)
-  var wrapClass = gWrapLongLines ? ' class="wrap"' : '';
-  var source =
-    '<!DOCTYPE html>'
-  + '<html>'
-  + '<head><title>Mozilla</title>'
-  + '<link rel="stylesheet" type="text/css" href="' + gViewSourceCSS + '">'
-  + '<style type="text/css">'
-  + '#target { border: dashed 1px; background-color: lightyellow; }'
-  + '</style>'
-  + '</head>'
-  + '<body id="viewsource"' + wrapClass
-  +        ' onload="document.getElementById(\'target\').scrollIntoView(true)">'
-  + '<pre>'
-  + getOuterMarkup(topNode, 0)
-  + '</pre></body></html>'
-  ; // end
-
-  // display
-  var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
-  getBrowser().webNavigation
-              .loadURI("data:text/html;charset=utf-8," + encodeURIComponent(source),
-                       loadFlags, null, null, null);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-function getInnerMarkup(node, indent) {
-  var str = '';
-  for (var i = 0; i < node.childNodes.length; i++) {
-    str += getOuterMarkup(node.childNodes.item(i), indent);
-  }
-  return str;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-function getOuterMarkup(node, indent) {
-  var newline = '';
-  var padding = '';
-  var str = '';
-  if (node == gTargetNode) {
-    gStartTargetLine = gLineCount;
-    str += '</pre><pre id="target">';
-  }
-
-  switch (node.nodeType) {
-  case Node.ELEMENT_NODE: // Element
-    // to avoid the wide gap problem, '\n' is not emitted on the first
-    // line and the lines before & after the <pre id="target">...</pre>
-    if (gLineCount > 0 &&
-        gLineCount != gStartTargetLine &&
-        gLineCount != gEndTargetLine) {
-      newline = '\n';
-    }
-    gLineCount++;
-    if (gDebug) {
-      newline += gLineCount;
-    }
-    for (var k = 0; k < indent; k++) {
-      padding += ' ';
-    }
-    str += newline + padding
-        +  '&lt;<span class="start-tag">' + node.nodeName + '</span>';
-    for (var i = 0; i < node.attributes.length; i++) {
-      var attr = node.attributes.item(i);
-      if (!gDebug && attr.nodeName.match(/^[-_]moz/)) {
-        continue;
-      }
-      str += ' <span class="attribute-name">'
-          +  attr.nodeName
-          +  '</span>=<span class="attribute-value">"'
-          +  unicodeTOentity(attr.nodeValue)
-          +  '"</span>';
-    }
-    if (!node.hasChildNodes()) {
-      str += '/&gt;';
-    }
-    else {
-      str += '&gt;';
-      var oldLine = gLineCount;
-      str += getInnerMarkup(node, indent + 2);
-      if (oldLine == gLineCount) {
-        newline = '';
-        padding = '';
-      }
-      else {
-        newline = (gLineCount == gEndTargetLine) ? '' : '\n';
-        gLineCount++;
-        if (gDebug) {
-          newline += gLineCount;
-        }
-      }
-      str += newline + padding
-          +  '&lt;/<span class="end-tag">' + node.nodeName + '</span>&gt;';
-    }
-    break;
-  case Node.TEXT_NODE: // Text
-    var tmp = node.nodeValue.replace(/(\n|\r|\t)+/g, " ").trim();
-    if (tmp.length != 0) {
-      str += '<span class="text">' + unicodeTOentity(tmp) + '</span>';
-    }
-    break;
-  default:
-    break;
-  }
-
-  if (node == gTargetNode) {
-    gEndTargetLine = gLineCount;
-    str += '</pre><pre>';
-  }
-  return str;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-function unicodeTOentity(text)
-{
-  const charTable = {
-    '&': '&amp;<span class="entity">amp;</span>',
-    '<': '&amp;<span class="entity">lt;</span>',
-    '>': '&amp;<span class="entity">gt;</span>',
-    '"': '&amp;<span class="entity">quot;</span>'
-  };
-
-  function charTableLookup(letter) {
-    return charTable[letter];
-  }
-
-  function convertEntity(letter) {
-    try {
-      var unichar = gEntityConverter.ConvertToEntity(letter, entityVersion);
-      var entity = unichar.substring(1); // extract '&'
-      return '&amp;<span class="entity">' + entity + '</span>';
-    } catch (ex) {
-      return letter;
-    }
-  }
-
-  if (!gEntityConverter) {
-    try {
-      gEntityConverter =
-        Components.classes["@mozilla.org/intl/entityconverter;1"]
-                  .createInstance(Components.interfaces.nsIEntityConverter);
-    } catch(e) { }
-  }
-
-  const entityVersion = Components.interfaces.nsIEntityConverter.entityW3C;
-
-  var str = text;
-
-  // replace chars in our charTable
-  str = str.replace(/[<>&"]/g, charTableLookup);
-
-  // replace chars > 0x7f via nsIEntityConverter
-  str = str.replace(/[^\0-\u007f]/g, convertEntity);
-
-  return str;
-}
deleted file mode 100644
--- a/suite/browser/viewPartialSource.xul
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0"?> <!-- -*- Mode: HTML -*- --> 
-<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?> 
-
-<!-- ***** BEGIN LICENSE BLOCK *****
-   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
-   -
-   - The contents of this file are subject to the Mozilla Public License Version
-   - 1.1 (the "License"); you may not use this file except in compliance with
-   - the License. You may obtain a copy of the License at
-   - http://www.mozilla.org/MPL/
-   -
-   - Software distributed under the License is distributed on an "AS IS" basis,
-   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-   - for the specific language governing rights and limitations under the
-   - License.
-   -
-   - The Original Code is mozilla.org view-source front end.
-   -
-   - The Initial Developer of the Original Code is
-   - mozilla.org.
-   - Portions created by the Initial Developer are Copyright (C) 2002
-   - the Initial Developer. All Rights Reserved.
-   -
-   - Contributor(s):
-   -   Roger B. Sidje <rbs@maths.uq.edu.au> (Original Author)
-   -   Doron Rosenberg <doronr@naboonline.com>
-   -
-   - Alternatively, the contents of this file may be used under the terms of
-   - either of the GNU General Public License Version 2 or later (the "GPL"),
-   - or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-   - in which case the provisions of the GPL or the LGPL are applicable instead
-   - of those above. If you wish to allow use of your version of this file only
-   - under the terms of either the GPL or the LGPL, and not to allow others to
-   - use your version of this file under the terms of the MPL, indicate your
-   - decision by deleting the provisions above and replace them with the notice
-   - and other provisions required by the GPL or the LGPL. If you do not delete
-   - the provisions above, a recipient may use your version of this file under
-   - the terms of any one of the MPL, the GPL or the LGPL.
-   -
-   - ***** END LICENSE BLOCK ***** -->
-
-<?xul-overlay href="chrome://navigator/content/viewSourceOverlay.xul"?>
-
-<!DOCTYPE window [
-<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
-%brandDTD;
-<!ENTITY % sourceDTD SYSTEM "chrome://navigator/locale/viewSource.dtd" >
-%sourceDTD;
-<!ENTITY % navigatorDTD SYSTEM "chrome://navigator/locale/navigator.dtd" >
-%navigatorDTD;
-<!ENTITY % contentAreaCommandsDTD SYSTEM "chrome://communicator/locale/contentAreaCommands.dtd" >
-%contentAreaCommandsDTD;
-]>
-
-<window id="main-window"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        onload="onLoadViewPartialSource();"
-        title="&viewPartialSourceWindow.title;"
-        windowtype="navigator:view-source"
-        width="500" height="300"
-        screenX="10" screenY="10"
-        persist="screenX screenY width height sizemode">
-
-  <script type="application/javascript" src="chrome://navigator/content/viewPartialSource.js"/>
-
-  <commandset id="commands"/>
-  <keyset id="viewSourceKeys"/>
-  <stringbundleset id="viewSource-stringbundleset"/>
-  <popupset id="viewSourceContextSet" />
-
-  <toolbox id="viewSource-toolbox">
-    <menubar id="viewSource-main-menubar">
-      <menu id="menu_File"/>
-      <menu id="menu_Edit"/>
-      <menu id="menu_View">
-        <menupopup id="menu_View_Popup">
-          <menuitem accesskey="&reloadCmd.accesskey;" key="key_reload" label="&reloadCmd.label;" oncommand="BrowserReload();"/>
-          <menuseparator />
-          <menu id="menu_zoom"/>  
-          <menuseparator/>
-<!--      <menuitem key="key_viewInfo" observes="View:PageInfo"
-                    label="&pageInfoCmd.label;" accesskey="&pageInfoCmd.accesskey;"/>
-          <menuseparator id="file_moduleSeparator"/>-->
-          <menuitem id="menu_wrapLongLines" type="checkbox" oncommand="wrapLongLines()"
-                    label="&menu_wrapLongLines.title;" accesskey="&menu_wrapLongLines.accesskey;"/>
-          <menuitem type="checkbox" id="menu_highlightSyntax" oncommand="highlightSyntax();"
-                    label="&menu_highlightSyntax.label;" accesskey="&menu_highlightSyntax.accesskey;"/>
-        </menupopup>
-      </menu>
-      <menu id="windowMenu"/>
-      <menu id="menu_Help"/>
-    </menubar>
-  </toolbox>
-  
-  <vbox id="appcontent" flex="1"
-        ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);">
-
-    <browser id="content" type="content-primary" name="content" src="about:blank" flex="1"
-             disablehistory="true" disablesecurity="true"
-             context="viewSourceContextMenu"/>
-
-  </vbox>
-
-</window>
deleted file mode 100644
--- a/suite/browser/viewSource.xul
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0"?> <!-- -*- Mode: HTML -*- --> 
-<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?> 
-
-<!-- ***** BEGIN LICENSE BLOCK *****
-   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
-   -
-   - The contents of this file are subject to the Mozilla Public License Version
-   - 1.1 (the "License"); you may not use this file except in compliance with
-   - the License. You may obtain a copy of the License at
-   - http://www.mozilla.org/MPL/
-   -
-   - Software distributed under the License is distributed on an "AS IS" basis,
-   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-   - for the specific language governing rights and limitations under the
-   - License.
-   -
-   - The Original Code is mozilla.org viewsource frontend.
-   -
-   - The Initial Developer of the Original Code is
-   - Netscape Communications Corporation.
-   - Portions created by the Initial Developer are Copyright (C) 2000
-   - the Initial Developer. All Rights Reserved.
-   -
-   - Contributor(s):
-   -   Doron Rosenberg (doronr@naboonline.com)
-   -   Roger B. Sidje (rbs@maths.uq.edu.au)
-   -
-   - Alternatively, the contents of this file may be used under the terms of
-   - either of the GNU General Public License Version 2 or later (the "GPL"),
-   - or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-   - in which case the provisions of the GPL or the LGPL are applicable instead
-   - of those above. If you wish to allow use of your version of this file only
-   - under the terms of either the GPL or the LGPL, and not to allow others to
-   - use your version of this file under the terms of the MPL, indicate your
-   - decision by deleting the provisions above and replace them with the notice
-   - and other provisions required by the GPL or the LGPL. If you do not delete
-   - the provisions above, a recipient may use your version of this file under
-   - the terms of any one of the MPL, the GPL or the LGPL.
-   -
-   - ***** END LICENSE BLOCK ***** -->
-
-<?xul-overlay href="chrome://navigator/content/viewSourceOverlay.xul"?>
-
-<!DOCTYPE window [
-<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
-%brandDTD;
-<!ENTITY % sourceDTD SYSTEM "chrome://navigator/locale/viewSource.dtd" >
-%sourceDTD;
-<!ENTITY % navigatorDTD SYSTEM "chrome://navigator/locale/navigator.dtd" >
-%navigatorDTD;
-<!ENTITY % contentAreaCommandsDTD SYSTEM "chrome://communicator/locale/contentAreaCommands.dtd" >
-%contentAreaCommandsDTD;
-]>
-
-<window id="main-window"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        onload="onLoadViewSource();"
-        contenttitlesetting="true"
-        title="&mainWindow.title;" 
-        titlemodifier="&mainWindow.titlemodifier;" 
-        titlepreface="&mainWindow.preface;"
-        titlemenuseparator ="&mainWindow.titlemodifierseparator;"  
-        windowtype="navigator:view-source"
-        width="640" height="480"
-        screenX="10" screenY="10"
-        persist="screenX screenY width height sizemode">
-
-  <commandset id="commands"/>
-  <keyset id="viewSourceKeys"/>
-  <stringbundleset id="viewSource-stringbundleset"/>
-  <popupset id="viewSourceContextSet" />
-
-  <toolbox id="viewSource-toolbox">
-    <menubar id="viewSource-main-menubar">
-      <menu id="menu_File"/>
-      <menu id="menu_Edit"/>
-      <menu id="menu_View">
-        <menupopup id="menu_View_Popup">
-          <menuitem accesskey="&reloadCmd.accesskey;" key="key_reload" label="&reloadCmd.label;" oncommand="BrowserReload();"/>
-          <menuseparator />
-          <menu id="menu_zoom"/>  
-          <menuseparator/>
-<!--      <menuitem key="key_viewInfo" observes="View:PageInfo"
-                    label="&pageInfoCmd.label;" accesskey="&pageInfoCmd.accesskey;"/>
-          <menuseparator id="file_moduleSeparator"/>-->
-          <menu id="charsetMenu"/>
-          <menuitem id="menu_wrapLongLines" type="checkbox" oncommand="wrapLongLines()"
-                    label="&menu_wrapLongLines.title;" accesskey="&menu_wrapLongLines.accesskey;"/>
-          <menuitem type="checkbox" id="menu_highlightSyntax" oncommand="highlightSyntax();"
-                    label="&menu_highlightSyntax.label;" accesskey="&menu_highlightSyntax.accesskey;"/>
-        </menupopup>
-      </menu>
-      <menu id="windowMenu"/>
-      <menu id="menu_Help"/>
-    </menubar>
-  </toolbox>
-
-  <vbox id="appcontent" flex="1"
-       ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);">
-
-    <browser id="content" type="content-primary" name="content" src="about:blank" flex="1"
-             disablesecurity="true" context="viewSourceContextMenu" showcaret="true"/>
-
-  </vbox> 
-
-  <statusbar id="status-bar" class="chromeclass-status">
-    <statusbarpanel id="statusbar-line-col" label="" flex="1"/>
-  </statusbar>
-</window>
deleted file mode 100644
--- a/suite/browser/viewSourceOverlay.xul
+++ /dev/null
@@ -1,189 +0,0 @@
-<?xml version="1.0"?> <!-- -*- Mode: HTML -*- -->
-<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?>
-
-<!-- ***** BEGIN LICENSE BLOCK *****
-   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
-   -
-   - The contents of this file are subject to the Mozilla Public License Version
-   - 1.1 (the "License"); you may not use this file except in compliance with
-   - the License. You may obtain a copy of the License at
-   - http://www.mozilla.org/MPL/
-   -
-   - Software distributed under the License is distributed on an "AS IS" basis,
-   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-   - for the specific language governing rights and limitations under the
-   - License.
-   -
-   - The Original Code is mozilla.org view-source front-end.
-   -
-   - The Initial Developer of the Original Code is
-   - mozilla.org.
-   - Portions created by the Initial Developer are Copyright (C) 2002
-   - the Initial Developer. All Rights Reserved.
-   -
-   - Contributor(s):
-   -   Doron Rosenberg (doronr@naboonline.com)
-   -   Roger B. Sidje (rbs@maths.uq.edu.au)
-   -
-   - Alternatively, the contents of this file may be used under the terms of
-   - either of the GNU General Public License Version 2 or later (the "GPL"),
-   - or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-   - in which case the provisions of the GPL or the LGPL are applicable instead
-   - of those above. If you wish to allow use of your version of this file only
-   - under the terms of either the GPL or the LGPL, and not to allow others to
-   - use your version of this file under the terms of the MPL, indicate your
-   - decision by deleting the provisions above and replace them with the notice
-   - and other provisions required by the GPL or the LGPL. If you do not delete
-   - the provisions above, a recipient may use your version of this file under
-   - the terms of any one of the MPL, the GPL or the LGPL.
-   -
-   - ***** END LICENSE BLOCK ***** -->
-
-<?xul-overlay href="chrome://navigator/content/navigatorOverlay.xul"?>
-
-<!DOCTYPE overlay [
-<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
-%brandDTD;
-<!ENTITY % sourceDTD SYSTEM "chrome://navigator/locale/viewSource.dtd" >
-%sourceDTD;
-<!ENTITY % navigatorDTD SYSTEM "chrome://navigator/locale/navigator.dtd" >
-%navigatorDTD;
-<!ENTITY % contentAreaCommandsDTD SYSTEM "chrome://communicator/locale/contentAreaCommands.dtd" >
-%contentAreaCommandsDTD;
-]>
-
-<overlay id="viewSourceOverlay"
-         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <script type="application/javascript" src="chrome://global/content/nsDragAndDrop.js"/>
-  <script type="application/javascript" src="chrome://communicator/content/contentAreaDD.js"/>
-  <script type="application/javascript" src="chrome://global/content/printUtils.js"/>
-  <script type="application/javascript" src="chrome://navigator/content/browser.js"/>
-  <script type="application/javascript" src="chrome://navigator/content/viewsource.js"/>
-  <script type="application/javascript" src="chrome://communicator/content/findUtils.js"/>
-  <script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
-
-  <commandset id="commands">
-    <commandset id="globalEditMenuItems"/>
-    <commandset id="selectEditMenuItems"/>
-    <commandset id="clipboardEditMenuItems"/>
-    <commandset id="viewSourceMenuItems">
-      <command id="cmd_close" oncommand="ViewSourceClose()"/>
-      <command id="cmd_savePage" oncommand="ViewSourceSavePage();"/>
-      <command id="cmd_editPage" oncommand="ViewSourceEditPage();"/>
-      <command id="cmd_goToLine" oncommand="ViewSourceGoToLine();" disabled="true"/>
-    </commandset>
-  </commandset>
-
-  <stringbundleset id="viewSource-stringbundleset">
-    <stringbundle id="bundle_viewZoom"/>
-    <stringbundle id="findBundle" src="chrome://global/locale/finddialog.properties"/>
-    <stringbundle id="viewSourceBundle" src="chrome://navigator/locale/viewSource.properties"/>
-  </stringbundleset>
-
-  <!-- keys are appended from the overlay -->
-  <keyset id="viewSourceKeys">
-    <!-- File Menu -->
-    <key id="key_newNavigator"/>
-    <key id="key_newBlankPage"/>
-    <key id="key_savePage"     key="&savePageCmd.commandkey;" command="cmd_savePage" modifiers="accel"/>
-    <key id="key_editPage"     key="&editPageCmd.commandkey;" command="Browser:EditPage" modifiers="accel"/>
-    <key id="printKb"          key="&printCmd.commandkey;" command="Browser:Print"  modifiers="accel"/>
-    <key id="key_close"/>
-
-    <!-- Edit Menu -->
-    <key id="key_undo"/>
-    <key id="key_redo"/>
-    <key id="key_cut"/>
-    <key id="key_copy"/>
-    <key id="key_paste"/>
-    <key id="key_delete"/>
-    <key id="key_delete2"/>
-    <key id="key_selectAll"/>
-    <key id="key_goToLine"     key="&goToLineCmd.commandkey;"  command="cmd_goToLine"  modifiers="accel"/>
-    <key id="key_find"         key="&findOnCmd.commandkey;" command="Browser:Find" modifiers="accel"/>
-    <key id="key_findAgain"    key="&findAgainCmd.commandkey;" command="Browser:FindAgain" modifiers="accel"/>
-    <key id="key_findPrev"     key="&findPrevCmd.commandkey;"  command="Browser:FindPrev"  modifiers="accel, shift"/>
-    <key keycode="&findAgainCmd.commandkey2;" command="Browser:FindAgain"/>
-    <key keycode="&findPrevCmd.commandkey2;"  command="Browser:FindPrev"  modifiers="shift"/>
-    <key id="key_findTypeText"/>
-
-    <!-- View Menu -->
-    <key id="key_reload"  key="&reloadCmd.commandkey;" oncommand="BrowserReload();" modifiers="accel"/>
-    <key key="&reloadCmd.commandkey;" oncommand="BrowserReloadSkipCache();" modifiers="accel,shift"/>
-    <keyset id="viewZoomKeys"/>
-
-    <!-- Window Menu -->
-    <keyset id="tasksKeys"/>
-
-    <!-- Context Menu -->
-    <key keycode="VK_BACK" command="Browser:Back"/>
-    <key keycode="VK_BACK" command="Browser:Forward" modifiers="shift"/>
-    <keyset id="navigationKeys"/>
-  </keyset>
-
-  <!-- context menu -->
-  <popupset id="viewSourceContextSet">
-    <popup id="viewSourceContextMenu">
-      <menuitem id="context-back" command="Browser:Back"
-                label="&goBackCmd.label;" accesskey="&goBackCmd.accesskey;"/>
-      <menuitem id="context-forward" command="Browser:Forward"
-                label="&goForwardCmd.label;" accesskey="&goForwardCmd.accesskey;"/>
-      <menuseparator/>
-      <menuitem label="&findNextCmd.label;" accesskey="&findNextCmd.accesskey;"  command="Browser:FindAgain"/>
-      <menuseparator/>
-      <menuitem id="menu_copy_cm" command="cmd_copy"
-                label="&copyCmd.label;" accesskey="&copyCmd.accesskey;"/>
-      <menuseparator/>
-      <menuitem id="menu_selectAll_cm" command="cmd_selectAll"
-                label="&selectAllCmd.label;" accesskey="&selectAllCmd.accesskey;"/>
-    </popup>
-  </popupset>
-
-  <!-- Common menus -->
-      <menu id="menu_File">
-        <menupopup id="filemenu-popup" onpopupshowing="updateSavePageItems();">
-          <menu id="menu_New">
-            <menupopup id="menu_NewPopup">
-              <menuitem id="menu_newNavigator"/>
-              <menuitem id="menu_newEditor"/>
-            </menupopup>
-          </menu>
-          <menuitem id="menu_close"/>
-          <menuseparator/>
-          <menuitem id="savepage" key="key_savePage" command="cmd_savePage"
-                    valueSaveAs="&savePageAsCmd.label;" valueSave="&savePageCmd.label;"
-                    accesskey="&savePageCmd.accesskey;"/>
-          <menuseparator/>
-          <menuitem key="key_editPage" command="cmd_editPage"
-                    label="&editPageCmd.label;" accesskey="&editPageCmd.accesskey;"/>
-          <menuseparator/>
-          <menuitem id="printSetupMenuItem" label="&printSetupCmd.label;" accesskey="&printSetupCmd.accesskey;" command="cmd_printSetup"/>
-          <menuitem label="&printCmd.label;" accesskey="&printCmd.accesskey;" key="printKb" command="Browser:Print"/>
-        </menupopup>
-      </menu>
-
-      <menu id="menu_Edit">
-        <menupopup id="menu_EditPopup">
-          <menuitem id="menu_undo"/>
-          <menuitem id="menu_redo"/>
-          <menuseparator/>
-          <menuitem id="menu_cut"/>
-          <menuitem id="menu_copy"/>
-          <menuitem id="menu_paste"/>
-          <menuitem id="menu_delete"/>
-          <menuseparator/>
-          <menuitem id="menu_selectAll"/>
-          <menuseparator/>
-          <menuitem id="menu_goToLine" key="key_goToLine" command="cmd_goToLine"
-                    label="&goToLineCmd.label;" accesskey="&goToLineCmd.accesskey;"/>
-          <menuitem id="menu_find" key="key_find" command="Browser:Find"
-                    label="&findOnCmd.label;" accesskey="&findOnCmd.accesskey;"/>
-          <menuitem id="menu_findAgain" key="key_findAgain" command="Browser:FindAgain"
-                    label="&findAgainCmd.label;" accesskey="&findAgainCmd.accesskey;"/>
-          <menuitem id="menu_findPrev" key="key_findPrev" command="Browser:FindPrev"
-                    label="&findPrevCmd.label;" accesskey="&findPrevCmd.accesskey;"/>
-          <menuseparator/>
-          <menuitem id="menu_findTypeText"/>
-        </menupopup>
-      </menu>
-</overlay>
deleted file mode 100644
--- a/suite/browser/viewsource.js
+++ /dev/null
@@ -1,694 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Doron Rosenberg (doronr@naboonline.com)
- *   Neil Rashbrook (neil@parkwaycc.co.uk)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-const pageLoaderIface = Components.interfaces.nsIWebPageDescriptor;
-const nsISelectionPrivate = Components.interfaces.nsISelectionPrivate;
-const nsISelectionController = Components.interfaces.nsISelectionController;
-var gBrowser = null;
-var gViewSourceBundle = null;
-var gPrefs = null;
-
-var gLastLineFound = '';
-var gGoToLine = 0;
-
-try {
-  var prefService = Components.classes["@mozilla.org/preferences-service;1"]
-                              .getService(Components.interfaces.nsIPrefService);
-  gPrefs = prefService.getBranch(null);
-} catch (ex) {
-}
-
-var gSelectionListener = {
-  timeout: 0,
-  attached: false,
-  notifySelectionChanged: function(doc, sel, reason)
-  {
-    // Coalesce notifications within 100ms intervals.
-    if (!this.timeout)
-      this.timeout = setTimeout(updateStatusBar, 100);
-  }
-}
-
-var gViewSourceProgressListener = {
-  QueryInterface: function (aIID) {
-    if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
-        aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
-        aIID.equals(Components.interfaces.nsISupports))
-      return this;
-    throw Components.results.NS_NOINTERFACE;
-  },
-
-  onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus) {
-  },
-
-  onProgressChange: function (aWebProgress, aRequest,
-                              aCurSelfProgress, aMaxSelfProgress,
-                              aCurTotalProgress, aMaxTotalProgress) {
-  },
-
-  onLocationChange: function (aWebProgress, aRequest, aLocationURI) {
-    UpdateBackForwardCommands(getBrowser().webNavigation);
-  },
-
-  onStatusChange: function (aWebProgress, aRequest, aStatus, aMessage) {
-  },
-
-  onSecurityChange: function (aWebProgress, aRequest, aState) {
-  }
-}
-
-function onLoadViewSource() 
-{
-  viewSource(window.arguments[0]);
-  document.commandDispatcher.focusedWindow = content;
-}
-
-function getBrowser()
-{
-  if (!gBrowser)
-    gBrowser = document.getElementById("content");
-  return gBrowser;
-}
-
-function getSelectionController()
-{
-  return getBrowser().docShell
-    .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-    .getInterface(Components.interfaces.nsISelectionDisplay)
-    .QueryInterface(nsISelectionController);
-
-}
-
-function getViewSourceBundle()
-{
-  if (!gViewSourceBundle)
-    gViewSourceBundle = document.getElementById("viewSourceBundle");
-  return gViewSourceBundle;
-}
-
-function viewSource(url)
-{
-  if (!url)
-    return false; // throw Components.results.NS_ERROR_FAILURE;
-
-  var viewSrcUrl = "view-source:" + url;
-
-  getBrowser().addEventListener("unload", onUnloadContent, true);
-  getBrowser().addEventListener("load", onLoadContent, true);
-  window.addEventListener("AppCommand", HandleAppCommandEvent, true);
-
-  // Attach the progress listener.
-  getBrowser().addProgressListener(gViewSourceProgressListener,
-      Components.interfaces.nsIWebProgress.NOTIFY_LOCATION);
-
-  var loadFromURL = true;
-  //
-  // Parse the 'arguments' supplied with the dialog.
-  //    arg[0] - URL string.
-  //    arg[1] - Charset value in the form 'charset=xxx'.
-  //    arg[2] - Page descriptor used to load content from the cache.
-  //    arg[3] - Line number to go to.
-  //
-  if ("arguments" in window) {
-    var arg;
-    //
-    // Set the charset of the viewsource window...
-    //
-    if (window.arguments.length >= 2) {
-      arg = window.arguments[1];
-
-      try {
-        if (typeof(arg) == "string" && arg.indexOf('charset=') != -1) {
-          var arrayArgComponents = arg.split('=');
-          if (arrayArgComponents) {
-            //we should "inherit" the charset menu setting in a new window
-            getMarkupDocumentViewer().defaultCharacterSet = arrayArgComponents[1];
-          } 
-        }
-      } catch (ex) {
-        // Ignore the failure and keep processing arguments...
-      }
-    }
-    //
-    // Get any specified line to jump to.
-    //
-    if (window.arguments.length >= 4) {
-      arg = window.arguments[3];
-      gGoToLine = parseInt(arg);
-    }
-    //
-    // Use the page descriptor to load the content from the cache (if
-    // available).
-    //
-    if (window.arguments.length >= 3) {
-      arg = window.arguments[2];
-
-      try {
-        if (typeof(arg) == "object" && arg != null) {
-          var PageLoader = getBrowser().webNavigation.QueryInterface(pageLoaderIface);
-
-          //
-          // Load the page using the page descriptor rather than the URL.
-          // This allows the content to be fetched from the cache (if
-          // possible) rather than the network...
-          //
-          PageLoader.loadPage(arg, pageLoaderIface.DISPLAY_AS_SOURCE);
-
-          // Record the page load in the session history so <back> will work.
-          var shEntrySource = arg.QueryInterface(Components.interfaces.nsISHEntry);
-          var shEntry = Components.classes["@mozilla.org/browser/session-history-entry;1"]
-                                  .createInstance(Components.interfaces.nsISHEntry);
-          shEntry.setURI(makeURI(viewSrcUrl, null, null));
-          shEntry.setTitle(viewSrcUrl);
-          shEntry.loadType = Components.interfaces.nsIDocShellLoadInfo.loadHistory;
-          shEntry.cacheKey = shEntrySource.cacheKey;
-          PageLoader.sessionHistory
-                    .QueryInterface(Components.interfaces.nsISHistoryInternal)
-                    .addEntry(shEntry, true);
-
-          // The content was successfully loaded from the page cookie and
-          // recorded in session history, so we don't need to load via the URL.
-          loadFromURL = false;
-        }
-      } catch(ex) {
-        // Ignore the failure.  The content will be loaded via the URL
-        // that was supplied in arg[0].
-      }
-    }
-  }
-
-  if (loadFromURL) {
-    //
-    // Currently, an exception is thrown if the URL load fails...
-    //
-    var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
-    getBrowser().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)
-        document.getElementById('menu_wrapLongLines').setAttribute("checked", "true");
-    } catch (ex) {
-    }
-    try {
-      document.getElementById("menu_highlightSyntax").setAttribute("checked", gPrefs.getBoolPref("view_source.syntax_highlight"));
-    } catch (ex) {
-    }
-  } else {
-    document.getElementById("menu_highlightSyntax").setAttribute("hidden", "true");
-  }
-
-  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()
-   .QueryInterface(nsISelectionPrivate)
-   .addSelectionListener(gSelectionListener);
-  gSelectionListener.attached = true;
-}
-
-function onUnloadContent()
-{
-  //
-  // Disable "go to line" while reloading due to e.g. change of charset
-  // or toggling of syntax highlighting.
-  //
-  document.getElementById('cmd_goToLine').setAttribute('disabled', 'true');
-
-  // If we're not just unloading the initial "about:blank" which doesn't have
-  // a selection listener, get rid of it so it doesn't try to fire after the
-  // window has gone away.
-  if (gSelectionListener.attached) {
-    window.content.getSelection()
-          .QueryInterface(nsISelectionPrivate)
-          .removeSelectionListener(gSelectionListener);
-    gSelectionListener.attached = false;
-  }
-}
-
-function HandleAppCommandEvent(event)
-{
-  event.stopPropagation();
-  switch (event.command) {
-    case "Back":
-      BrowserBack();
-      break;
-    case "Forward":
-      BrowserForward();
-      break;
-    case "Reload":
-      BrowserReload();
-      break;
-  }
-}
-
-function ViewSourceClose()
-{
-  window.close();
-}
-
-function BrowserBack() {
-  try {
-    getBrowser().goBack();
-  }
-  catch(ex) {
-  }
-}
-
-function BrowserForward() {
-  try {
-    getBrowser().goForward();
-  }
-  catch(ex) {
-  }
-}
-
-function BrowserReload()
-{
-  // Reload will always reload from cache which is probably not what's wanted
-  BrowserReloadSkipCache();
-}
-
-function BrowserReloadSkipCache()
-{
-  const webNavigation = getBrowser().webNavigation;
-  webNavigation.reload(webNavigation.LOAD_FLAGS_BYPASS_PROXY | webNavigation.LOAD_FLAGS_BYPASS_CACHE);
-}
-
-// Strips the |view-source:| for editPage()
-function ViewSourceEditPage()
-{
-  editPage(window.content.location.href.substring(12));
-}
-
-// Strips the |view-source:| for saveURL()
-function ViewSourceSavePage()
-{
-  saveURL(window.content.location.href.substring(12), null, "SaveLinkTitle",
-          false, true);
-}
-
-function ViewSourceGoToLine()
-{
-  var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
-        .getService(Components.interfaces.nsIPromptService);
-  var viewSourceBundle = getViewSourceBundle();
-
-  var input = {value:gLastLineFound};
-  for (;;) {
-    var ok = promptService.prompt(
-        window,
-        viewSourceBundle.getString("goToLineTitle"),
-        viewSourceBundle.getString("goToLineText"),
-        input,
-        null,
-        {value:0});
-
-    if (!ok)
-      return;
-
-    var line = parseInt(input.value, 10);
-
-    if (!(line > 0)) {
-      promptService.alert(window,
-          viewSourceBundle.getString("invalidInputTitle"),
-          viewSourceBundle.getString("invalidInputText"));
-
-      continue;
-    }
-
-    var found = goToLine(line);
-
-    if (found) {
-      break;
-    }
-
-    promptService.alert(window,
-        viewSourceBundle.getString("outOfRangeTitle"),
-        viewSourceBundle.getString("outOfRangeText"));
-  }
-}
-
-function goToLine(line)
-{
-  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;
-  for (var lbound = 0, ubound = viewsource.childNodes.length; ; ) {
-    var middle = (lbound + ubound) >> 1;
-    pre = viewsource.childNodes[middle];
-
-    var firstLine = parseInt(pre.id.substring(4));
-
-    if (lbound == ubound - 1) {
-      break;
-    }
-
-    if (line >= firstLine) {
-      lbound = middle;
-    } else {
-      ubound = middle;
-    }
-  }
-
-  var result = {};
-  var found = findLocation(pre, line, null, -1, false, result);
-
-  if (!found) {
-    return false;
-  }
-
-  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;
-
-  selection.addRange(result.range);
-
-  if (!selection.isCollapsed) {
-    selection.collapseToEnd();
-
-    var offset = result.range.startOffset;
-    var node = result.range.startContainer;
-    if (offset < node.data.length) {
-      // The same text node spans across the "\n", just focus where we were.
-      selection.extend(node, offset);
-    }
-    else {
-      // There is another tag just after the "\n", hook there. We need
-      // to focus a safe point because there are edgy cases such as
-      // <span>...\n</span><span>...</span> vs.
-      // <span>...\n<span>...</span></span><span>...</span>
-      node = node.nextSibling ? node.nextSibling : node.parentNode.nextSibling;
-      selection.extend(node, 0);
-    }
-  }
-
-  var selCon = getSelectionController();
-  selCon.setDisplaySelection(nsISelectionController.SELECTION_ON);
-  selCon.setCaretVisibilityDuringSelection(true);
-
-  // Scroll the beginning of the line into view.
-  selCon.scrollSelectionIntoView(
-    nsISelectionController.SELECTION_NORMAL,
-    nsISelectionController.SELECTION_FOCUS_REGION,
-    true);
-
-  gLastLineFound = line;
-
-  document.getElementById("statusbar-line-col").label = getViewSourceBundle()
-      .getFormattedString("statusBarLineCol", [line, 1]);
-
-  return true;
-}
-
-function updateStatusBar()
-{
-  // Reset the coalesce flag.
-  gSelectionListener.timeout = 0;
-
-  var statusBarField = document.getElementById("statusbar-line-col");
-
-  var selection = window.content.getSelection();
-  if (!selection.focusNode) {
-    statusBarField.label = '';
-    return;
-  }
-  if (selection.focusNode.nodeType != Node.TEXT_NODE) {
-    return;
-  }
-
-  var selCon = getSelectionController();
-  selCon.setDisplaySelection(nsISelectionController.SELECTION_ON);
-  selCon.setCaretVisibilityDuringSelection(true);
-
-  var interlinePosition = selection
-      .QueryInterface(nsISelectionPrivate).interlinePosition;
-
-  var result = {};
-  findLocation(null, -1, 
-      selection.focusNode, selection.focusOffset, interlinePosition, result);
-
-  statusBarField.label = getViewSourceBundle()
-      .getFormattedString("statusBarLineCol", [result.line, result.col]);
-}
-
-//
-// Loops through the text lines in the pre element. The arguments are either
-// (pre, line) or (node, offset, interlinePosition). result is an out
-// argument. If (pre, line) are specified (and node == null), result.range is
-// a range spanning the specified line. If the (node, offset,
-// interlinePosition) are specified, result.line and result.col are the line
-// and column number of the specified offset in the specified node relative to
-// the whole file.
-//
-function findLocation(pre, line, node, offset, interlinePosition, result)
-{
-  if (node && !pre) {
-    //
-    // Look upwards to find the current pre element.
-    //
-    for (pre = node;
-         pre.nodeName != "PRE";
-         pre = pre.parentNode);
-  }
-
-  //
-  // 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.
-  //
-  var curLine = parseInt(pre.id.substring(4));
-
-  //
-  // Walk through each of the text nodes and count newlines.
-  //
-  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;
-  for (var textNode = treewalker.firstChild();
-       textNode && !found;
-       textNode = treewalker.nextNode()) {
-
-    //
-    // \r is not a valid character in the DOM, so we only check for \n.
-    //
-    var lineArray = textNode.data.split(/\n/);
-    var lastLineInNode = curLine + lineArray.length - 1;
-
-    //
-    // Check if we can skip the text node without further inspection.
-    //
-    if (node ? (textNode != node) : (lastLineInNode < line)) {
-      if (lineArray.length > 1) {
-        firstCol = 1;
-      }
-      firstCol += lineArray[lineArray.length - 1].length;
-      curLine = lastLineInNode;
-      continue;
-    }
-
-    //
-    // curPos is the offset within the current text node of the first
-    // character in the current line.
-    //
-    for (var i = 0, curPos = 0;
-         i < lineArray.length;
-         curPos += lineArray[i++].length + 1) {
-
-      if (i > 0) {
-        curLine++;
-      }
-
-      if (node) {
-        if (offset >= curPos && offset <= curPos + lineArray[i].length) {
-          //
-          // If we are right after the \n of a line and interlinePosition is
-          // false, the caret looks as if it were at the end of the previous
-          // line, so we display that line and column instead.
-          //
-          if (i > 0 && offset == curPos && !interlinePosition) {
-            result.line = curLine - 1;
-            var prevPos = curPos - lineArray[i - 1].length;
-            result.col = (i == 1 ? firstCol : 1) + offset - prevPos;
-
-          } else {
-            result.line = curLine;
-            result.col = (i == 0 ? firstCol : 1) + offset - curPos;
-          }
-          found = true;
-
-          break;
-        }
-
-      } else {
-        if (curLine == line && !("range" in result)) {
-          result.range = document.createRange();
-          result.range.setStart(textNode, curPos);
-
-          //
-          // This will always be overridden later, except when we look for
-          // the very last line in the file (this is the only line that does
-          // not end with \n).
-          //
-          result.range.setEndAfter(pre.lastChild);
-
-        } else if (curLine == line + 1) {
-          result.range.setEnd(textNode, curPos - 1);
-          found = true;
-          break;
-        }
-      }
-    }
-  }
-
-  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;
-
-  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  
-  if (gPrefs){
-    try {
-      if (myWrap.className == '') {
-        gPrefs.setBoolPref("view_source.wrap_long_lines", false);
-      }
-      else {
-        gPrefs.setBoolPref("view_source.wrap_long_lines", true);
-      }
-    } catch (ex) {
-    }
-  }
-}
-
-//function to toggle syntax highlighting and set the view_source.syntax_highlight
-//pref to persist the last state
-function highlightSyntax()
-{
-  var highlightSyntaxMenu = document.getElementById("menu_highlightSyntax");
-  var highlightSyntax = (highlightSyntaxMenu.getAttribute("checked") == "true");
-  gPrefs.setBoolPref("view_source.syntax_highlight", highlightSyntax);
-
-  var PageLoader = getBrowser().webNavigation.QueryInterface(pageLoaderIface);
-  PageLoader.loadPage(PageLoader.currentDescriptor, pageLoaderIface.DISPLAY_NORMAL);
-}
-
-// Fix for bug 136322: this function overrides the function in
-// browser.js to call PageLoader.loadPage() instead of BrowserReloadWithFlags()
-function BrowserSetForcedCharacterSet(aCharset)
-{
-  var docCharset = getBrowser().docShell.QueryInterface(
-                            Components.interfaces.nsIDocCharset);
-  docCharset.charset = aCharset;
-  var PageLoader = getBrowser().webNavigation.QueryInterface(pageLoaderIface);
-  PageLoader.loadPage(PageLoader.currentDescriptor, pageLoaderIface.DISPLAY_NORMAL);
-}
-
-function updateSavePageItems()
-{
-  var autoDownload = gPrefs.getBoolPref("browser.download.useDownloadDir");
-  goSetMenuValue("savepage", autoDownload ? "valueSave" : "valueSaveAs");
-}
-
-function UpdateBackForwardCommands(aWebNavigation) {
-  var backBroadcaster = document.getElementById("Browser:Back");
-  var forwardBroadcaster = document.getElementById("Browser:Forward");
-
-  var backDisabled = backBroadcaster.hasAttribute("disabled");
-  var forwardDisabled = forwardBroadcaster.hasAttribute("disabled");
-
-  if (backDisabled == aWebNavigation.canGoBack) {
-    if (backDisabled)
-      backBroadcaster.removeAttribute("disabled");
-    else
-      backBroadcaster.setAttribute("disabled", true);
-  }
-
-  if (forwardDisabled == aWebNavigation.canGoForward) {
-    if (forwardDisabled)
-      forwardBroadcaster.removeAttribute("disabled");
-    else
-      forwardBroadcaster.setAttribute("disabled", true);
-  }
-}
--- a/suite/common/jar.mn
+++ b/suite/common/jar.mn
@@ -1,15 +1,17 @@
 comm.jar:
 % content communicator %content/communicator/ xpcnativewrappers=yes contentaccessible=yes
 % override chrome://global/content/license.html chrome://communicator/content/license.html
 % override chrome://mozapps/content/profile/profileSelection.xul chrome://communicator/content/profile/profileSelection.xul
 % overlay chrome://communicator/content/contentAreaContextOverlay.xul chrome://communicator/content/permissions/imageContextOverlay.xul
 % overlay chrome://navigator/content/navigatorOverlay.xul chrome://communicator/content/permissions/permissionsNavigatorOverlay.xul
 % overlay chrome://global/content/console.xul chrome://communicator/content/consoleOverlay.xul
+% overlay chrome://global/content/viewSource.xul chrome://communicator/content/viewSourceOverlay.xul
+% overlay chrome://global/content/viewPartialSource.xul chrome://communicator/content/viewSourceOverlay.xul
 % overlay chrome://help/content/help.xul chrome://communicator/content/helpOverlay.xul
 % overlay chrome://editor/content/EdAdvancedEdit.xul chrome://communicator/content/helpEditorOverlay.xul
 % overlay chrome://editor/content/EdImageProps.xul chrome://communicator/content/helpEditorOverlay.xul
 % overlay chrome://editor/content/EditorPublish.xul chrome://communicator/content/helpEditorOverlay.xul
 % overlay chrome://editor/content/EditorPublishProgress.xul chrome://communicator/content/helpEditorOverlay.xul
 % overlay chrome://editor/content/EditorPublishSettings.xul chrome://communicator/content/helpEditorOverlay.xul
 % overlay chrome://editor/content/EdLinkProps.xul chrome://communicator/content/helpEditorOverlay.xul
 % overlay chrome://editor/content/EdTableProps.xul chrome://communicator/content/helpEditorOverlay.xul
@@ -73,16 +75,18 @@ comm.jar:
    content/communicator/openLocation.xul
    content/communicator/passwordManager.xul
    content/communicator/printPreviewBindings.xml
    content/communicator/sanitize.xul
    content/communicator/tasksOverlay.js
    content/communicator/tasksOverlay.xul
    content/communicator/utilityOverlay.js
    content/communicator/utilityOverlay.xul
+   content/communicator/viewSourceOverlay.js
+   content/communicator/viewSourceOverlay.xul
    content/communicator/viewZoomOverlay.xul
    content/communicator/viewZoomOverlay.js
 #ifdef XP_MACOSX
    content/communicator/platformBrowserBindings.xul                 (mac/platformBrowserBindings.xul)
    content/communicator/platformEditorBindings.xul                  (mac/platformEditorBindings.xul)
    content/communicator/platformCommunicatorOverlay.xul             (mac/platformCommunicatorOverlay.xul)
 #else
 #ifdef XP_WIN32
--- a/suite/common/nsContextMenu.js
+++ b/suite/common/nsContextMenu.js
@@ -764,18 +764,18 @@ nsContextMenu.prototype = {
     if (aContext == "selection")
       reference = focusedWindow.getSelection();
     else if (aContext == "mathml")
       reference = this.target;
     else
       throw "not reached";
 
     var docUrl = null; // unused (and play nice for fragments generated via XSLT too)
-    window.openDialog("chrome://navigator/content/viewPartialSource.xul",
-                      "_blank", "scrollbars,resizable,chrome,dialog=no",
+    window.openDialog("chrome://global/content/viewPartialSource.xul",
+                      "_blank", "all,dialog=no",
                       docUrl, docCharset, reference, aContext);
   },
 
   // Open new "view source" window with the frame's URL.
   viewFrameSource: function() {
     BrowserViewSourceOfDocument(this.target.ownerDocument);
   },
 
new file mode 100644
--- /dev/null
+++ b/suite/common/viewSourceOverlay.js
@@ -0,0 +1,53 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is SeaMonkey internet suite code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Robert Kaiser <kairo@kairo.at>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+// onload make sure we adapt what's needed for partial source
+window.addEventListener("load", onLoadViewSourceOverlay, false);
+
+function onLoadViewSourceOverlay() {
+  if (/viewPartialSource\.xul$/.test(document.location)) {
+    // disable menu items that don't work since the selection is munged and
+    // the editor doesn't work for MathML
+    document.getElementById('cmd_savePage').setAttribute('disabled', 'true');
+    document.getElementById('cmd_editPage').setAttribute('disabled', 'true');
+  }
+}
+
+// editPage() comes in from editorApplicationOverlay.js
+function ViewSourceEditPage() {
+  editPage(window.content.location.href);
+}
new file mode 100644
--- /dev/null
+++ b/suite/common/viewSourceOverlay.xul
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+
+<!-- ***** BEGIN LICENSE BLOCK *****
+ Version: MPL 1.1/GPL 2.0/LGPL 2.1
+
+ The contents of this file are subject to the Mozilla Public License Version
+ 1.1 (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS" basis,
+ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ for the specific language governing rights and limitations under the
+ License.
+
+ The Original Code is SeaMonkey internet suite code.
+
+ The Initial Developer of the Original Code is
+ Mozilla Foundation.
+ Portions created by the Initial Developer are Copyright (C) 2010
+ the Initial Developer. All Rights Reserved.
+
+ Contributor(s):
+   Robert Kaiser <kairo@kairo.at>
+
+ Alternatively, the contents of this file may be used under the terms of
+ either of the GNU General Public License Version 2 or later (the "GPL"),
+ or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ in which case the provisions of the GPL or the LGPL are applicable instead
+ of those above. If you wish to allow use of your version of this file only
+ under the terms of either the GPL or the LGPL, and not to allow others to
+ use your version of this file under the terms of the MPL, indicate your
+ decision by deleting the provisions above and replace them with the notice
+ and other provisions required by the GPL or the LGPL. If you do not delete
+ the provisions above, a recipient may use your version of this file under
+ the terms of any one of the MPL, the GPL or the LGPL.
+
+ ***** END LICENSE BLOCK ***** -->
+
+<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://communicator/skin/viewSourceOverlay.css" type="text/css"?>
+
+<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
+<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
+<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
+
+<!DOCTYPE overlay [
+
+<!ENTITY % navDTD SYSTEM "chrome://navigator/locale/navigator.dtd">
+%navDTD;
+
+]>
+
+<overlay id="viewSourceOverlay"
+         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <script type="application/javascript"
+          src="chrome://communicator/content/viewSourceOverlay.js"/>
+  <script type="application/javascript"
+          src="chrome://editor/content/editorApplicationOverlay.js"/>
+
+  <window id="viewSource">
+    <commandset id="tasksCommands"/>
+    <command id="cmd_newNavigator"/>
+    <command id="cmd_newEditor"/>
+    <command id="cmd_editPage" oncommand="ViewSourceEditPage();"/>
+  </window>
+
+  <keyset id="viewSourceKeys">
+    <keyset id="tasksKeys"/>
+    <key id="key_newBlankPage"/>
+    <key id="key_newNavigator"/>
+    <key id="key_editPage" key="&editPageCmd.commandkey;"
+         command="Browser:EditPage" modifiers="accel"/>
+  </keyset>
+
+  <menubar id="viewSource-main-menubar"
+           class="chromeclass-menubar"
+           grippytooltiptext="&menuBar.tooltip;">
+    <menu id="menu_file">
+      <menupopup id="filemenu-popup">
+        <menu id="menu_New" position="1">
+          <menupopup id="menu_NewPopup">
+            <menuitem id="menu_newNavigator"/>
+            <menuitem id="menu_newEditor"/>
+          </menupopup>
+        </menu>
+        <menuitem id="menu_editPage" insertafter="menu_savePage"
+                  key="key_editPage" command="cmd_editPage"
+                  label="&editPageCmd.label;"
+                  accesskey="&editPageCmd.accesskey;"/>
+        <menuseparator insertbefore="menu_pageSetup"/>
+      </menupopup>
+    </menu>
+
+    <!-- tasks menu filled from tasksOverlay -->
+    <menu id="tasksMenu"/>
+
+    <!-- window menu filled from tasksOverlay -->
+    <menu id="windowMenu"/>
+
+    <!-- help menu filled from globalOverlay -->
+    <menu id="menu_Help"/>
+  </menubar>
+
+</overlay>
deleted file mode 100644
--- a/suite/locales/en-US/chrome/browser/viewSource.dtd
+++ /dev/null
@@ -1,27 +0,0 @@
-<!-- extracted from content/viewSource.xul -->
-
-<!-- LOCALIZATION NOTE (mainWindow.title) : DONT_TRANSLATE --> 
-<!ENTITY mainWindow.title "&brandShortName;"> 
-<!-- LOCALIZATION NOTE (mainWindow.titlemodifier) : DONT_TRANSLATE --> 
-<!ENTITY mainWindow.titlemodifier "&brandShortName;"> 
-<!-- LOCALIZATION NOTE (mainWindow.titlemodifierseparator) : DONT_TRANSLATE -->
-<!ENTITY mainWindow.titlemodifierseparator " - ">
-<!ENTITY mainWindow.preface "Source of: ">
-
-<!ENTITY viewPartialSourceWindow.title "DOM Source">
-
-<!ENTITY menu_wrapLongLines.title "Wrap Long Lines"> 
-<!ENTITY menu_wrapLongLines.accesskey "W">
-
-<!ENTITY menu_highlightSyntax.label "Syntax Highlighting">
-<!ENTITY menu_highlightSyntax.accesskey "H">
-
-<!ENTITY findNextCmd.label "Find Next">
-<!ENTITY findNextCmd.accesskey "n">
-
-<!ENTITY goToLineCmd.label "Go to Line…">
-<!ENTITY goToLineCmd.accesskey "G">
-<!ENTITY goToLineCmd.commandkey "l">
-
-<!ENTITY printSetupCmd.label "Page Setup…">
-<!ENTITY printSetupCmd.accesskey "u">
deleted file mode 100644
--- a/suite/locales/en-US/chrome/browser/viewSource.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-goToLineTitle     = Go to line
-goToLineText      = Enter line number
-invalidInputTitle = Invalid input
-invalidInputText  = The line number entered is invalid.
-outOfRangeTitle   = Line not found
-outOfRangeText    = The specified line was not found.
-statusBarLineCol  = Line %1$S, Col %2$S
--- a/suite/locales/jar.mn
+++ b/suite/locales/jar.mn
@@ -329,18 +329,16 @@
   locale/@AB_CD@/navigator/metadata.dtd                                     (%chrome/browser/metadata.dtd)
   locale/@AB_CD@/navigator/metadata.properties                              (%chrome/browser/metadata.properties)
   locale/@AB_CD@/navigator/navigator.dtd                                    (%chrome/browser/navigator.dtd)
   locale/@AB_CD@/navigator/navigator.properties                             (%chrome/browser/navigator.properties)
   locale/@AB_CD@/navigator/pageInfo.dtd                                     (%chrome/browser/pageInfo.dtd)
   locale/@AB_CD@/navigator/pageInfo.properties                              (%chrome/browser/pageInfo.properties)
   locale/@AB_CD@/navigator/tabbrowser.dtd                                   (%chrome/browser/tabbrowser.dtd)
   locale/@AB_CD@/navigator/tabbrowser.properties                            (%chrome/browser/tabbrowser.properties)
-  locale/@AB_CD@/navigator/viewSource.dtd                                   (%chrome/browser/viewSource.dtd)
-  locale/@AB_CD@/navigator/viewSource.properties                            (%chrome/browser/viewSource.properties)
   locale/@AB_CD@/navigator-platform/mac/navigator.properties                (%chrome/browser/mac/navigator.properties)
   locale/@AB_CD@/navigator-platform/mac/platformNavigationBindings.dtd      (%chrome/browser/mac/platformNavigationBindings.dtd)
   locale/@AB_CD@/navigator-platform/unix/navigator.properties               (%chrome/browser/unix/navigator.properties)
   locale/@AB_CD@/navigator-platform/unix/platformNavigationBindings.dtd     (%chrome/browser/unix/platformNavigationBindings.dtd)
   locale/@AB_CD@/navigator-platform/win/navigator.properties                (%chrome/browser/win/navigator.properties)
   locale/@AB_CD@/navigator-platform/win/platformNavigationBindings.dtd      (%chrome/browser/win/platformNavigationBindings.dtd)
   locale/@AB_CD@/navigator-region/region.properties                         (%chrome/browser/region.properties)
   locale/@AB_CD@/pippki/pref-certs.dtd                                      (%chrome/common/pref/pref-certs.dtd)
--- a/suite/mailnews/mailCommands.js
+++ b/suite/mailnews/mailCommands.js
@@ -467,17 +467,17 @@ function ViewPageSource(messages)
 
         var mailCharacterSet = "charset=" + msgWindow.mailCharacterSet;
 
         for (var i = 0; i < numMessages; i++)
         {
             // Now, we need to get a URL from a URI
             var url = mailSession.ConvertMsgURIToMsgURL(messages[i], msgWindow);
 
-            window.openDialog( "chrome://navigator/content/viewSource.xul",
+            window.openDialog( "chrome://global/content/viewSource.xul",
                                "_blank", "all,dialog=no", url,
                                mailCharacterSet);
         }
         return true;
     } catch (e) {
         // Couldn't get mail session
         return false;
     }
--- a/suite/mailnews/msgHdrViewOverlay.js
+++ b/suite/mailnews/msgHdrViewOverlay.js
@@ -1155,17 +1155,17 @@ createNewAttachmentInfo.prototype.saveAt
                              false);
 }
 
 createNewAttachmentInfo.prototype.viewAttachment = function viewAttachment()
 {
   var url = this.url;
   if (!this.isExternalAttachment)
     url += "&filename=" + encodeURIComponent(this.displayName);
-  openDialog("chrome://navigator/content/viewSource.xul",
+  openDialog("chrome://global/content/viewSource.xul",
              "_blank", "all,dialog=no", url);
 }
 
 createNewAttachmentInfo.prototype.openAttachment = function openAttachment()
 {
   if (this.contentType == "text/x-moz-deleted")
     return;
 
new file mode 100644
--- /dev/null
+++ b/suite/themes/classic/communicator/viewSourceOverlay.css
@@ -0,0 +1,51 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is SeaMonkey internet suite code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Robert Kaiser <kairo@kairo.at>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* make findbar appear above content */
+#appcontent {
+  -moz-box-direction: reverse;
+}
+
+/* style findbar for being on top */
+#FindToolbar {
+  border-top: none;
+  border-bottom: 2px solid;
+  -moz-border-bottom-colors: ThreeDShadow ThreeDHighlight;
+  padding-top: 1px;
+  padding-bottom: 0px;
+  min-width: 1px;
+}
--- a/suite/themes/classic/jar.mn
+++ b/suite/themes/classic/jar.mn
@@ -51,16 +51,17 @@ classic.jar:
   skin/classic/communicator/brand.css                                   (communicator/brand.css)
   skin/classic/communicator/certError.css                               (communicator/certError.css)
   skin/classic/communicator/dialogs.css                                 (communicator/dialogs.css)
   skin/classic/communicator/communicatorBindings.xml                    (communicator/communicatorBindings.xml)
   skin/classic/communicator/preferences.css                             (communicator/preferences.css)
   skin/classic/communicator/prefpanels.css                              (communicator/prefpanels.css)
   skin/classic/communicator/smileys.css                                 (communicator/smileys.css)
   skin/classic/communicator/tasksOverlay.css                            (communicator/tasksOverlay.css)
+  skin/classic/communicator/viewSourceOverlay.css                       (communicator/viewSourceOverlay.css)
   skin/classic/communicator/bookmarks/bookmark-group.png                (communicator/bookmarks/bookmark-group.png)
   skin/classic/communicator/bookmarks/bookmark-item-dis.png             (communicator/bookmarks/bookmark-item-dis.png)
   skin/classic/communicator/bookmarks/bookmark-item-updated.png         (communicator/bookmarks/bookmark-item-updated.png)
   skin/classic/communicator/bookmarks/bookmark-item.png                 (communicator/bookmarks/bookmark-item.png)
   skin/classic/communicator/bookmarks/bookmarksWindow.css               (communicator/bookmarks/bookmarksWindow.css)
   skin/classic/communicator/bookmarks/home.png                          (communicator/bookmarks/home.png)
   skin/classic/communicator/bookmarks/location-act.gif                  (communicator/bookmarks/location-act.gif)
   skin/classic/communicator/bookmarks/location-dis.gif                  (communicator/bookmarks/location-dis.gif)
new file mode 100644
--- /dev/null
+++ b/suite/themes/modern/communicator/viewSourceOverlay.css
@@ -0,0 +1,41 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is SeaMonkey internet suite code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Robert Kaiser <kairo@kairo.at>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* make findbar appear above content */
+#appcontent {
+  -moz-box-direction: reverse;
+}
--- a/suite/themes/modern/jar.mn
+++ b/suite/themes/modern/jar.mn
@@ -18,16 +18,17 @@ modern.jar:
   skin/modern/communicator/tasksOverlay.css                        (communicator/tasksOverlay.css)
   skin/modern/communicator/button.css                              (communicator/button.css)
   skin/modern/communicator/toolbar.css                             (communicator/toolbar.css)
   skin/modern/communicator/dialogs.css                             (communicator/dialogs.css)
   skin/modern/communicator/helpOverlay.css                         (communicator/helpOverlay.css)
   skin/modern/communicator/smileys.css                             (communicator/smileys.css)
   skin/modern/communicator/communicator.css                        (communicator/communicator.css)
   skin/modern/communicator/aboutSessionRestore.css                 (communicator/aboutSessionRestore.css)
+  skin/modern/communicator/viewSourceOverlay.css                   (communicator/viewSourceOverlay.css)
   skin/modern/communicator/bookmarks/bookmark-folder-closed.gif    (communicator/bookmarks/bookmark-folder-closed.gif)
   skin/modern/communicator/bookmarks/bookmark-folder-dis.gif       (communicator/bookmarks/bookmark-folder-dis.gif)
   skin/modern/communicator/bookmarks/bookmark-folder-open.gif      (communicator/bookmarks/bookmark-folder-open.gif)
   skin/modern/communicator/bookmarks/bookmark-group.gif            (communicator/bookmarks/bookmark-group.gif)
   skin/modern/communicator/bookmarks/bookmark-item-dis.gif         (communicator/bookmarks/bookmark-item-dis.gif)
   skin/modern/communicator/bookmarks/bookmark-item-updated.gif     (communicator/bookmarks/bookmark-item-updated.gif)
   skin/modern/communicator/bookmarks/bookmark-item.gif             (communicator/bookmarks/bookmark-item.gif)
   skin/modern/communicator/bookmarks/bookmarks.css                 (communicator/bookmarks/bookmarks.css)