| Index: third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-getEventListeners.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-getEventListeners.html b/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-getEventListeners.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..42d704d5edd460e20c4c16f1f4b9d868f78492b9
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-getEventListeners.html
|
| @@ -0,0 +1,74 @@
|
| +<html>
|
| +<head>
|
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
|
| +<script>
|
| +
|
| +function test()
|
| +{
|
| + var objectId;
|
| + InspectorTest.sendCommand("DOM.enable", {});
|
| + InspectorTest.sendCommand("Runtime.enable", {});
|
| + InspectorTest.sendCommand("DOMDebugger.enable", {});
|
| + InspectorTest.sendCommandPromise("Runtime.evaluate", { expression: "document" })
|
| + .then((result) => { objectId = result.result.result.objectId })
|
| + .then(() => dumpListeners(objectId))
|
| + .then(() => dumpListeners(objectId, 1))
|
| + .then(() => dumpListeners(objectId, 4))
|
| + .then(() => dumpListeners(objectId, -1))
|
| + .then(() => dumpListeners(objectId, -1, true))
|
| + .then(() => InspectorTest.completeTest());
|
| +
|
| + function dumpListeners(objectId, depth, pierce) {
|
| + var params = {objectId : objectId};
|
| + if (depth)
|
| + params.depth = depth;
|
| + if (pierce !== undefined)
|
| + params.pierce = pierce;
|
| + InspectorTest.log(`Fetching listeners for depth = ${depth} and pierce = ${pierce}`);
|
| + return InspectorTest.sendCommandPromise("DOMDebugger.getEventListeners", params).then((result) => logResponse(result.result));
|
| + }
|
| +
|
| + function stabilize(key, value) {
|
| + var unstableKeys = ["scriptId", "lineNumber", "columnNumber"];
|
| + if (unstableKeys.indexOf(key) !== -1)
|
| + return "<" + typeof(value) + ">";
|
| + return value;
|
| + }
|
| +
|
| + function logResponse(response) {
|
| + InspectorTest.log(JSON.stringify(response, stabilize, 2));
|
| + }
|
| +}
|
| +
|
| +</script>
|
| +<template id="shadow-template" onclick="clickTemplate">
|
| +<style>
|
| +:host {
|
| + color: red;
|
| +}
|
| +</style>
|
| +<div></div><h1>Hi from a template!</h1></div>
|
| +</template>
|
| +</head>
|
| +<body class="body-class" onload="runTest()">
|
| + <div id="A"> A
|
| + <div id="B"> B
|
| + <div id="C"> C
|
| + </div>
|
| + </div>
|
| + </div>
|
| +
|
| + <iframe src="../dom/resources/iframe-with-listener.html" width="400" height="200"></iframe>
|
| + <div id="shadow-host"></div>
|
| + <script type="text/javascript">
|
| + var host = document.querySelector("#shadow-host").createShadowRoot();
|
| + var template = document.querySelector("#shadow-template");
|
| + host.appendChild(template.content);
|
| + template.remove();
|
| + document.getElementById("A").addEventListener("listenerA", () => {});
|
| + document.getElementById("B").addEventListener("listenerB", () => {});
|
| + document.getElementById("C").addEventListener("listenerC", () => {});
|
| + document.addEventListener("documentListener", () => {});
|
| + </script>
|
| +</body>
|
| +</html>
|
|
|