зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1164252 - Profiler should be able to parse evaluated location sites. r=jsantell
This commit is contained in:
Родитель
b139a57e27
Коммит
0d7961a9fa
|
@ -5,6 +5,7 @@
|
|||
|
||||
const global = require("devtools/client/performance/modules/global");
|
||||
const demangle = require("devtools/client/shared/demangle");
|
||||
const { assert } = require("devtools/shared/DevToolsUtils");
|
||||
const { isChromeScheme, isContentScheme, parseURL } =
|
||||
require("devtools/client/shared/source-utils");
|
||||
|
||||
|
@ -20,6 +21,8 @@ const CHAR_CODE_COLON = ":".charCodeAt(0);
|
|||
const CHAR_CODE_SPACE = " ".charCodeAt(0);
|
||||
const CHAR_CODE_UNDERSCORE = "_".charCodeAt(0);
|
||||
|
||||
const EVAL_TOKEN = "%20%3E%20eval";
|
||||
|
||||
// The cache used to store inflated frames.
|
||||
const gInflatedFrameStore = new WeakMap();
|
||||
|
||||
|
@ -149,6 +152,26 @@ function parseLocation(location, fallbackLine, fallbackColumn) {
|
|||
fileName = parsedUrl.fileName;
|
||||
port = parsedUrl.port;
|
||||
host = parsedUrl.host;
|
||||
|
||||
// Check for the case of the filename containing eval
|
||||
// e.g. "file.js%20line%2065%20%3E%20eval"
|
||||
let evalIndex = fileName.indexOf(EVAL_TOKEN);
|
||||
if (evalIndex !== -1 && evalIndex === (fileName.length - EVAL_TOKEN.length)) {
|
||||
// Match the filename
|
||||
let evalLine = line;
|
||||
let [, _fileName, , _line] = fileName.match(/(.+)(%20line%20(\d+)%20%3E%20eval)/) || [];
|
||||
fileName = `${_fileName} (eval:${evalLine})`;
|
||||
line = _line;
|
||||
assert(_fileName !== undefined,
|
||||
"Filename could not be found from an eval location site");
|
||||
assert(_line !== undefined,
|
||||
"Line could not be found from an eval location site");
|
||||
|
||||
// Match the url as well
|
||||
[, url] = url.match(/(.+)( line (\d+) > eval)/) || [];
|
||||
assert(url !== undefined,
|
||||
"The URL could not be parsed correctly from an eval location site");
|
||||
}
|
||||
} else {
|
||||
functionName = location;
|
||||
url = null;
|
||||
|
|
|
@ -20,6 +20,9 @@ const CONTENT_LOCATIONS = [
|
|||
"hello/<.world (http://localhost:8888/file.js:100:1)",
|
||||
"hello/<.world (http://localhost:8888/file.js:100)",
|
||||
|
||||
// Eval
|
||||
"hello/<.world (http://localhost:8888/file.js line 65 > eval:1)",
|
||||
|
||||
// Occurs when executing an inline script on a root html page with port
|
||||
// (I've never seen it with a column number but check anyway) bug 1164131
|
||||
"hello/<.world (http://localhost:8888/:1)",
|
||||
|
@ -72,6 +75,7 @@ add_task(function () {
|
|||
["hello/<.world", "file.js", "myfxosapp", "app://myfxosapp/file.js", 100, 1, "myfxosapp", null],
|
||||
["hello/<.world", "file.js", "localhost:8888", "http://localhost:8888/file.js", 100, 1, "localhost:8888", 8888],
|
||||
["hello/<.world", "file.js", "localhost:8888", "http://localhost:8888/file.js", 100, null, "localhost:8888", 8888],
|
||||
["hello/<.world", "file.js (eval:1)", "localhost:8888", "http://localhost:8888/file.js", 65, null, "localhost:8888", 8888],
|
||||
["hello/<.world", "/", "localhost:8888", "http://localhost:8888/", 1, null, "localhost:8888", 8888],
|
||||
["hello/<.world", "/", "localhost:8888", "http://localhost:8888/", 100, 50, "localhost:8888", 8888],
|
||||
["Native[\"arraycopy(blah)\"]", "profiler.html", "localhost:8888", "http://localhost:8888/profiler.html", 4, null, "localhost:8888", 8888],
|
||||
|
|
Загрузка…
Ссылка в новой задаче