Skip to content

Commit 77c61ce

Browse files
authored
Remove deprecated isOOPFrame (#2739)
1 parent 73f4de2 commit 77c61ce

File tree

6 files changed

+14
-95
lines changed

6 files changed

+14
-95
lines changed

lib/PuppeteerSharp.Nunit/TestExpectations/TestExpectations.upstream.json

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,62 +2971,6 @@
29712971
"expectations": ["FAIL"],
29722972
"comment": "https://bugzilla.mozilla.org/show_bug.cgi?id=187816"
29732973
},
2974-
{
2975-
"testIdPattern": "[oopif.spec] OOPIF should support OOP iframes becoming normal iframes again",
2976-
"platforms": ["darwin", "linux", "win32"],
2977-
"parameters": ["chrome", "webDriverBiDi"],
2978-
"expectations": ["FAIL"],
2979-
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
2980-
},
2981-
{
2982-
"testIdPattern": "[oopif.spec] OOPIF should support OOP iframes becoming normal iframes again",
2983-
"platforms": ["darwin", "linux", "win32"],
2984-
"parameters": ["firefox", "webDriverBiDi"],
2985-
"expectations": ["FAIL"],
2986-
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
2987-
},
2988-
{
2989-
"testIdPattern": "[oopif.spec] OOPIF should support OOP iframes getting detached",
2990-
"platforms": ["darwin", "linux", "win32"],
2991-
"parameters": ["chrome", "webDriverBiDi"],
2992-
"expectations": ["FAIL"],
2993-
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
2994-
},
2995-
{
2996-
"testIdPattern": "[oopif.spec] OOPIF should support OOP iframes getting detached",
2997-
"platforms": ["darwin", "linux", "win32"],
2998-
"parameters": ["firefox", "webDriverBiDi"],
2999-
"expectations": ["FAIL"],
3000-
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
3001-
},
3002-
{
3003-
"testIdPattern": "[oopif.spec] OOPIF should support wait for navigation for transitions from local to OOPIF",
3004-
"platforms": ["darwin", "linux", "win32"],
3005-
"parameters": ["chrome", "webDriverBiDi"],
3006-
"expectations": ["FAIL"],
3007-
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
3008-
},
3009-
{
3010-
"testIdPattern": "[oopif.spec] OOPIF should support wait for navigation for transitions from local to OOPIF",
3011-
"platforms": ["darwin", "linux", "win32"],
3012-
"parameters": ["cdp", "chrome"],
3013-
"expectations": ["SKIP"],
3014-
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
3015-
},
3016-
{
3017-
"testIdPattern": "[oopif.spec] OOPIF should support wait for navigation for transitions from local to OOPIF",
3018-
"platforms": ["darwin", "linux", "win32"],
3019-
"parameters": ["firefox", "webDriverBiDi"],
3020-
"expectations": ["FAIL"],
3021-
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
3022-
},
3023-
{
3024-
"testIdPattern": "[oopif.spec] OOPIF should wait for inner OOPIFs",
3025-
"platforms": ["darwin", "linux", "win32"],
3026-
"parameters": ["chrome", "webDriverBiDi"],
3027-
"expectations": ["FAIL"],
3028-
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
3029-
},
30302974
{
30312975
"testIdPattern": "[oopif.spec] OOPIF should wait for inner OOPIFs",
30322976
"platforms": ["darwin", "linux", "win32"],

lib/PuppeteerSharp.Tests/OOPIFTests/OOPIFTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,16 @@ public async Task ShouldSupportOopIframesBecomingNormalIframesAgain()
6868
var frameTask = Page.WaitForFrameAsync((frame) => frame != Page.MainFrame);
6969
await FrameUtils.AttachFrameAsync(Page, "frame1", TestConstants.EmptyPage).WithTimeout();
7070
var frame = await frameTask.WithTimeout();
71-
Assert.That(frame.IsOopFrame, Is.False);
7271
var nav = frame.WaitForNavigationAsync();
7372
await FrameUtils.NavigateFrameAsync(
7473
Page,
7574
"frame1",
7675
TestConstants.CrossProcessHttpPrefix + "/empty.html"
7776
).WithTimeout();
78-
Assert.That(frame.IsOopFrame, Is.True);
7977
await nav.WithTimeout();
8078
nav = frame.WaitForNavigationAsync();
8179
await FrameUtils.NavigateFrameAsync(Page, "frame1", TestConstants.EmptyPage).WithTimeout();
8280
await nav.WithTimeout();
83-
Assert.That(frame.IsOopFrame, Is.False);
8481
Assert.That(Page.Frames, Has.Length.EqualTo(2));
8582
}
8683

