在我的Main.js
中const { getMostRecentBrowserWindow } = require('sdk/window/utils');
var chromewin = getMostRecentBrowserWindow();
chromewin.PrintUtils.printPreview(chromewin.PrintPreviewListener);
浏览器控制台警告:“模块:... / main无权加载:sdk / window / utils”
答案 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
引用。