summaryrefslogtreecommitdiffstats
path: root/toolkit/modules/tests/browser/browser_BrowserUtils.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/modules/tests/browser/browser_BrowserUtils.js')
-rw-r--r--toolkit/modules/tests/browser/browser_BrowserUtils.js33
1 files changed, 32 insertions, 1 deletions
diff --git a/toolkit/modules/tests/browser/browser_BrowserUtils.js b/toolkit/modules/tests/browser/browser_BrowserUtils.js
index da28c07b69..de85566d98 100644
--- a/toolkit/modules/tests/browser/browser_BrowserUtils.js
+++ b/toolkit/modules/tests/browser/browser_BrowserUtils.js
@@ -21,7 +21,7 @@ add_task(async function test_getSelectionDetails_input() {
content.getSelection().removeAllRanges();
let info = SelectionUtils.getSelectionDetails(content);
Assert.equal(text, info.text);
- Assert.ok(!info.collapsed);
+ Assert.strictEqual(info.docSelectionIsCollapsed, false);
Assert.equal(linkURL, info.linkURL);
}
@@ -48,3 +48,34 @@ add_task(async function test_getSelectionDetails_input() {
});
});
});
+
+add_task(async function test_getSelectionDetails_shadow_selection() {
+ const url = kFixtureBaseURL + "file_getSelectionDetails_inputs.html";
+ await SpecialPowers.pushPrefEnv({
+ set: [["dom.shadowdom.selection_across_boundary.enabled", true]],
+ });
+ await BrowserTestUtils.withNewTab({ gBrowser, url }, async browser => {
+ await SpecialPowers.spawn(browser, [], async () => {
+ function checkSelection() {
+ const { SelectionUtils } = ChromeUtils.importESModule(
+ "resource://gre/modules/SelectionUtils.sys.mjs"
+ );
+
+ const text = content.document.getElementById("outer");
+ const host = content.document.getElementById("host");
+ content
+ .getSelection()
+ .setBaseAndExtent(
+ text,
+ 0,
+ host.shadowRoot.getElementById("inner").firstChild,
+ 3
+ );
+ let info = SelectionUtils.getSelectionDetails(content);
+ // TODO(sefeng): verify info.text after bug 1881095 is fixed
+ Assert.strictEqual(info.docSelectionIsCollapsed, false);
+ }
+ checkSelection();
+ });
+ });
+});