Bug 1578752 - Pass event listener column to debugger for more accurate pretty print. r=davidwalsh

Now the event listener tooltip url in the inspector will have an additional column part for generated file, which will be parsed as location.column to debugger, and the debugger pretty print can correctly create and use source map. It's the same bug as [[ https://bugzilla.mozilla.org/show_bug.cgi?id=1045237 | Bug 1045237]], [[ https://bugzilla.mozilla.org/show_bug.cgi?id=1134798 | Bug 1134798 ]], and [[ https://bugzilla.mozilla.org/show_bug.cgi?id=1175911 | Bug 1175911 ]]

Differential Revision: https://phabricator.services.mozilla.com/D48812

--HG--
extra : moz-landing-system : lando
This commit is contained in:
zhaogang 2019-10-16 23:03:15 +00:00
Родитель f3166b49e8
Коммит bd399a64e2
24 изменённых файлов: 191 добавлений и 168 удалений

Просмотреть файл

@ -16,16 +16,19 @@ import {
isGenerated,
isJavaScript,
} from "../../utils/source";
import { isFulfilled } from "../../utils/async-value";
import { loadSourceText } from "./loadSourceText";
import { mapFrames } from "../pause";
import { selectSpecificLocation } from "../sources";
import {
getSource,
getSourceContent,
getSourceFromId,
getSourceByURL,
getSelectedLocation,
getThreadContext,
getSourceActorsForSource,
} from "../../selectors";
import type { Action, ThunkArgs } from "../types";
@ -80,7 +83,14 @@ export function createPrettySource(cx: Context, sourceId: string) {
};
dispatch(({ type: "ADD_SOURCE", cx, source: prettySource }: Action));
await dispatch(selectSource(cx, prettySource.id));
const actors = getSourceActorsForSource(getState(), sourceId);
const content = getSourceContent(getState(), sourceId);
if (!content || !isFulfilled(content)) {
throw new Error("Cannot pretty-print a file that has not loaded");
}
await prettyPrintSource(sourceMaps, source, content.value, actors);
await dispatch(loadSourceText({ cx, source: prettySource }));
return prettySource;
};
@ -92,6 +102,7 @@ function selectPrettyLocation(cx: Context, prettySource: Source) {
if (location && location.line >= 1) {
location = await sourceMaps.getOriginalLocation(location);
return dispatch(
selectSpecificLocation(cx, { ...location, sourceId: prettySource.id })
);
@ -125,7 +136,6 @@ export function togglePrettyPrint(cx: Context, sourceId: string) {
}
await dispatch(loadSourceText({ cx, source }));
assert(
isGenerated(source),
"Pretty-printing only allowed on generated sources"
@ -139,6 +149,7 @@ export function togglePrettyPrint(cx: Context, sourceId: string) {
}
const newPrettySource = await dispatch(createPrettySource(cx, sourceId));
await dispatch(selectPrettyLocation(cx, newPrettySource));
const threadcx = getThreadContext(getState());

Просмотреть файл

@ -28,7 +28,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "mouseover",
filename: TEST_URL + ":45",
filename: TEST_URL + ":45:31",
attributes: ["Capturing", "DOM2"],
handler:
"function mouseoverHandler(event) {\n" +
@ -45,7 +45,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":52",
filename: TEST_URL + ":52:27",
attributes: ["Bubbling", "DOM2"],
handler:
"function clickHandler(event) {\n" +
@ -55,7 +55,7 @@ const TEST_DATA = [ // eslint-disable-line
},
{
type: "mouseup",
filename: TEST_URL + ":57",
filename: TEST_URL + ":57:29",
attributes: ["Bubbling", "DOM2"],
handler:
"function mouseupHandler(event) {\n" +
@ -81,7 +81,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":72",
filename: TEST_URL + ":72:35",
attributes: ["Bubbling", "DOM2"],
handler:
"function noeventsClickHandler(event) {\n" +
@ -117,7 +117,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":67",
filename: TEST_URL + ":67:29",
attributes: ["Bubbling", "DOM2"],
handler: "function(blah) {\n" + ' alert("handleEvent");\n' + "}",
},

Просмотреть файл

@ -17,19 +17,19 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":39",
filename: TEST_URL + ":39:43",
attributes: ["Bubbling", "DOM2"],
handler: "() => {\n" + ' alert("Fat arrow without params!");\n' + "}",
},
{
type: "click",
filename: TEST_URL + ":43",
filename: TEST_URL + ":43:43",
attributes: ["Bubbling", "DOM2"],
handler: "event => {\n" + ' alert("Fat arrow with 1 param!");\n' + "}",
},
{
type: "click",
filename: TEST_URL + ":47",
filename: TEST_URL + ":47:43",
attributes: ["Bubbling", "DOM2"],
handler:
"(event, foo, bar) => {\n" +
@ -38,7 +38,7 @@ const TEST_DATA = [ // eslint-disable-line
},
{
type: "click",
filename: TEST_URL + ":51",
filename: TEST_URL + ":51:43",
attributes: ["Bubbling", "DOM2"],
handler: "b => b",
},
@ -49,7 +49,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":62",
filename: TEST_URL + ":62:32",
attributes: ["Bubbling", "DOM2"],
handler: "function(event) {\n" + ' alert("Bound event");\n' + "}",
},
@ -60,7 +60,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":85",
filename: TEST_URL + ":85:29",
attributes: ["Bubbling", "DOM2"],
handler: "function() {\n" + ' alert("boundHandleEvent");\n' + "}",
},
@ -71,7 +71,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":91",
filename: TEST_URL + ":91:47",
attributes: ["Bubbling", "DOM2"],
handler:
"function functionProceededByInlineComment() {\n" +
@ -85,7 +85,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":96",
filename: TEST_URL + ":96:50",
attributes: ["Bubbling", "DOM2"],
handler:
"function functionProceededByStreamingComment() {\n" +
@ -99,7 +99,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":71",
filename: TEST_URL + ":71:34",
attributes: ["Bubbling", "DOM2"],
handler: "function() {\n" + ' alert("obj.anonObjectMethod");\n' + "}",
},
@ -110,7 +110,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":75",
filename: TEST_URL + ":75:34",
attributes: ["Bubbling", "DOM2"],
handler: "function kay() {\n" + ' alert("obj.objectMethod");\n' + "}",
},

