summaryrefslogtreecommitdiffstats
path: root/toolkit/components/viewsource/test/browser/browser_open_docgroup.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /toolkit/components/viewsource/test/browser/browser_open_docgroup.js
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/viewsource/test/browser/browser_open_docgroup.js')
-rw-r--r--toolkit/components/viewsource/test/browser/browser_open_docgroup.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/toolkit/components/viewsource/test/browser/browser_open_docgroup.js b/toolkit/components/viewsource/test/browser/browser_open_docgroup.js
new file mode 100644
index 0000000000..f9d2490fea
--- /dev/null
+++ b/toolkit/components/viewsource/test/browser/browser_open_docgroup.js
@@ -0,0 +1,41 @@
+"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_setup(async function() {
+ 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();
+});