зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1437847 - Enable browser_console_error_source_click.js in new frontend r=jdescottes
MozReview-Commit-ID: E3WBqjwoUdH --HG-- extra : rebase_source : 91af40bf0a1ffebdcca6e7381e9a3b80a091da5e
This commit is contained in:
Родитель
e39ab9c0e6
Коммит
915a55d779
|
@ -176,7 +176,6 @@ skip-if = true # Bug 1437844
|
|||
[browser_console_dead_objects.js]
|
||||
skip-if = true # Bug 1437845
|
||||
[browser_console_error_source_click.js]
|
||||
skip-if = true # Bug 1437847
|
||||
[browser_console_filters.js]
|
||||
[browser_console_nsiconsolemessage.js]
|
||||
[browser_console_open_or_focus.js]
|
||||
|
|
|
@ -3,26 +3,27 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* import-globals-from head.js */
|
||||
|
||||
// Check that JS errors and CSS warnings open view source when their source link
|
||||
// is clicked in the Browser Console. See bug 877778.
|
||||
// is clicked in the Browser Console.
|
||||
|
||||
"use strict";
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf8,<p>hello world from bug 877778 " +
|
||||
const TEST_URI = "data:text/html;charset=utf8,<p>hello world" +
|
||||
"<button onclick='foobar.explode()' " +
|
||||
"style='test-color: green-please'>click!</button>";
|
||||
|
||||
add_task(function* () {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["devtools.browserconsole.filter.cssparser", true]
|
||||
]}, resolve);
|
||||
});
|
||||
|
||||
yield loadTab(TEST_URI);
|
||||
let hud = yield HUDService.toggleBrowserConsole();
|
||||
add_task(async function () {
|
||||
await addTab(TEST_URI);
|
||||
let hud = await HUDService.toggleBrowserConsole();
|
||||
ok(hud, "browser console opened");
|
||||
|
||||
// Enable CSS warnings and errors.
|
||||
await setFilterState(hud, {
|
||||
css: true
|
||||
});
|
||||
|
||||
// On e10s, the exception is triggered in child process
|
||||
// and is ignored by test harness
|
||||
if (!Services.appinfo.browserTabsRemoteAutostart) {
|
||||
|
@ -30,50 +31,28 @@ add_task(function* () {
|
|||
}
|
||||
|
||||
info("generate exception and wait for the message");
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, {}, () => {
|
||||
let button = content.document.querySelector("button");
|
||||
button.click();
|
||||
});
|
||||
|
||||
let results = yield waitForMessages({
|
||||
webconsole: hud,
|
||||
messages: [
|
||||
{
|
||||
text: "ReferenceError: foobar is not defined",
|
||||
category: CATEGORY_JS,
|
||||
severity: SEVERITY_ERROR,
|
||||
},
|
||||
{
|
||||
text: "Unknown property \u2018test-color\u2019",
|
||||
category: CATEGORY_CSS,
|
||||
severity: SEVERITY_WARNING,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
let viewSourceCalled = false;
|
||||
|
||||
let viewSource = hud.viewSource;
|
||||
hud.viewSource = () => {
|
||||
viewSourceCalled = true;
|
||||
};
|
||||
|
||||
for (let result of results) {
|
||||
viewSourceCalled = false;
|
||||
|
||||
let msg = [...result.matched][0];
|
||||
ok(msg, "message element found for: " + result.text);
|
||||
ok(!msg.classList.contains("filtered-by-type"), "message element is not filtered");
|
||||
let selector = ".message .message-location .frame-link-source";
|
||||
let locationNode = msg.querySelector(selector);
|
||||
ok(locationNode, "message location element found");
|
||||
|
||||
locationNode.click();
|
||||
|
||||
ok(viewSourceCalled, "view source opened");
|
||||
}
|
||||
|
||||
hud.viewSource = viewSource;
|
||||
|
||||
yield finishTest();
|
||||
await waitForMessageAndViewSource(hud,
|
||||
"ReferenceError: foobar is not defined");
|
||||
await waitForMessageAndViewSource(hud,
|
||||
"Unknown property \u2018test-color\u2019.");
|
||||
await resetFilters(hud);
|
||||
});
|
||||
|
||||
async function waitForMessageAndViewSource(hud, message) {
|
||||
let msg = await waitFor(() => findMessage(hud, message));
|
||||
ok(msg, `Message found: "${message}"`);
|
||||
|
||||
let locationNode = msg.querySelector(".message-location .frame-link-source");
|
||||
ok(locationNode, "Message location link element found");
|
||||
|
||||
let onTabOpen = BrowserTestUtils.waitForNewTab(gBrowser, null, true);
|
||||
locationNode.click();
|
||||
let newTab = await onTabOpen;
|
||||
ok(true, "The view source tab was opened in response to clicking the link");
|
||||
await BrowserTestUtils.removeTab(newTab);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче