Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 92 additions & 92 deletions eng/Version.Details.props

Large diffs are not rendered by default.

370 changes: 185 additions & 185 deletions eng/Version.Details.xml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"jdk": "latest"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25459.101",
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25459.101",
"Microsoft.DotNet.SharedFramework.Sdk": "10.0.0-beta.25459.101",
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25460.104",
"Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25460.104",
"Microsoft.DotNet.SharedFramework.Sdk": "10.0.0-beta.25460.104",
"Microsoft.Build.NoTargets": "3.7.0",
"Microsoft.Build.Traversal": "3.4.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ private void WriteComponentHtml(int componentId, TextWriter output, bool allowBo
}
}

private static bool IsProgressivelyEnhancedNavigation(HttpRequest request)
internal static bool IsProgressivelyEnhancedNavigation(HttpRequest request)
{
// For enhanced nav, the Blazor JS code controls the "accept" header precisely, so we can be very specific about the format
var accept = request.Headers.Accept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ public Task SetParametersAsync(ParameterView parameters)

private void PreloadWebAssemblyAssets()
{
if (EndpointHtmlRenderer.IsProgressivelyEnhancedNavigation(_httpContext.Request))
{
return;
}

var preloads = _httpContext.GetEndpoint()?.Metadata.GetMetadata<ResourcePreloadCollection>();
if (preloads != null && preloads.TryGetAssets("webassembly", out var preloadAssets))
{
Expand Down
10 changes: 9 additions & 1 deletion src/Components/Server/test/Circuits/RemoteRendererTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.AspNetCore.Components.Server;
using Microsoft.AspNetCore.Components.Server.Circuits;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.InternalTesting;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -126,6 +127,7 @@ public async Task ProducesNewBatch_WhenABatchGetsAcknowledged()
}

[Fact]
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/61807")]
public async Task ProcessBufferedRenderBatches_WritesRenders()
{
// Arrange
Expand Down Expand Up @@ -767,7 +769,13 @@ public Task SetParametersAsync(ParameterView parameters)
public void TriggerRender()
{
var task = _renderHandle.Dispatcher.InvokeAsync(() => _renderHandle.Render(_renderFragment));
Assert.True(task.IsCompletedSuccessfully);

// Log the task state for debugging purposes.
var status = task.Status;
var innerException = task.Exception?.InnerException;
var message = $"Render task should succeed synchronously.\nStatus: '{status}'\nInner exception: '{innerException}'";

Assert.True(task.IsCompletedSuccessfully, message);
}
}

Expand Down
9 changes: 0 additions & 9 deletions src/Components/Web.JS/src/Rendering/DomMerging/DomSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,6 @@ function domNodeComparer(a: Node, b: Node): UpdateCost {
return UpdateCost.Infinite;
}

// Always treat "preloads" as new elements.
if (isPreloadElement(a as Element) || isPreloadElement(b as Element)) {
return UpdateCost.Infinite;
}

return UpdateCost.None;
case Node.DOCUMENT_TYPE_NODE:
// It's invalid to insert or delete doctype, and we have no use case for doing that. So just skip such
Expand All @@ -324,10 +319,6 @@ function domNodeComparer(a: Node, b: Node): UpdateCost {
}
}

function isPreloadElement(el: Element): boolean {
return el.tagName === 'LINK' && el.attributes.getNamedItem('rel')?.value === 'preload';
}

function upgradeComponentCommentsToLogicalRootComments(root: Node): ComponentDescriptor[] {
const serverDescriptors = discoverComponents(root, 'server') as ServerComponentDescriptor[];
const webAssemblyDescriptors = discoverComponents(root, 'webassembly') as WebAssemblyComponentDescriptor[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public override Task InitializeAsync()
[Theory]
[InlineData("server")]
[InlineData("webassembly")]
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/57766")]
public void CanUseAntiforgeryAfterInitialRender(string target)
{
Navigate($"{ServerPathBase}/{target}-antiforgery-form");
Expand All @@ -47,7 +46,6 @@ public void CanUseAntiforgeryAfterInitialRender(string target)
var submit = Browser.Exists(By.Id("submit"));
submit.Click();

var result = Browser.Exists(By.Id("result"));
Browser.Equal("Test", () => result.Text);
Browser.Equal("Test", () => Browser.FindElement(By.Id("result")).Text);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public void CanUseJsInteropToReferenceElements()
[Fact]
public void CanUseFocusExtensionToFocusElement()
{
Browser.Manage().Window.Size = new System.Drawing.Size(100, 300);
Browser.SetWindowSize(100, 300);
var appElement = Browser.MountTestComponent<ElementFocusComponent>();

// y scroll position before click
Expand Down Expand Up @@ -408,7 +408,7 @@ public void CanUseFocusExtensionToFocusElement()
[Fact]
public void CanUseFocusExtensionToFocusSvgElement()
{
Browser.Manage().Window.Size = new System.Drawing.Size(100, 300);
Browser.SetWindowSize(100, 300);
var appElement = Browser.MountTestComponent<SvgFocusComponent>();

var buttonElement = appElement.FindElement(By.Id("focus-button"));
Expand All @@ -430,7 +430,7 @@ public void CanUseFocusExtensionToFocusSvgElement()
[Fact]
public void CanUseFocusExtensionToFocusElementPreventScroll()
{
Browser.Manage().Window.Size = new System.Drawing.Size(600, 600);
Browser.SetWindowSize(600, 600);
var appElement = Browser.MountTestComponent<ElementFocusComponent>();

var buttonElement = Browser.Exists(By.Id("focus-button-prevented"));
Expand Down
12 changes: 10 additions & 2 deletions src/Components/test/E2ETest/Tests/StandaloneAppTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace Microsoft.AspNetCore.Components.E2ETest.Tests;

public class StandaloneAppTest
: ServerTestBase<BlazorWasmTestAppFixture<StandaloneApp.Program>>, IDisposable
: ServerTestBase<BlazorWasmTestAppFixture<StandaloneApp.Program>>
{
public StandaloneAppTest(
BrowserFixture browserFixture,
Expand All @@ -22,6 +22,12 @@ public StandaloneAppTest(

protected override void InitializeAsyncCore()
{
// The sidebar is hidden if the screen is too narrow.
// Without setting the window size explicitly, visibility-sensitive properties (e.g. IWebElement.Text)
// and element finders (e.g. By.LinkText) can behave unexpectedly, causing assertions to fail.
// In particular, this happens in the headless mode (used when running without debugger).
Browser.SetWindowSize(1920, 1080);

Navigate("/");
WaitUntilLoaded();
}
Expand Down Expand Up @@ -126,10 +132,12 @@ private void WaitUntilLoaded()
Browser.NotEqual("Loading...", () => app.Text);
}

public void Dispose()
public override Task DisposeAsync()
{
// Make the tests run faster by navigating back to the home page when we are done
// If we don't, then the next test will reload the whole page before it starts
Browser.Exists(By.LinkText("Home")).Click();

return base.DisposeAsync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
<TestContentPackage.InteractiveAntiforgery RenderForm="bool.Parse(RenderForm)" />
}
else
else if (RendererInfo.IsInteractive)
{
<p id="result">@Name</p>
}
Expand Down
2 changes: 2 additions & 0 deletions src/Mvc/Mvc.TagHelpers/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#nullable enable
*REMOVED*~override Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.Process(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output) -> void
~override Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.ProcessAsync(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output) -> System.Threading.Tasks.Task
22 changes: 18 additions & 4 deletions src/Mvc/Mvc.TagHelpers/src/ScriptTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,29 @@ private StringWriter StringWriter
}

/// <inheritdoc />
public override void Process(TagHelperContext context, TagHelperOutput output)
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
ArgumentNullException.ThrowIfNull(context);
ArgumentNullException.ThrowIfNull(output);

if (string.Equals(Type, "importmap", StringComparison.OrdinalIgnoreCase))
{
// This is an importmap script, we'll write out the import map and
// stop processing.
// Do not update the content if another tag helper targeting this element has already done so.
if (output.IsContentModified)
{
return;
}

// This is an importmap script, check if there's existing content first.
var childContent = await output.GetChildContentAsync();
if (!childContent.IsEmptyOrWhiteSpace)
{
// User provided existing content; preserve it.
output.Content.SetHtmlContent(childContent);
return;
}

// No existing content, so we can apply import map logic.
var importMap = ImportMap ?? ViewContext.HttpContext.GetEndpoint()?.Metadata.GetMetadata<ImportMapDefinition>();
if (importMap == null)
{
Expand All @@ -252,10 +266,10 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
return;
}

output.Content.SetHtmlContent(importMap.ToString());
output.TagName = "script";
output.TagMode = TagMode.StartTagAndEndTag;
output.Attributes.SetAttribute("type", "importmap");
output.Content.SetHtmlContent(importMap.ToString());
return;
}

Expand Down
Loading
Loading