无权加载:sdk / window / utils(Firefox插件SDK)

时间:2014-03-28 14:01:03

标签: firefox firefox-addon firefox-addon-sdk

在我的Main.js

const { getMostRecentBrowserWindow } = require('sdk/window/utils');
var chromewin = getMostRecentBrowserWindow();
chromewin.PrintUtils.printPreview(chromewin.PrintPreviewListener);

浏览器控制台警告:“模块:... / main无权加载:sdk / window / utils”

2 个答案:

答案 0 :(得分:3)

您的插件包含已损坏或不完整的harness-options.json。使用Addon SDK的新副本重建您的插件,或者(更棘手)手动编辑harness-options.json,以便在requirements部分下列出所有require d个模块。

答案 1 :(得分:1)

嗯,我会尝试这样做:

const { getMostRecentBrowserWindow } = require('sdk/window/utils');
getMostRecentBrowserWindow().PrintUtils.printPreview(getMostRecentBrowserWindow().PrintPreviewListener);

我的猜测是,您在该窗口关闭后尝试使用chromewin引用。