From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../places/tests/browser/browser_bug1601563.js | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 toolkit/components/places/tests/browser/browser_bug1601563.js (limited to 'toolkit/components/places/tests/browser/browser_bug1601563.js') diff --git a/toolkit/components/places/tests/browser/browser_bug1601563.js b/toolkit/components/places/tests/browser/browser_bug1601563.js new file mode 100644 index 0000000000..41e278ee54 --- /dev/null +++ b/toolkit/components/places/tests/browser/browser_bug1601563.js @@ -0,0 +1,40 @@ +const PREFIX = + "http://example.com/tests/toolkit/components/places/tests/browser/1601563"; + +function titleUpdate(pageUrl) { + let lastTitle = null; + return PlacesTestUtils.waitForNotification("page-title-changed", events => { + if (pageUrl != events[0].url) { + return false; + } + lastTitle = events[0].title; + return true; + }).then(() => { + return lastTitle; + }); +} + +add_task(async function () { + registerCleanupFunction(PlacesUtils.history.clear); + const FIRST_URL = PREFIX + "-1.html"; + const SECOND_URL = PREFIX + "-2.html"; + let firstTitlePromise = titleUpdate(FIRST_URL); + let secondTitlePromise = titleUpdate(SECOND_URL); + + let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, FIRST_URL); + + let firstTitle = await firstTitlePromise; + is(firstTitle, "First title", "First title should match the page"); + + let secondTitle = await secondTitlePromise; + is(secondTitle, "Second title", "Second title should match the page"); + + let entry = await PlacesUtils.history.fetch(FIRST_URL); + is( + entry.title, + firstTitle, + "Should not override first title with document.open()ed frame" + ); + + await BrowserTestUtils.removeTab(tab); +}); -- cgit v1.2.3