Bug 1108930 - Part 5: Call Map and Set with new in devtools. r=fitzgen

This commit is contained in:
Tooru Fujisawa 2015-02-05 00:59:15 +09:00
parent 30b2ce0209
commit 29b35296cd
6 changed files with 15 additions and 15 deletions

View File

@ -28,7 +28,7 @@ const { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {})
this.EXPORTED_SYMBOLS = ["BrowserToolboxProcess"];
let processes = Set();
let processes = new Set();
/**
* Constructor for creating a process that will hold a chrome toolbox.

View File

@ -2116,7 +2116,7 @@ Scope.prototype = {
// Creating maps and arrays thousands of times for variables or properties
// with a large number of children fills up a lot of memory. Make sure
// these are instantiated only if needed.
DevToolsUtils.defineLazyPrototypeGetter(Scope.prototype, "_store", Map);
DevToolsUtils.defineLazyPrototypeGetter(Scope.prototype, "_store", () => new Map());
DevToolsUtils.defineLazyPrototypeGetter(Scope.prototype, "_enumItems", Array);
DevToolsUtils.defineLazyPrototypeGetter(Scope.prototype, "_nonEnumItems", Array);

View File

@ -617,7 +617,7 @@ Item.prototype = {
// Creating maps thousands of times for widgets with a large number of children
// fills up a lot of memory. Make sure these are instantiated only if needed.
DevToolsUtils.defineLazyPrototypeGetter(Item.prototype, "_itemsByElement", Map);
DevToolsUtils.defineLazyPrototypeGetter(Item.prototype, "_itemsByElement", () => new Map());
/**
* Some generic Widget methods handling Item instances.

View File

@ -97,16 +97,16 @@ function markGCType(typeName, child, why, depth, ptrdness)
if (depth == 0) {
if (!(typeName in gcTypes))
gcTypes[typeName] = Set();
gcTypes[typeName] = new Set();
gcTypes[typeName].add(why);
} else if (depth == 1) {
if (!(typeName in gcPointers))
gcPointers[typeName] = Set();
gcPointers[typeName] = new Set();
gcPointers[typeName].add(why);
}
if (!(typeName in gcFields))
gcFields[typeName] = Map();
gcFields[typeName] = new Map();
gcFields[typeName].set(why, [ child, ptrdness ]);
if (typeName in structureParents) {
@ -148,7 +148,7 @@ addGCPointer('JS::AutoCheckCannotGC');
function explain(csu, indent, seen) {
if (!seen)
seen = Set();
seen = new Set();
seen.add(csu);
if (!(csu in gcFields))
return;

View File

@ -121,7 +121,7 @@ function test_find_actors() {
// All breakpoints
let bpSet = Set(bps);
let bpSet = new Set(bps);
for (let bp of bpStore.findActors()) {
bpSet.delete(bp);
}
@ -130,7 +130,7 @@ function test_find_actors() {
// Breakpoints by URL
bpSet = Set(bps.filter(bp => { return bp.sourceActor.actorID === "actor1" }));
bpSet = new Set(bps.filter(bp => { return bp.sourceActor.actorID === "actor1" }));
for (let bp of bpStore.findActors({ sourceActor: { actorID: "actor1" } })) {
bpSet.delete(bp);
}
@ -139,7 +139,7 @@ function test_find_actors() {
// Breakpoints by URL and line
bpSet = Set(bps.filter(bp => { return bp.sourceActor.actorID === "actor1" && bp.line === 10; }));
bpSet = new Set(bps.filter(bp => { return bp.sourceActor.actorID === "actor1" && bp.line === 10; }));
let first = true;
for (let bp of bpStore.findActors({ sourceActor: { actorID: "actor1" }, line: 10 })) {
if (first) {

View File

@ -104,7 +104,7 @@ function tryActors(aReachables, aCompleted) {
*/
function TestNoForwardingYet()
{
tryActors(Set(['root']), run_next_test);
tryActors(new Set(['root']), run_next_test);
}
/*
@ -138,7 +138,7 @@ function createSubconnection1()
// Establish forwarding, but don't put any actors in that server.
function TestForwardPrefix1OnlyRoot()
{
tryActors(Set(['root', 'prefix1/root']), run_next_test);
tryActors(new Set(['root', 'prefix1/root']), run_next_test);
}
/* Create a third root actor, to which we can forward things. */
@ -152,7 +152,7 @@ function createSubconnection2()
function TestForwardPrefix12OnlyRoot()
{
tryActors(Set(['root', 'prefix1/root', 'prefix2/root']), run_next_test);
tryActors(new Set(['root', 'prefix1/root', 'prefix2/root']), run_next_test);
}
// A dumb actor that implements 'echo'.
@ -183,7 +183,7 @@ function TestForwardPrefix12WithActor1()
actor.actorID = 'prefix1/actor';
gSubconnection1.addActor(actor);
tryActors(Set(['root', 'prefix1/root', 'prefix1/actor', 'prefix2/root']), run_next_test);
tryActors(new Set(['root', 'prefix1/root', 'prefix1/actor', 'prefix2/root']), run_next_test);
}
function TestForwardPrefix12WithActor12()
@ -192,5 +192,5 @@ function TestForwardPrefix12WithActor12()
actor.actorID = 'prefix2/actor';
gSubconnection2.addActor(actor);
tryActors(Set(['root', 'prefix1/root', 'prefix1/actor', 'prefix2/root', 'prefix2/actor']), run_next_test);
tryActors(new Set(['root', 'prefix1/root', 'prefix1/actor', 'prefix2/root', 'prefix2/actor']), run_next_test);
}