Bug 1577443 - Remove cmd_checkLinks that is unused. r=frg a=frg DONTBUILD
authorIan Neal <iann_cvs@blueyonder.co.uk>
Sun, 01 Sep 2019 15:08:07 +0200
changeset 32291 c773e2fef6cab3d26aaf46c31e6789cfd6f75a22
parent 32290 0349f4cf9c24a9110cae02ea7fba6ad633f5ae53
child 32292 705e72f8d0c4fed7e1f6b5c2d9ddf88139be6ad3
push id214
push userfrgrahl@gmx.net
push dateSun, 01 Sep 2019 13:11:43 +0000
treeherdercomm-esr60@705e72f8d0c4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg, frg
bugs1577443
Bug 1577443 - Remove cmd_checkLinks that is unused. r=frg a=frg DONTBUILD
editor/ui/composer/content/ComposerCommands.js
editor/ui/composer/content/editorOverlay.xul
editor/ui/dialogs/content/EdLinkChecker.js
editor/ui/dialogs/content/EdLinkChecker.xul
editor/ui/jar.mn
editor/ui/locales/en-US/chrome/dialogs/EdLinkChecker.dtd
editor/ui/locales/jar.mn
suite/extensions/debugQA/content/debugQAEditorOverlay.xul
suite/extensions/debugQA/locales/en-US/debugQAEditorOverlay.dtd
--- a/editor/ui/composer/content/ComposerCommands.js
+++ b/editor/ui/composer/content/ComposerCommands.js
@@ -89,17 +89,16 @@ function SetupTextEditorCommands()
 
   commandTable.registerCommand("cmd_findReplace",nsFindReplaceCommand);
   commandTable.registerCommand("cmd_find",       nsFindCommand);
   commandTable.registerCommand("cmd_findNext",   nsFindAgainCommand);
   commandTable.registerCommand("cmd_findPrev",   nsFindAgainCommand);
   commandTable.registerCommand("cmd_rewrap",     nsRewrapCommand);
   commandTable.registerCommand("cmd_spelling",   nsSpellingCommand);
   commandTable.registerCommand("cmd_validate",   nsValidateCommand);
-  commandTable.registerCommand("cmd_checkLinks", nsCheckLinksCommand);
   commandTable.registerCommand("cmd_insertChars", nsInsertCharsCommand);
 }
 
 function SetupComposerWindowCommands()
 {
   // Don't need to do this if already done
   if (gComposerWindowControllerID)
     return;
@@ -2406,32 +2405,16 @@ var nsValidateCommand =
     }
   },
   validateFilePageLoaded: function(event)
   {
     event.target.forms[0].uploaded_file.value = URL2Validate;
   }
 };
 
