--- a/devtools/client/inspector/markup/test/browser_markup_events_04.js
+++ b/devtools/client/inspector/markup/test/browser_markup_events_04.js
@@ -12,27 +12,16 @@ const TEST_URL = URL_ROOT + "doc_markup_
loadHelperScript("helper_events_test_runner.js");
const TEST_DATA = [ // eslint-disable-line
{
selector: "html",
expected: [
{
- type: "load",
- filename: TEST_URL,
- attributes: [
- "Bubbling",
- "DOM0"
- ],
- handler: "function onload(event) {\n" +
- " init();\n" +
- "}"
- },
- {
type: "click",
filename: TEST_URL + ":56",
attributes: [
"Bubbling",
"DOM2"
],
handler: "function(foo2, bar2) {\n" +
" alert(\"documentElement event listener clicked\");\n" +
@@ -44,16 +33,27 @@ const TEST_DATA = [ // eslint-disable-li
attributes: [
"Bubbling",
"DOM2"
],
handler: "function(foo, bar) {\n" +
" alert(\"document event listener clicked\");\n" +
"}"
},
+ {
+ type: "load",
+ filename: TEST_URL,
+ attributes: [
+ "Bubbling",
+ "DOM0"
+ ],
+ handler: "function onload(event) {\n" +
+ " init();\n" +
+ "}"
+ }
]
},
{
selector: "#constructed-function",
expected: [
{
type: "click",
filename: TEST_URL + ":1",
--- a/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.0.js
+++ b/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.0.js
@@ -13,16 +13,41 @@ const TEST_URL = URL_ROOT + "doc_markup_
loadHelperScript("helper_events_test_runner.js");
/*eslint-disable */
const TEST_DATA = [
{
selector: "html",
expected: [
{
+ type: "DOMContentLoaded",
+ filename: URL_ROOT + TEST_LIB + ":1117",
+ attributes: [
+ "Bubbling",
+ "DOM2"
+ ],
+ handler: "function() {\n" +
+ " // Make sure that the DOM is not already loaded\n" +
+ " if (!jQuery.isReady) {\n" +
+ " // Remember that the DOM is ready\n" +
+ " jQuery.isReady = true;\n" +
+ "\n" +
+ " // If there are functions bound, to execute\n" +
+ " if (jQuery.readyList) {\n" +
+ " // Execute all of them\n" +
+ " for (var i = 0; i < jQuery.readyList.length; i++)\n" +
+ " jQuery.readyList[i].apply(document);\n" +
+ "\n" +
+ " // Reset the list of functions\n" +
+ " jQuery.readyList = null;\n" +
+ " }\n" +
+ " }\n" +
+ "}"
+ },
+ {
type: "load",
filename: URL_ROOT + TEST_LIB + ":1117",
attributes: [
"jQuery"
],
handler: "function() {\n" +
" // Make sure that the DOM is not already loaded\n" +
" if (!jQuery.isReady) {\n" +
@@ -126,41 +151,16 @@ const TEST_DATA = [
" event.preventDefault();\n" +
" event.stopPropagation();\n" +
" returnValue = false;\n" +
" }\n" +
" }\n" +
"\n" +
" return returnValue;\n" +
"}"
- },
- {
- type: "DOMContentLoaded",
- filename: URL_ROOT + TEST_LIB + ":1117",
- attributes: [
- "Bubbling",
- "DOM2"
- ],
- handler: "function() {\n" +
- " // Make sure that the DOM is not already loaded\n" +
- " if (!jQuery.isReady) {\n" +
- " // Remember that the DOM is ready\n" +
- " jQuery.isReady = true;\n" +
- "\n" +
- " // If there are functions bound, to execute\n" +
- " if (jQuery.readyList) {\n" +
- " // Execute all of them\n" +
- " for (var i = 0; i < jQuery.readyList.length; i++)\n" +
- " jQuery.readyList[i].apply(document);\n" +
- "\n" +
- " // Reset the list of functions\n" +
- " jQuery.readyList = null;\n" +
- " }\n" +
- " }\n" +
- "}"
}
]
},
{
selector: "#testdiv",
expected: [
{
type: "click",
--- a/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.3.js
+++ b/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.3.js
@@ -13,16 +13,106 @@ const TEST_URL = URL_ROOT + "doc_markup_
loadHelperScript("helper_events_test_runner.js");
/*eslint-disable */
const TEST_DATA = [
{
selector: "html",
expected: [
{
+ type: "dblclick",
+ filename: URL_ROOT + TEST_LIB + ":19",
+ attributes: [
+ "jQuery"
+ ],
+ handler: "function c(G) {\n" +
+ " var D = RegExp(\"(^|\\\\.)\" + G.type + \"(\\\\.|$)\"),\n" +
+ " F = true,\n" +
+ " E = [];\n" +
+ " n.each(n.data(this, \"events\").live || [], function(H, I) {\n" +
+ " if (D.test(I.type)) {\n" +
+ " var J = n(G.target).closest(I.data)[0];\n" +
+ " if (J) {\n" +
+ " E.push({\n" +
+ " elem: J,\n" +
+ " fn: I\n" +
+ " })\n" +
+ " }\n" +
+ " }\n" +
+ " });\n" +
+ " n.each(E, function() {\n" +
+ " if (!G.isImmediatePropagationStopped() && " + "this.fn.call(this.elem, G, this.fn.data) === false) {\n" +
+ " F = false\n" +
+ " }\n" +
+ " });\n" +
+ " return F\n" +
+ "}"
+ },
+ {
+ type: "DOMContentLoaded",
+ filename: URL_ROOT + TEST_LIB + ":19",
+ attributes: [
+ "Bubbling",
+ "DOM2"
+ ],
+ handler: "function() {\n" +
+ " document.removeEventListener(\"DOMContentLoaded\", arguments.callee, false);\n" +
+ " n.ready()\n" +
+ "}"
+ },
+ {
+ type: "dragstart",
+ filename: URL_ROOT + TEST_LIB + ":19",
+ attributes: [
+ "jQuery"
+ ],
+ handler: "function c(G) {\n" +
+ " var D = RegExp(\"(^|\\\\.)\" + G.type + \"(\\\\.|$)\"),\n" +
+ " F = true,\n" +
+ " E = [];\n" +
+ " n.each(n.data(this, \"events\").live || [], function(H, I) {\n" +
+ " if (D.test(I.type)) {\n" +
+ " var J = n(G.target).closest(I.data)[0];\n" +
+ " if (J) {\n" +
+ " E.push({\n" +
+ " elem: J,\n" +
+ " fn: I\n" +
+ " })\n" +
+ " }\n" +
+ " }\n" +
+ " });\n" +
+ " n.each(E, function() {\n" +
+ " if (!G.isImmediatePropagationStopped() && " + "this.fn.call(this.elem, G, this.fn.data) === false) {\n" +
+ " F = false\n" +
+ " }\n" +
+ " });\n" +
+ " return F\n" +
+ "}"
+ },
+ {
+ type: "live",
+ filename: URL_ROOT + TEST_LIB + ":19",
+ attributes: [
+ "jQuery"
+ ],
+ handler: "function() {\n" +
+ " return E.apply(this, arguments)\n" +
+ "}"
+ },
+ {
+ type: "live",
+ filename: URL_ROOT + TEST_LIB + ":19",
+ attributes: [
+ "jQuery"
+ ],
+ handler: "function() {\n" +
+ " return E.apply(this, arguments)\n" +
+ "}"
+ },
+ {
type: "load",
filename: URL_ROOT + TEST_LIB + ":19",
attributes: [
"jQuery"
],
handler: "function() {\n" +
" if (!n.isReady) {\n" +
" n.isReady = true;\n" +
@@ -102,106 +192,16 @@ const TEST_DATA = [
filename: URL_ROOT + TEST_LIB + ":19",
attributes: [
"jQuery"
],
handler: "function(H) {\n" +
" n(this).unbind(H, D);\n" +
" return (E || G).apply(this, arguments)\n" +
"}"
- },
- {
- type: "dblclick",
- filename: URL_ROOT + TEST_LIB + ":19",
- attributes: [
- "jQuery"
- ],
- handler: "function c(G) {\n" +
- " var D = RegExp(\"(^|\\\\.)\" + G.type + \"(\\\\.|$)\"),\n" +
- " F = true,\n" +
- " E = [];\n" +
- " n.each(n.data(this, \"events\").live || [], function(H, I) {\n" +
- " if (D.test(I.type)) {\n" +
- " var J = n(G.target).closest(I.data)[0];\n" +
- " if (J) {\n" +
- " E.push({\n" +
- " elem: J,\n" +
- " fn: I\n" +
- " })\n" +
- " }\n" +
- " }\n" +
- " });\n" +
- " n.each(E, function() {\n" +
- " if (!G.isImmediatePropagationStopped() && " + "this.fn.call(this.elem, G, this.fn.data) === false) {\n" +
- " F = false\n" +
- " }\n" +
- " });\n" +
- " return F\n" +
- "}"
- },
- {
- type: "DOMContentLoaded",
- filename: URL_ROOT + TEST_LIB + ":19",
- attributes: [
- "Bubbling",
- "DOM2"
- ],
- handler: "function() {\n" +
- " document.removeEventListener(\"DOMContentLoaded\", arguments.callee, false);\n" +
- " n.ready()\n" +
- "}"
- },
- {
- type: "dragstart",
- filename: URL_ROOT + TEST_LIB + ":19",
- attributes: [
- "jQuery"
- ],
- handler: "function c(G) {\n" +
- " var D = RegExp(\"(^|\\\\.)\" + G.type + \"(\\\\.|$)\"),\n" +
- " F = true,\n" +
- " E = [];\n" +
- " n.each(n.data(this, \"events\").live || [], function(H, I) {\n" +
- " if (D.test(I.type)) {\n" +
- " var J = n(G.target).closest(I.data)[0];\n" +
- " if (J) {\n" +
- " E.push({\n" +
- " elem: J,\n" +
- " fn: I\n" +
- " })\n" +
- " }\n" +
- " }\n" +
- " });\n" +
- " n.each(E, function() {\n" +
- " if (!G.isImmediatePropagationStopped() && " + "this.fn.call(this.elem, G, this.fn.data) === false) {\n" +
- " F = false\n" +
- " }\n" +
- " });\n" +
- " return F\n" +
- "}"
- },
- {
- type: "live",
- filename: URL_ROOT + TEST_LIB + ":19",
- attributes: [
- "jQuery"
- ],
- handler: "function() {\n" +
- " return E.apply(this, arguments)\n" +
- "}"
- },
- {
- type: "live",
- filename: URL_ROOT + TEST_LIB + ":19",
- attributes: [
- "jQuery"
- ],
- handler: "function() {\n" +
- " return E.apply(this, arguments)\n" +
- "}"
}
]
},
{
selector: "#testdiv",
expected: [
{
type: "click",
--- a/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.4.js
+++ b/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.4.js
@@ -13,16 +13,48 @@ const TEST_URL = URL_ROOT + "doc_markup_
loadHelperScript("helper_events_test_runner.js");
/*eslint-disable */
const TEST_DATA = [
{
selector: "html",
expected: [
{
+ type: "dblclick",
+ filename: URL_ROOT + TEST_LIB + ":31",
+ attributes: [
+ "jQuery"
+ ],
+ handler: "function() {\n" +
+ " return a.apply(d || this, arguments)\n" +
+ "}"
+ },
+ {
+ type: "DOMContentLoaded",
+ filename: URL_ROOT + TEST_LIB + ":32",
+ attributes: [
+ "Bubbling",
+ "DOM2"
+ ],
+ handler: "function() {\n" +
+ " s.removeEventListener(\"DOMContentLoaded\", M, false);\n" +
+ " c.ready()\n" +
+ "}"
+ },
+ {
+ type: "dragstart",
+ filename: URL_ROOT + TEST_LIB + ":31",
+ attributes: [
+ "jQuery"
+ ],
+ handler: "function() {\n" +
+ " return a.apply(d || this, arguments)\n" +
+ "}"
+ },
+ {
type: "load",
filename: TEST_URL + ":27",
attributes: [
"Bubbling",
"DOM2"
],
handler: "() => {\n" +
" var handler1 = function liveDivDblClick() {\n" +
@@ -91,48 +123,16 @@ const TEST_DATA = [
" c.isReady = true;\n" +
" if (Q) {\n" +
" for (var a, b = 0; a = Q[b++];) a.call(s, c);\n" +
" Q = null\n" +
" }\n" +
" c.fn.triggerHandler && c(s).triggerHandler(\"ready\")\n" +
" }\n" +
"}"
- },
- {
- type: "dblclick",
- filename: URL_ROOT + TEST_LIB + ":31",
- attributes: [
- "jQuery"
- ],
- handler: "function() {\n" +
- " return a.apply(d || this, arguments)\n" +
- "}"
- },
- {
- type: "DOMContentLoaded",
- filename: URL_ROOT + TEST_LIB + ":32",
- attributes: [
- "Bubbling",
- "DOM2"
- ],
- handler: "function() {\n" +
- " s.removeEventListener(\"DOMContentLoaded\", M, false);\n" +
- " c.ready()\n" +
- "}"
- },
- {
- type: "dragstart",
- filename: URL_ROOT + TEST_LIB + ":31",
- attributes: [
- "jQuery"
- ],
- handler: "function() {\n" +
- " return a.apply(d || this, arguments)\n" +
- "}"
}
]
},
{
selector: "#testdiv",
expected: [
{
type: "click",
--- a/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.6.js
+++ b/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.6.js
@@ -15,16 +15,27 @@ const TEST_URL = URL_ROOT + "doc_markup_
loadHelperScript("helper_events_test_runner.js");
/*eslint-disable */
const TEST_DATA = [
{
selector: "html",
expected: [
{
+ type: "DOMContentLoaded",
+ filename: URL_ROOT + TEST_LIB + ":16",
+ attributes: [
+ "Bubbling",
+ "DOM2"
+ ],
+ handler: "function() {\n" +
+ " c.removeEventListener(\"DOMContentLoaded\", z, !1), e.ready()\n" +
+ "}"
+ },
+ {
type: "load",
filename: TEST_URL + ":27",
attributes: [
"Bubbling",
"DOM2"
],
handler: "() => {\n" +
" var handler1 = function liveDivDblClick() {\n" +
@@ -90,27 +101,16 @@ const TEST_DATA = [
handler: "function(a) {\n" +
" if (a === !0 && !--e.readyWait || a !== !0 && !e.isReady) {\n" +
" if (!c.body) return setTimeout(e.ready, 1);\n" +
" e.isReady = !0;\n" +
" if (a !== !0 && --e.readyWait > 0) return;\n" +
" y.resolveWith(c, [e]), e.fn.trigger && e(c).trigger(\"ready\").unbind(\"ready\")\n" +
" }\n" +
"}"
- },
- {
- type: "DOMContentLoaded",
- filename: URL_ROOT + TEST_LIB + ":16",
- attributes: [
- "Bubbling",
- "DOM2"
- ],
- handler: "function() {\n" +
- " c.removeEventListener(\"DOMContentLoaded\", z, !1), e.ready()\n" +
- "}"
}
]
},
{
selector: "#testdiv",
expected: [
{
type: "click",
--- a/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.7.js
+++ b/devtools/client/inspector/markup/test/browser_markup_events_jquery_1.7.js
@@ -15,16 +15,27 @@ const TEST_URL = URL_ROOT + "doc_markup_
loadHelperScript("helper_events_test_runner.js");
/*eslint-disable */
const TEST_DATA = [
{
selector: "html",
expected: [
{
+ type: "DOMContentLoaded",
+ filename: URL_ROOT + TEST_LIB + ":2",
+ attributes: [
+ "Bubbling",
+ "DOM2"
+ ],
+ handler: "function() {\n" +
+ " c.removeEventListener(\"DOMContentLoaded\", C, !1), e.ready()\n" +
+ "}"
+ },
+ {
type: "load",
filename: TEST_URL + ":27",
attributes: [
"Bubbling",
"DOM2"
],
handler: "() => {\n" +
" var handler1 = function liveDivDblClick() {\n" +
@@ -90,27 +101,16 @@ const TEST_DATA = [
handler: "function(a) {\n" +
" if (a === !0 && !--e.readyWait || a !== !0 && !e.isReady) {\n" +
" if (!c.body) return setTimeout(e.ready, 1);\n" +
" e.isReady = !0;\n" +
" if (a !== !0 && --e.readyWait > 0) return;\n" +
" B.fireWith(c, [e]), e.fn.trigger && e(c).trigger(\"ready\").unbind(\"ready\")\n" +
" }\n" +
"}"
- },
- {
- type: "DOMContentLoaded",
- filename: URL_ROOT + TEST_LIB + ":2",
- attributes: [
- "Bubbling",
- "DOM2"
- ],
- handler: "function() {\n" +
- " c.removeEventListener(\"DOMContentLoaded\", C, !1), e.ready()\n" +
- "}"
}
]
},
{
selector: "#testdiv",
expected: [
{
type: "click",
--- a/devtools/server/actors/inspector/node.js
+++ b/devtools/server/actors/inspector/node.js
@@ -598,17 +598,19 @@ const NodeActor = protocol.ActorClassWit
getEventListenerInfo: function() {
let node = this.rawNode;
if (this.rawNode.nodeName.toLowerCase() === "html") {
let winListeners = this.getEventListeners(node.ownerGlobal) || [];
let docElementListeners = this.getEventListeners(node) || [];
let docListeners = this.getEventListeners(node.parentNode) || [];
- return [...winListeners, ...docElementListeners, ...docListeners];
+ return [...winListeners, ...docElementListeners, ...docListeners].sort((a, b) => {
+ return a.type.localeCompare(b.type);
+ });
}
return this.getEventListeners(node);
},
/**
* Modify a node's attributes. Passed an array of modifications
* similar in format to "attributes" mutations.
* {