Skip to content

Commit 8f26e8d

Browse files
feat: add support for originalOpener in BrowsingContext.Info
1 parent f0be113 commit 8f26e8d

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/bidiMapper/modules/cdp/CdpTarget.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ export class CdpTarget {
213213
this.#browsingContextStorage,
214214
this.#realmStorage,
215215
frame.url,
216+
undefined,
216217
this.#logger
217218
);
218219
}

src/bidiMapper/modules/cdp/CdpTargetManager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export class CdpTargetManager {
129129
// At this point, we don't know the URL of the frame yet, so it will be updated
130130
// later.
131131
'about:blank',
132+
undefined,
132133
this.#logger
133134
);
134135
}
@@ -187,6 +188,7 @@ export class CdpTargetManager {
187188
// https://html.spec.whatwg.org/multipage/document-sequences.html#creating-browsing-contexts
188189
// TODO: check who to deal with non-null creator and its `creatorOrigin`.
189190
targetInfo.url === '' ? 'about:blank' : targetInfo.url,
191+
targetInfo.openerId,
190192
this.#logger
191193
);
192194
}

src/bidiMapper/modules/context/BrowsingContextImpl.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ export class BrowsingContextImpl {
7979
// Keeps track of the previously set viewport.
8080
#previousViewport: {width: number; height: number} = {width: 0, height: 0};
8181

82+
#originalOpener?: string;
83+
8284
private constructor(
8385
id: BrowsingContext.BrowsingContext,
8486
parentId: BrowsingContext.BrowsingContext | null,
@@ -88,6 +90,7 @@ export class BrowsingContextImpl {
8890
browsingContextStorage: BrowsingContextStorage,
8991
realmStorage: RealmStorage,
9092
url: string,
93+
originalOpener?: string,
9194
logger?: LoggerFn
9295
) {
9396
this.#cdpTarget = cdpTarget;
@@ -99,6 +102,8 @@ export class BrowsingContextImpl {
99102
this.#realmStorage = realmStorage;
100103
this.#logger = logger;
101104
this.#url = url;
105+
106+
this.#originalOpener = originalOpener;
102107
}
103108

104109
static create(
@@ -110,6 +115,7 @@ export class BrowsingContextImpl {
110115
browsingContextStorage: BrowsingContextStorage,
111116
realmStorage: RealmStorage,
112117
url: string,
118+
originalOpener?: string,
113119
logger?: LoggerFn
114120
): BrowsingContextImpl {
115121
const context = new BrowsingContextImpl(
@@ -121,6 +127,7 @@ export class BrowsingContextImpl {
121127
browsingContextStorage,
122128
realmStorage,
123129
url,
130+
originalOpener,
124131
logger
125132
);
126133

@@ -305,6 +312,7 @@ export class BrowsingContextImpl {
305312
context: this.#id,
306313
url: this.url,
307314
userContext: this.userContext,
315+
originalOpener: this.#originalOpener ?? null,
308316
children:
309317
maxDepth > 0
310318
? this.directChildren.map((c) =>

0 commit comments

Comments
 (0)