Commit Graph

309 Commits

Author SHA1 Message Date
Steve Sanderson 1089eecbfc In RenderBatchWriter, deduplicate strings only when safe to do so (#1340)
We allow deduplication of HTML element and attribute names, plus whitespace text nodes / attribute values.
2018-08-22 14:52:35 +01:00
Nate McMaster 3a2606a636 Strong name Blazor assemblies (#1344) 2018-08-21 15:37:05 -07:00
Steve Sanderson 52813ddf63 Eliminate temporary MemoryStream buffers used during RenderBatch serialization (#1329)
* Eliminate temporary MemoryStream buffers used during RenderBatch serialization. Fixes #1132

* CR: Fix namespace
2018-08-21 14:08:39 +01:00
Daniel Roth 7a763fc4f6 Scan only declared methods for JS interop (#1320)
* Scan only declared methods for JS interop

* Add DotNetDispatcher test for JS invokable method on base class
2018-08-17 12:35:24 +01:00
Steve Sanderson d3bc28de55 E2E benchmarks (#1307) 2018-08-14 13:21:19 +01:00
Ryan Nowak fd5426943f Merge sibling nodes during markup block rewrite
This change adds the ability to merge sibling nodes when possible during
markup block rewriting. We retain that invariant that each markup block
is a valid chunk of markup containing properly nested tags.

We still haven't done any work to remove whitespace yet, so most of the
cases where this comes into play right now will merge an element with
its surrounding whitespace.
2018-08-13 11:17:11 -07:00
Ryan Nowak a05cb42845 Reenable markup blocks (#1286)
* Reenable HtmlBlock unit tests

* Add E2E tests for HTML Block cases

* Remove harded GenerateBaselines=true

* Fix #1193

This commit addresses the root cause of #1193. When we merge HTML
text nodes into HTML blocks we need to re-encode any HTML entities that
were encoded eariler.

I did a bit of a deep dive on how HTML encoding is handled in Blazor and
I think this is the best strategy. I think it's valuable that the
BrowserRenderer uses document.createTextNode, which will always encode
the text - this handles dynamic content. We want to keep this in place
to avoid HTML injection attacks.

* Fix #1265 Reenable MarkupBlock

* test cleanup
2018-08-10 16:29:39 -07:00
Steve Sanderson 70a4bf7521 E2E test async robustness tweaks following recent failures 2018-08-09 10:27:40 +01:00
Nate McMaster 78045b2177 Automate authenticode code-signing using Roslyn sign tool
* Change project layout to prepare for upcoming Arcade changes
* Add signtool config file to configure OPC, NuGet, and Authenticode signing
* Fix a bug when BaseIntermediateOutputPath is set to an absolute path
2018-08-08 08:52:46 -07:00
Nate McMaster 22a3fbf861 Use $(TargetDir) instead of $(ProjectDir)$(OutputPath) 2018-08-06 16:48:36 -07:00
Steve Sanderson 16d005e00c Fix returning arrays in async JS interop calls. Fixes #1205 2018-07-27 10:11:45 -07:00
Steve Sanderson 4b861929be Temporarily disable HtmlBlockPass for 0.5.1. Will be re-enabled later. 2018-07-27 10:11:31 -07:00
Steve Sanderson 4e892e74da Fix handling nonvoid elements in markup blocks (#1190)
* Fix empty nonvoid elements in markup blocks. Fixes #1186

* Also update another test
2018-07-25 09:53:52 -07:00
Steve Sanderson 4aaeac1e51 preventDefault for form onsubmit handlers. Fixes #951 2018-07-24 08:11:02 -07:00
Ryan Nowak 8b3f26b962 Fix #1169 ignore DOCTYPE
This change will cause the compiler to ignore <!DOCTYPE ...>
declarations in Blazor components. We don't think there's much useful
Blazor can do with doctype, since we don't generate textual output for
the browser the parse. The sanest thing to do for now is just to skip
over it.
2018-07-23 17:42:47 -07:00
Steve Sanderson d2f74249b1 Fix updating attributes on SVG elements. Fixes #934 and #1114 2018-07-23 16:03:18 -07:00
Ryan Nowak 8f072a0711 Add HTML Block rewriting (#1146)
* Add HTML Block rewriter

* Baseline updates

* test gaps

* Update some unit tests to represent same behavior as before

* Define Markup frame type. Tests for rendering markup frames into render tree.

* Support markup frames during diffing (retain, insert, update, delete)

* Support markup blocks on WebAssembly

* Support rendering markup frames with server-side execution too

* Support markup blocks with multiple top-level nodes. Support updating markup dynamically.

* Define MarkupString type as a way to insert dynamic markup without needing custom RenderFragment code

* Remove comment

* CR: Better null value handling
2018-07-23 18:18:07 +01:00
Steve Sanderson 41fcf65c05 Run E2E tests for server execution as well as WebAssembly. Fixes several
server-execution bugs uncovered by the E2E tests.
2018-07-19 18:57:17 +01:00
Steve Sanderson 154289ed3d Allow passing DotNetObjectRef to JS in interop calls, and invoking
instance methods on it
2018-07-19 18:57:17 +01:00
Ryan Nowak 9778b2054a Add blazor.server.js (#1116)
Adds a server-side flavored blazor script.
2018-07-13 18:01:05 -07:00
Steve Sanderson ad7e98be04 Make index.html static again (#1123)
* Add build command for generating the new boot JSON file

* Remove build command for generating index.html

* Update build targets to generate blazor.boot.json

* Change SPA fallback routing to look for index.html in regular wwwroot. Will need to update setup for published apps later.

* Stop autorebuild when index.html changes, since we no longer 'build' that file

* Update Boot.WebAssembly.ts logic to use boot JSON info on startup

* Restore support for loading CSS/JS from Blazor library projects

* Use new startup script tag in all samples and templates

* Fix MonoSanity sample - it must now be an exe because we use that as the trigger to generate the boot json (not the presence of index.html any more)

* Fix SPA fallback routing for published apps

Because in a previous commit, I changed it to look for index.html inside "wwwroot" instead of "dist" (because we no longer build it). But "wwwroot" doesn't exist for published apps, because static file servers wouldn't understand it.

* CR: Fix path normalization
2018-07-13 09:49:34 +01:00
Steve Sanderson 767a2373c8 Eliminate ElementRef's static incrementing ID for remote rendering cases
... because it's important not to disclose cross-user state, such as the number of IDs that have been assigned. Plus we don't want to run out of unique IDs, which we could if it's limited by the range of an 'int'.
2018-07-10 09:52:19 +01:00
Ryan Nowak ee62bd8d45 Add startup for client/mono Blazor
This change adds a host builder, and the startup pattern for client-side
Blazor apps running in mono/wasm. This will help us align better with
server side Blazor.
2018-07-09 11:13:26 -07:00
Steve Sanderson 5bccac05fc Refactoring to prepare for remote rendering.
- Prepare for building multiple entrypoint variants of the .js library
- Use async interop more consistently for rendering and event handling
- Add binary serializer for RenderBatch with tests
2018-07-09 11:04:14 +01:00
Steve Sanderson cafb56569d Initial debugger support 2018-07-06 11:56:21 +01:00
Ryan Nowak e0168eb0c8 Implement server-side sync context
This is a synchronization context we can use for server side blazor to
support a single logical thread of execution. This is optimized for
scalability and non-blocking behavior.
2018-07-05 12:41:31 -07:00
Ryan Nowak 8724b84a14 Fix #1068
This changes the bind lowering pass to be more tolerant of unexpected
and invalid content.
2018-07-05 11:28:54 -07:00
Ryan Nowak 844e38e641 Update versions to 2.1
Updates ASP.NET package versions to 2.1

Tweaks TFMs
- libraries = netstandard2.0
- exes/apps/tools = netcoreapp2.1
- unit tests = netcoreapp2.0
- e2e tests = netcoreapp2.1 (dependency on apps)

The exception to this is the Browser.JS project which depends on our
tool for its build. however this project just builds the js code so its
TFM doesn't really matter.
2018-07-05 09:53:55 -07:00
Ryan Nowak 45544858a3 Fix #954 - use weak typing for 'event handlers'
This change introduces a mechanism for bypassing type checking and then
uses for the 'event handlers'. The event handler tag helpers have some
ideosyncratic behaviors and rely on overloading at the render tree
builder level.
2018-07-05 09:15:01 -07:00
Steve Sanderson b275055835 JavaScript interop v3 (#1033)
* JavaScript interop via new IJSRuntime abstraction

* CR feedback
2018-06-25 15:14:42 +01:00
Steve Sanderson a1e613b717 When clicking <a> tag with no href, don't attempt navigation to "null". Fixes #943 2018-06-07 20:49:09 +01:00
Ryan Nowak 0fb47684c8 Fix #974
The root cause here was that we weren't setting the language version in
MSBuild, which is only for the command line version.

(cherry picked from commit 319e31f71a150e9b0d91e724f0e358390caec4c2)
2018-06-07 12:27:03 -07:00
Steve Sanderson 783edcbf4c Don't preventDefault on events. Fixes #803 2018-06-06 13:44:53 +01:00
Steve Sanderson 2492d00e75 Stylistic tweaks 2018-06-06 13:44:14 +01:00
Rémi BOURGAREL 3610068929 manages when users clicks on a link with the control button pushed. issue #867 2018-06-06 13:44:14 +01:00
Steve Sanderson 4427b3b773 Add more struct readonlyness hints 2018-06-06 11:49:55 +01:00
Ryan Nowak cb186f494a Add type checking for component parameters
Introduces a new primitive used by the compiler for type checking. Type
checking applies to component parameters when setting the value directly
and when using bind. This is nice because it also adds error checking
for bind.
2018-06-05 19:58:50 -07:00
Javier Calvarro Nelson 5cb544ece8 Improved interoperability
* Add support for invoking async JavaScript functions from .NET.
* Add support for invoking .NET methods from JavaScript.
* Add support for invoking async .NET methods from JavaScript.
2018-06-05 16:09:59 -07:00
Suchiman a3776b2a20 Add support for binding long / float / double / decimal 2018-06-05 16:42:31 +01:00
Ryan Nowak 5b40e3e121 Update versions to 2.1.0 (rtm) 2018-05-31 20:58:09 -07:00
Nikolei, Stefan 54eda39cb8 Update Anglesharp 2018-05-29 17:08:01 +01:00
Steve Sanderson 353da42cce Clean up use of relative URLs. Fixes #844 and #845 (#878)
* Handle links to empty-string href, resolved against base href

Needed to change the URLs used in E2E tests to be able to cover this (i.e., removed the /RouterTest prefixes so the default relative URL became an empty string)

* Change links in StandaloneApp sample to be relative

* Standardize on base URIs having trailing slash everywhere

Hence also change terminology from "base URI prefix" to simply "base URI"

* Handle link highlighting when visiting base-href-but-without-trailing-slash

* Removing leading slashes from base-relative URLs in templates
2018-05-24 09:54:43 +01:00
Steve Sanderson 7f3ba97fb7 Handle ChildContent that starts with an HTML element. Fixes #875 2018-05-23 15:57:48 +01:00
Robin Sue b5128a7efd Add support for sending and receiving arbitrary HttpContent, refs #479 (#815)
* Add support for zero copy byte array marshalling

* Add support for sending arbitrary HttpContent, refs #479

* Fix unit test to set ContentType correctly

* Add support for receiving binary data

* Compare header case insensitive

* Add unit test for binary http requests
2018-05-23 10:16:27 +01:00
Ryan Nowak e801707706 Add regression test for 609 2018-05-22 13:58:04 -07:00
Ryan Nowak c6148b6fe6 Fix #784 - allow complex content for HTML
The logic that binds event handlers was interfering with the code that
prevents component properties from receiving complex content.

This check was a little overzealous.
2018-05-22 11:58:46 -07:00
Ryan Nowak a88b24ed76 Resolves #297
Removes the workaround for #297 and sets the langauge version to
experimental.

This will require 2.1.0-rc of Razor.
2018-05-22 11:10:15 -07:00
Gutemberg Ribeiro ad501dc77f Event payloads for DOM event types 2018-05-22 13:12:55 +01:00
Ryan Nowak e4cf7a6d3e Fix #773 (for real this time)
The problem is that the new HTML rewrite pass was traversing into
attributes of all kinds and would turn any HTML content inside those
attributes into elements where possible. The solution is to not do
that.
2018-05-14 10:47:36 -07:00
Ryan Nowak 3142217bec Fix #745 - allow multiple implements directives
The pass for this was 'break'ing after the first directive for no real
reason. Oops.
2018-05-08 14:06:22 -07:00