Created
April 16, 2018 10:51
-
-
Save mozfreddyb/f22e1f1787a96391a5c1c141c473284b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for use within chrome://passwordmgr/content/passwordManager.xul | |
// this is the title of the CSV data | |
var csv = `"hostname", "username", "password"`; | |
// the signons variable already exists when the document is loaded. | |
// looping through all entries, called e. | |
for (var e of signons) { | |
// JSON.stringify properly adds quotes, regardless of what characters the entries. | |
// so for every entry, take e.hostname, e.username, e.passwowrd and turn them into a quoted string | |
// end with a newline | |
csv += `${JSON.stringify(e.hostname)}, ${JSON.stringify(e.username)}, ${JSON.stringify(e.password)}\n` | |
} | |
// get a clipboard object | |
var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"] | |
.getService(Components.interfaces.nsIClipboardHelper); | |
// and copy the csv data into the clipboard | |
clipboard.copyString(csv); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Without comments