summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/tabs/browser_viewsource_of_data_URI_in_file_process.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /browser/base/content/test/tabs/browser_viewsource_of_data_URI_in_file_process.js
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/tabs/browser_viewsource_of_data_URI_in_file_process.js')
-rw-r--r--browser/base/content/test/tabs/browser_viewsource_of_data_URI_in_file_process.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/browser/base/content/test/tabs/browser_viewsource_of_data_URI_in_file_process.js b/browser/base/content/test/tabs/browser_viewsource_of_data_URI_in_file_process.js
new file mode 100644
index 0000000000..aca9166afe
--- /dev/null
+++ b/browser/base/content/test/tabs/browser_viewsource_of_data_URI_in_file_process.js
@@ -0,0 +1,53 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+
+const DUMMY_FILE = "dummy_page.html";
+const DATA_URI = "data:text/html,Hi";
+const DATA_URI_SOURCE = "view-source:" + DATA_URI;
+
+// Test for bug 1345807.
+add_task(async function () {
+ // Open file:// page.
+ let dir = getChromeDir(getResolvedURI(gTestPath));
+ dir.append(DUMMY_FILE);
+ const uriString = Services.io.newFileURI(dir).spec;
+
+ await BrowserTestUtils.withNewTab(uriString, async function (fileBrowser) {
+ let filePid = await SpecialPowers.spawn(fileBrowser, [], () => {
+ return Services.appinfo.processID;
+ });
+
+ // Navigate to data URI.
+ let promiseLoad = BrowserTestUtils.browserLoaded(
+ fileBrowser,
+ false,
+ DATA_URI
+ );
+ BrowserTestUtils.loadURIString(fileBrowser, DATA_URI);
+ let href = await promiseLoad;
+ is(href, DATA_URI, "Check data URI loaded.");
+ let dataPid = await SpecialPowers.spawn(fileBrowser, [], () => {
+ return Services.appinfo.processID;
+ });
+ is(dataPid, filePid, "Check that data URI loaded in file content process.");
+
+ // Make sure we can view-source on the data URI page.
+ let promiseTab = BrowserTestUtils.waitForNewTab(gBrowser, DATA_URI_SOURCE);
+ BrowserViewSource(fileBrowser);
+ let viewSourceTab = await promiseTab;
+ registerCleanupFunction(async function () {
+ BrowserTestUtils.removeTab(viewSourceTab);
+ });
+ await SpecialPowers.spawn(
+ viewSourceTab.linkedBrowser,
+ [DATA_URI_SOURCE],
+ uri => {
+ is(
+ content.document.documentURI,
+ uri,
+ "Check that a view-source page was loaded."
+ );
+ }
+ );
+ });
+});