Script has no authority to require sdk/clipboard

When working on a copy-paste plug-in, one of the files requires sdk/self, sdk/page-mod, and chrome without a problem, but Mozilla asked that we change the code to use the high-level clipboard API instead of the chrome. When I include the line var pageMod = require("sdk/page-mod"); the plug-in does not function. When installing the plug-in, the console logs an Object with the message “Module: ezd-copy-paste/main has no authority to load: sdk/clipboard.”

How do I use the API? I can only find example code like on the API page.

Additionally, I noticed that the API only gives options for plain text, html, and image types instead of using any mimetype. This may be a problem, as we want to use xml as well.

The high level SDK APIs are often more limited than low level APIs. In this case the low level API is nsIClipboard, which has more complete support.

Where are you trying to require sdk/clipboard from? A content script?

When we submitted the app for review, they recommended we use the high level API, but it looks like nsIClipboard will do everything we want to do. Thanks for the recommendation!

It is being called from a content script currently.

After going through the “Using the clipboard”, I’ve realized that this is what we were using before. The problem is that Mozilla asked us not to use chrome, which is necessary to use these low level APIs.

If a high level API will do what you want, then you should use it. If not then use the low level API. Mozilla doesn’t like it, but for now it is still officially supported. One day it probably won’t be. Hopefully they’ll either have an alternative in place or they’ll lose another valuable addon. The addon reviewers, and doubly so the automated validation, have a bad habit of treating things they don’t like as if they are banned - don’t take it as gospel.

None of this answers the original question about authority to load. I’m not likely to be able to answer that as it is about an SDK API that I’ve never used.