Backed out changeset 6b0e836a33a9 (bug 1316265) for leaks in Linux x64 devtools tests. r=backout
This commit is contained in:
@@ -27,24 +27,16 @@ define(function (require, exports, module) {
|
||||
},
|
||||
|
||||
getTitle: function (grip) {
|
||||
let title = "function ";
|
||||
if (grip.isGenerator) {
|
||||
title = "function* ";
|
||||
}
|
||||
if (grip.isAsync) {
|
||||
title = "async " + title;
|
||||
}
|
||||
|
||||
if (this.props.objectLink) {
|
||||
return this.props.objectLink({
|
||||
object: grip
|
||||
}, title);
|
||||
}, "function ");
|
||||
}
|
||||
return title;
|
||||
return "";
|
||||
},
|
||||
|
||||
summarizeFunction: function (grip) {
|
||||
let name = grip.userDisplayName || grip.displayName || grip.name || "";
|
||||
let name = grip.userDisplayName || grip.displayName || grip.name || "function";
|
||||
return cropString(name + "()", 100);
|
||||
},
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ Test Func rep
|
||||
window.onload = Task.async(function* () {
|
||||
let { Rep } = browserRequire("devtools/client/shared/components/reps/rep");
|
||||
let { Func } = browserRequire("devtools/client/shared/components/reps/function");
|
||||
const { MODE } = browserRequire("devtools/client/shared/components/reps/constants");
|
||||
|
||||
const componentUnderTest = Func;
|
||||
|
||||
@@ -33,9 +32,6 @@ window.onload = Task.async(function* () {
|
||||
yield testVarNamed();
|
||||
yield testAnon();
|
||||
yield testLongName();
|
||||
yield testAsyncFunction();
|
||||
yield testAnonAsyncFunction();
|
||||
yield testGeneratorFunction();
|
||||
} catch(e) {
|
||||
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
|
||||
} finally {
|
||||
@@ -43,10 +39,10 @@ window.onload = Task.async(function* () {
|
||||
}
|
||||
|
||||
function testNamed() {
|
||||
// Test declaration: `function testName() { let innerVar = "foo" }`
|
||||
// Test declaration: `function testName{ let innerVar = "foo" }`
|
||||
const testName = "testNamed";
|
||||
|
||||
const defaultOutput = "function testName()";
|
||||
const defaultOutput = `testName()`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
@@ -59,10 +55,10 @@ window.onload = Task.async(function* () {
|
||||
}
|
||||
|
||||
function testUserNamed() {
|
||||
// Test declaration: `function testName() { let innerVar = "foo" }`
|
||||
// Test declaration: `function testName{ let innerVar = "foo" }`
|
||||
const testName = "testUserNamed";
|
||||
|
||||
const defaultOutput = "function testUserName()";
|
||||
const defaultOutput = `testUserName()`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
@@ -78,7 +74,7 @@ window.onload = Task.async(function* () {
|
||||
// Test declaration: `let testVarName = function() { }`
|
||||
const testName = "testVarNamed";
|
||||
|
||||
const defaultOutput = "function testVarName()";
|
||||
const defaultOutput = `testVarName()`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
@@ -94,7 +90,7 @@ window.onload = Task.async(function* () {
|
||||
// Test declaration: `() => {}`
|
||||
const testName = "testAnon";
|
||||
|
||||
const defaultOutput = "function ()";
|
||||
const defaultOutput = `function()`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
@@ -110,7 +106,7 @@ window.onload = Task.async(function* () {
|
||||
// Test declaration: `let f = function loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong() { }`
|
||||
const testName = "testLongName";
|
||||
|
||||
const defaultOutput = "function looooooooooooooooooooooooooooooooooooooooooooooooo\u2026ooooooooooooooooooooooooooooooooooooooooooooong()";
|
||||
const defaultOutput = `looooooooooooooooooooooooooooooooooooooooooooooooo\u2026ooooooooooooooooooooooooooooooooooooooooooooong()`;
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
@@ -122,110 +118,6 @@ window.onload = Task.async(function* () {
|
||||
testRepRenderModes(modeTests, testName, componentUnderTest, getGripStub(testName));
|
||||
}
|
||||
|
||||
function testAsyncFunction() {
|
||||
const testName = "testAsyncFunction";
|
||||
|
||||
const defaultOutput = "async function waitUntil2017()";
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
mode: undefined,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.TINY,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.SHORT,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.LONG,
|
||||
expectedOutput: defaultOutput,
|
||||
}
|
||||
];
|
||||
testRepRenderModes(modeTests, testName, componentUnderTest, getGripStub(testName));
|
||||
}
|
||||
|
||||
function testAnonAsyncFunction() {
|
||||
const testName = "testAnonAsyncFunction";
|
||||
|
||||
const defaultOutput = "async function ()";
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
mode: undefined,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.TINY,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.SHORT,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.LONG,
|
||||
expectedOutput: defaultOutput,
|
||||
}
|
||||
];
|
||||
testRepRenderModes(modeTests, testName, componentUnderTest, getGripStub(testName));
|
||||
}
|
||||
|
||||
function testGeneratorFunction() {
|
||||
const testName = "testGeneratorFunction";
|
||||
|
||||
const defaultOutput = "function* fib()";
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
mode: undefined,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.TINY,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.SHORT,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.LONG,
|
||||
expectedOutput: defaultOutput,
|
||||
}
|
||||
];
|
||||
testRepRenderModes(modeTests, testName, componentUnderTest, getGripStub(testName));
|
||||
}
|
||||
|
||||
function testAnonGeneratorFunction() {
|
||||
const testName = "testAnonGeneratorFunction";
|
||||
|
||||
const defaultOutput = "function* ()";
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
mode: undefined,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.TINY,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.SHORT,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.LONG,
|
||||
expectedOutput: defaultOutput,
|
||||
}
|
||||
];
|
||||
testRepRenderModes(modeTests, testName, componentUnderTest, getGripStub(testName));
|
||||
}
|
||||
|
||||
function getGripStub(functionName) {
|
||||
switch (functionName) {
|
||||
case "testNamed":
|
||||
@@ -236,8 +128,6 @@ window.onload = Task.async(function* () {
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"isAsync": false,
|
||||
"isGenerator": false,
|
||||
"name": "testName",
|
||||
"displayName": "testName",
|
||||
"location": {
|
||||
@@ -254,8 +144,6 @@ window.onload = Task.async(function* () {
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"isAsync": false,
|
||||
"isGenerator": false,
|
||||
"name": "testName",
|
||||
"userDisplayName": "testUserName",
|
||||
"displayName": "testName",
|
||||
@@ -273,8 +161,6 @@ window.onload = Task.async(function* () {
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"isAsync": false,
|
||||
"isGenerator": false,
|
||||
"displayName": "testVarName",
|
||||
"location": {
|
||||
"url": "debugger eval code",
|
||||
@@ -290,8 +176,6 @@ window.onload = Task.async(function* () {
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"isAsync": false,
|
||||
"isGenerator": false,
|
||||
"location": {
|
||||
"url": "debugger eval code",
|
||||
"line": 1
|
||||
@@ -306,8 +190,6 @@ window.onload = Task.async(function* () {
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"isAsync": false,
|
||||
"isGenerator": false,
|
||||
"name": "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
|
||||
"displayName": "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
|
||||
"location": {
|
||||
@@ -315,75 +197,6 @@ window.onload = Task.async(function* () {
|
||||
"line": 1
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
case "testAsyncFunction":
|
||||
return {
|
||||
"type": "object",
|
||||
"class": "Function",
|
||||
"actor": "server1.conn7.obj45",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"isAsync": true,
|
||||
"isGenerator": false,
|
||||
"name": "waitUntil2017",
|
||||
"displayName": "waitUntil2017",
|
||||
"location": {
|
||||
"url": "debugger eval code",
|
||||
"line": 1
|
||||
}
|
||||
};
|
||||
|
||||
case "testAnonAsyncFunction":
|
||||
return {
|
||||
"type": "object",
|
||||
"class": "Function",
|
||||
"actor": "server1.conn7.obj45",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"isAsync": true,
|
||||
"isGenerator": false,
|
||||
"location": {
|
||||
"url": "debugger eval code",
|
||||
"line": 1
|
||||
}
|
||||
};
|
||||
|
||||
case "testGeneratorFunction":
|
||||
return {
|
||||
"type": "object",
|
||||
"class": "Function",
|
||||
"actor": "server1.conn7.obj45",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"isAsync": false,
|
||||
"isGenerator": true,
|
||||
"name": "fib",
|
||||
"displayName": "fib",
|
||||
"location": {
|
||||
"url": "debugger eval code",
|
||||
"line": 1
|
||||
}
|
||||
};
|
||||
|
||||
case "testAnonGeneratorFunction":
|
||||
return {
|
||||
"type": "object",
|
||||
"class": "Function",
|
||||
"actor": "server1.conn7.obj45",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"isAsync": false,
|
||||
"isGenerator": true,
|
||||
"location": {
|
||||
"url": "debugger eval code",
|
||||
"line": 1
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1127,10 +1127,6 @@ DebuggerServer.ObjectActorPreviewers = {
|
||||
grip.parameterNames = obj.parameterNames;
|
||||
}
|
||||
|
||||
let type = DevToolsUtils.getProperty(obj, "constructor").name;
|
||||
grip.isAsync = type === "AsyncFunction";
|
||||
grip.isGenerator = type === "GeneratorFunction";
|
||||
|
||||
// Check if the developer has added a de-facto standard displayName
|
||||
// property for us to use.
|
||||
let userDisplayName;
|
||||
|
||||
Reference in New Issue
Block a user