Fixing Copy Link Name in Firefox 39

The useful Firefox extension Copy Link Name that allows to copy text of a link on a webpage to clipboard has stopped to work in Firefox 39 (this version of the browser is currently available on the “Aurora / Developer Edition” update channel).

Unfortunately, the official support email specified on the extension page on the Mozilla Addons website does not work (messages are returned immediately with the permanent error “user is over quota”), while website of the extension author is just a stub without ability to contact him. However it is possible to fix the extension easily by ourselves.

  1. Open the extensions folder of the Firefox profile folder. To find the path to profile folder, use “Help” → “Troubleshooting information” → “Profile Folder” → “Show Folder”).
  2. Find the {103B2EA2-F063-4273-958D-6B46E5B6F98C}.xpi file.
  3. Unpack the file as a Zip archive into a folder of the same name {103B2EA2-F063-4273-958D-6B46E5B6F98C}, e. g. with the free archiver 7-Zip (right mouse button on the file → “7-Zip” → “Open archive” → “Extract”).
  4. Open in a code editor (e. g. EmEditor) the cln.js file located in the chrome\content\cln subfolder of the folder that the extension has just been unpacked to.
  5. In the CopyLinkSource() method of the CLNOverlay object, replace gContextMenu.linkText() with gContextMenu.link.textContent.

Additionally, we can add removing leading and trailing whitespace of link text to copy via the standard trim() method of the String object:

gContextMenu.link.textContent.trim()

Then remove the original file of the extension from the extensions’ folder in the profile folder, and instead place the folder that contains the extension we have just fixed.

To make browser startup faster, we can again pack contents of the extension folder into a Zip archive, change the file extension from zip to xpi, and, instead of the folder containing the fixed extension, place the archive to the extensions’ folder of the browser, thus just replacing the original extension file.

To prevent replacing our fixed extension version with a new version during an automatic update or automatic restoration of the original extension file by the browser, it makes sense to replace the original GUID of the extension (contents of the em:id element — {103B2EA2-F063-4273-958D-6B46E5B6F98C}) in the install.rdf file with something different, for example: CopyLinkNameFixed@example.com. Note that the folder or the xpi file of the extension must have exactly the same name: CopyLinkNameFixed@example.com.xpi.

Selecting link text without using extensions

By the way, it is possible to copy a part of link text in Firefox under Windows by holding the Alt key while selecting — this is a built-in feature of Firefox available without any extensions.

In Firefox version for Ubuntu, besides the Alt key, the Ctrl key should also be holded down, and it should be released after performing text selection and before releasing the mouse button — otherwise not only text would be selected, but also the link would be opened in a new tab.