-var nsCheckLinksCommand =
-{
-  isCommandEnabled: function(aCommand, dummy)
-  {
-    return (IsDocumentEditable());
-  },
-
-  getCommandStateParams: function(aCommand, aParams, aRefCon) {},
-  doCommandParams: function(aCommand, aParams, aRefCon) {},
-
-  doCommand: function(aCommand)
-  {
-    window.openDialog("chrome://editor/content/EdLinkChecker.xul","_blank", "chrome,close,titlebar,modal");
-  }
-};
-
 //-----------------------------------------------------------------------------------
 var nsFormCommand =
 {
   isCommandEnabled: function(aCommand, dummy)
   {
     return (IsDocumentEditable() && IsEditingRenderedHTML());
   },
 
--- a/editor/ui/composer/content/editorOverlay.xul
+++ b/editor/ui/composer/content/editorOverlay.xul
@@ -175,17 +175,16 @@
     <command id="cmd_delete"/>
     <command id="cmd_selectAll"/>
     <command id="cmd_preferences"   oncommand="goDoCommand('cmd_preferences')"/>
     <command id="cmd_findReplace"   oncommand="goDoCommand('cmd_findReplace')"/>
     <command id="cmd_find"          oncommand="goDoCommand('cmd_find')"/>
     <command id="cmd_findNext"      oncommand="goDoCommand('cmd_findNext');"/>
     <command id="cmd_findPrev"      oncommand="goDoCommand('cmd_findPrev');"/>
     <command id="cmd_spelling"      oncommand="goDoCommand('cmd_spelling')"/>
-    <command id="cmd_checkLinks"    oncommand="goDoCommand('cmd_checkLinks')"/>
     <command id="cmd_pasteQuote"
              label="&pasteAsQuotationCmd.label;"
              accesskey="&pasteAsQuotationCmd.accesskey;"
              oncommand="goDoCommand('cmd_pasteQuote');"/>
   </commandset>
 
   <!-- style related commands that update on creation, and on selection change -->
   <commandset id="composerStyleMenuItems"
deleted file mode 100644
--- a/editor/ui/dialogs/content/EdLinkChecker.js
+++ /dev/null
@@ -1,193 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// Variables used across all the links being checked:
-var gNumLinksToCheck = 0;     // The number of nsILinkCheckers
-var gLinksBeingChecked = [];  // Array of nsIURICheckers
-var gURIRefObjects = [];      // Array of nsIURIRefObjects
-var gNumLinksCalledBack = 0;
-var gStartedAllChecks = false;
-var gLinkCheckTimerID = 0;
-
-// Implement nsIRequestObserver:
-var gRequestObserver =
-{
-  // urichecker requires that we have an OnStartRequest even tho it's a nop.
-  onStartRequest: function(request, ctxt) { },
-
-  // onStopRequest is where we really handle the status.
-  onStopRequest: function(request, ctxt, status)
-  {
-    var linkChecker = request.QueryInterface(Ci.nsIURIChecker);
-    if (linkChecker)
-    {
-      gNumLinksCalledBack++;
-      linkChecker.status = status;
-      for (var i = 0; i < gNumLinksCalledBack; i++)
-      {
-        if (linkChecker == gLinksBeingChecked[i])
-          gLinksBeingChecked[i].status = status;
-      }
-
-      if (gStartedAllChecks && gNumLinksCalledBack >= gNumLinksToCheck)
-      {
-        clearTimeout(gLinkCheckTimerID);
-        LinkCheckTimeOut();
-      }
-    }
-  }
-}
-
-function Startup()
-{
-  var editor = GetCurrentEditor();
-  if (!editor)
-  {
-    window.close();
-    return;
-  }
-
-  // Get all objects that refer to other locations
-  var objects;
-  try {
-    objects = editor.getLinkedObjects();
-  } catch (e) {}
-
-  if (!objects || objects.length == 0)
-  {
-    Services.prompt.alert(window, GetString("Alert"), GetString("NoLinksToCheck"));
-    window.close();
-    return;
-  }
-
-  gDialog.LinksList = document.getElementById("LinksList");
-
-  // Set window location relative to parent window (based on persisted attributes)
-  SetWindowLocation();
-
-  // Loop over the nodes that have links:
-  for (let i = 0; i < objects.length; i++)
-  {
-    let refobj = objects.queryElementAt(gNumLinksToCheck,
-                                        Ci.nsIURIRefObject);
-    // Loop over the links in this node:
-    if (refobj)
-    {
-      try {
-        var uri;
-        while ((uri = refobj.GetNextURI()))
-        {
-          // Use the real class in netlib:
-          // Note that there may be more than one link per refobj
-          gURIRefObjects[gNumLinksToCheck] = refobj;
-
-          // Make a new nsIURIChecker
-          gLinksBeingChecked[gNumLinksToCheck]
-            = Cc["@mozilla.org/network/urichecker;1"]
-                .createInstance()
-                  .QueryInterface(Ci.nsIURIChecker);
-          // XXX uri creation needs to be localized
-          gLinksBeingChecked[gNumLinksToCheck].init(GetIOService().newURI(uri));
-          gLinksBeingChecked[gNumLinksToCheck].asyncCheck(gRequestObserver, null);
-
-          // Add item
-          let linkChecker = gLinksBeingChecked[gNumLinksToCheck]
-                            .QueryInterface(Ci.nsIURIChecker);
-          SetItemStatus(linkChecker.name, "busy");
-          dump(" *** Linkcount = "+gNumLinksToCheck+"\n");
-          gNumLinksToCheck++;
-        }
-      } catch (e) { dump (" *** EXCEPTION\n"); }
-    }
-  }
-  // Done with the loop, now we can be prepared for the finish:
-  gStartedAllChecks = true;
-
-  // Start timer to limit how long we wait for link checking
-  gLinkCheckTimerID = setTimeout(LinkCheckTimeOut, 5000);
-  window.sizeToContent();
-}
-
-function LinkCheckTimeOut()
-{
-  // We might have gotten here via a late timeout
-  if (gNumLinksToCheck <= 0)
-    return;
-  gLinkCheckTimerID = 0;
-
-  gNumLinksToCheck = 0;
-  gStartedAllChecks = false;
-  for (var i=0; i < gLinksBeingChecked.length; i++)
-  {
-    var linkChecker = gLinksBeingChecked[i].QueryInterface(Ci.nsIURIChecker);
-    // nsIURIChecker status values:
-    // NS_BINDING_SUCCEEDED     link is valid
-    // NS_BINDING_FAILED        link is invalid (gave an error)
-    // NS_BINDING_ABORTED       timed out, or cancelled
-    switch (linkChecker.status)
-    {
-      case 0:           // NS_BINDING_SUCCEEDED
-        SetItemStatus(linkChecker.name, "done");
-        break;
-      case 0x804b0001:  // NS_BINDING_FAILED
-        dump(">> " + linkChecker.name + " is broken\n");
-      case 0x804b0002:   // NS_BINDING_ABORTED
-//        dump(">> " + linkChecker.name + " timed out\n");
-      default:
-//        dump(">> " + linkChecker.name + " not checked\n");
-        SetItemStatus(linkChecker.name, "failed");
-        break;
-    }
-  }
-}
-
-// Add url to list of links to check
-// or set status for file already in the list
-// Returns true if url was in the list
-function SetItemStatus(url, status)
-{
-  if (!url)
-    return false;
-
-  if (!status)
-    status = "busy";
-
-  // Just set attribute for status icon 
-  // if we already have this url 
-  let listitem = document.querySelector('listitem[label="' + url + '"]');
-  if (listitem)
-  {
-    listitem.setAttribute("progress", status);
-    return true;
-  }
-
-  // We're adding a new item to list
-  listitem = document.createElementNS(XUL_NS, "listitem");
-  if (listitem)
-  {
-    listitem.setAttribute("class", "listitem-iconic progressitem");
-    // This triggers CSS to show icon for each status state
-    listitem.setAttribute("progress", status);
-    listitem.setAttribute("label", url);
-    gDialog.LinksList.appendChild(listitem);
-  }
-  return false;
-}
-
-function onAccept()
-{
-  SaveWindowLocation();
-  return true; // do close the window
-}
-
-function onCancelLinkChecker()
-{
-  if (gLinkCheckTimerID)
-    clearTimeout(gLinkCheckTimerID);
-
-/*
-  LinkCheckTimeOut();
-*/
-  return onCancel();
-}
deleted file mode 100644
--- a/editor/ui/dialogs/content/EdLinkChecker.xul
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<?xml-stylesheet href="chrome://editor/skin/editor.css" type="text/css"?>
-<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
-
-<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?> 
-
-<!DOCTYPE dialog SYSTEM "chrome://editor/locale/EdLinkChecker.dtd">
-<!-- dialog containing a control requiring initial setup -->
-<dialog title="&windowTitle.label;"
-    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-    onload="Startup()"
-    buttonlabelcancel="&closeButton.label;"
-    ondialogaccept="return onAccept();"
-    ondialogcancel="return onCancelLinkChecker();">
-
-  <!-- Methods common to all editor dialogs -->
-  <script type="application/javascript" src="chrome://editor/content/editorUtilities.js"/>
-  <script type="application/javascript" src="chrome://editor/content/EdDialogCommon.js"/>
-  <script type="application/javascript" src="chrome://editor/content/EdLinkChecker.js"/>
-
-  <spacer id="location" offsetY="50" persist="offsetX offsetY"/>
-  <broadcaster id="args" value=""/>
-
-  <listbox rows="8" id="LinksList" class="MinWidth20" flex="1"/>
-  <hbox align="center">
-    <spacer class="bigspacer"/>
-    <image class="progressitem" progress="done"/>
-    <label value="&succeeded.label;"/>
-    <spacer class="bigspacer"/>
-    <spacer class="bigspacer"/>
-    <image class="progressitem" progress="failed"/>
-    <label value="&failed.label;"/>
-  </hbox>
-  <separator class="groove"/>
-</dialog>
--- a/editor/ui/jar.mn
+++ b/editor/ui/jar.mn
@@ -195,18 +195,16 @@ comm.jar:
       content/editor/images/tag-td.gif                         (composer/content/images/tag-td.gif)
       content/editor/images/tag-th.gif                         (composer/content/images/tag-th.gif)
       content/editor/images/tag-tr.gif                         (composer/content/images/tag-tr.gif)
       content/editor/images/tag-tt.gif                         (composer/content/images/tag-tt.gif)
       content/editor/images/tag-u.gif                          (composer/content/images/tag-u.gif)
       content/editor/images/tag-ul.gif                         (composer/content/images/tag-ul.gif)
       content/editor/images/tag-var.gif                        (composer/content/images/tag-var.gif)
       content/editor/images/tag-userdefined.gif                (composer/content/images/tag-userdefined.gif)
-      content/editor/EdLinkChecker.xul                         (dialogs/content/EdLinkChecker.xul)
-      content/editor/EdLinkChecker.js                          (dialogs/content/EdLinkChecker.js)
       content/editor/EdSnapToGrid.xul                          (dialogs/content/EdSnapToGrid.xul)
       content/editor/EdSnapToGrid.js                           (dialogs/content/EdSnapToGrid.js)
       content/editor/EditConflict.xul                          (dialogs/content/EditConflict.xul)
       content/editor/EditConflict.js                           (dialogs/content/EditConflict.js)
       content/editor/EditorSaveAsCharset.xul                   (dialogs/content/EditorSaveAsCharset.xul)
       content/editor/EditorSaveAsCharset.js                    (dialogs/content/EditorSaveAsCharset.js)
       content/editor/EditorPublish.xul                         (dialogs/content/EditorPublish.xul)
       content/editor/EditorPublish.js                          (dialogs/content/EditorPublish.js)
deleted file mode 100644
--- a/editor/ui/locales/en-US/chrome/dialogs/EdLinkChecker.dtd
+++ /dev/null
@@ -1,9 +0,0 @@
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<!-- Window title -->
-<!ENTITY windowTitle.label     "Check Image and Link Locations">
-<!ENTITY succeeded.label       "Succeeded">
-<!ENTITY failed.label          "Failed">
-<!ENTITY closeButton.label     "Close">
--- a/editor/ui/locales/jar.mn
+++ b/editor/ui/locales/jar.mn
@@ -41,17 +41,16 @@
 @AB_CD@.jar:
 % locale editor-region @AB_CD@ %locale/@AB_CD@/editor-region/
   locale/@AB_CD@/editor/editor.dtd                           (%chrome/composer/editor.dtd)
   locale/@AB_CD@/editor/editingOverlay.dtd                   (%chrome/composer/editingOverlay.dtd)
   locale/@AB_CD@/editor/editorPrefsOverlay.dtd               (%chrome/composer/editorPrefsOverlay.dtd)
   locale/@AB_CD@/editor/pref-toolbars.dtd                    (%chrome/composer/pref-toolbars.dtd)
   locale/@AB_CD@/editor/pref-editing.dtd                     (%chrome/composer/pref-editing.dtd)
   locale/@AB_CD@/editor/pref-composer.dtd                    (%chrome/composer/pref-composer.dtd)
-  locale/@AB_CD@/editor/EdLinkChecker.dtd                    (%chrome/dialogs/EdLinkChecker.dtd)
   locale/@AB_CD@/editor/EditorPageProperties.dtd             (%chrome/dialogs/EditorPageProperties.dtd)
   locale/@AB_CD@/editor/EditorSnapToGrid.dtd                 (%chrome/dialogs/EditorSnapToGrid.dtd)
   locale/@AB_CD@/editor/EditConflict.dtd                     (%chrome/dialogs/EditConflict.dtd)
   locale/@AB_CD@/editor/EditorSaveAsCharset.dtd              (%chrome/dialogs/EditorSaveAsCharset.dtd)
   locale/@AB_CD@/editor/EditorPublish.dtd                    (%chrome/dialogs/EditorPublish.dtd)
   locale/@AB_CD@/editor/EditorPublishProgress.dtd            (%chrome/dialogs/EditorPublishProgress.dtd)
   locale/@AB_CD@/editor-region/region.properties             (%chrome/region/region.properties)
 #endif
--- a/suite/extensions/debugQA/content/debugQAEditorOverlay.xul
+++ b/suite/extensions/debugQA/content/debugQAEditorOverlay.xul
@@ -31,18 +31,16 @@
                   key="pastequotationkb"
                   command="cmd_pasteQuote"/>
         <menuitem label="&editRewrapCmd.label;"
                   oncommand="try { GetCurrentEditor().rewrap(true); } catch (e) {}"/>
         <menuitem label="&editStripQuotesCmd.label;"
                   oncommand="try { GetCurrentEditor().stripCites(); } catch (e) {}"/>
         <menuitem label="&insertTextCmd.label;"
                   oncommand="EditorInsertText('All good things come to those who wait. ')"/>
-        <menuitem id="menu_checkLinks" observes="cmd_checkLinks"
-                  label="&checkLinksCmd.label;"/>
         <menuseparator/>
         <menu accesskey="&insertFormMenu.accesskey;" id="insertFormMenu"
               label="&insertFormMenu.label;">
           <menupopup>
             <menuitem accesskey="&insertFormCmd.accesskey;" command="cmd_form"
                       label="&insertFormCmd.label;"/>
             <menuseparator/>
             <menuitem accesskey="&insertInputTagCmd.accesskey;"
--- a/suite/extensions/debugQA/locales/en-US/debugQAEditorOverlay.dtd
+++ b/suite/extensions/debugQA/locales/en-US/debugQAEditorOverlay.dtd
@@ -30,17 +30,16 @@
 <!ENTITY setFocusCmd.label "Set Focus">
 
 <!-- Text editor values -->
 <!ENTITY textEditorWindow.titlemodifier "Text Editor">
 
 <!ENTITY statusText.label "Done loading page">
 <!ENTITY editStripQuotesCmd.label "Strip Quotes">
 <!ENTITY editRewrapCmd.label "Rewrap">
-<!ENTITY checkLinksCmd.label "Check Links">
 <!ENTITY insertFormMenu.label "Form">
 <!ENTITY insertFormMenu.accesskey "F">
 <!ENTITY insertFormCmd.label "Define Form…">
 <!ENTITY insertFormCmd.accesskey "D">
 <!ENTITY insertInputTagCmd.label "Form Field…">
 <!ENTITY insertInputTagCmd.accesskey "e">
 <!ENTITY insertInputImageCmd.label "Form Image…">
 <!ENTITY insertInputImageCmd.accesskey "I">