Bug 1845865 - Part 3: Add tests. r=devtools-reviewers,ochameau

Differential Revision: https://phabricator.services.mozilla.com/D186926
This commit is contained in:
Tooru Fujisawa 2023-09-15 04:15:52 +00:00
Родитель 7cd4ad4807
Коммит b314e02c6b
7 изменённых файлов: 56 добавлений и 0 удалений

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

@ -142,6 +142,7 @@ skip-if = ccov && os == 'win' # Bug 1443132
skip-if = true # bug 1607636
[browser_dbg-inline-exceptions.js]
[browser_dbg-inline-exceptions-inline-script.js]
[browser_dbg-inline-exceptions-position.js]
[browser_dbg-inspector-integration.js]
[browser_dbg-keyboard-navigation.js]
[browser_dbg-keyboard-shortcuts-modal.js]

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

@ -0,0 +1,32 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// This test checks the appearance of an inline exception
// and the content of the exception tooltip.
"use strict";
add_task(async function () {
const dbg = await initDebugger("doc-exception-position.html");
await selectSource(dbg, "exception-position-1.js");
let elems = findAllElementsWithSelector(dbg, ".mark-text-exception");
is(elems.length, 1);
is(elems[0].textContent, "a1");
await selectSource(dbg, "exception-position-2.js");
elems = findAllElementsWithSelector(dbg, ".mark-text-exception");
is(elems.length, 1);
is(elems[0].textContent, "a2");
await selectSource(dbg, "exception-position-3.js");
elems = findAllElementsWithSelector(dbg, ".mark-text-exception");
is(elems.length, 1);
is(elems[0].textContent, "a3");
await selectSource(dbg, "exception-position-4.js");
elems = findAllElementsWithSelector(dbg, ".mark-text-exception");
is(elems.length, 1);
is(elems[0].textContent, "a4");
});

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

@ -0,0 +1,13 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<html>
<head>
<title>Debugger test page</title>
<script type="text/javascript" src="exception-position-1.js"></script>
<script type="text/javascript" src="exception-position-2.js"></script>
<script type="text/javascript" src="exception-position-3.js"></script>
<script type="text/javascript" src="exception-position-4.js"></script>
</head>
<body></body>
</html>

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

@ -0,0 +1,4 @@
function f() {
[1, 2, 3].push(a1);
}
f();

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

@ -0,0 +1,2 @@
const a2 = null;
const b2 = 100 + a2.item;

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

@ -0,0 +1,2 @@
const a3 = null;
console.log(1, 2, a3.item, 3, 4, 5);

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

@ -0,0 +1,2 @@
const a4 = null;
const b4 = [1, 2, a4.item, 3, 4, 5];