summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/pageStyle
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 /browser/base/content/test/pageStyle
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/pageStyle')
-rw-r--r--browser/base/content/test/pageStyle/browser.ini5
-rw-r--r--browser/base/content/test/pageStyle/browser_disable_author_style_oop.js75
-rw-r--r--browser/base/content/test/pageStyle/page_style.html8
3 files changed, 88 insertions, 0 deletions
diff --git a/browser/base/content/test/pageStyle/browser.ini b/browser/base/content/test/pageStyle/browser.ini
new file mode 100644
index 0000000000..7e9976e9ad
--- /dev/null
+++ b/browser/base/content/test/pageStyle/browser.ini
@@ -0,0 +1,5 @@
+[browser_disable_author_style_oop.js]
+https_first_disabled = true
+support-files =
+ page_style.html
+
diff --git a/browser/base/content/test/pageStyle/browser_disable_author_style_oop.js b/browser/base/content/test/pageStyle/browser_disable_author_style_oop.js
new file mode 100644
index 0000000000..bf2b1ffae2
--- /dev/null
+++ b/browser/base/content/test/pageStyle/browser_disable_author_style_oop.js
@@ -0,0 +1,75 @@
+"use strict";
+
+async function getColor(aSpawnTarget) {
+ return SpecialPowers.spawn(aSpawnTarget, [], function() {
+ return content.document.defaultView.getComputedStyle(
+ content.document.querySelector("p")
+ ).color;
+ });
+}
+
+async function insertIFrame() {
+ let bc = gBrowser.selectedBrowser.browsingContext;
+ let len = bc.children.length;
+
+ await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
+ return new Promise(function(resolve) {
+ let e = content.document.createElement("iframe");
+ e.src =
+ "http://mochi.test:8888/browser/browser/base/content/test/pageStyle/page_style.html";
+ e.onload = () => resolve();
+ content.document.body.append(e);
+ });
+ });
+
+ // Wait for the new frame to get a pres shell and be styled.
+ await BrowserTestUtils.waitForCondition(async function() {
+ return (
+ bc.children.length == len + 1 && (await getColor(bc.children[len])) != ""
+ );
+ });
+}
+
+// Test that inserting an iframe with a URL that is loaded OOP with Fission
+// enabled correctly matches the tab's author style disabled state.
+add_task(async function test_disable_style() {
+ let tab = await BrowserTestUtils.openNewForegroundTab(
+ gBrowser,
+ "http://example.com/browser/browser/base/content/test/pageStyle/page_style.html",
+ /* waitForLoad = */ true
+ );
+
+ let bc = gBrowser.selectedBrowser.browsingContext;
+
+ await insertIFrame();
+
+ is(
+ await getColor(bc),
+ "rgb(0, 0, 255)",
+ "parent color before disabling style"
+ );
+ is(
+ await getColor(bc.children[0]),
+ "rgb(0, 0, 255)",
+ "first child color before disabling style"
+ );
+
+ gPageStyleMenu.disableStyle();
+
+ is(await getColor(bc), "rgb(0, 0, 0)", "parent color after disabling style");
+ is(
+ await getColor(bc.children[0]),
+ "rgb(0, 0, 0)",
+ "first child color after disabling style"
+ );
+
+ await insertIFrame();
+
+ is(
+ await getColor(bc.children[1]),
+ "rgb(0, 0, 0)",
+ "second child color after disabling style"
+ );
+
+ BrowserTestUtils.removeTab(tab);
+});
diff --git a/browser/base/content/test/pageStyle/page_style.html b/browser/base/content/test/pageStyle/page_style.html
new file mode 100644
index 0000000000..c16a9ea4aa
--- /dev/null
+++ b/browser/base/content/test/pageStyle/page_style.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<style>
+p { color: blue; font-weight: bold; }
+</style>
+<p>Some text.</p>
+<script>
+let gFramesLoaded = 0;
+</script>