Skip to content

Commit db1b417

Browse files
committed
Bidi Page Popup event
1 parent f05e8e3 commit db1b417

File tree

2 files changed

+11
-29
lines changed

2 files changed

+11
-29
lines changed

lib/PuppeteerSharp.Nunit/TestExpectations/TestExpectations.local.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,21 +1020,6 @@
10201020
"FAIL"
10211021
]
10221022
},
1023-
{
1024-
"comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one",
1025-
"testIdPattern": "[page.spec] *Page.Events.Popup*",
1026-
"platforms": [
1027-
"darwin",
1028-
"linux",
1029-
"win32"
1030-
],
1031-
"parameters": [
1032-
"webDriverBiDi"
1033-
],
1034-
"expectations": [
1035-
"FAIL"
1036-
]
1037-
},
10381023
{
10391024
"comment": "This is part of organizing the webdriver bidi implementation, We will remove it one by one",
10401025
"testIdPattern": "[page.spec] *Page.removeExposedFunction*",

lib/PuppeteerSharp/Bidi/BidiBrowserContext.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,26 +122,23 @@ private void Initialize()
122122

123123
// We need to wait for the DOMContentLoaded as the
124124
// browsingContext still may be navigating from the about:blank
125-
browsingContext.DomContentLoaded += (o, eventArgs) =>
125+
if (browsingContext.OriginalOpener == null)
126126
{
127-
if (browsingContext.OriginalOpener == null)
127+
return;
128+
}
129+
130+
foreach (var context in UserContext.BrowsingContexts)
131+
{
132+
if (context.Id != browsingContext.OriginalOpener)
128133
{
129-
return;
134+
continue;
130135
}
131136

132-
foreach (var context in UserContext.BrowsingContexts)
137+
if (_pages.TryGetValue(context, out var originalOpenerPage))
133138
{
134-
if (context.Id != browsingContext.OriginalOpener)
135-
{
136-
continue;
137-
}
138-
139-
if (_pages.TryGetValue(context, out var originalOpenerPage))
140-
{
141-
originalOpenerPage.OnPopup(page);
142-
}
139+
originalOpenerPage.OnPopup(page);
143140
}
144-
};
141+
}
145142
};
146143
}
147144

0 commit comments

Comments
 (0)