Bug 809265 - Update Identity js and jsm modules to use new global object. r=benadida
authorJed Parsons <jparsons@mozilla.com>
Thu, 08 Nov 2012 20:54:13 -0500
changeset 112760 d4a84844aa40d866bcfaea2746ef7d43767551ca
parent 112759 4be5aca0d6cf303e87aa5116ac9cf272bf3fa09f
child 112761 bb8f67c678117b0c3159a3ea6a2f9534546292cd
push id17763
push userryanvm@gmail.com
push dateFri, 09 Nov 2012 01:55:38 +0000
treeherdermozilla-inbound@d4a84844aa40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbenadida
bugs809265
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 809265 - Update Identity js and jsm modules to use new global object. r=benadida
b2g/components/SignInToWebsite.jsm
dom/identity/nsIDService.js
toolkit/identity/IdentityUtils.jsm
toolkit/identity/MinimalIdentity.jsm
toolkit/identity/Sandbox.jsm
toolkit/identity/jwcrypto.jsm
--- a/b2g/components/SignInToWebsite.jsm
+++ b/b2g/components/SignInToWebsite.jsm
@@ -64,17 +64,17 @@
  * (Identity:RP:Watch:OnLogin etc.), and finally, nsDOMIdentity
  * receives these messages and calls the original callback that the
  * Relying Party registered (navigator.id.watch(),
  * navigator.id.request(), or navigator.id.logout()).
  */
 
 "use strict";
 
-const EXPORTED_SYMBOLS = ["SignInToWebsiteController"];
+this.EXPORTED_SYMBOLS = ["SignInToWebsiteController"];
 
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "IdentityService",
@@ -248,17 +248,17 @@ let Pipe = {
  * The controller sits between the IdentityService used by DOMIdentity
  * and a gaia process launches an (invisible) iframe or (visible)
  * trusty UI.  Using an injected js script (identity.js), the
  * controller enables the gaia window to access the persona identity
  * storage in the system cookie jar and send events back via the
  * controller into IdentityService and DOM, and ultimately up to the
  * Relying Party, which is open in a different window context.
  */
-let SignInToWebsiteController = {
+this.SignInToWebsiteController = {
 
   /*
    * Initialize the controller.  To use a different gaia communication pipe,
    * such as when mocking it in tests, pass aOptions.pipe.
    */
   init: function SignInToWebsiteController_init(aOptions) {
     aOptions = aOptions || {};
     this.pipe = aOptions.pipe || Pipe;
--- a/dom/identity/nsIDService.js
+++ b/dom/identity/nsIDService.js
@@ -3,20 +3,21 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
-function IDService() {
+this.IDService = function IDService() {
   this.wrappedJSObject = this;
-}
-IDService.prototype = {
+};
+
+this.IDService.prototype = {
   classID: Components.ID("{baa581e5-8e72-406c-8c9f-dcd4b23a6f82}"),
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
                                          Ci.nsISupportsWeakReference]),
 
   observe: function observe(subject, topic, data) {
     switch (topic) {
       case "app-startup":
--- a/toolkit/identity/IdentityUtils.jsm
+++ b/toolkit/identity/IdentityUtils.jsm
@@ -3,44 +3,44 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // functions common to Identity.jsm and MinimalIdentity.jsm
 
 "use strict";
 
-const EXPORTED_SYMBOLS = ["checkRenamed"];
+this.EXPORTED_SYMBOLS = ["checkDeprecated", "checkRenamed"];
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Logger",
                                   "resource://gre/modules/identity/LogUtils.jsm");
 
 function log(...aMessageArgs) {
   Logger.log.apply(Logger, ["Identity"].concat(aMessageArgs));
 }
 
 function defined(item) {
   return typeof item !== 'undefined';
 }
 
-function checkDeprecated(aOptions, aField) {
+var checkDeprecated = this.checkDeprecated = function checkDeprecated(aOptions, aField) {
   if (defined(aOptions[aField])) {
     log("WARNING: field is deprecated:", aField);
     return true;
   }
   return false;
-}
+};
 
-let checkRenamed = function checkRenamed(aOptions, aOldName, aNewName) {
+this.checkRenamed = function checkRenamed(aOptions, aOldName, aNewName) {
   if (defined(aOptions[aOldName]) &&
       defined(aOptions[aNewName])) {
     let err = "You cannot provide both " + aOldName + " and " + aNewName;
     Logger.reportError(err);
     throw new Error(err);
   }
 
   if (checkDeprecated(aOptions, aOldName)) {
     aOptions[aNewName] = aOptions[aOldName];
     delete(aOptions[aOldName]);
   }
-};
\ No newline at end of file
+};
--- a/toolkit/identity/MinimalIdentity.jsm
+++ b/toolkit/identity/MinimalIdentity.jsm
@@ -10,17 +10,17 @@
  * server-provided app.
  *
  * On b2g, the messages identity-controller-watch, -request, and
  * -logout, are observed by the component SignInToWebsite.jsm.
  */
 
 "use strict";
 
-const EXPORTED_SYMBOLS = ["IdentityService"];
+this.EXPORTED_SYMBOLS = ["IdentityService"];
 
 const Cu = Components.utils;
 const Ci = Components.interfaces;
 const Cc = Components.classes;
 const Cr = Components.results;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
@@ -367,9 +367,9 @@ IDService.prototype = {
       log("ERROR: _fetchWellKnownFile:", err);
       return aCallback("Error");
     };
     req.send(null);
   },
 
 };
 
-let IdentityService = new IDService();
+this.IdentityService = new IDService();
--- a/toolkit/identity/Sandbox.jsm
+++ b/toolkit/identity/Sandbox.jsm
@@ -32,19 +32,19 @@ XPCOMUtils.defineLazyModuleGetter(this,
  *        (function) Callback to be invoked with a Sandbox, when ready.
  */
 this.Sandbox = function Sandbox(aURL, aCallback) {
   // Normalize the URL so the comparison in _makeSandboxContentLoaded works
   this._url = Services.io.newURI(aURL, null, null).spec;
   this._log("Creating sandbox for:", this._url);
   this._createFrame();
   this._createSandbox(aCallback);
-}
+};
 
-Sandbox.prototype = {
+this.Sandbox.prototype = {
 
   /**
    * Use the outer window ID as the identifier of the sandbox.
    */
   get id() {
     return this._frame.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                .getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
   },
--- a/toolkit/identity/jwcrypto.jsm
+++ b/toolkit/identity/jwcrypto.jsm
@@ -121,9 +121,9 @@ jwcryptoClass.prototype = {
       var signedAssertion = headerBytes + "." + payloadBytes + "." + signature;
       return aCallback(null, aCert + "~" + signedAssertion);
     });
   }
 
 };
 
 this.jwcrypto = new jwcryptoClass();
-jwcrypto.ALGORITHMS = ALGORITHMS;
+this.jwcrypto.ALGORITHMS = ALGORITHMS;