Bug 1250191 - Load 3rd party lazily, r=MattN draft
authorMathieu Leplatre <mathieu@mozilla.com>
Fri, 15 Apr 2016 17:19:37 +0200
changeset 352079 31c3377daf3a90ea48df6b74f89a3177b2da1889
parent 349406 70f18c8eb9a85f6262baaf78697bad36fc4d72b1
child 352656 81d4b653d6208db00c8db927177c4474b6b6544e
push id15604
push usermleplatre@mozilla.com
push dateFri, 15 Apr 2016 16:02:26 +0000
reviewersMattN
bugs1250191
milestone48.0a1
Bug 1250191 - Load 3rd party lazily, r=MattN MozReview-Commit-ID: 8s8U0hCyM8C
services/common/canonical-json.js
services/common/tests/unit/test_canonicaljson.js
--- a/services/common/canonical-json.js
+++ b/services/common/canonical-json.js
@@ -1,17 +1,19 @@
 /* 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/. */
 
-const {utils: Cu} = Components;
-
 this.EXPORTED_SYMBOLS = ["CanonicalJSON"];
 
-Cu.import("resource://gre/modules/third_party/jsesc/jsesc.js");
+const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "jsesc",
+                                  "resource://gre/modules/third_party/jsesc/jsesc.js");
 
 this.CanonicalJSON = {
   /**
    * Return the canonical JSON form of the passed source, sorting all the object
    * keys recursively.
    *
    * @param source
    *        The elements to be serialized.
--- a/services/common/tests/unit/test_canonicaljson.js
+++ b/services/common/tests/unit/test_canonicaljson.js
@@ -1,11 +1,8 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
 const { CanonicalJSON } = Cu.import("resource://services-common/canonical-json.js");
 
 function stringRepresentation(obj) {
   const clone = JSON.parse(JSON.stringify(obj));
   return JSON.stringify(clone);
 }
 
 add_task(function* test_canonicalJSON_should_preserve_array_order() {