Skip to content

Commit

Permalink
Merge pull request #65 from AngleSharp/devel
Browse files Browse the repository at this point in the history
Release 0.14.0
  • Loading branch information
FlorianRappl authored Apr 1, 2020
2 parents 25b30c3 + 61fb713 commit 801aa30
Show file tree
Hide file tree
Showing 19 changed files with 171 additions and 82 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.14.0

Released on Tuesday, March 31 2020.

- Fixed deadlock with some versions of jQuery (#63)
- Enabled the instance creator factory (#11)
- Return `IDocument` from `WaitUntilAvailable()` (#61)

# 0.13.0

Released on Friday, September 6 2019.
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ AngleSharp.Js contains code written by (in order of first pull request / commit)
* [Florian Rappl](https://github.com/FlorianRappl)
* [Georgios Diamantopoulos](https://github.com/georgiosd)
* [miroslav22](https://github.com/miroslav22)
* [doominator42](https://github.com/doominator42)

Without these awesome people AngleSharp.Js could not exist. Thanks to everyone for your contributions! :beers:

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013 - 2019 AngleSharp
Copyright (c) 2013 - 2020 AngleSharp

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ This project is supported by the [.NET Foundation](https://dotnetfoundation.org)

The MIT License (MIT)

Copyright (c) 2015 - 2019 AngleSharp
Copyright (c) 2015 - 2020 AngleSharp

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
2 changes: 2 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ var solutionName = "AngleSharp.Js";
var frameworks = new Dictionary<String, String>
{
{ "net46", "net46" },
{ "net461", "net461" },
{ "net472", "net472" },
{ "netstandard1.3", "netstandard1.3" },
{ "netstandard2.0", "netstandard2.0" },
};
Expand Down
13 changes: 8 additions & 5 deletions src/AngleSharp.Js.Tests/AngleSharp.Js.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AngleSharp.Css" Version="0.13.0" />
<PackageReference Include="AngleSharp.Xml" Version="0.13.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="AngleSharp.Css" Version="0.14.0-alpha-139" />
<PackageReference Include="AngleSharp.Xml" Version="0.14.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/AngleSharp.Js.Tests/ComponentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ComponentTests
private static async Task<String> RunScriptComponent(String script)
{
var service = new JsScriptingService();
var cfg = Configuration.Default.WithXml().With(service);
var cfg = Configuration.Default.WithXml().WithEventLoop().With(service);
var html = String.Concat("<!doctype html><script>", script, "</script>");
var document = await BrowsingContext.New(cfg).OpenAsync(m => m.Content(html));
var value = service.GetOrCreateJint(document).GetValue("assert");
Expand Down
26 changes: 13 additions & 13 deletions src/AngleSharp.Js.Tests/FireEventTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class FireEventTests
public async Task InvokeFunctionOnLoadEventShouldFireDelayed()
{
var service = new JsScriptingService();
var cfg = Configuration.Default.With(service);
var cfg = Configuration.Default.With(service).WithEventLoop();
var html = "<!doctype html><div id=result></div><script>document.addEventListener('load', function () { document.querySelector('#result').textContent = 'done'; }, false);</script>";
var document = await BrowsingContext.New(cfg).OpenAsync(m => m.Content(html))
.WhenStable();
Expand All @@ -25,7 +25,7 @@ public async Task InvokeFunctionOnLoadEventShouldFireDelayed()
public async Task InvokeFunctionOnCustomEvent()
{
var service = new JsScriptingService();
var cfg = Configuration.Default.With(service);
var cfg = Configuration.Default.With(service).WithEventLoop();
var html = "<!doctype html><div id=result>0</div><script>var i = 0; document.addEventListener('hello', function () { i++; document.querySelector('#result').textContent = i.toString(); }, false);</script>";
var document = await BrowsingContext.New(cfg).OpenAsync(m => m.Content(html));
var div = document.QuerySelector("#result");
Expand All @@ -39,7 +39,7 @@ public async Task InvokeFunctionOnCustomEvent()
public async Task InvokeLoadEventFromJsAndCustomEventFromJsAndCs()
{
var service = new JsScriptingService();
var cfg = Configuration.Default.With(service);
var cfg = Configuration.Default.With(service).WithEventLoop();
var html = @"<!doctype html>
<html>
<body>
Expand Down Expand Up @@ -73,7 +73,7 @@ public async Task InvokeLoadEventFromJsAndCustomEventFromJsAndCs()
public async Task AddClickHandlerClassicallyWillExecute()
{
var service = new JsScriptingService();
var cfg = Configuration.Default.With(service);
var cfg = Configuration.Default.With(service).WithEventLoop();
var html = @"<!doctype html>
<html>
<body>
Expand All @@ -94,7 +94,7 @@ public async Task AddClickHandlerClassicallyWillExecute()
public async Task AddAndRemoveClickHandlerWontExecute()
{
var service = new JsScriptingService();
var cfg = Configuration.Default.With(service);
var cfg = Configuration.Default.With(service).WithEventLoop();
var html = @"<!doctype html>
<html>
<body>
Expand All @@ -116,7 +116,7 @@ public async Task AddAndRemoveClickHandlerWontExecute()
public async Task AddAndInvokeClickHandlerWillChangeCapturedValue()
{
var service = new JsScriptingService();
var cfg = Configuration.Default.With(service);
var cfg = Configuration.Default.With(service).WithEventLoop();
var html = @"<!doctype html>
<html>
<body>
Expand All @@ -137,7 +137,7 @@ public async Task AddAndInvokeClickHandlerWillChangeCapturedValue()
public async Task AddAndInvokeClickHandlerWithStringFunctionWontWork()
{
var service = new JsScriptingService();
var cfg = Configuration.Default.With(service);
var cfg = Configuration.Default.With(service).WithEventLoop();
var html = @"<!doctype html>
<html>
<body>
Expand All @@ -155,7 +155,7 @@ public async Task AddAndInvokeClickHandlerWithStringFunctionWontWork()
[Test]
public async Task BodyOnloadWorksWhenSetAsAttributeInitially()
{
var cfg = Configuration.Default.WithJs();
var cfg = Configuration.Default.WithJs().WithEventLoop();
var html = @"<!doctype html>
<html>
<body onload='window.foo = 2+3'>
Expand All @@ -173,7 +173,7 @@ public async Task BodyOnloadWorksWhenSetAsAttributeInitially()
[Test]
public async Task BodyOnloadWorksWhenSetAsAttributeLater()
{
var cfg = Configuration.Default.WithJs();
var cfg = Configuration.Default.WithJs().WithEventLoop();
var html = @"<!doctype html>
<html>
<body>
Expand All @@ -192,7 +192,7 @@ public async Task BodyOnloadWorksWhenSetAsAttributeLater()
public async Task SetTimeoutWithNormalFunction()
{
var service = new JsScriptingService();
var cfg = Configuration.Default.With(service);
var cfg = Configuration.Default.With(service).WithEventLoop();
var html = @"<!doctype html>
<html>
<body>
Expand All @@ -214,7 +214,7 @@ public async Task DomContentLoadedEventIsFired_Issue50()
{
//TODO Check this as well on the window level - currently works
//only against document (se AngleSharp#789)
var cfg = Configuration.Default.WithJs();
var cfg = Configuration.Default.WithJs().WithEventLoop();
var html = @"<!doctype html>
<html>
<body>
Expand All @@ -236,7 +236,7 @@ public async Task DomContentLoadedEventIsFired_Issue50()
[Test]
public async Task DocumentLoadEventIsFired_Issue42()
{
var cfg = Configuration.Default.WithJs();
var cfg = Configuration.Default.WithJs().WithEventLoop();
var html = @"<!doctype html>
<html>
<body>
Expand All @@ -260,7 +260,7 @@ public async Task DocumentLoadEventIsFired_Issue42()
public async Task SetTimeoutWithStringAsFunction()
{
var service = new JsScriptingService();
var cfg = Configuration.Default.With(service);
var cfg = Configuration.Default.With(service).WithEventLoop();
var html = @"<!doctype html>
<html>
<body>
Expand Down
3 changes: 2 additions & 1 deletion src/AngleSharp.Js.Tests/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static class Helpers
public static async Task<String> EvalScriptAsync(this String source)
{
var console = new ConsoleLogger();
var cfg = Configuration.Default.WithJs().WithConsoleLogger(context => console);
var cfg = Configuration.Default.WithJs().WithEventLoop().WithConsoleLogger(context => console);
var html = $"<!doctype html><script>console.log({source})</script>";
await BrowsingContext.New(cfg).OpenAsync(m => m.Content(html));
return console.Content.ToString().Trim();
Expand All @@ -23,6 +23,7 @@ public static async Task<String> EvalScriptAsync(this String source)
internal static IConfiguration GetCssConfig() =>
Configuration.Default
.WithJs()
.WithEventLoop()
.WithCss()
.WithRenderDevice();

Expand Down
6 changes: 4 additions & 2 deletions src/AngleSharp.Js.Tests/JavascriptErrorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public class JavascriptErrorTests
public async Task JavascriptErrorInListenerShouldNotThrowJavascriptException()
{
var config = Configuration.Default
.WithJs();
.WithJs()
.WithEventLoop();

var context = BrowsingContext.New(config);

Expand Down Expand Up @@ -50,7 +51,8 @@ public async Task CanComputeAndHoistLocalVariablesInForLoop()
return ret;
})('abc').length";
var config = Configuration.Default
.WithJs();
.WithJs()
.WithEventLoop();
var document = await BrowsingContext.New(config).OpenNewAsync();
var result = document.ExecuteScript(source);
Assert.AreEqual(0.0, result);
Expand Down
2 changes: 1 addition & 1 deletion src/AngleSharp.Js.Tests/JqueryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public async Task JqueryWithAjaxToDelayedResponse()
{
var message = "Hi!";
var req = new DelayedRequester(10, message);
var cfg = Configuration.Default.WithJs().With(req).WithDefaultLoader();
var cfg = Configuration.Default.WithJs().WithEventLoop().With(req).WithDefaultLoader();
var sources = new [] { Constants.Jquery2_1_4, @"
$.ajax('http://example.com/', {
success: function (data, status, xhr) {
Expand Down
15 changes: 8 additions & 7 deletions src/AngleSharp.Js.Tests/ScriptEvalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ScriptEvalTests
{
public static async Task<String> EvaluateComplexScriptAsync(params String[] sources)
{
var cfg = Configuration.Default.WithJs();
var cfg = Configuration.Default.WithJs().WithEventLoop();
var scripts = "<script>" + String.Join("</script><script>", sources) + "</script>";
var html = "<!doctype html><div id=result></div>" + scripts;
var document = await BrowsingContext.New(cfg).OpenAsync(m => m.Content(html));
Expand Down Expand Up @@ -79,7 +79,7 @@ public async Task CreateXmlHttpRequestShouldWork()
public async Task PerformXmlHttpRequestSynchronousToDataUrlShouldWork()
{
var req = new DataRequester();
var cfg = Configuration.Default.With(req).WithJs().WithDefaultLoader();
var cfg = Configuration.Default.With(req).WithJs().WithEventLoop().WithDefaultLoader();
var script = "var xhr = new XMLHttpRequest(); xhr.open('GET', 'data:plain/text,Hello World!', false);xhr.send();document.querySelector('#result').textContent = xhr.responseText;";
var html = "<!doctype html><div id=result></div><script>" + script + "</script>";
var document = await BrowsingContext.New(cfg).OpenAsync(m => m.Content(html));
Expand All @@ -92,7 +92,7 @@ public async Task PerformXmlHttpRequestSynchronousToDelayedResponseShouldWork()
{
var message = "Hi!";
var req = new DelayedRequester(10, message);
var cfg = Configuration.Default.WithJs().With(req).WithDefaultLoader();
var cfg = Configuration.Default.WithJs().WithEventLoop().With(req).WithDefaultLoader();
var script = @"
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://example.com/', false);
Expand All @@ -109,7 +109,7 @@ public async Task PerformXmlHttpRequestAsynchronousToDelayedResponseShouldWork()
{
var message = "Hi!";
var req = new DelayedRequester(10, message);
var cfg = Configuration.Default.WithJs().With(req).WithDefaultLoader();
var cfg = Configuration.Default.WithJs().WithEventLoop().With(req).WithDefaultLoader();
var script = @"
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://example.com/');
Expand All @@ -131,9 +131,10 @@ public async Task PerformXmlHttpRequestAsynchronousToDelayedResponseShouldWork()
[Test]
public async Task SetContentOfIFrameElement()
{
var cfg = Configuration.Default.
WithDefaultLoader(new LoaderOptions { IsResourceLoadingEnabled = true }).
WithJs();
var cfg = Configuration.Default
.WithDefaultLoader(new LoaderOptions { IsResourceLoadingEnabled = true })
.WithJs()
.WithEventLoop();
var html = @"<!doctype html><iframe id=myframe srcdoc=''></iframe><script>
var iframe = document.querySelector('#myframe');
var doc = iframe.contentWindow.document;
Expand Down
18 changes: 13 additions & 5 deletions src/AngleSharp.Js.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,28 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Integrates a JavaScript engine to AngleSharp.</description>
<releaseNotes>https://github.com/AngleSharp/AngleSharp.Js/blob/master/CHANGELOG.md</releaseNotes>
<copyright>Copyright 2017-2019, AngleSharp</copyright>
<copyright>Copyright 2017-2020, AngleSharp</copyright>
<tags>html html5 css css3 dom javascript scripting library js scripts runtime jint anglesharp angle</tags>
<dependencies>
<group targetFramework="netstandard1.3">
<dependency id="AngleSharp" version="0.13.0" />
<dependency id="AngleSharp" version="0.14.0" />
<dependency id="Jint" version="2.10.4" />
<dependency id="System.Threading.Thread" version="4.0.0" />
<dependency id="System.Threading.Thread" version="4.3.0" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="AngleSharp" version="0.13.0" />
<dependency id="AngleSharp" version="0.14.0" />
<dependency id="Jint" version="2.10.4" />
</group>
<group targetFramework="net46">
<dependency id="AngleSharp" version="0.13.0" />
<dependency id="AngleSharp" version="0.14.0" />
<dependency id="Jint" version="2.10.4" />
</group>
<group targetFramework="net461">
<dependency id="AngleSharp" version="0.14.0" />
<dependency id="Jint" version="2.10.4" />
</group>
<group targetFramework="net472">
<dependency id="AngleSharp" version="0.14.0" />
<dependency id="Jint" version="2.10.4" />
</group>
</dependencies>
Expand Down
16 changes: 13 additions & 3 deletions src/AngleSharp.Js/AngleSharp.Js.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,30 @@
<AssemblyName>AngleSharp.Js</AssemblyName>
<RootNamespace>AngleSharp.Js</RootNamespace>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.3;netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">netstandard1.3;netstandard2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">netstandard1.3;netstandard2.0;net46;net461;net472</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>7.1</LangVersion>
<RepositoryUrl>https://github.com/AngleSharp/AngleSharp.Js</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AngleSharp" Version="0.13.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AngleSharp" Version="0.14.0" />
<PackageReference Include="Jint" Version="2.10.4" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="System.Threading.Thread" Version="4.0.0" />
<PackageReference Include="System.Threading.Thread" Version="4.3.0" />
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
Expand Down
Loading

0 comments on commit 801aa30

Please sign in to comment.