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.
Extensions follow the space's profile: pins per profile, options pages per profile, proxy owner in the log (#107) (#120)
Victor Kildahla4df5b3f3db0
diff --git a/Packages/CraCore/Sources/CraCore/ExtensionPagePlacement.swift b/Packages/CraCore/Sources/CraCore/ExtensionPagePlacement.swiftnew file mode 100644index 0000000..5f4a2ce--- /dev/null+++ b/Packages/CraCore/Sources/CraCore/ExtensionPagePlacement.swift@@ -0,0 +1,46 @@+import Foundation++/// Where a page an extension asks for goes: its options page, a `chrome.tabs.create`, a welcome+/// page (GitHub #107). Each Chromium profile runs its own copy of an extension, so the page+/// belongs in a space on the profile that asked: the space the window shows when that one+/// matches, else the first space on that profile. Chrome keeps one tab per options page and+/// opening it again selects that tab (#38). Arc does that across spaces too (Arc 1.171, offline,+/// 2 Nov 2026: options open in one space, asked for again from another, Arc went back to the+/// first space and selected it), but only within the profile: another profile's copy of the+/// page is another extension's, and is never reused.+public enum ExtensionPagePlacement {+ public struct Space: Equatable, Sendable {+ public let id: UUID+ /// Chromium profile folder ("Default", "Profile <id>").+ public let profile: String++ public init(id: UUID, profile: String) {+ self.id = id+ self.profile = profile+ }+ }++ public enum Target: Equatable, Sendable {+ case select(tab: UUID)+ case create(inSpace: UUID)+ }++ /// - Parameters:+ /// - focused: the space the window shows.+ /// - spaces: the normal (not incognito) spaces, in sidebar order.+ /// - profile: the profile the page comes from, nil when it's the focused page's own.+ /// - openTabs: tabs already showing the page, with their spaces; only singleton pages+ /// (options pages) reuse one.+ public static func target(focused: Space, spaces: [Space], profile: String?,+ openTabs: [(tab: UUID, space: UUID)], singleton: Bool) -> Target {+ let home = profile.flatMap { p in focused.profile == p ? focused : spaces.first { $0.profile == p } } ?? focused+ guard singleton else { return .create(inSpace: home.id) }+ if let open = openTabs.first(where: { $0.space == home.id }) { return .select(tab: open.tab) }+ // From an incognito space only its own tabs count: a normal one can't show there.+ if spaces.contains(home),+ let open = openTabs.first(where: { t in spaces.contains { $0.id == t.space && $0.profile == home.profile } }) {+ return .select(tab: open.tab)+ }+ return .create(inSpace: home.id)+ }+}diff --git a/Packages/CraCore/Sources/CraCore/ExtensionProxyControl.swift b/Packages/CraCore/Sources/CraCore/ExtensionProxyControl.swiftnew file mode 100644index 0000000..340fd34--- /dev/null+++ b/Packages/CraCore/Sources/CraCore/ExtensionProxyControl.swift@@ -0,0 +1,73 @@+import Foundation++/// Which extension's proxy a profile uses (GitHub #107: two proxy extensions collided and+/// nothing said so). An extension's `chrome.proxy.settings.set` lands in its own+/// `extensions.settings.<id>.preferences` (or `regular_only_preferences`) under "proxy", and+/// Chromium applies the one from the most recently installed or updated enabled extension+/// (ExtensionPrefValueMap::GetEffectivePrefValueController: the latest `last_update_time`+/// wins, a tie goes to the later ID). The others get `levelOfControl:+/// "controlled_by_other_extensions"`, which is how ZeroOmega knows to warn.+public enum ExtensionProxyControl {+ public struct Controller: Equatable, Sendable {+ public let extensionID: String+ /// Chromium's `last_update_time`: microseconds since 1601.+ public let installTime: Int64+ /// The proxy it asks for, without addresses beyond a host (see `summary`).+ public let config: String+ /// The proxy servers' and PAC file's hosts, for Export Diagnostics' "Hide site names".+ public let hosts: [String]++ public init(extensionID: String, installTime: Int64, config: String, hosts: [String] = []) {+ self.extensionID = extensionID+ self.installTime = installTime+ self.config = config+ self.hosts = hosts+ }+ }++ /// The extensions in `enabled` that set the proxy for normal pages, the one Chromium applies+ /// first. `settings` is a profile's `extensions.settings`.+ public static func controllers(settings: [String: Any], enabled: Set<String>) -> [Controller] {+ settings.compactMap { id, value -> Controller? in+ guard enabled.contains(id), let s = value as? [String: Any] else { return nil }+ let proxy = ((s["regular_only_preferences"] as? [String: Any])?["proxy"]+ ?? (s["preferences"] as? [String: Any])?["proxy"]) as? [String: Any]+ guard let proxy else { return nil }+ let time = (s["last_update_time"] as? String).flatMap { Int64($0) } ?? (s["last_update_time"] as? NSNumber)?.int64Value ?? 0+ let d = describe(proxy)+ return Controller(extensionID: id, installTime: time, config: d.summary, hosts: d.hosts)+ }+ .sorted { ($0.installTime, $0.extensionID) > ($1.installTime, $1.extensionID) }+ }++ /// A proxy pref (Chromium's ProxyConfigDictionary: mode, server, pac_url, bypass_list) in+ /// a line for the log and the diagnostics: hosts and ports, never a PAC URL's path or an+ /// inline PAC script.+ public static func summary(_ proxy: [String: Any]) -> String { describe(proxy).summary }++ private static func describe(_ proxy: [String: Any]) -> (summary: String, hosts: [String]) {+ let mode = proxy["mode"] as? String ?? "?"+ switch mode {+ case "fixed_servers":+ var hosts: [String] = []+ let servers = (proxy["server"] as? String ?? "").split(separator: ";").map { rule -> String in+ // "http=host:port", "socks5://host:port", "host:port": keep the scheme and host:port.+ let parts = rule.split(separator: "=", maxSplits: 1)+ let target = String(parts.last ?? "")+ let label = parts.count == 2 ? "\(parts[0])=" : ""+ return label + (URLComponents(string: target.contains("://") ? target : "x://" + target).map {+ let scheme = target.contains("://") ? "\($0.scheme ?? "")://" : ""+ if let h = $0.host { hosts.append(h) }+ return scheme + ($0.host ?? "?") + ($0.port.map { ":\($0)" } ?? "")+ } ?? "?")+ }+ return ("fixed_servers " + servers.joined(separator: ";"), hosts)+ case "pac_script":+ guard let url = proxy["pac_url"] as? String, !url.isEmpty, !url.hasPrefix("data:") else { return ("pac_script (inline)", []) }+ let host = URLComponents(string: url)?.host+ return ("pac_script " + (host ?? "?"), host.map { [$0] } ?? [])+ default:+ return (mode, [])+ }+ }+}diff --git a/Packages/CraCore/Sources/CraCore/PinnedExtensions.swift b/Packages/CraCore/Sources/CraCore/PinnedExtensions.swiftnew file mode 100644index 0000000..73834fb--- /dev/null+++ b/Packages/CraCore/Sources/CraCore/PinnedExtensions.swift@@ -0,0 +1,70 @@+import Foundation++/// pinned-extensions.json: the extensions pinned to the toolbar, in toolbar order, for each+/// Chromium profile. Arc keeps them per profile: its `arc::BrowserContext` (one per profile)+/// reads and writes Chromium's `extensions.pinned_extensions` pref, so a space shows the pins of+/// the profile it is bound to (GitHub #107). Cra kept one list for every profile before that, a+/// plain array. That list still serves each profile that has not pinned or unpinned anything+/// itself, so an update changes no toolbar, and a file with no list of a profile's own is still+/// written as that array.+public struct PinnedExtensions: Codable, Equatable, Sendable {+ /// The pins of every profile without a list of its own.+ public var shared: [String]+ /// Lists of profiles whose pins changed, by profile folder ("Default", "Profile <id>").+ public var profiles: [String: [String]]++ public init(shared: [String] = [], profiles: [String: [String]] = [:]) {+ self.shared = shared+ self.profiles = profiles+ }++ /// Chromium extension IDs in toolbar order.+ public func ids(inProfile profile: String) -> [String] { profiles[profile] ?? shared }++ public func isPinned(_ id: String, inProfile profile: String) -> Bool { ids(inProfile: profile).contains(id) }++ /// Pins or unpins in one profile only; the others keep what they show.+ public mutating func setPinned(_ id: String, _ pinned: Bool, inProfile profile: String) {+ guard pinned != isPinned(id, inProfile: profile) else { return }+ var list = ids(inProfile: profile)+ if pinned { list.append(id) } else { list.removeAll { $0 == id } }+ profiles[profile] = list+ }++ public mutating func move(_ id: String, to index: Int, inProfile profile: String) {+ var list = ids(inProfile: profile)+ guard let from = list.firstIndex(of: id) else { return }+ list.remove(at: from)+ list.insert(id, at: min(max(0, index), list.count))+ profiles[profile] = list+ }++ /// Drops the extensions `isGone` says are no longer installed, from every list.+ public mutating func removeAll(where isGone: (String) -> Bool) {+ shared.removeAll(where: isGone)+ for key in profiles.keys { profiles[key]?.removeAll(where: isGone) }+ }++ private enum CodingKeys: String, CodingKey { case shared, profiles }++ public init(from decoder: Decoder) throws {+ if let list = try? decoder.singleValueContainer().decode([String].self) {+ self.init(shared: list)+ return+ }+ let c = try decoder.container(keyedBy: CodingKeys.self)+ self.init(shared: try c.decodeIfPresent([String].self, forKey: .shared) ?? [],+ profiles: try c.decodeIfPresent([String: [String]].self, forKey: .profiles) ?? [:])+ }++ public func encode(to encoder: Encoder) throws {+ if profiles.isEmpty {+ var c = encoder.singleValueContainer()+ try c.encode(shared)+ return+ }+ var c = encoder.container(keyedBy: CodingKeys.self)+ try c.encode(shared, forKey: .shared)+ try c.encode(profiles, forKey: .profiles)+ }+}diff --git a/Packages/CraCore/Tests/CraCoreTests/ExtensionPagePlacementTests.swift b/Packages/CraCore/Tests/CraCoreTests/ExtensionPagePlacementTests.swiftnew file mode 100644index 0000000..67ab60a--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/ExtensionPagePlacementTests.swift@@ -0,0 +1,61 @@+import CraCore+import Foundation+import Testing++/// An extension's page opens in a space on the profile that asked, and an options page stays+/// one tab per profile, as in Arc (GitHub #107).+struct ExtensionPagePlacementTests {+ typealias P = ExtensionPagePlacement+ let a = P.Space(id: UUID(), profile: "Default")+ let b = P.Space(id: UUID(), profile: "Default")+ let work = P.Space(id: UUID(), profile: "Profile 1")+ let incognito = P.Space(id: UUID(), profile: "Default")+ let tabInA = UUID(), tabInB = UUID(), tabInWork = UUID()++ /// Arc: options open in space A, asked for again from space B, selects the tab in A.+ @Test func openInAnotherSpaceOfTheProfileIsSelected() {+ let t = P.target(focused: b, spaces: [a, b, work], profile: "Default",+ openTabs: [(tabInA, a.id)], singleton: true)+ #expect(t == .select(tab: tabInA))+ }++ @Test func openInThisSpaceWins() {+ let t = P.target(focused: b, spaces: [a, b], profile: nil,+ openTabs: [(tabInA, a.id), (tabInB, b.id)], singleton: true)+ #expect(t == .select(tab: tabInB))+ }++ /// The report: Work (its own profile) asked, and the options tab open in a Default space+ /// pulled the window there, showing the Default profile's copy of the extension.+ @Test func anotherProfilesTabIsNeverReused() {+ #expect(P.target(focused: work, spaces: [a, b, work], profile: nil,+ openTabs: [(tabInA, a.id)], singleton: true) == .create(inSpace: work.id))+ #expect(P.target(focused: a, spaces: [a, b, work], profile: nil,+ openTabs: [(tabInWork, work.id)], singleton: true) == .create(inSpace: a.id))+ }++ /// chrome.tabs.create and welcome pages always get a tab of their own.+ @Test func otherPagesAlwaysOpenANewTab() {+ let t = P.target(focused: b, spaces: [a, b], profile: nil, openTabs: [(tabInB, b.id)], singleton: false)+ #expect(t == .create(inSpace: b.id))+ }++ /// Another profile's extension copy asked: its page loads in a space on that profile.+ @Test func anotherProfilesPageGoesToItsSpace() {+ #expect(P.target(focused: a, spaces: [a, b, work], profile: "Profile 1", openTabs: [], singleton: true)+ == .create(inSpace: work.id))+ #expect(P.target(focused: a, spaces: [a, b, work], profile: "Profile 1",+ openTabs: [(tabInA, a.id), (tabInWork, work.id)], singleton: true) == .select(tab: tabInWork))+ }++ /// The page's profile has no space left: the space in front, as before.+ @Test func profileWithoutASpaceUsesTheFocusedOne() {+ #expect(P.target(focused: a, spaces: [a, b], profile: "Profile 9", openTabs: [], singleton: true) == .create(inSpace: a.id))+ }++ /// An incognito window never selects a normal tab (it can't show one).+ @Test func incognitoKeepsToItsOwnSpace() {+ #expect(P.target(focused: incognito, spaces: [a, b], profile: nil,+ openTabs: [(tabInA, a.id)], singleton: true) == .create(inSpace: incognito.id))+ }+}diff --git a/Packages/CraCore/Tests/CraCoreTests/ExtensionProxyControlTests.swift b/Packages/CraCore/Tests/CraCoreTests/ExtensionProxyControlTests.swiftnew file mode 100644index 0000000..2dc6e3a--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/ExtensionProxyControlTests.swift@@ -0,0 +1,65 @@+import CraCore+import Foundation+import Testing++/// Which extension's proxy Chromium applies, read from extensions.settings (GitHub #107).+struct ExtensionProxyControlTests {+ static func ext(_ time: String, proxy: [String: Any]?, key: String = "preferences") -> [String: Any] {+ var s: [String: Any] = ["last_update_time": time, "state": 1]+ if let proxy { s[key] = ["proxy": proxy] }+ return s+ }++ static let pac: [String: Any] = ["mode": "pac_script", "pac_url": "data:application/x-ns-proxy-autoconfig;base64,ZnVuY3Rpb24="]+ static let fixed: [String: Any] = ["mode": "fixed_servers", "server": "proxy.corp.example:3128", "bypass_list": "<local>"]++ /// The most recently installed or updated one wins; the other is overridden.+ @Test func latestInstallWins() {+ let settings: [String: Any] = [+ "zeroomega": Self.ext("13400000000000000", proxy: Self.pac),+ "otherproxy": Self.ext("13400000000000500", proxy: Self.fixed),+ "noproxy": Self.ext("13400000000009999", proxy: nil),+ ]+ let c = ExtensionProxyControl.controllers(settings: settings, enabled: ["zeroomega", "otherproxy", "noproxy"])+ #expect(c.map(\.extensionID) == ["otherproxy", "zeroomega"])+ #expect(c[0].config == "fixed_servers proxy.corp.example:3128")+ #expect(c[0].hosts == ["proxy.corp.example"] && c[1].hosts.isEmpty)+ #expect(c[1].config == "pac_script (inline)")+ }++ /// A turned-off or uninstalled extension's leftover pref does not count.+ @Test func onlyEnabledExtensionsCount() {+ let settings: [String: Any] = [+ "a": Self.ext("100", proxy: Self.pac),+ "b": Self.ext("200", proxy: Self.fixed),+ ]+ #expect(ExtensionProxyControl.controllers(settings: settings, enabled: ["a"]).map(\.extensionID) == ["a"])+ #expect(ExtensionProxyControl.controllers(settings: settings, enabled: []).isEmpty)+ }++ /// Chromium's map walks IDs in order and a later equal time takes over.+ @Test func tieGoesToTheLaterID() {+ let settings: [String: Any] = ["aaa": Self.ext("100", proxy: Self.pac), "bbb": Self.ext("100", proxy: Self.fixed)]+ #expect(ExtensionProxyControl.controllers(settings: settings, enabled: ["aaa", "bbb"]).first?.extensionID == "bbb")+ }++ /// chrome.proxy.settings.set with scope "regular_only".+ @Test func regularOnlyScopeCounts() {+ let settings: [String: Any] = ["a": Self.ext("100", proxy: Self.fixed, key: "regular_only_preferences"),+ "b": Self.ext("50", proxy: Self.pac, key: "incognito_preferences")]+ #expect(ExtensionProxyControl.controllers(settings: settings, enabled: ["a", "b"]).map(\.extensionID) == ["a"])+ }++ @Test(arguments: [+ (["mode": "direct"], "direct"),+ (["mode": "system"], "system"),+ (["mode": "auto_detect"], "auto_detect"),+ (["mode": "pac_script", "pac_url": "https://wpad.corp.example/secret/proxy.pac?token=1"], "pac_script wpad.corp.example"),+ (["mode": "pac_script"], "pac_script (inline)"),+ (["mode": "fixed_servers", "server": "http=h1:80;https=h2:443"], "fixed_servers http=h1:80;https=h2:443"),+ (["mode": "fixed_servers", "server": "socks5://user:[email protected]:1080"], "fixed_servers socks5://s.example:1080"),+ ] as [([String: String], String)])+ func summaries(proxy: [String: String], expected: String) {+ #expect(ExtensionProxyControl.summary(proxy) == expected)+ }+}diff --git a/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/input/pinned-extensions-profiles.json b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/input/pinned-extensions-profiles.jsonnew file mode 100644index 0000000..46ee53d--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/input/pinned-extensions-profiles.json@@ -0,0 +1 @@+{"shared":["aeblfdkhhhdcdjpifhhbdiojplfjncoa"],"profiles":{"Default":[],"Profile B0000000-0000-0000-0000-000000000001":["pfjdepjjfjjahkjfpkcgfmfhmnakjfba","aeblfdkhhhdcdjpifhhbdiojplfjncoa"]}}diff --git a/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/input/pinned-extensions.json b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/input/pinned-extensions.jsonnew file mode 100644index 0000000..ce09f04--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/input/pinned-extensions.json@@ -0,0 +1 @@+["aeblfdkhhhdcdjpifhhbdiojplfjncoa","pfjdepjjfjjahkjfpkcgfmfhmnakjfba"]diff --git a/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/pinned-extensions-profiles.json b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/pinned-extensions-profiles.jsonnew file mode 100644index 0000000..46ee53d--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/pinned-extensions-profiles.json@@ -0,0 +1 @@+{"shared":["aeblfdkhhhdcdjpifhhbdiojplfjncoa"],"profiles":{"Default":[],"Profile B0000000-0000-0000-0000-000000000001":["pfjdepjjfjjahkjfpkcgfmfhmnakjfba","aeblfdkhhhdcdjpifhhbdiojplfjncoa"]}}diff --git a/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/pinned-extensions.json b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/pinned-extensions.jsonnew file mode 100644index 0000000..ce09f04--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/Fixtures/Model/recorded/pinned-extensions.json@@ -0,0 +1 @@+["aeblfdkhhhdcdjpifhhbdiojplfjncoa","pfjdepjjfjjahkjfpkcgfmfhmnakjfba"]diff --git a/Packages/CraCore/Tests/CraCoreTests/ModelFixtureTests.swift b/Packages/CraCore/Tests/CraCoreTests/ModelFixtureTests.swiftindex 5aab87e..671502e 100644--- a/Packages/CraCore/Tests/CraCoreTests/ModelFixtureTests.swift+++ b/Packages/CraCore/Tests/CraCoreTests/ModelFixtureTests.swift@@ -89,6 +89,21 @@ struct ModelFixtureTests {#expect(loaded["nextTab"] == [KeyChord(key: KeyChord.tab, modifiers: 1 << 18), KeyChord(key: KeyChord.right, modifiers: 1 << 20 | 1 << 19)])}+ /// pinned-extensions.json: the one list of before #107 loads as every profile's and stays an+ /// array when saved; per-profile lists keep an emptied profile's empty list.+ @Test(arguments: ["pinned-extensions.json", "pinned-extensions-profiles.json"])+ func pinnedExtensionsLoadAsRecorded(name: String) throws {+ let (loaded, recorded) = try Self.load(name, as: PinnedExtensions.self)+ #expect(loaded == recorded)+ #expect(try Self.roundTrips(loaded))+ if loaded.profiles.isEmpty {+ #expect(try JSONSerialization.jsonObject(with: JSONEncoder().encode(loaded)) is [String])+ #expect(loaded.ids(inProfile: "Profile B0000000-0000-0000-0000-000000000001") == loaded.shared)+ } else {+ #expect(loaded.ids(inProfile: "Default").isEmpty && loaded.ids(inProfile: "Profile 9") == loaded.shared)+ }+ }+// MARK: What the old shapes turn into@Test func legacySidebarGetsWhatTheStoreRepairsFrom() throws {diff --git a/Packages/CraCore/Tests/CraCoreTests/PinnedExtensionsTests.swift b/Packages/CraCore/Tests/CraCoreTests/PinnedExtensionsTests.swiftnew file mode 100644index 0000000..a1d3282--- /dev/null+++ b/Packages/CraCore/Tests/CraCoreTests/PinnedExtensionsTests.swift@@ -0,0 +1,60 @@+import CraCore+import Foundation+import Testing++/// Pinned extensions belong to a profile, like Arc's (GitHub #107).+struct PinnedExtensionsTests {+ /// The list Cra kept before #107 serves every profile until one changes its own.+ @Test func oldListServesEveryProfile() throws {+ let pins = try JSONDecoder().decode(PinnedExtensions.self, from: Data(#"["a","b"]"#.utf8))+ #expect(pins.ids(inProfile: "Default") == ["a", "b"])+ #expect(pins.ids(inProfile: "Profile 1") == ["a", "b"])+ // Written back unchanged.+ #expect(String(decoding: try JSONEncoder().encode(pins), as: UTF8.self) == #"["a","b"]"#)+ }++ @Test func pinningInOneProfileLeavesTheOthers() {+ var pins = PinnedExtensions(shared: ["a", "b"])+ pins.setPinned("c", true, inProfile: "Profile 1")+ pins.setPinned("a", false, inProfile: "Profile 1")+ #expect(pins.ids(inProfile: "Profile 1") == ["b", "c"])+ #expect(pins.ids(inProfile: "Default") == ["a", "b"])+ #expect(pins.isPinned("c", inProfile: "Profile 1"))+ #expect(!pins.isPinned("c", inProfile: "Default"))+ }++ @Test func noChangeKeepsTheSharedList() {+ var pins = PinnedExtensions(shared: ["a"])+ pins.setPinned("a", true, inProfile: "Default")+ pins.setPinned("z", false, inProfile: "Default")+ pins.move("z", to: 0, inProfile: "Default")+ #expect(pins.profiles.isEmpty)+ }++ @Test func moveReordersOneProfile() {+ var pins = PinnedExtensions(shared: ["a", "b", "c"])+ pins.move("c", to: 0, inProfile: "Default")+ pins.move("a", to: 99, inProfile: "Default")+ #expect(pins.ids(inProfile: "Default") == ["c", "b", "a"])+ #expect(pins.ids(inProfile: "Profile 2") == ["a", "b", "c"])+ }++ @Test func removedExtensionsLeaveEveryList() {+ var pins = PinnedExtensions(shared: ["a", "b"], profiles: ["Profile 1": ["b", "c"]])+ pins.removeAll { $0 == "b" }+ #expect(pins == PinnedExtensions(shared: ["a"], profiles: ["Profile 1": ["c"]]))+ }++ @Test func profileListsRoundTrip() throws {+ let pins = PinnedExtensions(shared: ["a"], profiles: ["Default": [], "Profile 1": ["c", "a"]])+ let data = try JSONEncoder().encode(pins)+ #expect(try JSONDecoder().decode(PinnedExtensions.self, from: data) == pins)+ // An unpinned-everything profile keeps its empty list rather than falling back.+ #expect(pins.ids(inProfile: "Default").isEmpty)+ }++ @Test func unreadableFileMeansNoPins() throws {+ #expect((try? JSONDecoder().decode(PinnedExtensions.self, from: Data(#"{"shared": 3}"#.utf8))) == nil)+ #expect(try JSONDecoder().decode(PinnedExtensions.self, from: Data("{}".utf8)) == PinnedExtensions())+ }+}diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swiftindex 8ae4e7f..4c145c3 100644--- a/Sources/Cra/App/AppDelegate.swift+++ b/Sources/Cra/App/AppDelegate.swift@@ -89,7 +89,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {let installed = ExtensionStore.shared.entries.map(\.extensionID)let hasNewExtension = !Set(installed).isSubset(of: welcomed)try? JSONEncoder().encode(installed.sorted()).write(to: welcomedFile, options: .atomic)- CraCEFRuntime.setStrayPageHandler { [weak self] url in+ CraCEFRuntime.setStrayPageHandler { [weak self] url, profile inTask { @MainActor inguard let self else { return }if Date().timeIntervalSince(launchedAt) < 10,@@ -97,9 +97,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {NSLog("Cra: dropped start-up page from an extension: %@", url)return}- self.useNormalWindow()- self.openExtensionPage(url)- self.main.showWindow(nil)+ // The window in use, and a space on the profile whose extension asked (#107).+ let window = self.useNormalWindow()+ self.openExtensionPage(url, window: window.windowID, profile: profile)+ window.showWindow(nil)}}CraCEFRuntime.setRelaunchHandler { [weak self] urls in@@ -305,13 +306,32 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {/// A page an extension opens as a tab. Its options page stays one tab, as in Chrome and/// Arc: opening it again selects the open one (GitHub #38).- func openExtensionPage(_ url: String, window: UUID? = nil) {+ /// `profile` is the Chromium profile folder whose extension asked, nil for the focused page's.+ func openExtensionPage(_ url: String, window: UUID, profile: String? = nil) {+ // Extensions run in the normal profile, so Chrome opens their pages in a normal window:+ // in an incognito one the page can't load (#107). Incognito is Default's off the record.+ var window = window, profile = profile+ if mainWindows.first(where: { $0.windowID == window })?.isIncognito == true {+ let normal = useNormalWindow()+ if !normal.isIncognito {+ window = normal.windowID+ profile = profile ?? "Default"+ normal.showWindow(nil)+ }+ }let page = { (u: String) in u.split(separator: "#", maxSplits: 1).first.map(String.init) ?? u }- if ExtensionStore.shared.optionsPageOwner(url) != nil,- let open = store.allTabs().first(where: { $0.tab.map { page($0.url) == page(url) } == true && !store.isIncognito(item: $0.id) }) {- store.selectTab(open.id, window: window)- } else {- store.createTab(url: url, select: true, window: window)+ let space = { (id: UUID) in ExtensionPagePlacement.Space(id: id, profile: self.store.profileDirectoryName(space: id)) }+ let open = store.allTabs().compactMap { t -> (tab: UUID, space: UUID)? in+ guard t.tab.map({ page($0.url) == page(url) }) == true, let sid = store.spaceID(ofItem: t.id) else { return nil }+ return (t.id, sid)+ }+ let target = ExtensionPagePlacement.target(+ focused: space(store.focusedSpaceID(window: window)),+ spaces: store.orderedSpaces.filter { !store.isIncognito(space: $0.id) }.map { space($0.id) },+ profile: profile, openTabs: open, singleton: ExtensionStore.shared.optionsPageOwner(url) != nil)+ switch target {+ case .select(let tab): store.selectTab(tab, window: window)+ case .create(let sid): store.createTab(url: url, in: sid, select: true, window: window)}}diff --git a/Sources/Cra/Services/Diagnostics.swift b/Sources/Cra/Services/Diagnostics.swiftindex c0734b5..5422f1e 100644--- a/Sources/Cra/Services/Diagnostics.swift+++ b/Sources/Cra/Services/Diagnostics.swift@@ -126,6 +126,8 @@ enum Diagnostics {let urls = store.allTabs().compactMap { $0.tab?.url } + store.history.values.map(\.url)+ store.archive.compactMap { $0.item.tab?.url }for u in urls { if let h = SiteNames.siteHost(of: u) { hosts.insert(h) } }+ // The proxy servers extensions set (summary.txt's Proxy section, cra.log).+ for c in ExtensionStore.shared.proxyControllers.values.joined() { hosts.formUnion(c.hosts) }return hosts}@@ -187,6 +189,14 @@ enum Diagnostics {.filter { $0.hasPrefix("webRequest") || $0.hasPrefix("declarativeNetRequest") || $0 == "proxy" }lines.append(" \(e.name) \(e.version) [\(e.extensionID)]\(e.managedByChrome ? " web store" : "")\(permissions.isEmpty ? "" : " " + permissions.joined(separator: ","))")}+ // Two extensions that set the proxy collide quietly (GitHub #107): the one in use and the+ // ones it overrides, per profile.+ lines += ["", "Proxy:"]+ let proxies = ExtensionStore.shared.proxyControllers+ if proxies.isEmpty { lines.append(" not set by an extension") }+ for profile in proxies.keys.sorted() {+ lines.append(" \(profile): " + ExtensionStore.proxyLine(proxies[profile] ?? []))+ }return lines.joined(separator: "\n") + "\n"}}diff --git a/Sources/Cra/Services/ExtensionStore.swift b/Sources/Cra/Services/ExtensionStore.swiftindex ef28d6e..a80afbb 100644--- a/Sources/Cra/Services/ExtensionStore.swift+++ b/Sources/Cra/Services/ExtensionStore.swift@@ -77,7 +77,7 @@ final class ExtensionStore {init() {reload()// Keep what was taken over from another browser, so it is only read once.- if !FileManager.default.fileExists(atPath: Self.pinnedFile.path), !pinnedIDs.isEmpty { savePinned() }+ if !FileManager.default.fileExists(atPath: Self.pinnedFile.path), !pinned.shared.isEmpty { savePinned() }}func reload() {@@ -122,7 +122,37 @@ final class ExtensionStore {for p in old.disabledProfiles.subtracting(e.disabledProfiles).sorted() { CraLog.note("extension \(e.extensionID) turned on in \(p)") }}entries = next- pinnedIDs.removeAll { id in !entries.contains { $0.extensionID == id } }+ pinned.removeAll { id in !entries.contains { $0.extensionID == id } }+ noteProxyControllers(settings: settings)+ }++ // MARK: Proxy (GitHub #107)++ /// Per profile folder, the turned-on extensions that set the proxy, the one Chromium applies+ /// first. Two of them collide quietly: the others get "controlled_by_other_extensions",+ /// which only the extensions themselves show, so the log and diagnostics name them.+ private(set) var proxyControllers: [String: [ExtensionProxyControl.Controller]] = [:]++ private func noteProxyControllers(settings: [String: [String: Any]]) {+ var next: [String: [ExtensionProxyControl.Controller]] = [:]+ for (profile, s) in settings {+ let on = Set(entries(inProfile: profile).map(\.extensionID))+ let c = ExtensionProxyControl.controllers(settings: s, enabled: on)+ if !c.isEmpty { next[profile] = c }+ }+ // By what the line says: --load-extension reinstalls (new times) on every launch.+ for profile in Set(next.keys).union(proxyControllers.keys).sorted() {+ let line = Self.proxyLine(next[profile] ?? [])+ if line != Self.proxyLine(proxyControllers[profile] ?? []) { CraLog.note("proxy in \(profile): " + line) }+ }+ proxyControllers = next+ }++ /// "set by <id> (<config>), overriding <id>, <id>", or "not set by an extension".+ static func proxyLine(_ controllers: [ExtensionProxyControl.Controller]) -> String {+ guard let first = controllers.first else { return "not set by an extension" }+ let others = controllers.dropFirst().map(\.extensionID)+ return "set by \(first.extensionID) (\(first.config))" + (others.isEmpty ? "" : ", overriding " + others.joined(separator: ", "))}/// The extensions a page in this Chromium profile folder can run; running another@@ -187,40 +217,42 @@ final class ExtensionStore {private static var pinnedFile: URL { AppPaths.file("pinned-extensions.json") }- /// Chromium extension IDs in toolbar order.- private(set) var pinnedIDs: [String] = ExtensionStore.loadPinned()+ /// Each profile's pins, like Arc's (GitHub #107).+ private(set) var pinned = ExtensionStore.loadPinned()/// Before Cra has a list of its own, the browser it replaces supplies one: Arc keeps its/// pinned extensions in Chromium's `extensions.pinned_extensions` pref, as do Dia and Chrome.- private static func loadPinned() -> [String] {- if let data = try? Data(contentsOf: pinnedFile) { return (try? JSONDecoder().decode([String].self, from: data)) ?? [] }+ private static func loadPinned() -> PinnedExtensions {+ if let data = try? Data(contentsOf: pinnedFile) { return (try? JSONDecoder().decode(PinnedExtensions.self, from: data)) ?? PinnedExtensions() }for source in [ImportSource.arc, .dia] + ImportSource.allCases.filter({ $0.id == "chrome" }) {let prefs = source.dataDir.appendingPathComponent("Default/Preferences")guard let data = try? Data(contentsOf: prefs),let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],let ids = (json["extensions"] as? [String: Any])?["pinned_extensions"] as? [String], !ids.isEmpty else { continue }- return ids+ return PinnedExtensions(shared: ids)}- return []+ return PinnedExtensions()}- func isPinned(_ id: String) -> Bool { pinnedIDs.contains(id) }+ /// Chromium extension IDs in toolbar order, for spaces on this profile folder.+ func pinnedIDs(inProfile profile: String) -> [String] { pinned.ids(inProfile: profile) }++ func isPinned(_ id: String, inProfile profile: String) -> Bool { pinned.isPinned(id, inProfile: profile) }- func setPinned(_ id: String, _ pinned: Bool) {- guard pinned != isPinned(id) else { return }- if pinned { pinnedIDs.append(id) } else { pinnedIDs.removeAll { $0 == id } }- savePinned()+ func setPinned(_ id: String, _ isPinned: Bool, inProfile profile: String) {+ let before = pinned+ pinned.setPinned(id, isPinned, inProfile: profile)+ if pinned != before { savePinned() }}- func movePinned(_ id: String, to index: Int) {- guard let from = pinnedIDs.firstIndex(of: id) else { return }- pinnedIDs.remove(at: from)- pinnedIDs.insert(id, at: min(max(0, index), pinnedIDs.count))- savePinned()+ func movePinned(_ id: String, to index: Int, inProfile profile: String) {+ let before = pinned+ pinned.move(id, to: index, inProfile: profile)+ if pinned != before { savePinned() }}private func savePinned() {- try? JSONEncoder().encode(pinnedIDs).write(to: Self.pinnedFile, options: .atomic)+ try? JSONEncoder().encode(pinned).write(to: Self.pinnedFile, options: .atomic)NotificationCenter.default.post(name: .craPinnedExtensionsChanged, object: self)}diff --git a/Sources/Cra/UI/ExtensionsMenu.swift b/Sources/Cra/UI/ExtensionsMenu.swiftindex 207f47e..6221b13 100644--- a/Sources/Cra/UI/ExtensionsMenu.swift+++ b/Sources/Cra/UI/ExtensionsMenu.swift@@ -47,9 +47,9 @@ final class ExtensionsMenu: NSObject, NSMenuDelegate, NSMenuItemValidation {for e in entries {let item = NSMenuItem(title: e.name, action: #selector(togglePin(_:)), keyEquivalent: "")item.target = self- item.representedObject = e.extensionID+ item.representedObject = [e.extensionID, profile]item.image = Self.menuIcon(e.icon)- item.state = store.isPinned(e.extensionID) ? .on : .off+ item.state = store.isPinned(e.extensionID, inProfile: profile) ? .on : .offpinMenu.addItem(item)}pin.submenu = pinMenu@@ -151,8 +151,9 @@ final class ExtensionsMenu: NSObject, NSMenuDelegate, NSMenuItemValidation {@objc private func manageExtensions() { openTab("chrome://extensions") }@objc private func togglePin(_ sender: NSMenuItem) {- guard let id = sender.representedObject as? String else { return }- ExtensionStore.shared.setPinned(id, !ExtensionStore.shared.isPinned(id))+ // The profile of the space the menu was opened in: the pins are that profile's (GitHub #107).+ guard let pair = sender.representedObject as? [String], pair.count == 2 else { return }+ ExtensionStore.shared.setPinned(pair[0], !ExtensionStore.shared.isPinned(pair[0], inProfile: pair[1]), inProfile: pair[1])}private func openTab(_ url: String) {diff --git a/Sources/Cra/UI/PaneToolbarView.swift b/Sources/Cra/UI/PaneToolbarView.swiftindex 66385be..46b0370 100644--- a/Sources/Cra/UI/PaneToolbarView.swift+++ b/Sources/Cra/UI/PaneToolbarView.swift@@ -148,7 +148,7 @@ final class PaneToolbarView: NSView {?? store.profileDirectoryName(space: store.focusedSpaceID(window: ui.windowID))let entries = extensions.entries(inProfile: profile)m.hasExtensions = !entries.isEmpty- m.pinned = extensions.pinnedIDs.compactMap { id in+ m.pinned = extensions.pinnedIDs(inProfile: profile).compactMap { id inentries.first { $0.extensionID == id }.map {Model.Ext(id: id, name: $0.name, icon: extensions.toolbarIcon(for: $0, profile: profile, tab: m.tabID),badge: extensions.badge(for: $0, profile: profile, tab: m.tabID))diff --git a/Sources/Cra/UI/Sidebar/List/SidebarView.swift b/Sources/Cra/UI/Sidebar/List/SidebarView.swiftindex 12eefc8..4793faf 100644--- a/Sources/Cra/UI/Sidebar/List/SidebarView.swift+++ b/Sources/Cra/UI/Sidebar/List/SidebarView.swift@@ -341,7 +341,7 @@ final class SidebarTopBarView: NSView {let profile = tab.map { store.profileDirectoryName(item: $0.id) }?? store.profileDirectoryName(space: store.focusedSpaceID(window: ui.windowID))let entries = ext.entries(inProfile: profile)- let pinned = ext.pinnedIDs.compactMap { id in+ let pinned = ext.pinnedIDs(inProfile: profile).compactMap { id inentries.first { $0.extensionID == id }.map {(id, $0.name, ext.badged(ext.toolbarIcon(for: $0, profile: profile, tab: tab?.id),ext.badge(for: $0, profile: profile, tab: tab?.id), tint: colors.textSecondary))diff --git a/Sources/Cra/UI/SiteControlCenter.swift b/Sources/Cra/UI/SiteControlCenter.swiftindex faaf2fe..222d20b 100644--- a/Sources/Cra/UI/SiteControlCenter.swift+++ b/Sources/Cra/UI/SiteControlCenter.swift@@ -77,8 +77,8 @@ final class SiteControlCenterView: NSView {/// Arc: pinned extensions in toolbar order, then the rest by name.private var orderedExtensions: [ExtensionStore.Entry] {let entries = extensions.entries(inProfile: profile)- let pinned = extensions.pinnedIDs.compactMap { id in entries.first { $0.extensionID == id } }- let rest = entries.filter { !extensions.isPinned($0.extensionID) }+ let pinned = extensions.pinnedIDs(inProfile: profile).compactMap { id in entries.first { $0.extensionID == id } }+ let rest = entries.filter { !extensions.isPinned($0.extensionID, inProfile: profile) }.sorted { $0.name.localizedStandardCompare($1.name) == .orderedAscending }return pinned + rest}@@ -86,7 +86,7 @@ final class SiteControlCenterView: NSView {private func observe() {withObservationTracking {_ = extensions.entries- _ = extensions.pinnedIDs+ _ = extensions.pinned_ = store.settings} onChange: { [weak self] inTask { @MainActor in self?.observe() }@@ -124,9 +124,11 @@ final class SiteControlCenterView: NSView {let ext = SiteSectionView(title: "Extensions", hoverText: "Manage", colors: colors, onHeaderClick: actions.manageExtensions)extensionTiles = [:]var tiles: [NSView] = orderedExtensions.map { e in- let tile = SiteExtensionTile(entry: e, pinned: extensions.isPinned(e.extensionID), colors: colors,+ let tile = SiteExtensionTile(entry: e, pinned: extensions.isPinned(e.extensionID, inProfile: profile), colors: colors,run: { [actions] in actions.runExtension(e.extensionID) },- togglePin: { ExtensionStore.shared.setPinned(e.extensionID, !ExtensionStore.shared.isPinned(e.extensionID)) })+ togglePin: { [profile] in+ ExtensionStore.shared.setPinned(e.extensionID, !ExtensionStore.shared.isPinned(e.extensionID, inProfile: profile), inProfile: profile)+ })tile.show(icon: liveIcon(e))extensionTiles[e.extensionID] = tilereturn tile@@ -300,6 +302,11 @@ private class SiteTile: SiteHoverView {glyph.imageScaling = .scaleProportionallyDownaddSubview(glyph)if !help.isEmpty { _ = ArcTooltipAnchorView.attach(to: self, help: help) }+ // A button to VoiceOver, like the popover's other controls.+ setAccessibilityElement(true)+ setAccessibilityRole(.button)+ setAccessibilityLabel(help)+ glyph.setAccessibilityElement(false)refresh()}@@ -349,7 +356,10 @@ private final class SiteExtensionTile: SiteTile {pinGlyph.frame = NSRect(x: 0, y: 0, width: 14, height: 14)badge.addSubview(pinGlyph)_ = ArcTooltipAnchorView.attach(to: badge, help: pinned ? "Unpin" : "Pin")+ badge.setAccessibilityElement(true)+ badge.setAccessibilityRole(.button)badge.setAccessibilityLabel(pinned ? "Unpin" : "Pin")+ pinGlyph.setAccessibilityElement(false)refresh()}diff --git a/Sources/CraCEF/CraCEF.mm b/Sources/CraCEF/CraCEF.mmindex af961f0..f36fbad 100644--- a/Sources/CraCEF/CraCEF.mm+++ b/Sources/CraCEF/CraCEF.mm@@ -68,7 +68,7 @@ static BOOL g_alreadyRunning = NO;static NSHashTable<CraBrowser*>* g_allBrowsers = nil;/// Closed tabs whose page stays alive until its downloads end (see -[CraBrowser close]).static NSMutableSet<CraBrowser*>* g_parkedBrowsers = nil;-static void (^g_strayPageHandler)(NSString*) = nil;+static void (^g_strayPageHandler)(NSString*, NSString*) = nil;static void (^g_processEventHandler)(NSString*, NSString*, NSString*) = nil;static NSString* NSStringFromCef(const CefString& s) {@@ -268,8 +268,13 @@ public:browser->GetHost()->CloseBrowser(true);return true;}- void (^handler)(NSString*) = g_strayPageHandler;- dispatch_async(dispatch_get_main_queue(), ^{ handler(url); });+ // The profile whose extension asked: its pages belong in a space on that profile (#107).+ CefRefPtr<CefRequestContext> context = browser->GetHost()->GetRequestContext();+ NSString* cache = context ? NSStringFromCef(context->GetCachePath()) : @"";+ // The global context's path is the root folder: that is Default.+ NSString* profile = !cache.length ? nil : [cache.lastPathComponent hasPrefix:@"Profile "] ? cache.lastPathComponent : @"Default";+ void (^handler)(NSString*, NSString*) = g_strayPageHandler;+ dispatch_async(dispatch_get_main_queue(), ^{ handler(url, profile); });browser->GetHost()->CloseBrowser(true);return true;}@@ -2441,7 +2446,7 @@ static void MarkProfileExitedCleanly(NSString* profileDir) {+ (BOOL)anotherInstanceWasNotified { return g_alreadyRunning; }+ (void)setRelaunchHandler:(void (^)(NSArray<NSString*>*))handler { g_relaunchHandler = [handler copy]; }-+ (void)setStrayPageHandler:(void (^)(NSString*))handler { g_strayPageHandler = [handler copy]; }++ (void)setStrayPageHandler:(void (^)(NSString*, NSString*))handler { g_strayPageHandler = [handler copy]; }+ (void)setProcessEventHandler:(void (^)(NSString*, NSString*, NSString*))handler { g_processEventHandler = [handler copy]; }+ (BOOL)isExtensionWindow:(NSWindow*)window { return window && [g_extensionWindows containsObject:window]; }+ (BOOL)isPageWindow:(NSWindow*)window {diff --git a/Sources/CraCEF/include/CraCEF.h b/Sources/CraCEF/include/CraCEF.hindex fe92eb1..9696b8d 100644--- a/Sources/CraCEF/include/CraCEF.h+++ b/Sources/CraCEF/include/CraCEF.h@@ -269,9 +269,10 @@ typedef NS_ENUM(NSInteger, CraDownloadState) {+ (void)setRelaunchHandler:(void (^)(NSArray<NSString *> *urls))handler;/// Pages Chromium opens on its own (an extension's chrome.tabs.create or/// windows.create, welcome pages after an extension loads). The handler gets-/// the URL to open as a Cra tab; Chrome's own window for it is closed.+/// the URL to open as a Cra tab and the Chromium profile folder it came from+/// ("Default", "Profile <id>"; nil off the record); Chrome's own window for it is closed./// Popup-type windows (windows.create({type: "popup"})) stay Chrome's windows.-+ (void)setStrayPageHandler:(void (^)(NSString *url))handler;++ (void)setStrayPageHandler:(void (^)(NSString *url, NSString * _Nullable profile))handler;/// Renderer trouble and failed loads, for Cra's performance recorder (GitHub #91): `kind` is/// terminated, unresponsive, responsive or loadError; `detail` how it ended or the net error/// code; `site` the host (nil for incognito, Cra's own pages or a closed tab). Never a URL.diff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.mdindex 3f24c7e..108f01d 100644--- a/docs/arc-reverse-engineering.md+++ b/docs/arc-reverse-engineering.md@@ -2319,3 +2319,31 @@ tap with a real Shift key held around them; the space read from each window's `s- Cra: `extensions-action-updates.patch` reports icon, title, badge text (or the declarativeNetRequest count), badgeand text colour. `ExtensionBadge` (CraCore) lays the badge out; `ExtensionStore.badged` draws it into the icon.Captured side by side with the same probe, Cra matches Arc's five states to the pixel (text ±1 px antialiasing).++## Extensions per profile, options pages and the proxy (Arc 1.171, 2 Nov 2026, issue #107)++- [O static] Pinned extensions are per profile: Arc's `arc::BrowserContext` (one per Chromium profile) has+ `getPinnedExtensionOrder` / `setPinnedExtensionOrder:`, `browserContext:didChangePinnedExtensionOrder:` and+ `arc::BrowserContext::Extensions::Delegate::DidPinnedExtensionOrderChange`, over Chromium's+ `extensions.pinned_extensions` pref. This Mac's Arc has only the Default profile (two pins), so two lists were not+ compared live. Cra: `PinnedExtensions` (pinned-extensions.json), where the old single list serves every profile until+ one pins or unpins something of its own.+- [O] Arc has no per-space extension switch. A space gets the extensions of the profile it is bound to, and an+ extension is turned off for one profile in that profile's arc://extensions. Cra does the same with+ chrome://extensions opened from a space on that profile (Extensions ▸ Manage Extensions…). Verified on a test copy:+ an `Extensions/` extension turned off in a Work profile left that profile's toolbar and proxy, and kept running+ in Default.+- [O live] Options page across spaces: offline Arc (fake home, see "One space") with this Mac's two spaces and an+ unpacked probe (`--load-extension` + `--disable-features=DisableLoadExtensionCommandLineSwitch`) whose service+ worker calls `chrome.runtime.openOptionsPage()` when a tab opens `…#cra-opts`, driven by Arc's AppleScript (`tell+ space "…" to focus`, `make new tab`). The options page opened in space 1. Asked again from space 2, Arc went back+ to space 1 and selected that tab, with no second options tab. Arc has no options-page code of its own+ (`runtime.openOptionsPage` → Chromium's `ShowSingletonTabOverwritingNTP`). Cra keeps that, per profile: another+ profile's copy of the page is never reused (`ExtensionPagePlacement`).+- [O] Two extensions setting the proxy: Chromium applies the latest `last_update_time` among the enabled ones+ (ExtensionPrefValueMap::GetEffectivePrefValueController; on a tie, the later ID). The other gets+ `levelOfControl: "controlled_by_other_extensions"`, which CEF reports correctly (checked with two probes).+ `--load-extension` folders are reinstalled on every launch, but the winner stayed the same over three launches.+ `ForceWebRequestProxyForTest` makes `MayHaveProxies()` always true, so a proxy extension enabled later does not+ reset the URL loader factories. Cra logs the winner and the overridden ones per profile when they change, and+ Export Diagnostics' summary.txt has a "Proxy:" section.