在较新的 firefox 附加组件上使用 Blob

Use Blob on newer firefox add-on

This answer 已过时:

let { Cc, Ci, Cu, CC } = require('chrome');
const {Blob, File} = Cu.import("resource://gre/modules/Services.jsm", {});
console.log(typeof Blob);//undefined

如何导入 blob?

Cu.importGlobalProperties(["Blob"]);

这适用于 FF35 之后。旧方法应该适用于 FF34 及更低版本。

相关阅读:https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Language_Bindings/Components.utils.importGlobalProperties