Skip to content

Commit 47a20f7

Browse files
authored
Roll Chromium to r662092 (#1143)
1 parent 39a02e6 commit 47a20f7

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

lib/PuppeteerSharp.Tests/PageTests/EvaluateTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ public async Task ShouldEvaluateInThePageContext()
7575
public async Task ShouldReturnUndefinedForObjectsWithSymbols()
7676
=> Assert.Null(await Page.EvaluateFunctionAsync<object>("() => [Symbol('foo4')]"));
7777

78+
[Fact]
79+
public async Task ShouldWorkWithUnicodeChars()
80+
=> Assert.Equal(42, await Page.EvaluateFunctionAsync<int>("a => a['中文字符']", new Dictionary<string, int> { ["中文字符"] = 42 }));
81+
7882
[Fact]
7983
public async Task ShouldThrowWhenEvaluationTriggersReload()
8084
{

lib/PuppeteerSharp.Tests/PageTests/SetContentTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,26 @@ public async Task ShouldWorkWithTrickyContent()
107107
await Page.SetContentAsync("<div>hello world</div>\x7F");
108108
Assert.Equal("hello world", await Page.QuerySelectorAsync("div").EvaluateFunctionAsync<string>("div => div.textContent"));
109109
}
110+
111+
[Fact]
112+
public async Task ShouldWorkWithAccents()
113+
{
114+
await Page.SetContentAsync("<div>aberración</div>");
115+
Assert.Equal("aberración", await Page.QuerySelectorAsync("div").EvaluateFunctionAsync<string>("div => div.textContent"));
116+
}
117+
118+
[Fact]
119+
public async Task ShouldWorkWithEmojis()
120+
{
121+
await Page.SetContentAsync("<div>🐥</div>");
122+
Assert.Equal("🐥", await Page.QuerySelectorAsync("div").EvaluateFunctionAsync<string>("div => div.textContent"));
123+
}
124+
125+
[Fact]
126+
public async Task ShouldWorkWithNewline()
127+
{
128+
await Page.SetContentAsync("<div>\n</div>");
129+
Assert.Equal("\n", await Page.QuerySelectorAsync("div").EvaluateFunctionAsync<string>("div => div.textContent"));
130+
}
110131
}
111132
}

lib/PuppeteerSharp/BrowserFetcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class BrowserFetcher
3737
/// <summary>
3838
/// Default Chromium revision.
3939
/// </summary>
40-
public const int DefaultRevision = 656675;
40+
public const int DefaultRevision = 662092;
4141

4242
/// <summary>
4343
/// Gets the downloads folder.

lib/PuppeteerSharp/DOMWorld.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ internal async Task SetContentAsync(string html, NavigationOptions options = nul
139139

140140
// We rely upon the fact that document.open() will reset frame lifecycle with "init"
141141
// lifecycle event. @see https://crrev.com/608658
142-
await EvaluateFunctionAsync(@"base64html => {
142+
await EvaluateFunctionAsync(@"html => {
143143
document.open();
144-
document.write(atob(base64html));
144+
document.write(html);
145145
document.close();
146-
}", Convert.ToBase64String(Encoding.UTF8.GetBytes(html))).ConfigureAwait(false);
146+
}", html).ConfigureAwait(false);
147147

148148
var watcher = new LifecycleWatcher(_frameManager, Frame, waitUntil, timeout);
149149
var watcherTask = await Task.WhenAny(

0 commit comments

Comments
 (0)