@@ -139,13 +136,11 @@ public async Task ShouldSupportOopIframesGettingDetached()
139136
var frameTask = Page.WaitForFrameAsync((frame) => frame != Page.MainFrame);
140137
await FrameUtils.AttachFrameAsync(Page, "frame1", TestConstants.EmptyPage).WithTimeout();
141138
var frame = await frameTask.WithTimeout();
142-
Assert.That(frame.IsOopFrame, Is.False);
143139
await FrameUtils.NavigateFrameAsync(
144140
Page,
145141
"frame1",
146142
TestConstants.CrossProcessHttpPrefix + "/empty.html"
147143
).WithTimeout();
148-
Assert.That(frame.IsOopFrame, Is.True);
149144
var detachedTcs = new TaskCompletionSource<bool>();
150145
Page.FrameDetached += (sender, e) => detachedTcs.TrySetResult(true);
151146
await FrameUtils.DetachFrameAsync(Page, "frame1").WithTimeout();
@@ -160,15 +155,13 @@ public async Task ShouldSupportWaitForNavigationForTransitionsFromLocalToOopif()
160155
var frameTask = Page.WaitForFrameAsync((frame) => frame != Page.MainFrame);
161156
await FrameUtils.AttachFrameAsync(Page, "frame1", TestConstants.EmptyPage).WithTimeout();
162157
var frame = await frameTask.WithTimeout();
163-
Assert.That(frame.IsOopFrame, Is.False);
164158
var nav = frame.WaitForNavigationAsync();
165159
await FrameUtils.NavigateFrameAsync(
166160
Page,
167161
"frame1",
168162
TestConstants.CrossProcessHttpPrefix + "/empty.html"
169163
).WithTimeout();
170164
await nav.WithTimeout();
171-
Assert.That(frame.IsOopFrame, Is.True);
172165
var detachedTcs = new TaskCompletionSource<bool>();
173166
Page.FrameDetached += (sender, e) => detachedTcs.TrySetResult(true);
174167
await FrameUtils.DetachFrameAsync(Page, "frame1").WithTimeout();
@@ -271,7 +264,6 @@ public async Task ShouldWaitForInnerOopifs()
271264
await Page.GoToAsync($"http://mainframe:{TestConstants.Port}/main-frame.html");
272265
var frame = await frameTask.WithTimeout();
273266
Assert.That((await GetIframesAsync()), Has.Length.EqualTo(2));
274-
Assert.That(Page.Frames.Count(frameElement => frameElement.IsOopFrame), Is.EqualTo(2));
275267
Assert.That(await frame.EvaluateFunctionAsync<int>("() => document.querySelectorAll('button').length"), Is.EqualTo(1));
276268
}
277269

lib/PuppeteerSharp/Cdp/CdpFrame.cs

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ internal CdpFrame(FrameManager frameManager, string frameId, string parentFrameI
5959
/// <inheritdoc/>
6060
public override IPage Page => FrameManager.Page;
6161

62-
/// <inheritdoc/>
63-
public override bool IsOopFrame => Client != FrameManager.Client;
64-
6562
/// <inheritdoc/>
6663
public override IReadOnlyCollection<IFrame> ChildFrames => FrameManager.FrameTree.GetChildFrames(Id);
6764

@@ -98,8 +95,9 @@ public override async Task<IResponse> GoToAsync(string url, NavigationOptions op
9895
await task.ConfigureAwait(false);
9996

10097
task = await Task.WhenAny(
101-
watcher.TerminationTask,
102-
ensureNewDocumentNavigation ? watcher.NewDocumentNavigationTask : watcher.SameDocumentNavigationTask).ConfigureAwait(false);
98+
watcher.TerminationTask,
99+
ensureNewDocumentNavigation ? watcher.NewDocumentNavigationTask : watcher.SameDocumentNavigationTask)
100+
.ConfigureAwait(false);
103101

104102
await task.ConfigureAwait(false);
105103
}
@@ -122,7 +120,8 @@ async Task NavigateAsync()
122120