Просмотреть файл

@ -17,7 +17,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":66",
filename: TEST_URL + ":66:17",
attributes: ["Bubbling", "DOM2"],
handler:
"es6Method(foo, bar) {\n" + ' alert("obj.es6Method");\n' + "}",
@ -29,7 +29,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":85",
filename: TEST_URL + ":85:25",
attributes: ["Bubbling", "DOM2"],
handler: "function* generator() {\n" + ' alert("generator");\n' + "}",
},
@ -40,7 +40,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":43",
filename: TEST_URL + ":43:58",
attributes: ["Bubbling", "DOM2"],
handler: "function*() {\n" + ' alert("anonGenerator");\n' + "}",
},
@ -51,7 +51,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":20",
filename: TEST_URL + ":20:18",
attributes: ["Bubbling", "DOM2"],
handler:
"function foo() {\n" + ' alert("namedFunctionExpression");\n' + "}",
@ -63,7 +63,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":24",
filename: TEST_URL + ":24:43",
attributes: ["Bubbling", "DOM2"],
handler:
"function() {\n" + ' alert("anonFunctionExpression");\n' + "}",
@ -75,7 +75,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":29",
filename: TEST_URL + ":29:27",
attributes: ["Bubbling", "DOM2"],
handler: "function bar() {\n" + ' alert("returnedFunction");\n' + "}",
},

Просмотреть файл

@ -17,7 +17,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":56",
filename: TEST_URL + ":56:67",
attributes: ["Bubbling", "DOM2"],
handler:
"function(foo2, bar2) {\n" +
@ -26,7 +26,7 @@ const TEST_DATA = [ // eslint-disable-line
},
{
type: "click",
filename: TEST_URL + ":52",
filename: TEST_URL + ":52:51",
attributes: ["Bubbling", "DOM2"],
handler:
"function(foo, bar) {\n" +
@ -46,7 +46,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":1",
filename: TEST_URL + ":1:0",
attributes: ["Bubbling", "DOM2"],
handler: "function anonymous() {\n" + "\n" + "}",
},
@ -57,7 +57,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":1",
filename: TEST_URL + ":1:0",
attributes: ["Bubbling", "DOM2"],
handler:
"function anonymous(a, b, c) {\n" +
@ -71,7 +71,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":24",
filename: TEST_URL + ":24:57",
attributes: ["Bubbling", "DOM2"],
handler:
"function multi() {\n" + ' alert("multipleAssignment");\n' + "}",
@ -105,7 +105,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":77",
filename: TEST_URL + ":77:29",
attributes: ["Bubbling", "DOM2"],
handler:
"function(event) {\n" +

