Bug 1147456 - Fix broken copy context menu in Page Info r=Neil a=IanN comm-beta comm-release CLOSED TREE SEAMONKEY_2_35_RELEASE_BRANCH
authorPhilip Chee <philip.chee@gmail.com>
Wed, 15 Apr 2015 13:46:14 +0800
branchSEAMONKEY_2_35_RELEASE_BRANCH
changeset 31168 bcd7bf77142b2370ea52dc4b8c1a8a3ca6309529
parent 31167 4087b73dd4e2d88dc8ae06b52b3153d9cc900052
child 31170 d86b473aa849e15ec0ba6ef65ea68f3eb743556f
push id1
push userclokep@gmail.com
push dateMon, 07 May 2018 22:45:56 +0000
treeherdercomm-esr60@57eacde5ef40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil, IanN
bugs1147456
Bug 1147456 - Fix broken copy context menu in Page Info r=Neil a=IanN comm-beta comm-release CLOSED TREE
suite/browser/pageinfo/pageInfo.js
--- a/suite/browser/pageinfo/pageInfo.js
+++ b/suite/browser/pageinfo/pageInfo.js
@@ -228,24 +228,16 @@ const diskCacheStorage =
               .getService(Components.interfaces.nsICacheStorageService)
               .diskCacheStorage({ isPrivate: opener.gPrivate }, false);
 
 const nsICookiePermission  = Components.interfaces.nsICookiePermission;
 
 const nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;
 const CERTIFICATEDIALOGS_CONTRACTID = "@mozilla.org/nsCertificateDialogs;1"
 
-// clipboard helper
-try {
-  const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
-}
-catch(e) {
-  // do nothing, later code will handle the error
-}
-
 // Interface for image loading content
 const nsIImageLoadingContent = Components.interfaces.nsIImageLoadingContent;
 
 // namespaces, don't need all of these yet...
 const MathMLNS = "http://www.w3.org/1998/Math/MathML";
 const XLinkNS  = "http://www.w3.org/1999/xlink";
 const XULNS    = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 const XMLNS    = "http://www.w3.org/XML/1998/namespace";
@@ -285,17 +277,16 @@ var onProcessElement = [ ];
 
 // These functions are called once when all the elements in all of the target
 // document (and all of its subframes, if any) have been processed
 var onFinished = [ ];
 
 // These functions are called once when the Page Info window is closed.
 var onUnloadRegistry = [ ];
 
-
 /* Called when PageInfo window is loaded.  Arguments are:
  *  window.arguments[0] - (optional) an object consisting of
  *                         - doc: (optional) document to use for source. if not provided,
  *                                the calling window's document will be used
  *                         - initialTab: (optional) id of the inital tab to display
  */
 function onLoadPageInfo()
 {
@@ -1364,22 +1355,21 @@ function getSelectedItems(linksMode)
     }
   }
   
   return text;
 }
 
 function doCopy(isLinkMode)
 {
-  if (!gClipboardHelper)
-    return;
-
   var text = getSelectedItems(isLinkMode);
 
-  gClipboardHelper.copyString(text.join("\n"), gDocument);
+  Components.classes["@mozilla.org/widget/clipboardhelper;1"]
+            .getService(Components.interfaces.nsIClipboardHelper)
+            .copyString(text.join("\n"), gDocument);
 }
 
 function doSelectAll()
 {
   var elem = document.commandDispatcher.focusedElement;
 
   if (elem && "treeBoxObject" in elem)
     elem.view.selection.selectAll();