merge fx-team to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2014-06-30 15:29:16 +02:00
commit 853b7a8ed8
12 changed files with 242 additions and 19 deletions

View File

@ -2,6 +2,7 @@
subsuite = devtools
support-files =
doc_simple-canvas.html
doc_simple-canvas-bitmasks.html
doc_simple-canvas-deep-stack.html
doc_simple-canvas-transparent.html
head.js
@ -13,6 +14,7 @@ support-files =
[browser_canvas-actor-test-05.js]
[browser_canvas-actor-test-06.js]
[browser_canvas-actor-test-07.js]
[browser_canvas-actor-test-08.js]
[browser_canvas-frontend-call-highlight.js]
[browser_canvas-frontend-call-list.js]
[browser_canvas-frontend-call-search.js]

View File

@ -0,0 +1,38 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that integers used in arguments are not cast to their constant, enum value
* forms if the method's signature does not expect an enum. Bug 999687.
*/
function ifTestingSupported() {
let [target, debuggee, front] = yield initCanavsDebuggerBackend(SIMPLE_BITMASKS_URL);
let navigated = once(target, "navigate");
yield front.setup({ reload: true });
ok(true, "The front was setup up successfully.");
yield navigated;
ok(true, "Target automatically navigated when the front was set up.");
let snapshotActor = yield front.recordAnimationFrame();
let animationOverview = yield snapshotActor.getOverview();
let functionCalls = animationOverview.calls;
is(functionCalls[0].name, "clearRect",
"The first called function's name is correct.");
is(functionCalls[0].argsPreview, "0, 0, 4, 4",
"The first called function's args preview is not cast to enums.");
is(functionCalls[2].name, "fillRect",
"The fillRect called function's name is correct.");
is(functionCalls[2].argsPreview, "0, 0, 1, 1",
"The fillRect called function's args preview is not casted to enums.");
yield removeTab(target.tab);
finish();
}

View File

@ -0,0 +1,34 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Canvas inspector test page</title>
</head>
<body>
<canvas width="128" height="128"></canvas>
<script type="text/javascript;version=1.8">
"use strict";
var ctx = document.querySelector("canvas").getContext("2d");
function drawRect(fill, size) {
ctx.fillStyle = fill;
ctx.fillRect(size[0], size[1], size[2], size[3]);
}
function drawScene() {
ctx.clearRect(0, 0, 4, 4);
drawRect("rgb(192, 192, 192)", [0, 0, 1, 1]);
window.requestAnimationFrame(drawScene);
}
drawScene();
</script>
</body>
</html>

View File

@ -26,6 +26,7 @@ let Toolbox = devtools.Toolbox;
const EXAMPLE_URL = "http://example.com/browser/browser/devtools/canvasdebugger/test/";
const SIMPLE_CANVAS_URL = EXAMPLE_URL + "doc_simple-canvas.html";
const SIMPLE_BITMASKS_URL = EXAMPLE_URL + "doc_simple-canvas-bitmasks.html";
const SIMPLE_CANVAS_TRANSPARENT_URL = EXAMPLE_URL + "doc_simple-canvas-transparent.html";
const SIMPLE_CANVAS_DEEP_STACK_URL = EXAMPLE_URL + "doc_simple-canvas-deep-stack.html";

View File