Просмотреть файл

@ -18,7 +18,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: `${FRAMESCRIPT_URL}:1`,
filename: `${FRAMESCRIPT_URL}:1:109`,
attributes: ["Bubbling", "DOM2"],
handler: `() => { /* Do nothing */ }`,
},

Просмотреть файл

@ -18,7 +18,7 @@ const TEST_DATA = [
expected: [
{
type: "DOMContentLoaded",
filename: URL_ROOT + TEST_LIB + ":1117",
filename: URL_ROOT + TEST_LIB + ":1117:16",
attributes: [
"Bubbling",
"DOM2"
@ -44,7 +44,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL + ":27",
filename: TEST_URL + ":27:38",
attributes: [
"Bubbling",
"DOM2"
@ -106,7 +106,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: URL_ROOT + TEST_LIB + ":894",
filename: URL_ROOT + TEST_LIB + ":894:18",
attributes: [
"Bubbling",
"DOM2"
@ -142,7 +142,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_URL + ":34",
filename: TEST_URL + ":34:41",
attributes: [
"jQuery"
],
@ -153,7 +153,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL + ":35",
filename: TEST_URL + ":35:41",
attributes: [
"jQuery"
],
@ -164,7 +164,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: URL_ROOT + TEST_LIB + ":894",
filename: URL_ROOT + TEST_LIB + ":894:18",
attributes: [
"Bubbling",
"DOM2"
@ -195,7 +195,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL + ":36",
filename: TEST_URL + ":36:42",
attributes: [
"jQuery"
],
@ -206,7 +206,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: URL_ROOT + TEST_LIB + ":894",
filename: URL_ROOT + TEST_LIB + ":894:18",
attributes: [
"Bubbling",
"DOM2"

Просмотреть файл

@ -18,7 +18,7 @@ const TEST_DATA = [
expected: [
{
type: "load",
filename: TEST_URL + ":27",
filename: TEST_URL + ":27:38",
attributes: [
"Bubbling",
"DOM2"
@ -80,7 +80,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: URL_ROOT + TEST_LIB + ":1224",
filename: URL_ROOT + TEST_LIB + ":1224:17",
attributes: [
"Bubbling",
"DOM2"
@ -126,7 +126,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_URL + ":34",
filename: TEST_URL + ":34:41",
attributes: [
"jQuery"
],
@ -137,7 +137,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL + ":35",
filename: TEST_URL + ":35:41",
attributes: [
"jQuery"
],
@ -148,7 +148,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: URL_ROOT + TEST_LIB + ":1224",
filename: URL_ROOT + TEST_LIB + ":1224:17",
attributes: [
"Bubbling",
"DOM2"
@ -189,7 +189,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL + ":36",
filename: TEST_URL + ":36:42",
attributes: [
"jQuery"
],
@ -200,7 +200,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: URL_ROOT + TEST_LIB + ":1224",
filename: URL_ROOT + TEST_LIB + ":1224:17",
attributes: [
"Bubbling",
"DOM2"

Просмотреть файл

@ -18,7 +18,7 @@ const TEST_DATA = [
expected: [
{
type: "load",
filename: TEST_URL + ":27",
filename: TEST_URL + ":27:38",
attributes: [
"Bubbling",
"DOM2"
@ -86,7 +86,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_URL + ":34",
filename: TEST_URL + ":34:41",
attributes: [
"jQuery"
],
@ -97,7 +97,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL + ":35",
filename: TEST_URL + ":35:41",
attributes: [
"jQuery"
],
@ -108,7 +108,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL + ":36",
filename: TEST_URL + ":36:42",
attributes: [
"jQuery"
],
@ -125,7 +125,7 @@ const TEST_DATA = [
expected: [
{
type: "dragend",
filename: TEST_URL + ":31",
filename: TEST_URL + ":31:46",
attributes: [
"jQuery",
"Live"
@ -137,7 +137,7 @@ const TEST_DATA = [
},
{
type: "dragleave",
filename: TEST_URL + ":30",
filename: TEST_URL + ":30:48",
attributes: [
"jQuery",
"Live"
@ -149,7 +149,7 @@ const TEST_DATA = [
},
{
type: "dragover",
filename: TEST_URL + ":33",
filename: TEST_URL + ":33:47",
attributes: [
"jQuery",
"Live"
@ -161,7 +161,7 @@ const TEST_DATA = [
},
{
type: "drop",
filename: TEST_URL + ":32",
filename: TEST_URL + ":32:43",
attributes: [
"jQuery",
"Live"

Просмотреть файл

@ -18,7 +18,7 @@ const TEST_DATA = [
expected: [
{
type: "load",
filename: TEST_URL + ":27",
filename: TEST_URL + ":27:38",
attributes: [
"Bubbling",
"DOM2"
@ -85,7 +85,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_URL + ":34",
filename: TEST_URL + ":34:41",
attributes: [
"jQuery"
],
@ -96,7 +96,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL + ":35",
filename: TEST_URL + ":35:41",
attributes: [
"jQuery"
],
@ -107,7 +107,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: URL_ROOT + TEST_LIB + ":24",
filename: URL_ROOT + TEST_LIB + ":24:10040",
attributes: [
"Bubbling",
"DOM2"
@ -122,7 +122,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL + ":36",
filename: TEST_URL + ":36:42",
attributes: [
"jQuery"
],
@ -133,7 +133,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: URL_ROOT + TEST_LIB + ":24",
filename: URL_ROOT + TEST_LIB + ":24:10040",
attributes: [
"Bubbling",
"DOM2"

Просмотреть файл

@ -18,7 +18,7 @@ const TEST_DATA = [
expected: [
{
type: "DOMContentLoaded",
filename: URL_ROOT + TEST_LIB + ":19",
filename: URL_ROOT + TEST_LIB + ":19:18937",
attributes: [
"Bubbling",
"DOM2"
@ -31,7 +31,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL + ":27",
filename: TEST_URL + ":27:38",
attributes: [
"Bubbling",
"DOM2"
@ -98,7 +98,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_URL + ":34",
filename: TEST_URL + ":34:41",
attributes: [
"jQuery"
],
@ -109,7 +109,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL + ":35",
filename: TEST_URL + ":35:41",
attributes: [
"jQuery"
],
@ -120,7 +120,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL + ":36",
filename: TEST_URL + ":36:42",
attributes: [
"jQuery"
],
@ -136,7 +136,7 @@ const TEST_DATA = [
expected: [
{
type: "dblclick",
filename: TEST_URL + ":28",
filename: TEST_URL + ":28:47",
attributes: [
"jQuery",
"Live"
@ -148,7 +148,7 @@ const TEST_DATA = [
},
{
type: "dragstart",
filename: TEST_URL + ":29",
filename: TEST_URL + ":29:48",
attributes: [
"jQuery",
"Live"

Просмотреть файл

@ -18,7 +18,7 @@ const TEST_DATA = [
expected: [
{
type: "DOMContentLoaded",
filename: URL_ROOT + TEST_LIB + ":32",
filename: URL_ROOT + TEST_LIB + ":32:355",
attributes: [
"Bubbling",
"DOM2"
@ -31,7 +31,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL + ":27",
filename: TEST_URL + ":27:38",
attributes: [
"Bubbling",
"DOM2"
@ -93,7 +93,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: URL_ROOT + TEST_LIB + ":26",
filename: URL_ROOT + TEST_LIB + ":26:107",
attributes: [
"Bubbling",
"DOM2"
@ -118,7 +118,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_URL + ":34",
filename: TEST_URL + ":34:41",
attributes: [
"jQuery"
],
@ -129,7 +129,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL + ":35",
filename: TEST_URL + ":35:41",
attributes: [
"jQuery"
],
@ -140,7 +140,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL + ":36",
filename: TEST_URL + ":36:42",
attributes: [
"jQuery"
],
@ -156,7 +156,7 @@ const TEST_DATA = [
expected: [
{
type: "dblclick",
filename: TEST_URL + ":28",
filename: TEST_URL + ":28:47",
attributes: [
"jQuery",
"Live"
@ -168,7 +168,7 @@ const TEST_DATA = [
},
{
type: "dblclick",
filename: URL_ROOT + TEST_LIB + ":17",
filename: URL_ROOT + TEST_LIB + ":17:183",
attributes: [
"jQuery",
"Live"
@ -180,7 +180,7 @@ const TEST_DATA = [
},
{
type: "dragstart",
filename: TEST_URL + ":29",
filename: TEST_URL + ":29:48",
attributes: [
"jQuery",
"Live"
@ -192,7 +192,7 @@ const TEST_DATA = [
},
{
type: "dragstart",
filename: URL_ROOT + TEST_LIB + ":17",
filename: URL_ROOT + TEST_LIB + ":17:183",
attributes: [
"jQuery",
"Live"

Просмотреть файл

@ -20,7 +20,7 @@ const TEST_DATA = [
expected: [
{
type: "DOMContentLoaded",
filename: URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16:14483",
attributes: [
"Bubbling",
"DOM2"
@ -32,7 +32,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL + ":27",
filename: TEST_URL + ":27:38",
attributes: [
"Bubbling",
"DOM2"
@ -94,7 +94,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16:10001",
attributes: [
"Bubbling",
"DOM2"
@ -116,7 +116,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_URL + ":34",
filename: TEST_URL + ":34:41",
attributes: [
"jQuery"
],
@ -127,7 +127,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL + ":35",
filename: TEST_URL + ":35:41",
attributes: [
"jQuery"
],
@ -138,7 +138,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL + ":36",
filename: TEST_URL + ":36:42",
attributes: [
"jQuery"
],
@ -154,7 +154,7 @@ const TEST_DATA = [
expected: [
{
type: "dblclick",
filename: TEST_URL + ":28",
filename: TEST_URL + ":28:47",
attributes: [
"jQuery",
"Live"
@ -166,7 +166,7 @@ const TEST_DATA = [
},
{
type: "dblclick",
filename: URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16:4732",
attributes: [
"jQuery",
"Live"
@ -211,7 +211,7 @@ const TEST_DATA = [
},
{
type: "dragend",
filename: TEST_URL + ":31",
filename: TEST_URL + ":31:46",
attributes: [
"jQuery",
"Live"
@ -223,7 +223,7 @@ const TEST_DATA = [
},
{
type: "dragend",
filename: URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16:4732",
attributes: [
"jQuery",
"Live"
@ -268,7 +268,7 @@ const TEST_DATA = [
},
{
type: "dragleave",
filename: TEST_URL + ":30",
filename: TEST_URL + ":30:48",
attributes: [
"jQuery",
"Live"
@ -280,7 +280,7 @@ const TEST_DATA = [
},
{
type: "dragleave",
filename: URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16:4732",
attributes: [
"jQuery",
"Live"
@ -325,7 +325,7 @@ const TEST_DATA = [
},
{
type: "dragstart",
filename: TEST_URL + ":29",
filename: TEST_URL + ":29:48",
attributes: [
"jQuery",
"Live"
@ -337,7 +337,7 @@ const TEST_DATA = [
},
{
type: "dragstart",
filename: URL_ROOT + TEST_LIB + ":16",
filename: URL_ROOT + TEST_LIB + ":16:4732",
attributes: [
"jQuery",
"Live"

Просмотреть файл

@ -20,7 +20,7 @@ const TEST_DATA = [
expected: [
{
type: "DOMContentLoaded",
filename: URL_ROOT + TEST_LIB + ":2",
filename: URL_ROOT + TEST_LIB + ":2:14177",
attributes: [
"Bubbling",
"DOM2"
@ -32,7 +32,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: TEST_URL + ":27",
filename: TEST_URL + ":27:38",
attributes: [
"Bubbling",
"DOM2"
@ -94,7 +94,7 @@ const TEST_DATA = [
},
{
type: "load",
filename: URL_ROOT + TEST_LIB + ":2",
filename: URL_ROOT + TEST_LIB + ":2:9526",
attributes: [
"Bubbling",
"DOM2"
@ -116,7 +116,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_URL + ":34",
filename: TEST_URL + ":34:41",
attributes: [
"jQuery"
],
@ -127,7 +127,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL + ":35",
filename: TEST_URL + ":35:41",
attributes: [
"jQuery"
],
@ -138,7 +138,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL + ":36",
filename: TEST_URL + ":36:42",
attributes: [
"jQuery"
],
@ -154,7 +154,7 @@ const TEST_DATA = [
expected: [
{
type: "dblclick",
filename: TEST_URL + ":28",
filename: TEST_URL + ":28:47",
attributes: [
"jQuery",
"Live"
@ -166,7 +166,7 @@ const TEST_DATA = [
},
{
type: "dragend",
filename: TEST_URL + ":31",
filename: TEST_URL + ":31:46",
attributes: [
"jQuery",
"Live"
@ -178,7 +178,7 @@ const TEST_DATA = [
},
{
type: "dragleave",
filename: TEST_URL + ":30",
filename: TEST_URL + ":30:48",
attributes: [
"jQuery",
"Live"
@ -190,7 +190,7 @@ const TEST_DATA = [
},
{
type: "dragover",
filename: TEST_URL + ":33",
filename: TEST_URL + ":33:47",
attributes: [
"jQuery",
"Live"
@ -202,7 +202,7 @@ const TEST_DATA = [
},
{
type: "dragstart",
filename: TEST_URL + ":29",
filename: TEST_URL + ":29:48",
attributes: [
"jQuery",
"Live"
@ -214,7 +214,7 @@ const TEST_DATA = [
},
{
type: "drop",
filename: TEST_URL + ":32",
filename: TEST_URL + ":32:43",
attributes: [
"jQuery",
"Live"

Просмотреть файл

@ -20,7 +20,7 @@ const TEST_DATA = [
expected: [
{
type: "load",
filename: TEST_URL + ":27",
filename: TEST_URL + ":27:38",
attributes: [
"Bubbling",
"DOM2"
@ -87,7 +87,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_URL + ":34",
filename: TEST_URL + ":34:41",
attributes: [
"jQuery"
],
@ -98,7 +98,7 @@ const TEST_DATA = [
},
{
type: "click",
filename: TEST_URL + ":35",
filename: TEST_URL + ":35:41",
attributes: [
"jQuery"
],
@ -109,7 +109,7 @@ const TEST_DATA = [
},
{
type: "keydown",
filename: TEST_URL + ":36",
filename: TEST_URL + ":36:42",
attributes: [
"jQuery"
],
@ -125,7 +125,7 @@ const TEST_DATA = [
expected: [
{
type: "dragend",
filename: TEST_URL + ":31",
filename: TEST_URL + ":31:46",
attributes: [
"jQuery",
"Live"
@ -137,7 +137,7 @@ const TEST_DATA = [
},
{
type: "dragleave",
filename: TEST_URL + ":30",
filename: TEST_URL + ":30:48",
attributes: [
"jQuery",
"Live"
@ -149,7 +149,7 @@ const TEST_DATA = [
},
{
type: "dragover",
filename: TEST_URL + ":33",
filename: TEST_URL + ":33:47",
attributes: [
"jQuery",
"Live"
@ -161,7 +161,7 @@ const TEST_DATA = [
},
{
type: "drop",
filename: TEST_URL + ":32",
filename: TEST_URL + ":32:43",
attributes: [
"jQuery",
"Live"

Просмотреть файл

@ -18,7 +18,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":17",
filename: TEST_URL + ":17:23",
attributes: ["Bubbling", "DOM2"],
handler: `() => {\n` + ` console.log("handleEvent");\n` + `}`,
},
@ -29,7 +29,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
filename: TEST_URL + ":24",
filename: TEST_URL + ":24:23",
attributes: ["Bubbling", "DOM2"],
handler: `() => {\n` + ` console.log("handleEvent");\n` + `}`,
},

Просмотреть файл

@ -21,7 +21,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":17530",
filename: TEST_LIB + ":17530:42",
attributes: [
"Bubbling",
"DOM2"
@ -30,7 +30,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_URL + ":21",
filename: TEST_URL + ":21:33",
attributes: [
"Bubbling",
"React"
@ -47,7 +47,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":17530",
filename: TEST_LIB + ":17530:42",
attributes: [
"Bubbling",
"DOM2"
@ -56,7 +56,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -73,7 +73,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":17530",
filename: TEST_LIB + ":17530:42",
attributes: [
"Bubbling",
"DOM2"
@ -82,7 +82,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -94,7 +94,7 @@ const TEST_DATA = [
},
{
type: "onMouseUp",
filename: TEST_URL + ":21",
filename: TEST_URL + ":21:33",
attributes: [
"Bubbling",
"React"
@ -111,7 +111,7 @@ const TEST_DATA = [
expected: [
{
type: "onClickCapture",
filename: TEST_EXTERNAL_LISTENERS + ":8",
filename: TEST_EXTERNAL_LISTENERS + ":8:34",
attributes: [
"Capturing",
"React"

Просмотреть файл

@ -23,7 +23,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":17530",
filename: TEST_LIB + ":17530:42",
attributes: [
"Bubbling",
"DOM2"
@ -32,7 +32,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_LIB_BABEL + ":10",
filename: TEST_LIB_BABEL + ":10:41",
attributes: [
"Bubbling",
"React"
@ -49,7 +49,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":17530",
filename: TEST_LIB + ":17530:42",
attributes: [
"Bubbling",
"DOM2"
@ -58,7 +58,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -75,7 +75,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":17530",
filename: TEST_LIB + ":17530:42",
attributes: [
"Bubbling",
"DOM2"
@ -84,7 +84,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -96,7 +96,7 @@ const TEST_DATA = [
},
{
type: "onMouseUp",
filename: TEST_LIB_BABEL + ":10",
filename: TEST_LIB_BABEL + ":10:41",
attributes: [
"Bubbling",
"React"
@ -113,7 +113,7 @@ const TEST_DATA = [
expected: [
{
type: "onClickCapture",
filename: TEST_EXTERNAL_LISTENERS + ":8",
filename: TEST_EXTERNAL_LISTENERS + ":8:34",
attributes: [
"Capturing",
"React"

Просмотреть файл

@ -21,7 +21,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":16",
filename: TEST_LIB + ":16:27180",
attributes: [
"Bubbling",
"DOM2"
@ -30,7 +30,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_URL + ":21",
filename: TEST_URL + ":21:33",
attributes: [
"Bubbling",
"React"
@ -47,7 +47,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":16",
filename: TEST_LIB + ":16:27180",
attributes: [
"Bubbling",
"DOM2"
@ -56,7 +56,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -73,7 +73,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":16",
filename: TEST_LIB + ":16:27180",
attributes: [
"Bubbling",
"DOM2"
@ -82,7 +82,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -94,7 +94,7 @@ const TEST_DATA = [
},
{
type: "onMouseUp",
filename: TEST_URL + ":21",
filename: TEST_URL + ":21:33",
attributes: [
"Bubbling",
"React"
@ -111,7 +111,7 @@ const TEST_DATA = [
expected: [
{
type: "onClickCapture",
filename: TEST_EXTERNAL_LISTENERS + ":8",
filename: TEST_EXTERNAL_LISTENERS + ":8:34",
attributes: [
"Capturing",
"React"

Просмотреть файл

@ -23,7 +23,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":16",
filename: TEST_LIB + ":16:27180",
attributes: [
"Bubbling",
"DOM2"
@ -32,7 +32,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_LIB_BABEL + ":10",
filename: TEST_LIB_BABEL + ":10:41",
attributes: [
"Bubbling",
"React"
@ -49,7 +49,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":16",
filename: TEST_LIB + ":16:27180",
attributes: [
"Bubbling",
"DOM2"
@ -58,7 +58,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -75,7 +75,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":16",
filename: TEST_LIB + ":16:27180",
attributes: [
"Bubbling",
"DOM2"
@ -84,7 +84,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -96,7 +96,7 @@ const TEST_DATA = [
},
{
type: "onMouseUp",
filename: TEST_LIB_BABEL + ":10",
filename: TEST_LIB_BABEL + ":10:41",
attributes: [
"Bubbling",
"React"
@ -113,7 +113,7 @@ const TEST_DATA = [
expected: [
{
type: "onClickCapture",
filename: TEST_EXTERNAL_LISTENERS + ":8",
filename: TEST_EXTERNAL_LISTENERS + ":8:34",
attributes: [
"Capturing",
"React"

Просмотреть файл

@ -21,7 +21,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":93",
filename: TEST_LIB + ":93:417",
attributes: [
"Bubbling",
"DOM2"
@ -30,7 +30,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_URL + ":21",
filename: TEST_URL + ":21:22",
attributes: [
"Bubbling",
"React"
@ -47,7 +47,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":93",
filename: TEST_LIB + ":93:417",
attributes: [
"Bubbling",
"DOM2"
@ -56,7 +56,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -73,7 +73,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":93",
filename: TEST_LIB + ":93:417",
attributes: [
"Bubbling",
"DOM2"
@ -82,7 +82,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -94,7 +94,7 @@ const TEST_DATA = [
},
{
type: "onMouseUp",
filename: TEST_URL + ":21",
filename: TEST_URL + ":21:22",
attributes: [
"Bubbling",
"React"
@ -111,7 +111,7 @@ const TEST_DATA = [
expected: [
{
type: "onClickCapture",
filename: TEST_EXTERNAL_LISTENERS + ":8",
filename: TEST_EXTERNAL_LISTENERS + ":8:34",
attributes: [
"Capturing",
"React"

Просмотреть файл

@ -23,7 +23,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":93",
filename: TEST_LIB + ":93:417",
attributes: [
"Bubbling",
"DOM2"
@ -32,7 +32,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_LIB_BABEL + ":26",
filename: TEST_LIB_BABEL + ":26:34",
attributes: [
"Bubbling",
"React"
@ -49,7 +49,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":93",
filename: TEST_LIB + ":93:417",
attributes: [
"Bubbling",
"DOM2"
@ -58,7 +58,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -75,7 +75,7 @@ const TEST_DATA = [
expected: [
{
type: "click",
filename: TEST_LIB + ":93",
filename: TEST_LIB + ":93:417",
attributes: [
"Bubbling",
"DOM2"
@ -84,7 +84,7 @@ const TEST_DATA = [
},
{
type: "onClick",
filename: TEST_EXTERNAL_LISTENERS + ":4",
filename: TEST_EXTERNAL_LISTENERS + ":4:25",
attributes: [
"Bubbling",
"React"
@ -96,7 +96,7 @@ const TEST_DATA = [
},
{
type: "onMouseUp",
filename: TEST_LIB_BABEL + ":26",
filename: TEST_LIB_BABEL + ":26:34",
attributes: [
"Bubbling",
"React"
@ -113,7 +113,7 @@ const TEST_DATA = [
expected: [
{
type: "onClickCapture",
filename: TEST_EXTERNAL_LISTENERS + ":8",
filename: TEST_EXTERNAL_LISTENERS + ":8:34",
attributes: [
"Capturing",
"React"

Просмотреть файл

@ -127,12 +127,13 @@ EventTooltip.prototype = {
sourceMapService.subscribe(
location.url,
location.line,
null,
location.column,
callback
);
this._subscriptions.push({
url: location.url,
line: location.line,
column: location.column,
callback,
});
}
@ -285,7 +286,6 @@ EventTooltip.prototype = {
const content = header.nextElementSibling;
const { sourceActor, uri } = this._eventEditors.get(content);
const location = this._parseLocation(uri);
if (location) {
// Save a copy of toolbox as it will be set to null when we hide the tooltip.
@ -303,21 +303,28 @@ EventTooltip.prototype = {
},
/**
* Parse URI and return {url, line}; or return null if it can't be parsed.
* Parse URI and return {url, line, column}; or return null if it can't be parsed.
*/
_parseLocation: function(uri) {
if (uri && uri !== "?") {
uri = uri.replace(/"/g, "");
const matches = uri.match(/(.*):(\d+$)/);
let matches = uri.match(/(.*):(\d+):(\d+$)/);
if (matches) {
return {
url: matches[1],
line: parseInt(matches[2], 10),
column: parseInt(matches[3], 10),
};
} else if ((matches = uri.match(/(.*):(\d+$)/))) {
return {
url: matches[1],
line: parseInt(matches[2], 10),
column: null,
};
}
return { url: uri, line: 1 };
return { url: uri, line: 1, column: null };
}
return null;
},
@ -357,7 +364,7 @@ EventTooltip.prototype = {
sourceMapService.unsubscribe(
subscription.url,
subscription.line,
null,
subscription.column,
subscription.callback
);
}

Просмотреть файл

@ -936,6 +936,7 @@ class EventCollector {
let dom0 = false;
let functionSource = handler.toString();
let line = 0;
let column = null;
let native = false;
let url = "";
let sourceActor = "";
@ -975,8 +976,8 @@ class EventCollector {
} else {
dom0 = false;
}
line = script.startLine;
column = script.startColumn;
url = script.url;
const actor = this.targetActor.sources.getOrCreateSourceActor(
script.source
@ -1030,7 +1031,11 @@ class EventCollector {
if (native) {
origin = "[native code]";
} else {
origin = url + (dom0 || line === 0 ? "" : ":" + line);
origin =
url +
(dom0 || line === 0
? ""
: ":" + line + (column === null ? "" : ":" + column));
}
const eventObj = {