[web] Correct JS property name for baseUri (flutter/engine#42357)
Up to this point, whenever users use the `PathUrlStrategy`, they would be using `flutter_web_plugins`'s copy of `BrowserPlatformLocation` which has a [different implementation for `getBaseHref()`](9376a2ac60/packages/flutter_web_plugins/lib/src/navigation/url_strategy.dart (L235)). So we never hit the [implementation in the engine](d73aac2434/lib/web_ui/lib/ui_web/src/ui_web/navigation/platform_location.dart (L138)), meaning the bug was invisible. Now that we are [removing](https://github.com/flutter/flutter/pull/126851) `BrowserPlatformLocation` from `flutter_web_plugins`, we are hitting the engine's implementation which contains the bug being solved in this PR.
This commit is contained in:
@@ -440,7 +440,7 @@ extension DomProgressEventExtension on DomProgressEvent {
|
||||
class DomNode extends DomEventTarget {}
|
||||
|
||||
extension DomNodeExtension on DomNode {
|
||||
@JS('baseUri')
|
||||
@JS('baseURI')
|
||||
external JSString? get _baseUri;
|
||||
String? get baseUri => _baseUri?.toDart;
|
||||
|
||||
|
||||
@@ -717,6 +717,11 @@ void testMain() {
|
||||
// A listener that was never added.
|
||||
expect(() => location.removePopStateListener(myNonAddedListener), throwsAssertionError);
|
||||
});
|
||||
|
||||
test('returns a non-empty baseUri', () {
|
||||
const BrowserPlatformLocation location = BrowserPlatformLocation();
|
||||
expect(location.getBaseHref(), isNotNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user