Loading docshell/base/nsDocShell.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -4380,6 +4380,8 @@ nsDocShell::LoadPageAsViewSource(nsIDocShell* aOtherDocShell, // is only exposed to system code. The triggering principal for this load // should be the system principal. loadState->SetTriggeringPrincipal(nsContentUtils::GetSystemPrincipal()); loadState->SetPrincipalToInherit(nullptr); loadState->SetPartitionedPrincipalToInherit(nullptr); loadState->SetOriginalURI(nullptr); loadState->SetResultPrincipalURI(nullptr); Loading toolkit/components/viewsource/test/browser/browser.toml +3 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ support-files = [ "head.js", "file_bug464222.html", "file_bug2048851.html", ] ["browser_bug464222.js"] Loading @@ -9,6 +10,8 @@ https_first_disabled = true ["browser_bug713810.js"] ["browser_bug2048851.js"] ["browser_contextmenu.js"] skip-if = ["os == 'mac' && !debug"] # Bug 1713913 - new Fission platform triage Loading toolkit/components/viewsource/test/browser/browser_bug2048851.js 0 → 100644 +40 −0 Original line number Diff line number Diff line "use strict"; /** * Crashtest for bug 2048851. * A cross-origin navigation has the previous page as principal to inherit. * When viewing as page source, the load should not reference that principal. */ add_task(async function test_view_source_after_cross_origin_navigation() { const TEST_PAGE = "https://example.com/browser/toolkit/components/viewsource/test/browser/file_bug2048851.html"; await BrowserTestUtils.withNewTab( { gBrowser, url: TEST_PAGE, }, async function (browser) { let loaded = BrowserTestUtils.browserLoaded( browser, false, "https://example.org/" ); await BrowserTestUtils.synthesizeMouseAtCenter("#link", {}, browser); await loaded; 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); } ); }); toolkit/components/viewsource/test/browser/file_bug2048851.html 0 → 100644 +1 −0 Original line number Diff line number Diff line <a id="link" href="https://example.org/">click</a> Loading
docshell/base/nsDocShell.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -4380,6 +4380,8 @@ nsDocShell::LoadPageAsViewSource(nsIDocShell* aOtherDocShell, // is only exposed to system code. The triggering principal for this load // should be the system principal. loadState->SetTriggeringPrincipal(nsContentUtils::GetSystemPrincipal()); loadState->SetPrincipalToInherit(nullptr); loadState->SetPartitionedPrincipalToInherit(nullptr); loadState->SetOriginalURI(nullptr); loadState->SetResultPrincipalURI(nullptr); Loading
toolkit/components/viewsource/test/browser/browser.toml +3 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ support-files = [ "head.js", "file_bug464222.html", "file_bug2048851.html", ] ["browser_bug464222.js"] Loading @@ -9,6 +10,8 @@ https_first_disabled = true ["browser_bug713810.js"] ["browser_bug2048851.js"] ["browser_contextmenu.js"] skip-if = ["os == 'mac' && !debug"] # Bug 1713913 - new Fission platform triage Loading
toolkit/components/viewsource/test/browser/browser_bug2048851.js 0 → 100644 +40 −0 Original line number Diff line number Diff line "use strict"; /** * Crashtest for bug 2048851. * A cross-origin navigation has the previous page as principal to inherit. * When viewing as page source, the load should not reference that principal. */ add_task(async function test_view_source_after_cross_origin_navigation() { const TEST_PAGE = "https://example.com/browser/toolkit/components/viewsource/test/browser/file_bug2048851.html"; await BrowserTestUtils.withNewTab( { gBrowser, url: TEST_PAGE, }, async function (browser) { let loaded = BrowserTestUtils.browserLoaded( browser, false, "https://example.org/" ); await BrowserTestUtils.synthesizeMouseAtCenter("#link", {}, browser); await loaded; 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); } ); });
toolkit/components/viewsource/test/browser/file_bug2048851.html 0 → 100644 +1 −0 Original line number Diff line number Diff line <a id="link" href="https://example.org/">click</a>