screenshot.js 860 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict';
  2. /**
  3. Part of Zombie Navigator
  4. Copyright © 2016 Zombie Navigator Developers
  5. @file
  6. @license AGPL-3.0+
  7. */
  8. /*
  9. Zombie script example (= unprivileged)
  10. Do NOT require () this script from the addon code.
  11. */
  12. const {zombie, console} = require('zombie/zombie');
  13. const {openWindow, openPrivateWindow, closeAll} = require('zombie/webbrowser');
  14. const {run, delay} = require('zombie/async');
  15. run(function* () {
  16. let w = yield openPrivateWindow('about:addons');
  17. console.log(w);
  18. console.log(w.uri);
  19. yield w.runScript(function (addonID) {
  20. AddonManager.getAddonByID(
  21. addonID
  22. , addon => {
  23. unsafeWindow.gViewController.commands.cmd_showItemDetails
  24. .doCommand(addon, true);
  25. }
  26. );
  27. }, '@zombie-navigator');
  28. yield delay(3);
  29. console.log(yield w.screenshot());
  30. console.log('Done!');
  31. closeAll();
  32. });
  33. // vim: ts=4 noet ai