如何从特权代码使用Dom文件API? [英] How do I use the Dom File API from privileged code?
本文介绍了如何从特权代码使用Dom文件API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
File
为: const {File,Services} = Cu.import(' resource://gre/modules/Services.jsm',{});
但 Services.jsm 显然不会导出文件对象。我也试过:
new contentWindow.File(filename)
但是,这给了一个非常描述性的NS_ERROR_FAILURE。
欢迎任何线索,谢谢
解决方案
试试这个:
Cu.importGlobalProperties([ 文件]);
MDN :: Components.utils.importGlobalProperties
I'm working on a restartless firefox addon. Using firefox developer edition v36. The MDN page on the Dom File API claims that you can import File
as:
const {File, Services} = Cu.import('resource://gre/modules/Services.jsm', {});
But Services.jsm clearly does not export a File Object. I also tried:
new contentWindow.File( filename )
But this gives a very descriptive NS_ERROR_FAILURE.
Any clues are welcome, thanks
解决方案
Try this:
Cu.importGlobalProperties(["File"]);
MDN :: Components.utils.importGlobalProperties
这篇关于如何从特权代码使用Dom文件API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文