зеркало из https://github.com/mozilla/gecko-dev.git
Bug 915426 - Don't store debugging data in the global scope. r=ejpbruel
This commit is contained in:
Родитель
4965914593
Коммит
6cab715092
|
@ -15,6 +15,7 @@ support-files =
|
|||
code_blackboxing_three.js
|
||||
code_blackboxing_two.js
|
||||
code_breakpoints-break-on-last-line-of-script-on-reload.js
|
||||
code_breakpoints-other-tabs.js
|
||||
code_function-search-01.js
|
||||
code_function-search-02.js
|
||||
code_function-search-03.js
|
||||
|
@ -42,6 +43,8 @@ support-files =
|
|||
doc_binary_search.html
|
||||
doc_blackboxing.html
|
||||
doc_breakpoints-break-on-last-line-of-script-on-reload.html
|
||||
doc_breakpoints-other-tabs.html
|
||||
doc_breakpoints-reload.html
|
||||
doc_closures.html
|
||||
doc_closure-optimized-out.html
|
||||
doc_cmd-break.html
|
||||
|
@ -133,7 +136,9 @@ skip-if = os == "mac" || e10s # Bug 895426
|
|||
[browser_dbg_breakpoints-editor.js]
|
||||
[browser_dbg_breakpoints-highlight.js]
|
||||
[browser_dbg_breakpoints-new-script.js]
|
||||
[browser_dbg_breakpoints-other-tabs.js]
|
||||
[browser_dbg_breakpoints-pane.js]
|
||||
[browser_dbg_breakpoints-reload.js]
|
||||
[browser_dbg_chrome-create.js]
|
||||
[browser_dbg_chrome-debugging.js]
|
||||
[browser_dbg_clean-exit-window.js]
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that setting a breakpoint in one tab, doesn't cause another tab at
|
||||
* the same source to pause at that location.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_breakpoints-other-tabs.html";
|
||||
|
||||
let test = Task.async(function* () {
|
||||
const [tab1, debuggee1, panel1] = yield initDebugger(TAB_URL);
|
||||
const [tab2, debuggee2, panel2] = yield initDebugger(TAB_URL);
|
||||
|
||||
yield ensureSourceIs(panel1, "code_breakpoints-other-tabs.js", true);
|
||||
|
||||
const sources = panel1.panelWin.DebuggerView.Sources;
|
||||
|
||||
yield panel1.addBreakpoint({
|
||||
url: sources.selectedValue,
|
||||
line: 2
|
||||
});
|
||||
|
||||
const paused = waitForThreadEvents(panel2, "paused");
|
||||
executeSoon(() => debuggee2.testCase());
|
||||
const packet = yield paused;
|
||||
|
||||
is(packet.why.type, "debuggerStatement",
|
||||
"Should have stopped at the debugger statement, not the other tab's breakpoint");
|
||||
is(packet.frame.where.line, 3,
|
||||
"Should have stopped at line 3 (debugger statement), not line 2 (other tab's breakpoint)");
|
||||
|
||||
yield teardown(panel1);
|
||||
yield resumeDebuggerThenCloseAndFinish(panel2);
|
||||
});
|
|
@ -0,0 +1,35 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that setting a breakpoint on code that gets run on load, will get
|
||||
* hit when we reload.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_breakpoints-reload.html";
|
||||
|
||||
let test = Task.async(function* () {
|
||||
requestLongerTimeout(4);
|
||||
|
||||
const [tab, debuggee, panel] = yield initDebugger(TAB_URL);
|
||||
|
||||
yield ensureSourceIs(panel, "doc_breakpoints-reload.html", true);
|
||||
|
||||
const sources = panel.panelWin.DebuggerView.Sources;
|
||||
|
||||
yield panel.addBreakpoint({
|
||||
url: sources.selectedValue,
|
||||
line: 10 // "break on me" string
|
||||
});
|
||||
|
||||
const paused = waitForThreadEvents(panel, "paused");
|
||||
reloadActiveTab(panel);
|
||||
const packet = yield paused;
|
||||
|
||||
is(packet.why.type, "breakpoint",
|
||||
"Should have hit the breakpoint after the reload");
|
||||
is(packet.frame.where.line, 10,
|
||||
"Should have stopped at line 10, where we set the breakpoint");
|
||||
|
||||
yield resumeDebuggerThenCloseAndFinish(panel);
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
function testCase() {
|
||||
var foo = "break on me";
|
||||
debugger;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Debugger Breakpoints Other Tabs Test Page</title>
|
||||
</head>
|
||||
<script src="code_breakpoints-other-tabs.js"></script>
|
|
@ -0,0 +1,12 @@
|
|||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Debugger Breakpoints Other Tabs Test Page</title>
|
||||
</head>
|
||||
<script>
|
||||
(function () {
|
||||
window.foo = "break on me";
|
||||
}());
|
||||
</script>
|
|
@ -487,6 +487,10 @@ function ThreadActor(aParent, aGlobal)
|
|||
autoBlackBox: false
|
||||
};
|
||||
|
||||
this.breakpointStore = new BreakpointStore();
|
||||
this.blackBoxedSources = new Set(["self-hosted"]);
|
||||
this.prettyPrintedSources = new Map();
|
||||
|
||||
// A map of actorID -> actor for breakpoints created and managed by the
|
||||
// server.
|
||||
this._hiddenBreakpoints = new Map();
|
||||
|
@ -501,12 +505,6 @@ function ThreadActor(aParent, aGlobal)
|
|||
this.onNewScript = this.onNewScript.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* The breakpoint store must be shared across instances of ThreadActor so that
|
||||
* page reloads don't blow away all of our breakpoints.
|
||||
*/
|
||||
ThreadActor.breakpointStore = new BreakpointStore();
|
||||
|
||||
ThreadActor.prototype = {
|
||||
// Used by the ObjectActor to keep track of the depth of grip() calls.
|
||||
_gripDepth: null,
|
||||
|
@ -535,8 +533,6 @@ ThreadActor.prototype = {
|
|||
this.state == "running" ||
|
||||
this.state == "paused",
|
||||
|
||||
get breakpointStore() { return ThreadActor.breakpointStore; },
|
||||
|
||||
get threadLifetimePool() {
|
||||
if (!this._threadLifetimePool) {
|
||||
this._threadLifetimePool = new ActorPool(this.conn);
|
||||
|
@ -4906,14 +4902,6 @@ function ThreadSources(aThreadActor, aOptions, aAllowPredicate,
|
|||
this._generatedUrlsByOriginalUrl = Object.create(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Must be a class property because it needs to persist across reloads, same as
|
||||
* the breakpoint store.
|
||||
*/
|
||||
ThreadSources._blackBoxedSources = new Set(["self-hosted"]);
|
||||
ThreadSources._prettyPrintedSources = new Map();
|
||||
|
||||
|
||||
/**
|
||||
* Matches strings of the form "foo.min.js" or "foo-min.js", etc. If the regular
|
||||
* expression matches, we can be fairly sure that the source is minified, and
|
||||
|
@ -5210,7 +5198,7 @@ ThreadSources.prototype = {
|
|||
* boxed or not.
|
||||
*/
|
||||
isBlackBoxed: function (aURL) {
|
||||
return ThreadSources._blackBoxedSources.has(aURL);
|
||||
return this._thread.blackBoxedSources.has(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -5220,7 +5208,7 @@ ThreadSources.prototype = {
|
|||
* The URL of the source which we are black boxing.
|
||||
*/
|
||||
blackBox: function (aURL) {
|
||||
ThreadSources._blackBoxedSources.add(aURL);
|
||||
this._thread.blackBoxedSources.add(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -5230,7 +5218,7 @@ ThreadSources.prototype = {
|
|||
* The URL of the source which we are no longer black boxing.
|
||||
*/
|
||||
unblackBox: function (aURL) {
|
||||
ThreadSources._blackBoxedSources.delete(aURL);
|
||||
this._thread.blackBoxedSources.delete(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -5240,7 +5228,7 @@ ThreadSources.prototype = {
|
|||
* The URL of the source that might be pretty printed.
|
||||
*/
|
||||
isPrettyPrinted: function (aURL) {
|
||||
return ThreadSources._prettyPrintedSources.has(aURL);
|
||||
return this._thread.prettyPrintedSources.has(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -5250,14 +5238,14 @@ ThreadSources.prototype = {
|
|||
* The URL of the source to be pretty printed.
|
||||
*/
|
||||
prettyPrint: function (aURL, aIndent) {
|
||||
ThreadSources._prettyPrintedSources.set(aURL, aIndent);
|
||||
this._thread.prettyPrintedSources.set(aURL, aIndent);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the indent the given URL was pretty printed by.
|
||||
*/
|
||||
prettyPrintIndent: function (aURL) {
|
||||
return ThreadSources._prettyPrintedSources.get(aURL);
|
||||
return this._thread.prettyPrintedSources.get(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -5267,7 +5255,7 @@ ThreadSources.prototype = {
|
|||
* The URL of the source that is no longer pretty printed.
|
||||
*/
|
||||
disablePrettyPrint: function (aURL) {
|
||||
ThreadSources._prettyPrintedSources.delete(aURL);
|
||||
this._thread.prettyPrintedSources.delete(aURL);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -5495,21 +5483,9 @@ function getInnerId(window) {
|
|||
getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
|
||||
};
|
||||
|
||||
function getInnerId(window) {
|
||||
return window.QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
|
||||
};
|
||||
|
||||
const symbolProtoToString = typeof Symbol === "function" ? Symbol.prototype.toString : null;
|
||||
|
||||
function getSymbolName(symbol) {
|
||||
const name = symbolProtoToString.call(symbol).slice("Symbol(".length, -1);
|
||||
return name || undefined;
|
||||
}
|
||||
|
||||
exports.cleanup = function() {
|
||||
// Reset shared globals when reloading the debugger server
|
||||
ThreadActor.breakpointStore = new BreakpointStore();
|
||||
ThreadSources._blackBoxedSources.clear();
|
||||
ThreadSources._prettyPrintedSources.clear();
|
||||
}
|
||||
|
|
|
@ -275,13 +275,6 @@ var DebuggerServer = {
|
|||
}
|
||||
gRegisteredModules = {};
|
||||
|
||||
// The thread actor is special. It isn't registered as all the other ones
|
||||
// with a global or tab scope. It is loaded instead by its parent tab actor
|
||||
// on an 'attach' request. But tests still expect to observe its state
|
||||
// being reset when DebuggerServer is reset, so let's explicitly reset
|
||||
// it here.
|
||||
require("devtools/server/actors/script").cleanup();
|
||||
|
||||
this.closeAllListeners();
|
||||
this.globalActorFactories = {};
|
||||
this.tabActorFactories = {};
|
||||
|
|
|
@ -12,7 +12,6 @@ function run_test()
|
|||
addDebuggerToGlobal(this);
|
||||
|
||||
test_has_breakpoint();
|
||||
test_bug_754251();
|
||||
test_add_breakpoint();
|
||||
test_remove_breakpoint();
|
||||
test_find_breakpoints();
|
||||
|
@ -56,16 +55,6 @@ function test_has_breakpoint() {
|
|||
"Breakpoint with column removed but still exists in Breakpoint Store.");
|
||||
}
|
||||
|
||||
// Note: Removing this test will regress bug 754251. See comment above
|
||||
// ThreadActor.breakpointStore.
|
||||
function test_bug_754251() {
|
||||
let instance1 = new ThreadActor();
|
||||
let instance2 = new ThreadActor();
|
||||
do_check_true(instance1.breakpointStore instanceof BreakpointStore);
|
||||
do_check_eq(instance1.breakpointStore, ThreadActor.breakpointStore);
|
||||
do_check_eq(instance2.breakpointStore, ThreadActor.breakpointStore);
|
||||
}
|
||||
|
||||
function test_add_breakpoint() {
|
||||
// Breakpoint with column
|
||||
let bpStore = new BreakpointStore();
|
||||
|
|
Загрузка…
Ссылка в новой задаче