123121
ensureNewDocumentNavigation = !string.IsNullOrEmpty(response.LoaderId);
124122

125-
if (!string.IsNullOrEmpty(response.ErrorText) && response.ErrorText != "net::ERR_HTTP_RESPONSE_CODE_FAILURE")
123+
if (!string.IsNullOrEmpty(response.ErrorText) &&
124+
response.ErrorText != "net::ERR_HTTP_RESPONSE_CODE_FAILURE")
126125
{
127126
throw new NavigationException(response.ErrorText, url);
128127
}
@@ -137,7 +136,9 @@ public override async Task<IResponse> WaitForNavigationAsync(NavigationOptions o
137136
var raceTask = await Task.WhenAny(
138137
[
139138
watcher.NewDocumentNavigationTask,
140-
.. options?.IgnoreSameDocumentNavigation == true ? Array.Empty<Task>() : [watcher.SameDocumentNavigationTask],
139+
.. options?.IgnoreSameDocumentNavigation == true
140+
? Array.Empty<Task>()
141+
: [watcher.SameDocumentNavigationTask],
141142
watcher.TerminationTask,
142143
]).ConfigureAwait(false);
143144

@@ -178,7 +179,8 @@ public override async Task<IElementHandle> AddStyleTagAsync(AddTagOptions option
178179
throw new ArgumentNullException(nameof(options));
179180
}
180181

181-
if (string.IsNullOrEmpty(options.Url) && string.IsNullOrEmpty(options.Path) && string.IsNullOrEmpty(options.Content))
182+
if (string.IsNullOrEmpty(options.Url) && string.IsNullOrEmpty(options.Path) &&
183+
string.IsNullOrEmpty(options.Content))
182184
{
183185
throw new ArgumentException("Provide options with a `Url`, `Path` or `Content` property");
184186
}
@@ -244,7 +246,8 @@ public override async Task<IElementHandle> AddScriptTagAsync(AddTagOptions optio
244246
throw new ArgumentNullException(nameof(options));
245247
}
246248

247-
if (string.IsNullOrEmpty(options.Url) && string.IsNullOrEmpty(options.Path) && string.IsNullOrEmpty(options.Content))
249+
if (string.IsNullOrEmpty(options.Url) && string.IsNullOrEmpty(options.Path) &&
250+
string.IsNullOrEmpty(options.Content))
248251
{
249252
throw new ArgumentException("Provide options with a `Url`, `Path` or `Content` property");
250253
}
@@ -331,17 +334,5 @@ internal void UpdateClient(CDPSession client, bool keepWorlds = false)
331334

332335
/// <inheritdoc />
333336
protected internal override DeviceRequestPromptManager GetDeviceRequestPromptManager()
334-
{
335-
if (IsOopFrame)
336-
{
337-
return FrameManager.GetDeviceRequestPromptManager(Client);
338-
}
339-
340-
if (ParentFrame == null)
341-
{
342-
throw new PuppeteerException("Unable to find parent frame");
343-
}
344-
345-
return ParentFrame.GetDeviceRequestPromptManager();
346-
}
337+
=> FrameManager.GetDeviceRequestPromptManager(Client);
347338
}

lib/PuppeteerSharp/Cdp/FrameManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ private void OnFrameAttached(CDPSession session, string frameId, string parentFr
443443
var frame = GetFrame(frameId);
444444
if (frame != null)
445445
{
446-
if (session != null && frame.IsOopFrame)
446+
if (session != null && frame.Client != Client)
447447
{
448448
frame.UpdateClient(session);
449449
}

lib/PuppeteerSharp/Frame.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ public abstract class Frame : IFrame, IEnvironment
4343
/// <inheritdoc/>
4444
IFrame IFrame.ParentFrame => ParentFrame;
4545

46-
/// <inheritdoc/>
47-
public abstract bool IsOopFrame { get; }
48-
4946
/// <inheritdoc/>
5047
public string Id { get; internal set; }
5148

lib/PuppeteerSharp/IFrame.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ public interface IFrame
7575
/// </summary>
7676
IFrame ParentFrame { get; }
7777

78-
/// <summary>
79-
/// `true` if the frame is an OOP frame, or `false` otherwise.
80-
/// </summary>
81-
bool IsOopFrame { get; }
82-
8378
/// <summary>
8479
/// Gets the frame's url.
8580
/// </summary>

0 commit comments

Comments
 (0)