bug839193.js 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. const nsIQuotaManagerService = Components.interfaces.nsIQuotaManagerService;
  5. var gURI = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI("http://localhost", null, null);
  6. function onUsageCallback(request) {}
  7. function onLoad()
  8. {
  9. var quotaManagerService =
  10. Components.classes["@mozilla.org/dom/quota-manager-service;1"]
  11. .getService(nsIQuotaManagerService);
  12. let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
  13. .getService(Components.interfaces.nsIScriptSecurityManager)
  14. .createCodebasePrincipal(gURI, {});
  15. var quotaRequest = quotaManagerService.getUsageForPrincipal(principal,
  16. onUsageCallback);
  17. quotaRequest.cancel();
  18. Components.classes["@mozilla.org/observer-service;1"]
  19. .getService(Components.interfaces.nsIObserverService)
  20. .notifyObservers(window, "bug839193-loaded", null);
  21. }
  22. function onUnload()
  23. {
  24. Components.classes["@mozilla.org/observer-service;1"]
  25. .getService(Components.interfaces.nsIObserverService)
  26. .notifyObservers(window, "bug839193-unloaded", null);
  27. }