test_get_printer_basic_attributes.html (1002B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 5 </head> 6 <body onload="run()"> 7 <script type="application/javascript"> 8 9 SimpleTest.waitForExplicitFinish(); 10 11 async function run() { 12 try { 13 let printerList = Cc["@mozilla.org/gfx/printerlist;1"].getService( 14 Ci.nsIPrinterList 15 ); 16 17 let printers = await printerList.printers; 18 for (let printer of printers) { 19 printer.QueryInterface(Ci.nsIPrinter); 20 info(`Listing basic attributes for ${printer.name}:`); 21 let [supportsDuplex, supportsColor] = await Promise.all([printer.supportsDuplex, printer.supportsColor]); 22 info(`* supportsDuplex: ${supportsDuplex}`); 23 info(`* supportsColor: ${supportsColor}`); 24 } 25 26 ok(true, "Retrieved printer basic attributes successfully."); 27 } catch (e) { 28 ok(false, `Error thrown while retrieving printer basic attributes: ${e}.`); 29 console.error(e); 30 } 31 SimpleTest.finish(); 32 } 33 34 </script> 35 </body> 36 </html>