mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 931921 - Prevent creating multiple intances of global actors. r=past
This commit is contained in:
parent
61799e7294
commit
1244ab513a
@ -44,26 +44,15 @@ function test() {
|
||||
let extraPools = conn._extraPools;
|
||||
let globalPool;
|
||||
|
||||
for (let pool of extraPools) {
|
||||
if (Object.keys(pool._actors).some(e => {
|
||||
// Tab actors are in the global pool.
|
||||
let re = new RegExp(conn._prefix + "tab", "g");
|
||||
return e.match(re) !== null;
|
||||
})) {
|
||||
globalPool = pool;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Then we look if the global pool contains only one test actor.
|
||||
let actorPrefix = conn._prefix + "test_one";
|
||||
let actors = Object.keys(globalPool._actors).join();
|
||||
info("Global actors: " + actors);
|
||||
|
||||
isnot(actors.indexOf(actorPrefix), -1,
|
||||
"The test actor exists in the pool.");
|
||||
is(actors.indexOf(actorPrefix), actors.lastIndexOf(actorPrefix),
|
||||
"Only one actor exists in the pool.");
|
||||
let count = 0;
|
||||
for (let pool of extraPools) {
|
||||
count += Object.keys(pool._actors).filter(e => {
|
||||
return e.startsWith(actorPrefix);
|
||||
}).length;
|
||||
}
|
||||
is(count, 2,
|
||||
"Only two actor exists in all pools. One tab actor and one global.");
|
||||
|
||||
gClient.close(finish);
|
||||
});
|
||||
|
@ -253,7 +253,11 @@ RootActor.prototype = {
|
||||
}
|
||||
|
||||
/* DebuggerServer.addGlobalActor support: create actors. */
|
||||
this._createExtraActors(this._parameters.globalActorFactories, newActorPool);
|
||||
if (!this._globalActorPool) {
|
||||
this._globalActorPool = new ActorPool(this.conn);
|
||||
this._createExtraActors(this._parameters.globalActorFactories, this._globalActorPool);
|
||||
this.conn.addActorPool(this._globalActorPool);
|
||||
}
|
||||
|
||||
/*
|
||||
* Drop the old actorID -> actor map. Actors that still mattered were
|
||||
|
@ -27,6 +27,7 @@ function run_test()
|
||||
add_test(test_pre_init_tab_actor);
|
||||
add_test(test_post_init_global_actor);
|
||||
add_test(test_post_init_tab_actor);
|
||||
add_test(test_stable_global_actor_instances);
|
||||
add_test(close_client);
|
||||
run_next_test();
|
||||
}
|
||||
@ -82,6 +83,25 @@ function test_post_init_tab_actor()
|
||||
);
|
||||
}
|
||||
|
||||
// Get the object object, from the server side, for a given actor ID
|
||||
function getActorInstance(connID, actorID) {
|
||||
return DebuggerServer._connections[connID].getActor(actorID);
|
||||
}
|
||||
|
||||
function test_stable_global_actor_instances()
|
||||
{
|
||||
// Consider that there is only one connection,
|
||||
// and the first one is ours
|
||||
let connID = Object.keys(DebuggerServer._connections)[0];
|
||||
let postInitGlobalActor = getActorInstance(connID, gActors.postInitGlobalActor);
|
||||
let preInitGlobalActor = getActorInstance(connID, gActors.preInitGlobalActor);
|
||||
gClient.listTabs(function onListTabs(aResponse) {
|
||||
do_check_eq(postInitGlobalActor, getActorInstance(connID, aResponse.postInitGlobalActor));
|
||||
do_check_eq(preInitGlobalActor, getActorInstance(connID, aResponse.preInitGlobalActor));
|
||||
run_next_test();
|
||||
});
|
||||
}
|
||||
|
||||
function close_client() {
|
||||
gClient.close(() => run_next_test());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user