@ -9,6 +9,9 @@ function test() {
initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => {
info("Starting test... ");
// It seems that this test may be slow on Ubuntu builds running on ec2.
requestLongerTimeout(2);
let { NetMonitorView } = aMonitor.panelWin;
let { RequestsMenu } = NetMonitorView;

View File

@ -9,6 +9,9 @@ function test() {
initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => {
info("Starting test... ");
// It seems that this test may be slow on Ubuntu builds running on ec2.
requestLongerTimeout(2);
let { window, $, NetMonitorView } = aMonitor.panelWin;
let { RequestsMenu } = NetMonitorView;

View File

@ -32,6 +32,7 @@ support-files =
[browser_wa_graph-render-02.js]
[browser_wa_graph-markers.js]
[browser_wa_graph-selected.js]
[browser_wa_graph-zoom.js]
[browser_wa_inspector.js]
[browser_wa_inspector-toggle.js]

View File

@ -0,0 +1,45 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that the graph's scale and position is reset on a page reload.
*/
function spawnTest() {
let [target, debuggee, panel] = yield initWebAudioEditor(SIMPLE_CONTEXT_URL);
let { panelWin } = panel;
let { gFront, $, $$, EVENTS, WebAudioGraphView } = panelWin;
let started = once(gFront, "start-context");
yield Promise.all([
reload(target),
waitForGraphRendered(panelWin, 3, 2)
]);
is(WebAudioGraphView.getCurrentScale(), 1, "Default graph scale is 1.");
is(WebAudioGraphView.getCurrentTranslation()[0], 20, "Default x-translation is 20.");
is(WebAudioGraphView.getCurrentTranslation()[1], 20, "Default y-translation is 20.");
// Change both attribute and D3's internal store
panelWin.d3.select("#graph-target").attr("transform", "translate([100, 400]) scale(10)");
WebAudioGraphView._zoomBinding.scale(10);
WebAudioGraphView._zoomBinding.translate([100, 400]);
is(WebAudioGraphView.getCurrentScale(), 10, "After zoom, scale is 10.");
is(WebAudioGraphView.getCurrentTranslation()[0], 100, "After zoom, x-translation is 100.");
is(WebAudioGraphView.getCurrentTranslation()[1], 400, "After zoom, y-translation is 400.");
yield Promise.all([
reload(target),
waitForGraphRendered(panelWin, 3, 2)
]);
is(WebAudioGraphView.getCurrentScale(), 1, "After refresh, graph scale is 1.");
is(WebAudioGraphView.getCurrentTranslation()[0], 20, "After refresh, x-translation is 20.");
is(WebAudioGraphView.getCurrentTranslation()[1], 20, "After refresh, y-translation is 20.");
yield teardown(panel);
finish();
}

View File

@ -16,10 +16,11 @@ const COLLAPSE_INSPECTOR_STRING = L10N.getStr("collapseInspector");
const INSPECTOR_WIDTH = 300;
// Globals for d3 stuff
// Width/height in pixels of SVG graph
// TODO investigate to see how this works in other host types bug 994257
const WIDTH = 1000;
const HEIGHT = 400;
// Default properties of the graph on rerender
const GRAPH_DEFAULTS = {
translate: [20, 20],
scale: 1
};
// Sizes of SVG arrows in graph
const ARROW_HEIGHT = 5;
@ -84,17 +85,41 @@ let WebAudioGraphView = {
* and clears out old content
*/
resetUI: function () {
this.resetGraph();
this.clearGraph();
this.resetGraphPosition();
},
/**
* Clears out the rendered graph, called when resetting the SVG elements to draw again,
* or when resetting the entire UI tool
*/
resetGraph: function () {
clearGraph: function () {
$("#graph-target").innerHTML = "";
},
/**
* Moves the graph back to its original scale and translation.
*/
resetGraphPosition: function () {
if (this._zoomBinding) {
let { translate, scale } = GRAPH_DEFAULTS;
// Must set the `zoomBinding` so the next `zoom` event is in sync with
// where the graph is visually (set by the `transform` attribute).
this._zoomBinding.scale(scale);
this._zoomBinding.translate(translate);
d3.select("#graph-target")
.attr("transform", "translate(" + translate + ") scale(" + scale + ")");
}
},
getCurrentScale: function () {
return this._zoomBinding ? this._zoomBinding.scale() : null;
},
getCurrentTranslation: function () {
return this._zoomBinding ? this._zoomBinding.translate() : null;
},
/**
* Makes the corresponding graph node appear "focused", removing
* focused styles from all other nodes. If no `actorID` specified,
@ -124,7 +149,7 @@ let WebAudioGraphView = {
*/
draw: function () {
// Clear out previous SVG information
this.resetGraph();
this.clearGraph();
let graph = new dagreD3.Digraph();
let edges = [];
@ -220,6 +245,10 @@ let WebAudioGraphView = {
.attr("transform", "translate(" + ev.translate + ") scale(" + ev.scale + ")");
});
d3.select("svg").call(this._zoomBinding);
// Set initial translation and scale -- this puts D3's awareness of
// the graph in sync with what the user sees originally.
this.resetGraphPosition();
}
},

View File

@ -44,8 +44,8 @@
<!ENTITY history_today_section "Today">
<!ENTITY history_yesterday_section "Yesterday">
<!ENTITY history_week_section "7 days ago">
<!ENTITY history_older_section "Older than 7 days">
<!ENTITY history_week_section2 "Last Week">
<!ENTITY history_older_section2 "Last Month">
<!ENTITY go "Go">
<!ENTITY search "Search">

View File

@ -74,8 +74,8 @@
<string name="history_today_section">&history_today_section;</string>
<string name="history_yesterday_section">&history_yesterday_section;</string>
<string name="history_week_section">&history_week_section;</string>
<string name="history_older_section">&history_older_section;</string>
<string name="history_week_section">&history_week_section2;</string>
<string name="history_older_section">&history_older_section2;</string>
<string name="share">&share;</string>
<string name="share_title">&share_title;</string>

View File

@ -197,12 +197,19 @@ let FunctionCallActor = protocol.ActorClass({
* The arguments as a string.
*/
_generateArgsPreview: function() {
let { caller, args } = this.details;
let { caller, args, name } = this.details;
let { global } = this.meta;
// Get method signature to determine if there are any enums
// used in this method.
let enumArgs = (CallWatcherFront.ENUM_METHODS[global] || {})[name];
if (typeof enumArgs === "function") {
enumArgs = enumArgs(args);
}
// XXX: All of this sucks. Make this smarter, so that the frontend
// can inspect each argument, be it object or primitive. Bug 978960.
let serializeArgs = () => args.map(arg => {
let serializeArgs = () => args.map((arg, i) => {
if (typeof arg == "undefined") {
return "undefined";
}
@ -212,12 +219,10 @@ let FunctionCallActor = protocol.ActorClass({
if (typeof arg == "object") {
return "Object";
}
if (global == CallWatcherFront.CANVAS_WEBGL_CONTEXT) {
// XXX: This doesn't handle combined bitmasks. Bug 978964.
return getEnumsLookupTable("webgl", caller)[arg] || arg;
}
if (global == CallWatcherFront.CANVAS_2D_CONTEXT) {
return getEnumsLookupTable("2d", caller)[arg] || arg;
// If this argument matches the method's signature
// and is an enum, change it to its constant name.
if (enumArgs && enumArgs.indexOf(i) !== -1) {
return getEnumsLookupTable(global, caller)[arg] || arg;
}
return arg;
});
@ -558,6 +563,68 @@ CallWatcherFront.UNKNOWN_SCOPE = 1;
CallWatcherFront.CANVAS_WEBGL_CONTEXT = 2;
CallWatcherFront.CANVAS_2D_CONTEXT = 3;
CallWatcherFront.ENUM_METHODS = {};
CallWatcherFront.ENUM_METHODS[CallWatcherFront.CANVAS_2D_CONTEXT] = {
asyncDrawXULElement: [6],
drawWindow: [6]
};
CallWatcherFront.ENUM_METHODS[CallWatcherFront.CANVAS_WEBGL_CONTEXT] = {
activeTexture: [0],
bindBuffer: [0],
bindFramebuffer: [0],
bindRenderbuffer: [0],
bindTexture: [0],
blendEquation: [0],
blendEquationSeparate: [0, 1],
blendFunc: [0, 1],
blendFuncSeparate: [0, 1, 2, 3],
bufferData: [0, 1, 2],
bufferSubData: [0, 1],
checkFramebufferStatus: [0],
clear: [0],
compressedTexImage2D: [0, 2],
compressedTexSubImage2D: [0, 6],
copyTexImage2D: [0, 2],
copyTexSubImage2D: [0],
createShader: [0],
cullFace: [0],
depthFunc: [0],
disable: [0],
drawArrays: [0],
drawElements: [0, 2],
enable: [0],
framebufferRenderbuffer: [0, 1, 2],
framebufferTexture2D: [0, 1, 2],
frontFace: [0],
generateMipmap: [0],
getBufferParameter: [0, 1],
getParameter: [0],
getFramebufferAttachmentParameter: [0, 1, 2],
getProgramParameter: [1],
getRenderbufferParameter: [0, 1],
getShaderParameter: [1],
getShaderPrecisionFormat: [0, 1],
getTexParameter: [0, 1],
getVertexAttrib: [1],
getVertexAttribOffset: [1],
hint: [0, 1],
isEnabled: [0],
pixelStorei: [0],
readPixels: [4, 5],
renderbufferStorage: [0, 1],
stencilFunc: [0],
stencilFuncSeparate: [0, 1],
stencilMaskSeparate: [0],
stencilOp: [0, 1, 2],
stencilOpSeparate: [0, 1, 2, 3],
texImage2D: (args) => args.length > 6 ? [0, 2, 6, 7] : [0, 2, 3, 4],
texParameterf: [0, 1],
texParameteri: [0, 1],
texSubImage2D: (args) => args.length === 9 ? [0, 6, 7] : [0, 4, 5],
vertexAttribPointer: [2]
};
/**
* A lookup table for cross-referencing flags or properties with their name
* assuming they look LIKE_THIS most of the time.