Skip to content

Commit

Permalink
Merge fx-team to m-c.
Browse files Browse the repository at this point in the history
  • Loading branch information
rvandermeulen committed Jun 12, 2013
2 parents 1a6cf7a + 9380ba6 commit 6ecc89a
Show file tree
Hide file tree
Showing 46 changed files with 1,407 additions and 123 deletions.
2 changes: 1 addition & 1 deletion browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ pref("devtools.debugger.remote-host", "localhost");
pref("devtools.debugger.remote-autoconnect", false);
pref("devtools.debugger.remote-connection-retries", 3);
pref("devtools.debugger.remote-timeout", 20000);
pref("devtools.debugger.source-maps-enabled", false);
pref("devtools.debugger.source-maps-enabled", true);

// The default Debugger UI settings
pref("devtools.debugger.ui.win-x", 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ function test() {
output: [
/Manifest has a character encoding of ISO-8859-1\. Manifests must have the utf-8 character encoding\./,
/The first line of the manifest must be "CACHE MANIFEST" at line 1\./,
/"CACHE MANIFEST" is only valid on the first line at line 3\./,
/"CACHE MANIFEST" is only valid on the first line but was found at line 3\./,
/images\/sound-icon\.png points to a resource that is not available at line 9\./,
/images\/background\.png points to a resource that is not available at line 10\./,
/NETWORK section line 13 \(\/checking\.cgi\) prevents caching of line 13 \(\/checking\.cgi\) in the NETWORK section\./,
/\/checking\.cgi points to a resource that is not available at line 13\./,
/Asterisk used as a wildcard in the NETWORK section at line 14\. A single line containing an asterisk is called the online whitelist wildcard flag and is only valid in the NETWORK section\. Other uses of the \* character are prohibited\. The presence of this flag indicates that any URI not listed as cached is to be implicitly treated as being in the online whitelist namespaces\. If the flag is not present then the blocking state indicates that URIs not listed explicitly in the manifest are to be treated as unavailable\./,
/Asterisk \(\*\) incorrectly used in the NETWORK section at line 14\. If a line in the NETWORK section contains only a single asterisk character, then any URI not listed in the manifest will be treated as if the URI was listed in the NETWORK section\. Otherwice such URIs will be treated as unavailable\. Other uses of the \* character are prohibited/,
/\.\.\/rel\.html points to a resource that is not available at line 17\./,
/\.\.\/\.\.\/rel\.html points to a resource that is not available at line 18\./,
/\.\.\/\.\.\/\.\.\/rel\.html points to a resource that is not available at line 19\./,
Expand All @@ -64,14 +64,14 @@ function test() {
/http:\/\/example\.com\/check\.png points to a resource that is not available at line 41\./,
/Spaces in URIs need to be replaced with % at line 42\./,
/http:\/\/example\.com\/cr oss\.png points to a resource that is not available at line 42\./,
/Asterisk used as a wildcard in the CACHE section at line 43\. A single line containing an asterisk is called the online whitelist wildcard flag and is only valid in the NETWORK section\. Other uses of the \* character are prohibited\. The presence of this flag indicates that any URI not listed as cached is to be implicitly treated as being in the online whitelist namespaces\. If the flag is not present then the blocking state indicates that URIs not listed explicitly in the manifest are to be treated as unavailable\./,
/Asterisk \(\*\) incorrectly used in the CACHE section at line 43\. If a line in the NETWORK section contains only a single asterisk character, then any URI not listed in the manifest will be treated as if the URI was listed in the NETWORK section\. Otherwice such URIs will be treated as unavailable\. Other uses of the \* character are prohibited/,
/The SETTINGS section may only contain a single value, "prefer-online" or "fast" at line 47\./,
/FALLBACK section line 50 \(\/section1\/ \/offline1\.html\) prevents caching of line 30 \(\/section1\/blockedbyfallback\.html\) in the CACHE section\./,
/\/offline1\.html points to a resource that is not available at line 50\./,
/FALLBACK section line 51 \(\/section2\/ offline2\.html\) prevents caching of line 32 \(\/section2\/blockedbyfallback\.html\) in the CACHE section\./,
/offline2\.html points to a resource that is not available at line 51\./,
/Only two URIs separated by spaces are allowed in the FALLBACK section at line 52\./,
/Asterisk \(\*\) incorrectly used as a wildcard in a fallback namespace at line 53\. Namespaces simply need to match a path prefix\./,
/Asterisk \(\*\) incorrectly used in the FALLBACK section at line 53\. URIs in the FALLBACK section simply need to match a prefix of the request URI\./,
/offline3\.html points to a resource that is not available at line 53\./,
/Invalid section name \(BLAH\) at line 55\./,
/Only two URIs separated by spaces are allowed in the FALLBACK section at line 55\./
Expand Down
18 changes: 18 additions & 0 deletions browser/devtools/debugger/debugger-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ StackFrames.prototype = {
currentBreakpointLocation: null,
currentEvaluation: null,
currentException: null,
currentReturnedValue: null,

/**
* Connect to the current thread client.
Expand Down Expand Up @@ -485,6 +486,17 @@ StackFrames.prototype = {
case "exception":
this.currentException = aPacket.why.exception;
break;
// If paused while stepping out of a frame, store the returned value or
// thrown exception.
case "resumeLimit":
if (!aPacket.why.frameFinished) {
break;
} else if (aPacket.why.frameFinished.throw) {
this.currentException = aPacket.why.frameFinished.throw;
} else if (aPacket.why.frameFinished.return) {
this.currentReturnedValue = aPacket.why.frameFinished.return;
}
break;
}

this.activeThread.fillFrames(CALL_STACK_PAGE_SIZE);
Expand Down Expand Up @@ -595,6 +607,7 @@ StackFrames.prototype = {
this.currentBreakpointLocation = null;
this.currentEvaluation = null;
this.currentException = null;
this.currentReturnedValue = null;
// After each frame step (in, over, out), framescleared is fired, which
// forces the UI to be emptied and rebuilt on framesadded. Most of the times
// this is not necessary, and will result in a brief redraw flicker.
Expand Down Expand Up @@ -832,6 +845,11 @@ StackFrames.prototype = {
let excRef = aScope.addVar("<exception>", { value: this.currentException });
this._addVarExpander(excRef, this.currentException);
}
// Add any returned value.
if (this.currentReturnedValue) {
let retRef = aScope.addVar("<return>", { value: this.currentReturnedValue });
this._addVarExpander(retRef, this.currentReturnedValue);
}
// Add "this".
if (aFrame.this) {
let thisRef = aScope.addVar("this", { value: aFrame.this });
Expand Down
2 changes: 2 additions & 0 deletions browser/devtools/debugger/test/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ MOCHITEST_BROWSER_TESTS = \
browser_dbg_chrome-debugging.js \
browser_dbg_source_maps-01.js \
browser_dbg_source_maps-02.js \
browser_dbg_step-out.js \
head.js \
$(NULL)

Expand Down Expand Up @@ -139,6 +140,7 @@ MOCHITEST_BROWSER_PAGES = \
binary_search.map \
test-location-changes-bp.js \
test-location-changes-bp.html \
test-step-out.html \
$(NULL)

ifneq (Linux,$(OS_ARCH))
Expand Down
133 changes: 133 additions & 0 deletions browser/devtools/debugger/test/browser_dbg_step-out.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */

/**
* Make sure that stepping out of a function displays the right return value.
*/

const TAB_URL = EXAMPLE_URL + "test-step-out.html";

var gPane = null;
var gTab = null;
var gDebugger = null;

function test()
{
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
gTab = aTab;
gPane = aPane;
gDebugger = gPane.panelWin;

expectUncaughtException();
testNormalReturn();
});
}

function testNormalReturn()
{
gPane.panelWin.gClient.addOneTimeListener("paused", function() {
gDebugger.addEventListener("Debugger:SourceShown", function dbgstmt(aEvent) {
gDebugger.removeEventListener(aEvent.type, dbgstmt);
is(gDebugger.DebuggerController.activeThread.state, "paused",
"Should be paused now.");

let count = 0;
gPane.panelWin.gClient.addOneTimeListener("paused", function() {
is(gDebugger.DebuggerController.activeThread.state, "paused",
"Should be paused again.");

gDebugger.addEventListener("Debugger:FetchedVariables", function stepout() {
ok(true, "Debugger:FetchedVariables event received.");
gDebugger.removeEventListener("Debugger:FetchedVariables", stepout, false);

Services.tm.currentThread.dispatch({ run: function() {

var scopes = gDebugger.DebuggerView.Variables._list,
innerScope = scopes.firstChild,
innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes;

is(innerNodes[0].querySelector(".name").getAttribute("value"), "<return>",
"Should have the right property name for the return value.");

is(innerNodes[0].querySelector(".value").getAttribute("value"), 10,
"Should have the right property value for the return value.");

testReturnWithException();
}}, 0);
}, false);
});

EventUtils.sendMouseEvent({ type: "mousedown" },
gDebugger.document.getElementById("step-out"),
gDebugger);
});
});

EventUtils.sendMouseEvent({ type: "click" },
content.document.getElementById("return"),
content.window);
}

function testReturnWithException()
{
gDebugger.DebuggerController.activeThread.resume(function() {
gPane.panelWin.gClient.addOneTimeListener("paused", function() {
gDebugger.addEventListener("Debugger:FetchedVariables", function dbgstmt(aEvent) {
gDebugger.removeEventListener(aEvent.type, dbgstmt, false);
is(gDebugger.DebuggerController.activeThread.state, "paused",
"Should be paused now.");

let count = 0;
gPane.panelWin.gClient.addOneTimeListener("paused", function() {
is(gDebugger.DebuggerController.activeThread.state, "paused",
"Should be paused again.");

gDebugger.addEventListener("Debugger:FetchedVariables", function stepout() {
ok(true, "Debugger:FetchedVariables event received.");
gDebugger.removeEventListener("Debugger:FetchedVariables", stepout, false);

Services.tm.currentThread.dispatch({ run: function() {

var scopes = gDebugger.DebuggerView.Variables._list,
innerScope = scopes.firstChild,
innerNodes = innerScope.querySelector(".variables-view-element-details").childNodes;

is(innerNodes[0].querySelector(".name").getAttribute("value"), "<exception>",
"Should have the right property name for the exception value.");

is(innerNodes[0].querySelector(".value").getAttribute("value"), '"boom"',
"Should have the right property value for the exception value.");

resumeAndFinish();

}}, 0);
}, false);
});

EventUtils.sendMouseEvent({ type: "mousedown" },
gDebugger.document.getElementById("step-out"),
gDebugger);
}, false);
});

EventUtils.sendMouseEvent({ type: "click" },
content.document.getElementById("throw"),
content.window);
});
}

function resumeAndFinish() {
gPane.panelWin.gClient.addOneTimeListener("resumed", function() {
Services.tm.currentThread.dispatch({ run: closeDebuggerAndFinish }, 0);
});

gDebugger.DebuggerController.activeThread.resume();
}

registerCleanupFunction(function() {
removeTab(gTab);
gPane = null;
gTab = null;
gDebugger = null;
});
32 changes: 32 additions & 0 deletions browser/devtools/debugger/test/test-step-out.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'/>
<title>Debugger Step Out Return Value Test</title>
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
</head>
<body>
<button id="return">return</button>
<button id="throw">throw</button>
</body>
<script type="text/javascript">
window.addEventListener("load", function() {
function normal(aArg) {
debugger;
var r = 10;
return r;
}
function error(aArg) {
debugger;
var r = 10;
throw "boom";
return r;
}
var button = document.getElementById("return");
button.addEventListener("click", normal, false);
button = document.getElementById("throw");
button.addEventListener("click", error, false);
});
</script>
</html>
41 changes: 29 additions & 12 deletions browser/devtools/inspector/inspector-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,19 @@ InspectorPanel.prototype = {

// All the components are initialized. Let's select a node.
if (this.target.isLocalTab) {
let root = this.browser.contentDocument.documentElement;
this._selection.setNode(root);
this._selection.setNode(
this._getDefaultNodeForSelection(this.browser.contentDocument));
} else if (this.target.window) {
let root = this.target.window.document.documentElement;
this._selection.setNode(root);
this._selection.setNode(
this._getDefaultNodeForSelection(this.target.window.document));
}

if (this.highlighter) {
this.highlighter.unlock();
}

this.markup.expandNode(this.selection.node);

this.emit("ready");
deferred.resolve(this);
}.bind(this));
Expand All @@ -143,6 +145,16 @@ InspectorPanel.prototype = {
return deferred.promise;
},

/**
* Select node for default selection
*/
_getDefaultNodeForSelection : function(document) {
// if available set body node as default selected node
// else set documentElement
var defaultNode = document.body || document.documentElement;
return defaultNode;
},

/**
* Selection object (read only)
*/
Expand Down Expand Up @@ -253,21 +265,26 @@ InspectorPanel.prototype = {
this.selection.setNode(null);
this._destroyMarkup();
this.isDirty = false;
let self = this;

function onDOMReady() {
let onDOMReady = function() {
newWindow.removeEventListener("DOMContentLoaded", onDOMReady, true);

if (self._destroyed) {
if (this._destroyed) {
return;
}

if (!self.selection.node) {
self.selection.setNode(newWindow.document.documentElement, "navigateaway");
if (!this.selection.node) {
let defaultNode = this._getDefaultNodeForSelection(newWindow.document);
this.selection.setNode(defaultNode, "navigateaway");
}
self._initMarkup();
self.setupSearchBox();
}
this._initMarkup();

this.once("markuploaded", () => {
this.markup.expandNode(this.selection.node);
});

this.setupSearchBox();
}.bind(this);

if (newWindow.document.readyState == "loading") {
newWindow.addEventListener("DOMContentLoaded", onDOMReady, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,16 @@ function test()
inspector = aInspector;

executeSoon(function() {
inspector.selection.once("new-node", highlightBodyNode);
inspector.selection.once("new-node", highlightHeaderNode);
// Test that navigating around without a selected node gets us to the
// body element.
node = doc.querySelector("body");
// head element.
node = doc.querySelector("h1");
let bc = inspector.breadcrumbs;
bc.nodeHierarchy[bc.currentIndex].button.focus();
EventUtils.synthesizeKey("VK_RIGHT", { });
});
}

function highlightBodyNode()
{
is(inspector.selection.node, node, "selected body element");

executeSoon(function() {
inspector.selection.once("new-node", highlightHeaderNode);
// Test that moving to the child works.
node = doc.querySelector("h1");
EventUtils.synthesizeKey("VK_RIGHT", { });
});
}

function highlightHeaderNode()
{
is(inspector.selection.node, node, "selected h1 element");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,7 @@ function test() {
var target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
inspector = toolbox.getCurrentPanel();
runTests();
});
}

function runTests() {
inspector.selection.once("new-node", startTests);
executeSoon(function() {
inspector.selection.setNode(doc.body);
startTests();
});
}

Expand Down
Loading

0 comments on commit 6ecc89a

Please sign in to comment.