blob: fbb07dd0ad3b805462bd6e206895e4c2f31f7267 (
plain)
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
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const frameSource = `<a href="about:mozilla">good</a>`;
const source = `<html><iframe srcdoc='${frameSource}' id="f"></iframe></html>`;
add_task(async function () {
let url = `data:text/html,${source}`;
await BrowserTestUtils.withNewTab({ gBrowser, url }, checkFrameSource);
});
async function checkFrameSource() {
let sourceTab = await openViewFrameSourceTab("#f");
registerCleanupFunction(function () {
gBrowser.removeTab(sourceTab);
});
let browser = gBrowser.selectedBrowser;
let textContent = await SpecialPowers.spawn(browser, [], async function () {
return content.document.body.textContent;
});
is(textContent, frameSource, "Correct content loaded");
let id = await SpecialPowers.spawn(browser, [], async function () {
return content.document.body.id;
});
is(id, "viewsource", "View source mode enabled");
}
|