Bug 988122 - Followup: fix bogus constification code. r=bz
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Mon, 31 Mar 2014 23:54:00 +0900
changeset 176225 3d28b17b283c127474d7e988f9f6dd22d847c1de
parent 176224 b6ac33cce754be166d3974d11061d66e514e740c
child 176226 a6f81133c315c408046affada77f814ec9da7990
push id26516
push userryanvm@gmail.com
push dateMon, 31 Mar 2014 21:14:11 +0000
treeherdermozilla-central@723177fe1452 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs988122
milestone31.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 988122 - Followup: fix bogus constification code. r=bz
dom/contacts/tests/test_migration_chrome.js
toolkit/devtools/tests/unit/test_async-utils.js
--- a/dom/contacts/tests/test_migration_chrome.js
+++ b/dom/contacts/tests/test_migration_chrome.js
@@ -9,28 +9,29 @@ const {classes: Cc, interfaces: Ci, util
 
 let imports = {};
 
 Cu.import("resource://gre/modules/ContactDB.jsm", imports);
 Cu.import("resource://gre/modules/ContactService.jsm", imports);
 Cu.import("resource://gre/modules/Promise.jsm", imports);
 Cu.importGlobalProperties(["indexedDB"]);
 
-// |const| will not work because
-// it will make the Promise object immutable before assigning.
-// Using |let| and Object.freeze() instead.
-let {
+const {
   STORE_NAME,
   SAVED_GETALL_STORE_NAME,
   REVISION_STORE,
   DB_NAME,
   ContactService,
-  Promise
 } = imports;
-Object.freeze(imports);
+// |const| will not work because
+// it will make the Promise object immutable before assigning.
+// Using Object.defineProperty() instead.
+Object.defineProperty(this, "Promise", {
+  value: imports.Promise, writable: false, configurable: false
+});
 
 let DEBUG = false;
 function debug(str) {
   if (DEBUG){
     dump("-*- TestMigrationChromeScript: " + str + "\n");
   }
 }
 
--- a/toolkit/devtools/tests/unit/test_async-utils.js
+++ b/toolkit/devtools/tests/unit/test_async-utils.js
@@ -2,19 +2,21 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test async-utils.js
 
 const {Task} = Cu.import("resource://gre/modules/Task.jsm", {});
 // |const| will not work because
 // it will make the Promise object immutable before assigning.
-// Using |let| and Object.freeze() instead.
-let {Promise} = Cu.import("resource://gre/modules/Promise.jsm", {});
-Object.freeze(Promise);
+// Using Object.defineProperty() instead.
+Object.defineProperty(this, "Promise", {
+  value: Cu.import("resource://gre/modules/Promise.jsm", {}).Promise,
+  writable: false, configurable: false
+});
 const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
 const {async, asyncOnce, promiseInvoke, promiseCall} = require("devtools/async-utils");
 
 function run_test() {
   do_test_pending();
   Task.spawn(function*() {
     for (let helper of [async, asyncOnce]) {
       yield test_async_args(helper);