Bug 1108930 - Part 6: Call WeakMap with new in xpconnect. r=mrbkap
authorTooru Fujisawa <arai_a@mac.com>
Thu, 05 Feb 2015 00:59:15 +0900
changeset 227480 798dc45a56108aea24215de76990d5b406182e6e
parent 227479 94276cdcc5fff760aec3eb59eaf866335ab9360c
child 227481 2c896a4f15ae37b72879bf1c022a87ccb85c5fcc
push id28230
push userryanvm@gmail.com
push dateWed, 04 Feb 2015 19:42:59 +0000
treeherdermozilla-central@3cda3997f45d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1108930
milestone38.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 1108930 - Part 6: Call WeakMap with new in xpconnect. r=mrbkap
js/xpconnect/tests/chrome/test_getweakmapkeys.xul
js/xpconnect/tests/chrome/test_weakmap_keys_preserved.xul
js/xpconnect/tests/mochitest/test_bug655297-1.html
js/xpconnect/tests/mochitest/test_bug655297-2.html
js/xpconnect/tests/mochitest/test_crosscompartment_weakmap.html
js/xpconnect/tests/unit/test_bug856067.js
--- a/js/xpconnect/tests/chrome/test_getweakmapkeys.xul
+++ b/js/xpconnect/tests/chrome/test_getweakmapkeys.xul
@@ -25,22 +25,22 @@ https://bugzilla.mozilla.org/show_bug.cg
   is(Cu.nondeterministicGetWeakMapKeys(11), undefined,
     "nondeterministicGetWeakMapKeys should return undefined for non-objects");
   is(Cu.nondeterministicGetWeakMapKeys({}), undefined,
     "nondeterministicGetWeakMapKeys should return undefined for non-weakmap objects");
   is(Cu.nondeterministicGetWeakMapKeys(null), undefined,
     "nondeterministicGetWeakMapKeys should return undefined for null");
 
   /* return an empty array for an empty WeakMap */
-  let mempty = WeakMap();
+  let mempty = new WeakMap();
   is(Cu.nondeterministicGetWeakMapKeys(mempty).length, 0,
     "nondeterministicGetWeakMapKeys should return empty array for empty weakmap");
 
   /* Test freeing/nonfreeing. */
-  let m = WeakMap();
+  let m = new WeakMap();
   let liveKeys = new Array();
 
   let add_elements = function () {
     let k1 = {};
     m.set(k1, "live1");
     liveKeys.push(k1);
 
     let k2 = {};
--- a/js/xpconnect/tests/chrome/test_weakmap_keys_preserved.xul
+++ b/js/xpconnect/tests/chrome/test_weakmap_keys_preserved.xul
@@ -20,17 +20,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   /** Test for Bug 673468 **/
 
   let Cc = Components.classes;
   let Cu = Components.utils;
   let Ci = Components.interfaces;
 
   let system = Cc["@mozilla.org/systemprincipal;1"].createInstance();
   let sandbox = Cu.Sandbox(system);
-  let map = sandbox.WeakMap();
+  let map = new sandbox.WeakMap();
   let obj = {};
   map.set(obj, {});
 
   Cu.forceGC();
 
   ok(map.has(obj), "Weakmap still contains our wrapper!");
   ]]>
   </script>
--- a/js/xpconnect/tests/mochitest/test_bug655297-1.html
+++ b/js/xpconnect/tests/mochitest/test_bug655297-1.html
@@ -16,17 +16,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
     <form>0</form> <form>1</form> <form>2</form> <form>3</form> <form>4</form>
     <form>5</form> <form>6</form> <form>7</form> <form>8</form> <form>9</form>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 655297 **/
 
-var map = WeakMap();
+var map = new WeakMap();
 function f() {
     var paras = document.getElementsByTagName("form");
     for (var i = 0; i < paras.length; i++)
         map.set(paras[i], "ok");
 }
 function g() {
     var paras = document.getElementsByTagName("form");
     for (var i = 0; i < paras.length; i++) {
--- a/js/xpconnect/tests/mochitest/test_bug655297-2.html
+++ b/js/xpconnect/tests/mochitest/test_bug655297-2.html
@@ -16,17 +16,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
     <p>0</p> <p>1</p> <p>2</p> <p>3</p> <p>4</p>
     <p>5</p> <p>6</p> <p>7</p> <p>8</p> <p>9</p>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 655297 **/
 
-var map = WeakMap();
+var map = new WeakMap();
 function f() {
     var paras = document.getElementsByTagName("p");
     for (var i = 0; i < paras.length; i++)
         map.set(paras[i], "ok");
 }
 function g() {
     var paras = document.getElementsByTagName("p");
     for (var i = 0; i < paras.length; i++) {
--- a/js/xpconnect/tests/mochitest/test_crosscompartment_weakmap.html
+++ b/js/xpconnect/tests/mochitest/test_crosscompartment_weakmap.html
@@ -4,17 +4,17 @@
   <title>Test Cross-Compartment DOM WeakMaps</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <p id="display"></p>
 <script type="application/javascript">
 
-var my_map = WeakMap();
+var my_map = new WeakMap();
 
 function setup() {
   var item = window.frames[0].document.querySelector("body");
 
   my_map.set(item, "success_string");
 
   var rule_fail = false;
   try {
--- a/js/xpconnect/tests/unit/test_bug856067.js
+++ b/js/xpconnect/tests/unit/test_bug856067.js
@@ -1,10 +1,10 @@
 const Cu = Components.utils;
 
 function run_test() {
   var sb = new Cu.Sandbox('http://www.example.com');
-  let w = Cu.evalInSandbox('var w = WeakMap(); w.__proto__ = new Set(); w.foopy = 12; w', sb);
+  let w = Cu.evalInSandbox('var w = new WeakMap(); w.__proto__ = new Set(); w.foopy = 12; w', sb);
   do_check_eq(Object.getPrototypeOf(w), sb.Object.prototype);
   do_check_eq(Object.getOwnPropertyNames(w).length, 0);
   do_check_eq(w.wrappedJSObject.foopy, 12);
   do_check_eq(w.foopy, undefined);
 }