The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.
Tab sleep: a discard keeps the tab's colours, critical pressure closes 9, one log line per pass (#237)
Victorc09f3c32f868
diff --git a/Packages/CraCore/Sources/CraCore/TabSleepPolicy.swift b/Packages/CraCore/Sources/CraCore/TabSleepPolicy.swiftindex 5eb2aa3..a2a864e 100644--- a/Packages/CraCore/Sources/CraCore/TabSleepPolicy.swift+++ b/Packages/CraCore/Sources/CraCore/TabSleepPolicy.swift@@ -32,20 +32,89 @@ public struct TabSleepPolicy: Equatable, Sendable {TabSleepPolicy(hiddenFor: after.seconds, keepsRecentTabs: after.seconds >= TabSleepThreshold.fourHours.seconds)}- /// "…when the Mac is short of memory": the 3 pages hidden longest, whatever their rank, but+ /// "…when the Mac is short of memory": the pages hidden longest, whatever their rank, but/// none left in the last 5 minutes, so a tab just left (or just woken) isn't closed again.- public static let memoryPressure = TabSleepPolicy(hiddenFor: 5 * 60, keepsRecentTabs: false, limit: 3, reason: .memoryPressure)+ /// 3 at warning; 9 at critical, so a sweep keeps up with tabs opened faster than the clock+ /// closes them (#237: a burst of YouTube tabs held a 16 GB Mac 7 GB over its memory).+ public static func memoryPressure(_ level: PerfSystemSample.Pressure) -> TabSleepPolicy {+ TabSleepPolicy(hiddenFor: 5 * 60, keepsRecentTabs: false, limit: level == .critical ? 9 : 3, reason: .memoryPressure)+ }/// A pinned tab that a split pane copied (Arc): its page sleeps at once, the copy shows it.public static let splitCopy = TabSleepPolicy(hiddenFor: 0, keepsRecentTabs: false, limit: 1, reason: .splitCopy)- /// macOS reports a level for a while after pages close, so a sweep waits this long for the- /// last one to tell before taking more.- public static let pressureSweepInterval: TimeInterval = 90+ /// How often the app's pass runs (AppComposition.tabSleepInterval).+ public static let passInterval: TimeInterval = 60- /// Whether the minute's pass sweeps for memory pressure.+ /// Whether the minute's pass sweeps for memory pressure. macOS reports a level for a while+ /// after pages close, so at warning a sweep skips a pass for the last one to tell (every+ /// 2 minutes); at critical it sweeps every pass (#237). Half a pass of slack absorbs the+ /// timer's jitter.public static func sweepsForPressure(_ pressure: PerfSystemSample.Pressure, enabled: Bool, lastSweep: Date?, now: Date) -> Bool {- enabled && pressure.isShort && lastSweep.map { now.timeIntervalSince($0) >= pressureSweepInterval } ?? true+ guard enabled, pressure.isShort else { return false }+ guard let lastSweep else { return true }+ let passes: TimeInterval = pressure == .critical ? 1 : 2+ return now.timeIntervalSince(lastSweep) >= (passes - 0.5) * passInterval+ }++ /// What one pass closed, as one line per way of closing in cra.log (#237: a sweep of twelve+ /// pages wrote twelve identical lines). Hosts only, as everywhere in the log.+ public struct PassLog: Equatable, Sendable {+ public var reason: Reason+ private var pages: [(host: String, minutes: Int, discarded: Bool, processEnded: Bool)] = []++ public init(reason: Reason) { self.reason = reason }++ public static func == (a: PassLog, b: PassLog) -> Bool { a.reason == b.reason && a.lines == b.lines }++ /// A page the pass closed: discarded in place, or unloaded by a CEF that can't discard.+ public mutating func closed(host: String, hiddenFor: TimeInterval, discarded: Bool, processEnded: Bool) {+ pages.append((host, Int(max(hiddenFor, 0) / 60), discarded, processEnded))+ }++ public var lines: [String] {+ let why = reason == .memoryPressure ? ", the Mac is short of memory" : reason == .splitCopy ? ", a split shows its copy" : ""+ return [(true, "discards"), (false, "unloads")].compactMap { discarded, verb in+ let ps = pages.filter { $0.discarded == discarded }+ guard !ps.isEmpty else { return nil }+ var counts: [String: Int] = [:], order: [String] = []+ for p in ps {+ if counts[p.host] == nil { order.append(p.host) }+ counts[p.host, default: 0] += 1+ }+ let hosts = order.enumerated().sorted { (counts[$0.element]!, -$0.offset) > (counts[$1.element]!, -$1.offset) }+ .map { counts[$0.element]! > 1 ? "\($0.element) ×\(counts[$0.element]!)" : $0.element }+ let lo = ps.map(\.minutes).min()!, hi = ps.map(\.minutes).max()!+ let ended = ps.filter(\.processEnded).count+ let detail: String+ if ps.count == 1 {+ detail = "hidden \(lo) min" + (ended == 1 ? ", its renderer ended" : "")+ } else {+ detail = "\(ps.count) pages hidden " + (lo == hi ? "\(lo)" : "\(lo)–\(hi)") + " min"+ + (ended == 0 ? "" : ", \(ended) renderer\(ended == 1 ? "" : "s") ended")+ }+ return "tab sleep \(verb) \(hosts.joined(separator: ", ")) (\(detail)\(why))"+ }+ }+ }++ /// Why a pass asks no page (#237: two pressure sweeps logged their cap and then nothing).+ /// `held` counts the candidates passed over by reason, `waiting` the ones inside their+ /// back-off after a refusal.+ public func nothingToClose(_ pages: [Page], visible: [UUID], held: [Hold: Int], waiting: Int, now: Date) -> String {+ func plural(_ n: Int, _ word: String) -> String { "\(n) \(word)\(n == 1 ? "" : "s")" }+ var why: [String] = []+ if !held.isEmpty {+ let total = held.values.reduce(0, +)+ let reasons = held.sorted { $0.key.rawValue < $1.key.rawValue }.map { "\($0.key.rawValue) \($0.value)" }+ why.append("\(plural(total, "page")) passed over (\(reasons.joined(separator: ", ")))")+ }+ if waiting > 0 { why.append("\(plural(waiting, "page")) refused lately, asked again later") }+ if !why.isEmpty { return why.joined(separator: "; ") }+ let hidden = pages.compactMap { p in visible.contains(p.id) ? nil : p.hiddenAt }+ guard let earliest = hidden.min() else { return "no page is out of sight" }+ let longest = Int(now.timeIntervalSince(earliest) / 60)+ return "none of \(plural(hidden.count, "hidden page")) has been out of sight \(Int(hiddenFor / 60)) min (longest \(longest) min)"}/// A page as tab sleeping sees it: when it went off screen (nil while shown) and when it lastdiff --git a/Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift b/Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swiftindex 2b03f1a..971af32 100644--- a/Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift+++ b/Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift@@ -71,7 +71,7 @@ struct TabSleepPolicyTests {@Test(.bug("https://github.com/VictorKildahl/cra/issues/153")) func visiblePagesStay() {let split = TabSleepPolicy.Page(id: UUID(), hiddenAt: now.addingTimeInterval(-86400))let p = pages(hiddenMinutesAgo: []) + [split]- #expect(TabSleepPolicy.memoryPressure.candidates(p, visible: [visible, split.id], now: now) == [])+ #expect(TabSleepPolicy.memoryPressure(.warning).candidates(p, visible: [visible, split.id], now: now) == [])}/// A page that played sound waits as long after it went quiet as after it went out of sight.@@ -82,12 +82,12 @@ struct TabSleepPolicyTests {let quiet20 = TabSleepPolicy.Page(id: id, hiddenAt: hidden, audibleAt: now.addingTimeInterval(-1200))#expect(TabSleepPolicy.timer(.fifteenMinutes).candidates([quiet2], visible: [], now: now) == [])#expect(TabSleepPolicy.timer(.fifteenMinutes).candidates([quiet20], visible: [], now: now) == [id])- #expect(TabSleepPolicy.memoryPressure.candidates([quiet2], visible: [], now: now) == [])+ #expect(TabSleepPolicy.memoryPressure(.warning).candidates([quiet2], visible: [], now: now) == [])}/// Under pressure: oldest first, the 10 used last included, none left in the last 5 minutes.@Test(.bug("https://github.com/VictorKildahl/cra/issues/153")) func pressureTakesTheOldestPastTheGrace() {- let policy = TabSleepPolicy.memoryPressure+ let policy = TabSleepPolicy.memoryPressure(.warning)#expect(policy.limit == 3 && policy.reason == .memoryPressure)let p = pages(hiddenMinutesAgo: [4.98, 5.02, 30, 10])#expect(policy.candidates(p, visible: [visible], now: now) == [p[3].id, p[4].id, p[2].id])@@ -99,8 +99,57 @@ struct TabSleepPolicyTests {#expect(!TabSleepPolicy.sweepsForPressure(.unknown, enabled: true, lastSweep: nil, now: now))#expect(TabSleepPolicy.sweepsForPressure(.warning, enabled: true, lastSweep: nil, now: now))#expect(TabSleepPolicy.sweepsForPressure(.critical, enabled: true, lastSweep: nil, now: now))- #expect(!TabSleepPolicy.sweepsForPressure(.warning, enabled: true, lastSweep: now.addingTimeInterval(-89), now: now))- #expect(TabSleepPolicy.sweepsForPressure(.warning, enabled: true, lastSweep: now.addingTimeInterval(-91), now: now))+ }++ /// The minute's pass is 60 s apart give or take; at warning a sweep skips one pass (every+ /// 2 minutes, which the old 90 s already meant), at critical it sweeps every pass (#237).+ @Test(.bug("https://github.com/VictorKildahl/cra/issues/237")) func pressureSweepCadence() {+ func sweeps(_ level: PerfSystemSample.Pressure, after s: TimeInterval) -> Bool {+ TabSleepPolicy.sweepsForPressure(level, enabled: true, lastSweep: now.addingTimeInterval(-s), now: now)+ }+ #expect(!sweeps(.warning, after: 60.2) && sweeps(.warning, after: 119.8) && sweeps(.warning, after: 120.3))+ #expect(!sweeps(.critical, after: 20) && sweeps(.critical, after: 59.8) && sweeps(.critical, after: 60.2))+ }++ /// Critical is warning further along: the sweep closes 9 pages, not 3, so it keeps up with a+ /// burst of tabs opened faster than the clock closes them (#237: 5–7 YouTube tabs a minute).+ /// The 5-minute floor stays: a tab just left isn't closed under the user.+ @Test(.bug("https://github.com/VictorKildahl/cra/issues/237")) func criticalClosesMore() {+ let warning = TabSleepPolicy.memoryPressure(.warning), critical = TabSleepPolicy.memoryPressure(.critical)+ #expect(warning.limit == 3 && critical.limit == 9)+ #expect(warning.hiddenFor == 300 && critical.hiddenFor == 300 && !critical.keepsRecentTabs && critical.reason == .memoryPressure)+ }++ /// One line per pass, not one per page (#237: twelve identical lines in 40 ms). A single page+ /// reads as it did; the host follows the verb, as the scenarios expect.+ @Test(.bug("https://github.com/VictorKildahl/cra/issues/237")) func passLogIsOneLine() {+ var log = TabSleepPolicy.PassLog(reason: .timer)+ #expect(log.lines.isEmpty)+ log.closed(host: "127.0.0.1", hiddenFor: 20, discarded: true, processEnded: true)+ #expect(log.lines == ["tab sleep discards 127.0.0.1 (hidden 0 min, its renderer ended)"])+ log = TabSleepPolicy.PassLog(reason: .timer)+ for (m, ended) in [(15, true), (22, true), (18, false)] { log.closed(host: "www.youtube.com", hiddenFor: Double(m) * 60 + 30, discarded: true, processEnded: ended) }+ log.closed(host: "github.com", hiddenFor: 16 * 60, discarded: true, processEnded: false)+ log.closed(host: "localhost", hiddenFor: 17 * 60, discarded: false, processEnded: false)+ #expect(log.lines == ["tab sleep discards www.youtube.com ×3, github.com (4 pages hidden 15–22 min, 2 renderers ended)",+ "tab sleep unloads localhost (hidden 17 min)"])+ var pressure = TabSleepPolicy.PassLog(reason: .memoryPressure)+ pressure.closed(host: "github.com", hiddenFor: 6 * 60, discarded: true, processEnded: false)+ #expect(pressure.lines == ["tab sleep discards github.com (hidden 6 min, the Mac is short of memory)"])+ }++ /// A sweep that asks no page says why (#237: two pressure sweeps logged their cap and then+ /// nothing; the pages were 2 and 4 minutes out of sight, under the 5-minute floor).+ @Test(.bug("https://github.com/VictorKildahl/cra/issues/237")) func emptySweepSaysWhy() {+ let policy = TabSleepPolicy.memoryPressure(.warning)+ let young = pages(hiddenMinutesAgo: [2, 4])+ #expect(policy.nothingToClose(young, visible: [visible], held: [:], waiting: 0, now: now)+ == "none of 2 hidden pages has been out of sight 5 min (longest 4 min)")+ #expect(policy.nothingToClose([], visible: [], held: [:], waiting: 0, now: now) == "no page is out of sight")+ #expect(policy.nothingToClose(pages(hiddenMinutesAgo: [30, 40]), visible: [visible], held: [.loading: 1, .devTools: 1], waiting: 0, now: now)+ == "2 pages passed over (devTools 1, loading 1)")+ #expect(policy.nothingToClose(pages(hiddenMinutesAgo: [30]), visible: [visible], held: [:], waiting: 1, now: now)+ == "1 page refused lately, asked again later")}/// Chromium's freezing reasons that keep a page from sleeping; the rest (a Web Lock, recentlydiff --git a/Sources/Cra/App/AppComposition.swift b/Sources/Cra/App/AppComposition.swiftindex 275c132..ebebb80 100644--- a/Sources/Cra/App/AppComposition.swift+++ b/Sources/Cra/App/AppComposition.swift@@ -20,7 +20,7 @@ final class AppComposition {/// Arc archives on a 30-minute pass; tab freezing and sleeping look every minute. `sleepTabs` reaches/// the windows' browser managers, which the composition does not own.static let autoArchiveInterval: TimeInterval = 1800- static let tabSleepInterval: TimeInterval = 60+ static let tabSleepInterval = TabSleepPolicy.passInterval/// Arc's timeToFreezeTab: a page out of sight 30 minutes is voted to freeze.static let tabFreezeAfter: TimeInterval = 30 * 60diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swiftindex 6f08482..38d6be3 100644--- a/Sources/Cra/App/AppDelegate.swift+++ b/Sources/Cra/App/AppDelegate.swift@@ -239,8 +239,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {guard TabSleepPolicy.sweepsForPressure(pressure, enabled: store.settings.tabSleepOnMemoryPressure,lastSweep: lastPressureSweep, now: now) else { return }lastPressureSweep = now- CraLog.note("tab sleep: memory pressure \(pressure.rawValue), closing up to \(TabSleepPolicy.memoryPressure.limit ?? 0) pages per window")- for w in mainWindows { w.browsers.sleepIdleTabs(.memoryPressure) }+ let policy = TabSleepPolicy.memoryPressure(pressure)+ CraLog.note("tab sleep: memory pressure \(pressure.rawValue), closing up to \(policy.limit ?? 0) pages per window")+ for w in mainWindows { w.browsers.sleepIdleTabs(policy) }}/// Settings > Privacy > "Always use secure connections", live like content blocking.diff --git a/Sources/Cra/Services/BrowserManager.swift b/Sources/Cra/Services/BrowserManager.swiftindex 5dce0f0..1662c28 100644--- a/Sources/Cra/Services/BrowserManager.swift+++ b/Sources/Cra/Services/BrowserManager.swift@@ -423,15 +423,21 @@ final class BrowserManager: NSObject, @preconcurrency CraBrowserDelegate {func sleepIdleTabs(_ policy: TabSleepPolicy) {let now = clock.nowlet cutoff = now.addingTimeInterval(-policy.hiddenFor)- var asked = 0+ var asked = 0, waiting = 0+ var held: [TabSleepPolicy.Hold: Int] = [:]+ let pass = SleepPass(reason: policy.reason)for id in policy.candidates(sleepPages, visible: visibleTabIDs, protectedRecent: protectedRecentTabs, now: now) {guard let rt = runtimes[id] else { continue }if let hold = sleepHold(rt, before: cutoff) {+ held[hold, default: 0] += 1passOver(rt, hold)continue}rt.sleepHold = nil- guard rt.sleepProbeAfter.map({ $0 <= now }) ?? true else { continue }+ guard rt.sleepProbeAfter.map({ $0 <= now }) ?? true else {+ waiting += 1+ continue+ }if let limit = policy.limit, asked >= limit { break }asked += 1let b = rt.browser@@ -456,7 +462,7 @@ final class BrowserManager: NSObject, @preconcurrency CraBrowserDelegate {guard let self, let rt, self.stillSleepable(id, rt, url, navigationRevision, cutoff) else { return }let refusal = TabSleepPolicy.refusal(freezingReasons: Self.freezingReasons(result))guard refusal.isEmpty else { return self.keepAwake(rt, url, refusal) }- self.discard(id, rt, url, policy)+ self.discard(id, rt, url, policy, pass)}}}@@ -464,11 +470,25 @@ final class BrowserManager: NSObject, @preconcurrency CraBrowserDelegate {}}}+ // A pressure sweep that asks nothing says why (#237); the minute's timer pass, with+ // nothing old enough most of the time, stays quiet.+ if asked == 0, policy.reason == .memoryPressure {+ let why = policy.nothingToClose(sleepPages, visible: visibleTabIDs, held: held, waiting: waiting, now: now)+ CraLog.note("tab sleep for memory pressure closes nothing: \(why)")+ }+ }++ /// One pass's closed pages, logged as one line once the last of its pages has answered and+ /// its callbacks let it go (#237: a sweep of twelve pages wrote twelve identical lines).+ private final class SleepPass {+ var log: TabSleepPolicy.PassLog+ init(reason: TabSleepPolicy.Reason) { log = TabSleepPolicy.PassLog(reason: reason) }+ deinit { for line in log.lines { CraLog.note(line) } }}/// Chrome's in-place discard (Cra.discard, which needs WebContentsDiscard). A CEF without it/// answers an error: the page closes instead, and its tab loads the URL again when shown.- private func discard(_ id: UUID, _ rt: TabRuntime, _ url: String, _ policy: TabSleepPolicy) {+ private func discard(_ id: UUID, _ rt: TabRuntime, _ url: String, _ policy: TabSleepPolicy, _ pass: SleepPass) {rt.browser.sendDevToolsMethod("Cra.discard", params: "{}") { [weak self, weak rt] result, error inDispatchQueue.main.async {guard let self, let rt, self.runtimes[id] === rt, !self.visibleTabIDs.contains(id) else { return }@@ -480,10 +500,8 @@ final class BrowserManager: NSObject, @preconcurrency CraBrowserDelegate {self.sleptTabs.insert(id)Perf.count(.tabSlept, policy.reason.rawValue)if !rt.browser.isIncognito {- let why = policy.reason == .memoryPressure ? ", the Mac is short of memory"- : policy.reason == .splitCopy ? ", a split shows its copy" : ""- let how = !discarded ? "unloads" : reply?["processEnded"] as? Bool == true ? "discards (its renderer ended)" : "discards"- CraLog.note("tab sleep \(how) \(CraLog.host(url)) (hidden \(Int(self.clock.now.timeIntervalSince(rt.hiddenAt ?? self.clock.now) / 60)) min\(why))")+ pass.log.closed(host: CraLog.host(url), hiddenFor: self.clock.now.timeIntervalSince(rt.hiddenAt ?? self.clock.now),+ discarded: discarded, processEnded: reply?["processEnded"] as? Bool == true)}guard discarded else { return self.unload(id) }rt.discarded = true@@ -754,7 +772,7 @@ final class BrowserManager: NSObject, @preconcurrency CraBrowserDelegate {private func hibernate(_ tabID: UUID) {guard let rt = runtimes[tabID], !rt.browser.isInPictureInPicture else { return }log(tabID, "sleeps: its split copy shows the page")- discard(tabID, rt, rt.browser.currentURL, .splitCopy)+ discard(tabID, rt, rt.browser.currentURL, .splitCopy, SleepPass(reason: .splitCopy))}/// The window is out of sight: covered by another app, on another desktop or in the Dock.@@ -1192,14 +1210,15 @@ final class BrowserManager: NSObject, @preconcurrency CraBrowserDelegate {}func browser(_ browser: CraBrowser, didReportThemeColor hex: String) {- guard let id = tabID(of: browser) else { return }+ // The blank document a discard leaves answers the load end's probe with white (#237).+ guard let id = tabID(of: browser), runtimes[id]?.discarded != true else { return }runtimes[id]?.themeColor = hexstore.setThemeColor(id, hex)delegate?.browserManagerDidUpdate(id)}func browser(_ browser: CraBrowser, didReportBackgroundColor hex: String) {- guard let id = tabID(of: browser), let rt = runtimes[id], rt.backgroundColor != hex else { return }+ guard let id = tabID(of: browser), let rt = runtimes[id], !rt.discarded, rt.backgroundColor != hex else { return }rt.backgroundColor = hexdelegate?.browserManagerDidUpdate(id)}diff --git a/Tests/BrowserManagerLifecycleTests.swift b/Tests/BrowserManagerLifecycleTests.swiftindex 50e3234..146acaf 100644--- a/Tests/BrowserManagerLifecycleTests.swift+++ b/Tests/BrowserManagerLifecycleTests.swift@@ -104,6 +104,7 @@ enum BrowserManagerLifecycleTests {await pressureSweepCase()await discardCase()await discardedPageLoadCase()+ await discardedPageColoursCase()await sleepCountsCase()shortTimerCase()recentlyAudibleCase()@@ -530,7 +531,7 @@ enum BrowserManagerLifecycleTests {runtimes[5].hiddenAt = clock.now.addingTimeInterval(-4 * 60)runtimes[0].sleepProbeAfter = clock.now.addingTimeInterval(60)func probed() -> [Bool] { runtimes.map { rt in rt.browser.replies.contains { $0.method == isolatedProbe } } }- manager.sleepIdleTabs(.memoryPressure)+ manager.sleepIdleTabs(.memoryPressure(.warning))expect(probed() == [false, true, true, true, false, false],"the 3 pages hidden longest are asked, past a refusing page, none of the 10 used last kept")for rt in runtimes[1...3] {@@ -541,7 +542,7 @@ enum BrowserManagerLifecycleTests {await finishSleep(rt.browser)}expect(ids.map { asleep(manager, $0) } == [false, true, true, true, false, false], "the 3 pages are discarded")- manager.sleepIdleTabs(.memoryPressure)+ manager.sleepIdleTabs(.memoryPressure(.warning))expect(probed()[4] && !probed()[5], "the next sweep takes the next page, not one left 4 minutes ago")manager.closeAll()}@@ -623,6 +624,38 @@ enum BrowserManagerLifecycleTests {manager.closeAll()}+ // promise: #237+ /// The blank document a discard leaves answers the load end's colour probes with white (#237:+ /// every discarded YouTube or GitHub tab saved #FFFFFF, a 2 MB sidebar.json write each, and+ /// woke with a white toolbar). The tab keeps the colours its page reported; woken, the page+ /// reports again.+ @MainActor+ private static func discardedPageColoursCase() async {+ let store = SidebarStore()+ let manager = BrowserManager(store: store, favicons: FaviconCache(), container: NSView())+ manager.protectedRecentTabs = 0+ let id = store.createTab(url: "https://example.test/dark-site").id+ let rt = manager.ensureRuntime(for: id)!+ manager.browser(rt.browser, didReportThemeColor: "#212121")+ manager.browser(rt.browser, didReportBackgroundColor: "#0F0F0F")+ rt.hiddenAt = Date.distantPast+ manager.sleepIdleTabs(TabSleepPolicy(hiddenFor: 60))+ rt.browser.reply(to: isolatedProbe, with: idleReply)+ await drainMainQueue()+ rt.browser.reply(to: "Runtime.evaluate", with: idleReply)+ await drainMainQueue()+ await finishSleep(rt.browser)+ expect(rt.discarded, "the page is discarded")+ manager.browser(rt.browser, didReportThemeColor: "#FFFFFF")+ manager.browser(rt.browser, didReportBackgroundColor: "#FFFFFF")+ expect(store.item(id)?.tab?.themeColor == "#212121" && rt.themeColor == "#212121" && rt.backgroundColor == "#0F0F0F",+ "a discarded page's blank document doesn't replace the tab's colours")+ manager.show(id, focus: false)+ manager.browser(rt.browser, didReportThemeColor: "#303030")+ expect(store.item(id)?.tab?.themeColor == "#303030", "the page loaded again on waking reports its colour")+ manager.closeAll()+ }+// promise: #214/// What the recorder says about tab sleeping (#214): a candidate passed over counts once per/// reason (the first that holds, TabSleepPolicy.hold), and a page refusing again after the@@ -722,7 +755,7 @@ enum BrowserManagerLifecycleTests {runtime.hiddenAt = Date.distantPastruntime.browser.isAudible = truemanager.sleepIdleTabs(TabSleepPolicy(hiddenFor: 60))- manager.sleepIdleTabs(.memoryPressure)+ manager.sleepIdleTabs(.memoryPressure(.warning))expect(!runtime.browser.replies.contains { $0.method == isolatedProbe } && !asleep(manager, id),"a page playing sound is never asked to sleep, on the timer or under memory pressure")manager.closeAll()diff --git a/Tests/promises.lock b/Tests/promises.lockindex 6bf04bc..8d7caa4 100644--- a/Tests/promises.lock+++ b/Tests/promises.lock@@ -14,7 +14,7 @@#22 Tests/PolicyTests.swift::extensionLaunch 8f21949f730d#24 Packages/CraCore/Tests/CraCoreTests/ShippedThemesTests.swift::edgeToEdgeIsOffUnlessChosen 96da512d440f#24 Tests/FloatingSidebarTests.swift::geometry be69a5b5124d-#28 Tests/BrowserManagerLifecycleTests.swift::audiblePageStaysAwakeCase 662b3dabe041+#28 Tests/BrowserManagerLifecycleTests.swift::audiblePageStaysAwakeCase 124ac2fe284e#29 Packages/CraCore/Tests/CraCoreTests/FavoritesLayoutTests.swift::columnsByCountMatchArc 9ab00f8c8434#30 Packages/CraCore/Tests/CraCoreTests/ArcThemeImportTests.swift::solidThemeKeepsItsColour 02956e3cc1bb#30 Packages/CraCore/Tests/CraCoreTests/ArcThemeImportTests.swift::unknownStyleFallsBackToThePalettesMidTone 33d9d79c196b@@ -222,15 +222,15 @@#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::eightHoursKeepsThemToo b3da3d8b8221#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::fourHoursKeepsTheTenUsedLast 727fd73ab07f#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::freezingReasonsThatKeepAPage 2a05a12e53eb-#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::pressureSweepTiming f737bdbb7c53-#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::pressureTakesTheOldestPastTheGrace 1561f645c0a9-#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::recentlyAudibleStays eca0c536d588+#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::pressureSweepTiming b11bee5c1aef+#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::pressureTakesTheOldestPastTheGrace 44378c844b70+#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::recentlyAudibleStays b6d5f2bd8b83#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::shortTimesCloseTheTenUsedLast 265e87cd7a23#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::thresholds 7e443a1abcb3#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::unknownTimeFallsBack 57fecfb31c5a-#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::visiblePagesStay 37235e5f2aa5+#153 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::visiblePagesStay 27ed11767d85#153 Tests/BrowserManagerLifecycleTests.swift::discardCase 0646d074a745-#153 Tests/BrowserManagerLifecycleTests.swift::pressureSweepCase dd5c8b3270f0+#153 Tests/BrowserManagerLifecycleTests.swift::pressureSweepCase b9895c19bf83#153 Tests/BrowserManagerLifecycleTests.swift::recentlyAudibleCase 1d3a7c7d2db1#153 Tests/BrowserManagerLifecycleTests.swift::shortTimerCase a9d9c860bc51#154 Packages/CraCore/Tests/CraCoreTests/FavoritesSharingTests.swift::aProfilesListIsReused 56b12941287c@@ -364,6 +364,11 @@#233 Packages/CraCore/Tests/CraCoreTests/MouseButtonSpaceSwitchTests.swift::backGoesToThePreviousSpaceAndForwardToTheNext 10b4dc8a4a65#233 Packages/CraCore/Tests/CraCoreTests/MouseButtonSpaceSwitchTests.swift::otherButtonsDoNotSwitch 07b725a8e6f5#233 Tests/Scenarios/mouse-buttons-switch-spaces.scenario 79148e8b3ebb+#237 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::criticalClosesMore 4c4b7c2f8168+#237 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::emptySweepSaysWhy 39babb07a0ec+#237 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::passLogIsOneLine f268f90d71b4+#237 Packages/CraCore/Tests/CraCoreTests/TabSleepPolicyTests.swift::pressureSweepCadence c58bde2e02a4+#237 Tests/BrowserManagerLifecycleTests.swift::discardedPageColoursCase 90cb62a0c2b9#241 Packages/CraCore/Tests/CraCoreTests/PageViewInsetsTests.swift::placesTheViewBelowTheBarInTheCard 7ba2374d493e#241 Packages/CraCore/Tests/CraCoreTests/PageViewInsetsTests.swift::readsTheBarAboveThePageInEitherSuperview 548a9473598d#241 Tests/Scenarios/debugger-infobar.scenario 189c93dc5b96