merge m-c to fx-team

This commit is contained in:
Tim Taubert 2012-08-23 09:35:44 -07:00
commit af2040dbb7
18 changed files with 365 additions and 226 deletions

View File

@ -1090,6 +1090,9 @@ pref("devtools.webconsole.filter.warn", true);
pref("devtools.webconsole.filter.info", true);
pref("devtools.webconsole.filter.log", true);
// Text size in the Web Console. Use 0 for the system default size.
pref("devtools.webconsole.fontSize", 0);
// The number of lines that are displayed in the web console for the Net,
// CSS, JS and Web Developer categories.
pref("devtools.hud.loglimit.network", 200);

View File

@ -185,21 +185,14 @@ let DebuggerController = {
},
/**
* Starts debugging the current tab. This function is called on each location
* change in this tab.
* This function is called on each location change in this tab.
*/
_onTabNavigated: function DC__onTabNavigated(aNotification, aPacket) {
let client = this.client;
client.activeThread.detach(function() {
client.activeTab.detach(function() {
client.listTabs(function(aResponse) {
let tab = aResponse.tabs[aResponse.selected];
this._startDebuggingTab(client, tab);
this.dispatchEvent("Debugger:Connecting");
}.bind(this));
}.bind(this));
}.bind(this));
DebuggerController.ThreadState._handleTabNavigation(function() {
DebuggerController.StackFrames._handleTabNavigation(function() {
DebuggerController.SourceScripts._handleTabNavigation();
});
});
},
/**
@ -327,7 +320,7 @@ ThreadState.prototype = {
this.activeThread.addListener("resumed", this._update);
this.activeThread.addListener("detached", this._update);
this._update();
this._handleTabNavigation();
aCallback && aCallback();
},
@ -344,6 +337,15 @@ ThreadState.prototype = {
this.activeThread.removeListener("detached", this._update);
},
/**
* Handles any initialization on a tab navigation event issued by the client.
*/
_handleTabNavigation: function TS__handleTabNavigation(aCallback) {
DebuggerView.StackFrames.updateState(this.activeThread.state);
aCallback && aCallback();
},
/**
* Update the UI after a thread state change.
*/
@ -397,12 +399,12 @@ StackFrames.prototype = {
*/
connect: function SF_connect(aCallback) {
window.addEventListener("Debugger:FetchedVariables", this._onFetchedVars, false);
this.activeThread.addListener("paused", this._onPaused);
this.activeThread.addListener("resumed", this._onResume);
this.activeThread.addListener("framesadded", this._onFrames);
this.activeThread.addListener("framescleared", this._onFramesCleared);
this._handleTabNavigation();
this.updatePauseOnExceptions(this.pauseOnExceptions);
aCallback && aCallback();
@ -412,17 +414,25 @@ StackFrames.prototype = {
* Disconnect from the client.
*/
disconnect: function SF_disconnect() {
window.removeEventListener("Debugger:FetchedVariables", this._onFetchedVars, false);
if (!this.activeThread) {
return;
}
window.removeEventListener("Debugger:FetchedVariables", this._onFetchedVars, false);
this.activeThread.removeListener("paused", this._onPaused);
this.activeThread.removeListener("resumed", this._onResume);
this.activeThread.removeListener("framesadded", this._onFrames);
this.activeThread.removeListener("framescleared", this._onFramesCleared);
},
/**
* Handles any initialization on a tab navigation event issued by the client.
*/
_handleTabNavigation: function SF__handleTabNavigation(aCallback) {
// Nothing to do here yet.
aCallback && aCallback();
},
/**
* Handler for the thread client's paused notification.
*
@ -436,6 +446,7 @@ StackFrames.prototype = {
if (aPacket.why.type == "exception") {
this.exception = aPacket.why.exception;
}
this.activeThread.fillFrames(this.pageSize);
DebuggerView.editor.focus();
},
@ -834,7 +845,6 @@ StackFrames.prototype = {
function SourceScripts() {
this._onNewScript = this._onNewScript.bind(this);
this._onScriptsAdded = this._onScriptsAdded.bind(this);
this._onScriptsCleared = this._onScriptsCleared.bind(this);
this._onShowScript = this._onShowScript.bind(this);
this._onLoadSource = this._onLoadSource.bind(this);
this._onLoadSourceFinished = this._onLoadSourceFinished.bind(this);
@ -869,17 +879,9 @@ SourceScripts.prototype = {
*/
connect: function SS_connect(aCallback) {
window.addEventListener("Debugger:LoadSource", this._onLoadSource, false);
this.debuggerClient.addListener("newScript", this._onNewScript);
this.activeThread.addListener("scriptsadded", this._onScriptsAdded);
this.activeThread.addListener("scriptscleared", this._onScriptsCleared);
this._clearLabelsCache();
this._onScriptsCleared();
// Retrieve the list of scripts known to the server from before the client
// was ready to handle new script notifications.
this.activeThread.fillScripts();
this._handleTabNavigation();
aCallback && aCallback();
},
@ -887,15 +889,26 @@ SourceScripts.prototype = {
/**
* Disconnect from the client.
*/
disconnect: function TS_disconnect() {
window.removeEventListener("Debugger:LoadSource", this._onLoadSource, false);
disconnect: function SS_disconnect() {
if (!this.activeThread) {
return;
}
window.removeEventListener("Debugger:LoadSource", this._onLoadSource, false);
this.debuggerClient.removeListener("newScript", this._onNewScript);
this.activeThread.removeListener("scriptsadded", this._onScriptsAdded);
this.activeThread.removeListener("scriptscleared", this._onScriptsCleared);
},
/**
* Handles any initialization on a tab navigation event issued by the client.
*/
_handleTabNavigation: function SS__handleTabNavigation(aCallback) {
this._clearLabelsCache();
this._onScriptsCleared();
// Retrieve the list of scripts known to the server from before the client
// was ready to handle new script notifications.
this.activeThread.getScripts(this._onScriptsAdded);
aCallback && aCallback();
},
/**
@ -909,10 +922,16 @@ SourceScripts.prototype = {
this._addScript({ url: aPacket.url, startLine: aPacket.startLine }, true);
// Select the script if it's the preferred one.
let preferredScriptUrl = DebuggerView.Scripts.preferredScriptUrl;
// Select this script if it's the preferred one.
if (aPacket.url === DebuggerView.Scripts.preferredScriptUrl) {
DebuggerView.Scripts.selectScript(aPacket.url);
}
// ..or the first entry if there's not one selected yet.
else if (!DebuggerView.Scripts.selected) {
DebuggerView.Scripts.selectIndex(0);
}
// If there are any stored breakpoints for this script, display them again,
// both in the editor and the pane.
@ -921,29 +940,36 @@ SourceScripts.prototype = {
DebuggerController.Breakpoints.displayBreakpoint(breakpoint);
}
}
DebuggerController.dispatchEvent("Debugger:AfterNewScript");
},
/**
* Handler for the thread client's scriptsadded notification.
* Callback for the getScripts() method.
*/
_onScriptsAdded: function SS__onScriptsAdded() {
for each (let script in this.activeThread.cachedScripts) {
_onScriptsAdded: function SS__onScriptsAdded(aResponse) {
for each (let script in aResponse.scripts) {
this._addScript(script, false);
}
DebuggerView.Scripts.commitScripts();
DebuggerController.Breakpoints.updatePaneBreakpoints();
// Select the preferred script if one exists, the first entry otherwise.
let preferredScriptUrl = DebuggerView.Scripts.preferredScriptUrl;
// Select the preferred script if it exists and was part of the response.
if (preferredScriptUrl && DebuggerView.Scripts.contains(preferredScriptUrl)) {
DebuggerView.Scripts.selectScript(preferredScriptUrl);
} else {
}
// ..or the first entry if there's not one selected yet.
else if (!DebuggerView.Scripts.selected) {
DebuggerView.Scripts.selectIndex(0);
}
DebuggerController.dispatchEvent("Debugger:AfterScriptsAdded");
},
/**
* Handler for the thread client's scriptscleared notification.
* Called during navigation to clear the currently-loaded scripts.
*/
_onScriptsCleared: function SS__onScriptsCleared() {
DebuggerView.Scripts.empty();

View File

@ -40,9 +40,13 @@ function testInitialLoad() {
function testLocationChange()
{
gDebugger.DebuggerController.activeThread.resume(function() {
gDebugger.DebuggerController.client.addOneTimeListener("tabAttached", function(aEvent, aPacket) {
ok(true, "Successfully reattached to the tab again.");
gDebugger.DebuggerController.client.addOneTimeListener("resumed", function(aEvent, aPacket) {
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
ok(true, "tabNavigated event was fired.");
info("Still attached to the tab.");
gDebugger.addEventListener("Debugger:AfterScriptsAdded", function _onEvent(aEvent) {
gDebugger.removeEventListener(aEvent.type, _onEvent);
executeSoon(function() {
validateSecondPage();
testBack();
@ -55,9 +59,13 @@ function testLocationChange()
function testBack()
{
gDebugger.DebuggerController.client.addOneTimeListener("tabAttached", function(aEvent, aPacket) {
ok(true, "Successfully reattached to the tab after going back.");
gDebugger.DebuggerController.client.addOneTimeListener("resumed", function(aEvent, aPacket) {
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
ok(true, "tabNavigated event was fired after going back.");
info("Still attached to the tab.");
gDebugger.addEventListener("Debugger:AfterScriptsAdded", function _onEvent(aEvent) {
gDebugger.removeEventListener(aEvent.type, _onEvent);
executeSoon(function() {
validateFirstPage();
testForward();
@ -71,9 +79,13 @@ function testBack()
function testForward()
{
gDebugger.DebuggerController.client.addOneTimeListener("tabAttached", function(aEvent, aPacket) {
ok(true, "Successfully reattached to the tab after going forward.");
gDebugger.DebuggerController.client.addOneTimeListener("resumed", function(aEvent, aPacket) {
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
ok(true, "tabNavigated event was fired after going forward.");
info("Still attached to the tab.");
gDebugger.addEventListener("Debugger:AfterScriptsAdded", function _onEvent(aEvent) {
gDebugger.removeEventListener(aEvent.type, _onEvent);
executeSoon(function() {
validateSecondPage();
closeDebuggerAndFinish();

View File

@ -57,25 +57,24 @@ function testLocationChange()
gDebugger.DebuggerController.activeThread.resume(function() {
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
ok(true, "tabNavigated event was fired.");
gDebugger.DebuggerController.client.addOneTimeListener("tabAttached", function(aEvent, aPacket) {
ok(true, "Successfully reattached to the tab again.");
info("Still attached to the tab.");
// Wait for the initial resume...
gDebugger.gClient.addOneTimeListener("resumed", function() {
is(gDebugger.DebuggerView.Scripts.selected, null,
"There should be no selected script.");
is(gDebugger.editor.getText().length, 0,
"The source editor not have any text displayed.");
gDebugger.addEventListener("Debugger:AfterScriptsAdded", function _onEvent(aEvent) {
gDebugger.removeEventListener(aEvent.type, _onEvent);
let menulist = gDebugger.DebuggerView.Scripts._scripts;
let noScripts = gDebugger.L10N.getStr("noScriptsText");
is(menulist.getAttribute("label"), noScripts,
"The menulist should display a notice that there are no scripts availalble.");
is(menulist.getAttribute("tooltiptext"), "",
"The menulist shouldn't have any tooltip text attributed when there are no scripts available.");
is(gDebugger.DebuggerView.Scripts.selected, null,
"There should be no selected script.");
is(gDebugger.editor.getText().length, 0,
"The source editor not have any text displayed.");
closeDebuggerAndFinish();
});
let menulist = gDebugger.DebuggerView.Scripts._scripts;
let noScripts = gDebugger.L10N.getStr("noScriptsText");
is(menulist.getAttribute("label"), noScripts,
"The menulist should display a notice that there are no scripts availalble.");
is(menulist.getAttribute("tooltiptext"), "",
"The menulist shouldn't have any tooltip text attributed when there are no scripts available.");
closeDebuggerAndFinish();
});
});
content.location = "about:blank";

View File

@ -57,25 +57,24 @@ function testLocationChange()
gDebugger.DebuggerController.activeThread.resume(function() {
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
ok(true, "tabNavigated event was fired.");
gDebugger.DebuggerController.client.addOneTimeListener("tabAttached", function(aEvent, aPacket) {
ok(true, "Successfully reattached to the tab again.");
info("Still attached to the tab.");
// Wait for the initial resume...
gDebugger.gClient.addOneTimeListener("resumed", function() {
isnot(gDebugger.DebuggerView.Scripts.selected, null,
"There should be a selected script.");
isnot(gDebugger.editor.getText().length, 0,
"The source editor should have some text displayed.");
gDebugger.addEventListener("Debugger:AfterScriptsAdded", function _onEvent(aEvent) {
gDebugger.removeEventListener(aEvent.type, _onEvent);
let menulist = gDebugger.DebuggerView.Scripts._scripts;
let noScripts = gDebugger.L10N.getStr("noScriptsText");
isnot(menulist.getAttribute("label"), noScripts,
"The menulist should not display a notice that there are no scripts availalble.");
isnot(menulist.getAttribute("tooltiptext"), "",
"The menulist should have a tooltip text attributed.");
isnot(gDebugger.DebuggerView.Scripts.selected, null,
"There should be a selected script.");
isnot(gDebugger.editor.getText().length, 0,
"The source editor should have some text displayed.");
closeDebuggerAndFinish();
});
let menulist = gDebugger.DebuggerView.Scripts._scripts;
let noScripts = gDebugger.L10N.getStr("noScriptsText");
isnot(menulist.getAttribute("label"), noScripts,
"The menulist should not display a notice that there are no scripts availalble.");
isnot(menulist.getAttribute("tooltiptext"), "",
"The menulist should have a tooltip text attributed.");
closeDebuggerAndFinish();
});
});
content.location = EXAMPLE_URL + "browser_dbg_iframes.html";

View File

@ -52,11 +52,9 @@ function testLocationChange()
gDebugger.DebuggerController.activeThread.resume(function() {
gDebugger.DebuggerController.client.addOneTimeListener("tabNavigated", function(aEvent, aPacket) {
ok(true, "tabNavigated event was fired.");
gDebugger.DebuggerController.client.addOneTimeListener("tabAttached", function(aEvent, aPacket) {
ok(true, "Successfully reattached to the tab again.");
info("Still attached to the tab.");
closeDebuggerAndFinish();
});
closeDebuggerAndFinish();
});
content.location = TAB1_URL;
});

View File

@ -24,6 +24,7 @@ MOCHITEST_BROWSER_FILES = \
browser_webconsole_bug_597136_network_requests_from_chrome.js \
browser_webconsole_completion.js \
browser_webconsole_console_logging_api.js \
browser_webconsole_change_font_size.js \
browser_webconsole_chrome.js \
browser_webconsole_execution_scope.js \
browser_webconsole_for_of.js \

View File

@ -0,0 +1,44 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* ***** BEGIN LICENSE BLOCK *****
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*
* Contributor(s):
* Jennifer Fong <jfong@mozilla.com>
*
* ***** END LICENSE BLOCK ***** */
const TEST_URI = "http://example.com/";
function test() {
addTab(TEST_URI);
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
Services.prefs.setIntPref("devtools.webconsole.fontSize", 10);
openConsole(null, testFontSizeChange);
}, true);
}
function testFontSizeChange(hud) {
let inputNode = hud.jsterm.inputNode;
let outputNode = hud.jsterm.outputNode;
outputNode.focus();
EventUtils.synthesizeKey("-", { accelKey: true });
is(inputNode.style.fontSize, "10px", "input font stays at same size with ctrl+-");
is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+-");
EventUtils.synthesizeKey("=", { accelKey: true });
is(inputNode.style.fontSize, "11px", "input font increased with ctrl+=");
is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+=");
EventUtils.synthesizeKey("-", { accelKey: true });
is(inputNode.style.fontSize, "10px", "font decreased with ctrl+-");
is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+-");
EventUtils.synthesizeKey("0", { accelKey: true });
is(inputNode.style.fontSize, "", "font reset with ctrl+0");
is(outputNode.style.fontSize, inputNode.style.fontSize, "output font stays at same size with ctrl+0");
finishTest();
}

View File

@ -152,6 +152,9 @@ const THROTTLE_UPDATES = 1000; // milliseconds
// The preference prefix for all of the Web Console filters.
const FILTER_PREFS_PREFIX = "devtools.webconsole.filter.";
// The minimum font size.
const MIN_FONT_SIZE = 10;
/**
* A WebConsoleFrame instance is an interactive console initialized *per tab*
* that displays console log data as well as provides an interactive terminal to
@ -318,11 +321,23 @@ WebConsoleFrame.prototype = {
this.filterBox = doc.querySelector(".hud-filter-box");
this.outputNode = doc.querySelector(".hud-output-node");
this.completeNode = doc.querySelector(".jsterm-complete-node");
this.inputNode = doc.querySelector(".jsterm-input-node");
this._setFilterTextBoxEvents();
this._initPositionUI();
this._initFilterButtons();
let fontSize = Services.prefs.getIntPref("devtools.webconsole.fontSize");
if (fontSize != 0) {
fontSize = Math.max(MIN_FONT_SIZE, fontSize);
this.outputNode.style.fontSize = fontSize + "px";
this.completeNode.style.fontSize = fontSize + "px";
this.inputNode.style.fontSize = fontSize + "px";
}
let saveBodies = doc.getElementById("saveBodies");
saveBodies.addEventListener("command", function() {
this.saveRequestAndResponseBodies = !this.saveRequestAndResponseBodies;
@ -511,6 +526,52 @@ WebConsoleFrame.prototype = {
this.jsterm && this.jsterm.inputNode.focus();
},
/**
* Increase, decrease or reset the font size.
*
* @param string size
* The size of the font change. Accepted values are "+" and "-".
* An unmatched size assumes a font reset.
*/
changeFontSize: function WCF_changeFontSize(aSize)
{
let fontSize = this.window
.getComputedStyle(this.outputNode, null)
.getPropertyValue("font-size").replace("px", "");
if (this.outputNode.style.fontSize) {
fontSize = this.outputNode.style.fontSize.replace("px", "");
}
if (aSize == "+" || aSize == "-") {
fontSize = parseInt(fontSize, 10);
if (aSize == "+") {
fontSize += 1;
}
else {
fontSize -= 1;
}
if (fontSize < MIN_FONT_SIZE) {
fontSize = MIN_FONT_SIZE;
}
Services.prefs.setIntPref("devtools.webconsole.fontSize", fontSize);
fontSize = fontSize + "px";
this.completeNode.style.fontSize = fontSize;
this.inputNode.style.fontSize = fontSize;
this.outputNode.style.fontSize = fontSize;
}
else {
this.completeNode.style.fontSize = "";
this.inputNode.style.fontSize = "";
this.outputNode.style.fontSize = "";
Services.prefs.clearUserPref("devtools.webconsole.fontSize");
}
},
/**
* Handler for all of the messages coming from the Web Console content script.
*
@ -3363,6 +3424,9 @@ CommandController.prototype = {
case "cmd_copy":
// Only enable "copy" if nodes are selected.
return this.owner.outputNode.selectedCount > 0;
case "cmd_fontSizeEnlarge":
case "cmd_fontSizeReduce":
case "cmd_fontSizeReset":
case "cmd_selectAll":
return true;
}
@ -3377,6 +3441,15 @@ CommandController.prototype = {
case "cmd_selectAll":
this.selectAll();
break;
case "cmd_fontSizeEnlarge":
this.owner.changeFontSize("+");
break;
case "cmd_fontSizeReduce":
this.owner.changeFontSize("-");
break;
case "cmd_fontSizeReset":
this.owner.changeFontSize("");
break;
}
}
};

View File

@ -18,6 +18,21 @@
<script type="text/javascript" src="webconsole.js"/>
<commandset id="editMenuCommands"/>
<commandset>
<command id="cmd_fullZoomEnlarge" oncommand="goDoCommand('cmd_fontSizeEnlarge');"/>
<command id="cmd_fullZoomReduce" oncommand="goDoCommand('cmd_fontSizeReduce');"/>
<command id="cmd_fullZoomReset" oncommand="goDoCommand('cmd_fontSizeReset');"/>
</commandset>
<keyset id="fontSizeChangeSet">
<key id="key_fullZoomReduce" key="&fullZoomReduceCmd.commandkey;" command="cmd_fullZoomReduce" modifiers="accel"/>
<key key="&fullZoomReduceCmd.commandkey2;" command="cmd_fullZoomReduce" modifiers="accel"/>
<key id="key_fullZoomEnlarge" key="&fullZoomEnlargeCmd.commandkey;" command="cmd_fullZoomEnlarge" modifiers="accel"/>
<key key="&fullZoomEnlargeCmd.commandkey2;" command="cmd_fullZoomEnlarge" modifiers="accel"/>
<key key="&fullZoomEnlargeCmd.commandkey3;" command="cmd_fullZoomEnlarge" modifiers="accel"/>
<key id="key_fullZoomReset" key="&fullZoomResetCmd.commandkey;" command="cmd_fullZoomReset" modifiers="accel"/>
<key key="&fullZoomResetCmd.commandkey2;" command="cmd_fullZoomReset" modifiers="accel"/>
</keyset>
<keyset id="editMenuKeys"/>
<popupset id="mainPopupSet">

View File

@ -78,3 +78,13 @@
<!ENTITY btnClear.label "Clear">
<!ENTITY btnClear.tooltip "Clear the Web Console output">
<!ENTITY btnClose.tooltip "Close the Web Console">
<!ENTITY fullZoomEnlargeCmd.commandkey "+">
<!ENTITY fullZoomEnlargeCmd.commandkey2 "="> <!-- + is above this key on many keyboards -->
<!ENTITY fullZoomEnlargeCmd.commandkey3 "">
<!ENTITY fullZoomReduceCmd.commandkey "-">
<!ENTITY fullZoomReduceCmd.commandkey2 "">
<!ENTITY fullZoomResetCmd.commandkey "0">
<!ENTITY fullZoomResetCmd.commandkey2 "">

View File

@ -18,7 +18,7 @@
color: GrayText;
margin-top: 0;
margin-bottom: 0;
font: 12px "DejaVu Sans Mono", monospace;
font-family: "DejaVu Sans Mono", monospace;
}
.hud-msg-node {
@ -43,7 +43,7 @@
-moz-margin-start: 3px;
-moz-margin-end: 6px;
white-space: pre-wrap;
font: 12px "DejaVu Sans Mono", monospace;
font-family: "DejaVu Sans Mono", monospace;
}
.webconsole-msg-body-piece {
@ -63,7 +63,7 @@
background-color: red;
border-radius: 40px;
font: message-box;
font-size: 10px;
font-size: 0.9em;
font-weight: 600;
}
@ -97,7 +97,7 @@
.jsterm-input-node,
.jsterm-complete-node {
font: 12px "DejaVu Sans Mono", monospace;
font: 0.9em "DejaVu Sans Mono", monospace;
}
.hud-output-node {
@ -105,6 +105,7 @@
border-bottom: 1px solid ThreeDShadow;
border-top: 1px solid ThreeDShadow;
margin: 0;
font-size: 0.9em;
}
.hud-filtered-by-type,
@ -214,36 +215,6 @@
}
/* JSTerm Styles */
.jsterm-wrapper-node {
font-family: monospace;
font-size: 1em;
background-color: #000;
border: 1px solid #333;
padding: 0.1em;
width: 100%;
height: 400px;
}
.jsterm-output-node {
width: 100%;
height: 400px;
color: white;
background-color: black;
overflow: auto;
overflow-x: auto;
position: absolute;
-moz-box-direction: reverse;
}
.jsterm-scroll-to-node {
height: 1px;
width: 1px;
position: relative;
top: 92%;
display: block;
}
.jsterm-input-node,
.jsterm-complete-node {
border: none;
@ -264,7 +235,3 @@
.jsterm-complete-node > .textbox-input-box > .textbox-textarea {
color: GrayText;
}
.jsterm-output-line {
font-size: 1em;
}

View File

@ -20,7 +20,7 @@
color: GrayText;
margin-top: 0;
margin-bottom: 0;
font: 11px Menlo, Monaco, monospace;
font-family: Menlo, Monaco, monospace;
}
.hud-msg-node {
@ -45,7 +45,7 @@
-moz-margin-start: 3px;
-moz-margin-end: 6px;
white-space: pre-wrap;
font: 11px Menlo, Monaco, monospace;
font-family: Menlo, Monaco, monospace;
}
.webconsole-msg-body-piece {
@ -65,7 +65,7 @@
background-color: red;
border-radius: 40px;
font: message-box;
font-size: 10px;
font-size: 0.9em;
font-weight: 600;
}
@ -90,7 +90,7 @@
.jsterm-input-node,
.jsterm-complete-node {
font: 11px Menlo, Monaco, monospace;
font: Menlo, Monaco, monospace;
}
.hud-output-node {
@ -282,36 +282,6 @@
}
/* JSTerm Styles */
.jsterm-wrapper-node {
font-family: monospace;
font-size: 1em;
background-color: #000;
border: 1px solid #333;
padding: 0.1em;
width: 100%;
height: 400px;
}
.jsterm-output-node {
width: 100%;
height: 400px;
color: white;
background-color: black;
overflow: auto;
overflow-x: auto;
position: absolute;
-moz-box-direction: reverse;
}
.jsterm-scroll-to-node {
height: 1px;
width: 1px;
position: relative;
top: 92%;
display: block;
}
.jsterm-input-container {
background: white;
}
@ -336,10 +306,6 @@
color: GrayText;
}
.jsterm-output-line {
font-size: 1em;
}
.hud-console-filter-toolbar {
background: @scopeBarBackground@;
border-bottom: @scopeBarSeparatorBorder@;

View File

@ -18,7 +18,7 @@
color: GrayText;
margin-top: 0;
margin-bottom: 0;
font: 12px Consolas, Lucida Console, monospace;
font-family: Consolas, Lucida Console, monospace;
}
.hud-msg-node {
@ -43,7 +43,7 @@
-moz-margin-start: 3px;
-moz-margin-end: 6px;
white-space: pre-wrap;
font: 12px Consolas, Lucida Console, monospace;
font-family: Consolas, Lucida Console, monospace;
}
.webconsole-msg-body-piece {
@ -63,7 +63,7 @@
background-color: red;
border-radius: 40px;
font: message-box;
font-size: 10px;
font-size: 0.9em;
font-weight: 600;
}
@ -88,7 +88,7 @@
.jsterm-input-node,
.jsterm-complete-node {
font: 12px Consolas, Lucida Console, monospace;
font-family: Consolas, Lucida Console, monospace;
}
.hud-output-node {
@ -232,36 +232,6 @@
}
/* JSTerm Styles */
.jsterm-wrapper-node {
font-family: monospace;
font-size: 1em;
background-color: #000;
border: 1px solid #333;
padding: 0.1em;
width: 100%;
height: 400px;
}
.jsterm-output-node {
width: 100%;
height: 400px;
color: white;
background-color: black;
overflow: auto;
overflow-x: auto;
position: absolute;
-moz-box-direction: reverse;
}
.jsterm-scroll-to-node {
height: 1px;
width: 1px;
position: relative;
top: 92%;
display: block;
}
.jsterm-input-node,
.jsterm-complete-node {
border: none;
@ -282,10 +252,6 @@
color: GrayText;
}
.jsterm-output-line {
font-size: 1em;
}
.hud-console-filter-toolbar {
padding: 1px 2px;
-moz-box-align: center;

View File

@ -177,6 +177,17 @@ const UnsolicitedNotifications = {
"tabNavigated": "tabNavigated"
};
/**
* Set of pause types that are sent by the server and not as an immediate
* response to a client request.
*/
const UnsolicitedPauses = {
"resumeLimit": "resumeLimit",
"debuggerStatement": "debuggerStatement",
"breakpoint": "breakpoint",
"watchpoint": "watchpoint"
};
/**
* Set of debug protocol request types that specify the protocol request being
* sent to the server.
@ -400,18 +411,28 @@ DebuggerClient.prototype = {
}
let onResponse;
// Don't count unsolicited notifications as responses.
// Don't count unsolicited notifications or pauses as responses.
if (aPacket.from in this._activeRequests &&
!(aPacket.type in UnsolicitedNotifications)) {
!(aPacket.type in UnsolicitedNotifications) &&
!(aPacket.type == ThreadStateTypes.paused &&
aPacket.why.type in UnsolicitedPauses)) {
onResponse = this._activeRequests[aPacket.from].onResponse;
delete this._activeRequests[aPacket.from];
}
// paused/resumed/detached get special treatment...
// Packets that indicate thread state changes get special treatment.
if (aPacket.type in ThreadStateTypes &&
aPacket.from in this._threadClients) {
this._threadClients[aPacket.from]._onThreadState(aPacket);
}
// On navigation the server resumes, so the client must resume as well.
// We achive that by generating a fake resumption packet that triggers
// the client's thread state change listeners.
if (aPacket.type == UnsolicitedNotifications.tabNavigated &&
aPacket.from in this._tabClients) {
let resumption = { from: this.activeThread._actor, type: "resumed" };
this.activeThread._onThreadState(resumption);
}
this.notify(aPacket.type, aPacket);
if (onResponse) {
@ -725,12 +746,20 @@ ThreadClient.prototype = {
this._client.request(packet, aOnResponse);
},
/**
* A cache of source scripts. Clients can observe the scriptsadded and
* scriptscleared event to keep up to date on changes to this cache,
* and can fill it using the fillScripts method.
*/
get cachedScripts() { return this._scriptCache; },
_doInterrupted: function TC_doInterrupted(aAction, aError) {
if (this.paused) {
aAction();
return;
}
this.interrupt(function(aResponse) {
if (aResponse) {
aError(aResponse);
return;
}
aAction();
this.resume(function() {});
}.bind(this));
},
/**
* Ensure that source scripts have been loaded in the

View File

@ -446,10 +446,19 @@ BrowserTabActor.prototype = {
return;
}
if (this._attached) {
this.threadActor.clearDebuggees();
this.threadActor.dbg.enabled = true;
if (this._progressListener) {
delete this._progressListener._needsTabNavigated;
}
this.conn.send({ from: this.actorID, type: "tabNavigated",
url: this.browser.contentDocument.URL });
}
}
if (this._attached) {
this._addDebuggees(evt.target.defaultView.wrappedJSObject);
}
}
};
@ -499,10 +508,13 @@ DebuggerProgressListener.prototype = {
}
aRequest.suspend();
this._tabActor.threadActor.onResume();
this._tabActor.threadActor.dbg.enabled = false;
this._tabActor._pendingNavigation = aRequest;
this._tabActor._detach();
this._needsTabNavigated = true;
} else if (isStop && isWindow && isNetwork && this._needsTabNavigated) {
delete this._needsTabNavigated;
this._tabActor.threadActor.dbg.enabled = true;
this._tabActor.conn.send({
from: this._tabActor.actorID,
type: "tabNavigated",

View File

@ -51,6 +51,24 @@ ThreadActor.prototype = {
return this._threadLifetimePool;
},
clearDebuggees: function TA_clearDebuggees() {
if (this._dbg) {
let debuggees = this._dbg.getDebuggees();
for (let debuggee of debuggees) {
this._dbg.removeDebuggee(debuggee);
}
}
this.conn.removeActorPool(this._threadLifetimePool || undefined);
this._threadLifetimePool = null;
// Unless we carefully take apart the scripts table this way, we end up
// leaking documents. It would be nice to track this down carefully, once
// we have the appropriate tools.
for (let url in this._scripts) {
delete this._scripts[url];
}
this._scripts = {};
},
/**
* Add a debuggee global to the Debugger object.
*/
@ -62,14 +80,17 @@ ThreadActor.prototype = {
if (!this._dbg) {
this._dbg = new Debugger();
this._dbg.uncaughtExceptionHook = this.uncaughtExceptionHook.bind(this);
this._dbg.onDebuggerStatement = this.onDebuggerStatement.bind(this);
this._dbg.onNewScript = this.onNewScript.bind(this);
// Keep the debugger disabled until a client attaches.
this.dbg.enabled = this._state != "detached";
}
this.dbg.addDebuggee(aGlobal);
this.dbg.uncaughtExceptionHook = this.uncaughtExceptionHook.bind(this);
this.dbg.onDebuggerStatement = this.onDebuggerStatement.bind(this);
this.dbg.onNewScript = this.onNewScript.bind(this);
// Keep the debugger disabled until a client attaches.
this.dbg.enabled = false;
for (let s of this.dbg.findScripts()) {
this._addScript(s);
}
},
/**
@ -90,19 +111,14 @@ ThreadActor.prototype = {
}
this._state = "exited";
if (this.dbg) {
this.dbg.enabled = false;
this._dbg = null;
this.clearDebuggees();
if (!this._dbg) {
return;
}
this.conn.removeActorPool(this._threadLifetimePool || undefined);
this._threadLifetimePool = null;
// Unless we carefully take apart the scripts table this way, we end up
// leaking documents. It would be nice to track this down carefully, once
// we have the appropriate tools.
for (let url in this._scripts) {
delete this._scripts[url];
}
this._scripts = {};
this._dbg.enabled = false;
this._dbg = null;
},
/**

View File

@ -366,7 +366,10 @@ DebuggerServerConnection.prototype = {
* Remove a previously-added pool of actors to the connection.
*/
removeActorPool: function DSC_removeActorPool(aActorPool) {
let index = this._extraPools.splice(this._extraPools.lastIndexOf(aActorPool), 1);
let index = this._extraPools.lastIndexOf(aActorPool);
if (index > -1) {
this._extraPools.splice(index, 1);
}
},
/**