Hi.
I’m working on port of XPCOM addon to Addon SDK and to be e10s compliant.
Addon creates global jsPrinSetup object in page script window context, which allow page scripts to perform some printer setting tasks.
If I’m on right way there is recommended most of this calls to be processed from content script parts of add-on.
But unfortunately I can’t use Components.classes in content scripts (may be this is privileged ).
How I can port the following old XPCOM code to add-on SDK?
// aWindow as unsafeWindow
var printSettingsService = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
.getService(Components.interfaces.nsIPrintSettingsService);
var printSettings = printSettingsService.newPrintSettings;
// do changes in print settings
printSettings.headerStrLeft = ‘foo’;
// other adjustements
var WebBrowserPrint = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebBrowserPrint);
webBrowserPrint.print(printSettings);