aboutsummaryrefslogtreecommitdiffstats
path: root/lib/clipboard.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-06-15 15:35:32 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-06-15 15:35:32 +0200
commit5e5bf56f7be019478741a571aa433ff34f7ac928 (patch)
treee793792199cf1c052b7ce9b54f94b28ee7b97055 /lib/clipboard.js
parentad87ad529947e29adbee0dc2016069b71495a609 (diff)
parent67bdce8805063717bfdbc449e5d8974f32f288a2 (diff)
downloadbugzilla-triage-5e5bf56f7be019478741a571aa433ff34f7ac928.tar.gz
Merged in r187.
Diffstat (limited to 'lib/clipboard.js')
-rw-r--r--lib/clipboard.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/clipboard.js b/lib/clipboard.js
index e5b4ac8..b87c477 100644
--- a/lib/clipboard.js
+++ b/lib/clipboard.js
@@ -14,9 +14,8 @@
// https://wiki.mozilla.org/Labs/Jetpack/JEP/10
function getClipboard() {
- const kClipboardContractID = "@mozilla.org/widget/clipboard;1";
- const kClipboardIID = Ci.nsIClipboard;
- var clip = Cc[kClipboardContractID].getService(kClipboardIID);
+ var clip = Cc["@mozilla.org/widget/clipboard;1"].
+ getService(Ci.nsIClipboard);
if (!clip) {
throw new Error("No access to the clipboard!");
}
@@ -24,9 +23,8 @@ function getClipboard() {
}
function createTransferable() {
- const kTransferableContractID = "@mozilla.org/widget/transferable;1";
- const kTransferableIID = Ci.nsITransferable
- var trans = Cc[kTransferableContractID].createInstance(kTransferableIID);
+ var trans = Cc["@mozilla.org/widget/transferable;1"].
+ createInstance(Ci.nsITransferable);
if (!trans) {
throw new Error("No access to the transfer object during the set of clipboard!");
}
@@ -102,6 +100,7 @@ var setMethod = exports.set = function setMethod(content, flavor) {
trans.setTransferData(mimeType, stuff, content.length * 2);
clip.setData(trans, null, clip.kGlobalClipboard);
+ return true;
};
function createSupportsWString() {
@@ -118,11 +117,13 @@ var flavorsMethod = exports.getCurrentFlavors = function flavorsMethod() {
"text/plain": "plain",
"text/html": "html"
};
- var flavourArray = createSupportsArray();
+ var flavourArray = [];
for (mime in possibleTypes) {
var kSuppString = createSupportsWString();
kSuppString.data = mime;
- flavourArray.AppendElement(kSuppString);
+ // FIXME Missing some kind of if (mime in flavors) ...
+ flavourArray.add(possibleTypes[mime]);
}
+ return flavourArray;
};