1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test the issues after reloading the browsing document.
const TEST_URI = `
<style>
body {
color: blue;
ruby-align: center;
user-modify: read-only;
}
div {
scrollbar-width: thin;
}
</style>
<body>
<div>test</div>
</body>
`;
const TEST_DATA_SELECTED = [
{
property: "ruby-align",
url: "https://developer.mozilla.org/docs/Web/CSS/ruby-align",
},
{
property: "user-modify",
url: "https://developer.mozilla.org/docs/Web/CSS/user-modify",
},
];
const TEST_DATA_ALL = [
...TEST_DATA_SELECTED,
{
property: "scrollbar-width",
url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-width",
},
];
const {
COMPATIBILITY_UPDATE_SELECTED_NODE_FAILURE,
COMPATIBILITY_UPDATE_TOP_LEVEL_TARGET_FAILURE,
} = require("resource://devtools/client/inspector/compatibility/actions/index.js");
add_task(async function () {
const tab = await addTab(
"data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)
);
const { allElementsPane, inspector, selectedElementPane } =
await openCompatibilityView();
info("Check the issues on the selected element");
await assertIssueList(selectedElementPane, TEST_DATA_SELECTED);
info("Check the issues on all elements");
await assertIssueList(allElementsPane, TEST_DATA_ALL);
let isUpdateSelectedNodeFailure = false;
let isUpdateTopLevelTargetFailure = false;
waitForDispatch(
inspector.store,
COMPATIBILITY_UPDATE_SELECTED_NODE_FAILURE
).then(() => {
isUpdateSelectedNodeFailure = true;
});
waitForDispatch(
inspector.store,
COMPATIBILITY_UPDATE_TOP_LEVEL_TARGET_FAILURE
).then(() => {
isUpdateTopLevelTargetFailure = true;
});
info("Reload the browsing page");
const onReloaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
const onUpdateSelectedNode = waitForUpdateSelectedNodeAction(inspector.store);
const onUpdateTopLevelTarget = waitForUpdateTopLevelTargetAction(
inspector.store
);
gBrowser.reloadTab(tab);
await Promise.all([onReloaded, onUpdateSelectedNode, onUpdateTopLevelTarget]);
info("Check whether the failure action will be fired or not");
ok(
!isUpdateSelectedNodeFailure && !isUpdateTopLevelTargetFailure,
"No error occurred"
);
info("Check the issues on the selected element again");
await assertIssueList(selectedElementPane, TEST_DATA_SELECTED);
info("Check the issues on all elements again");
await assertIssueList(allElementsPane, TEST_DATA_ALL);
});
|