Share the breakpoint store across ThreadActor instances (bug 777146); r=past

This commit is contained in:
Nick Fitzgerald 2012-08-06 12:32:00 +03:00
parent e283cc98e2
commit 0b9e755f46
3 changed files with 28 additions and 1 deletions

View File

@ -25,10 +25,15 @@ function ThreadActor(aHooks)
this._frameActors = [];
this._environmentActors = [];
this._hooks = aHooks ? aHooks : {};
this._breakpointStore = {};
this._scripts = {};
}
/**
* The breakpoint store must be shared across instances of ThreadActor so that
* page reloads don't blow away all of our breakpoints.
*/
ThreadActor._breakpointStore = {};
ThreadActor.prototype = {
actorPrefix: "context",
@ -36,6 +41,8 @@ ThreadActor.prototype = {
get dbg() { return this._dbg; },
get _breakpointStore() { return ThreadActor._breakpointStore; },
get threadLifetimePool() {
if (!this._threadLifetimePool) {
this._threadLifetimePool = new ActorPool(this.conn);

View File

@ -0,0 +1,19 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Note: Removing this test will regress bug 754251. See comment above
// ThreadActor._breakpointStore.
function run_test()
{
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://global/content/devtools/dbg-script-actors.js");
let instance1 = new ThreadActor();
let instance2 = new ThreadActor();
do_check_eq(instance1._breakpointStore, ThreadActor._breakpointStore);
do_check_eq(instance2._breakpointStore, ThreadActor._breakpointStore);
do_check_eq(instance1._breakpointStore, instance2._breakpointStore);
}

View File

@ -60,3 +60,4 @@ tail =
[test_framebindings-05.js]
[test_pause_exceptions-01.js]
[test_pause_exceptions-02.js]
[test_breakpointstore.js]