fune/toolkit/components/viewsource/test/browser/browser_open_docgroup.js
Kris Maglione 94e3b0bd8d Bug 1596918: Part 3a - Scripted rewrite of most ContentTask.spawn calls to SpecialPowers.spawn calls. r=mccr8,remote-protocol-reviewers,ato
This is generally pretty straightforward, and rewrites nearly all calls. It
skips the ones that it can detect using frame script globals like
`sendAsyncMessage`, though.

Differential Revision: https://phabricator.services.mozilla.com/D53740

--HG--
extra : moz-landing-system : lando
2019-12-13 20:36:16 +00:00

41 lines
973 B
JavaScript

"use strict";
/**
* Very basic smoketests for the View Source feature, which also
* forces on the DocGroup mismatch check that was added in
* bug 1340719.
*/
add_task(async function setup() {
await SpecialPowers.pushPrefEnv({
set: [["extensions.throw_on_docgroup_mismatch.enabled", true]],
});
});
/**
* Tests that we can open View Source in a tab.
*/
add_task(async function test_view_source_in_tab() {
await BrowserTestUtils.withNewTab(
{
gBrowser,
url: "http://example.com",
},
async function(browser) {
let sourceTab = await openViewSourceForBrowser(browser);
let sourceBrowser = sourceTab.linkedBrowser;
await SpecialPowers.spawn(sourceBrowser, [], async function() {
Assert.equal(
content.document.body.id,
"viewsource",
"View source mode enabled"
);
});
BrowserTestUtils.removeTab(sourceTab);
}
);
await SpecialPowers.popPrefEnv();
});