Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
remove unnecessary validation type checks in the clipboard module; r=myk
Browse files Browse the repository at this point in the history
  • Loading branch information
mykmelez committed Jan 19, 2011
2 parents 27641da + 43e996e commit b791cdc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/addon-kit/lib/clipboard.js
Expand Up @@ -92,14 +92,14 @@ let clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
exports.set = function(aData, aDataType) {
let options = {
data: aData,
datatype: aDataType || "text/unicode"
datatype: aDataType || "text"
};
options = apiUtils.validateOptions(options, {
data: {
is: ["string"]
},
datatype: {
is: ["null", "undefined", "string"]
is: ["string"]
}
});
Expand Down Expand Up @@ -153,11 +153,11 @@ exports.set = function(aData, aDataType) {

exports.get = function(aDataType) {
let options = {
datatype: aDataType
datatype: aDataType || "text"
};
options = apiUtils.validateOptions(options, {
datatype: {
is: ["null", "undefined", "string"]
is: ["string"]
}
});

Expand All @@ -167,7 +167,7 @@ exports.get = function(aDataType) {
throw new Error("Couldn't set the clipboard due to an internal error " +
"(couldn't create a Transferable object).");

var flavor = aDataType ? fromJetpackFlavor(aDataType) : "text/unicode";
var flavor = fromJetpackFlavor(options.datatype);

// Ensure that the user hasn't requested a flavor that we don't support.
if (!flavor)
Expand Down

0 comments on commit b791cdc

Please sign in to comment.