Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GeckoView tile loading android assets folder #4478

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Fix remove hash string when map is removed ([#4427](https://github.com/maplibre/maplibre-gl-js/pull/4427))
- Fix GeolocateControl may be added twice when calling addControl/removeControl/addControl rapidly ([#4454](https://github.com/maplibre/maplibre-gl-js/pull/4454))
- Fix `style.loadURL` abort error being logged when removing style ([#4425](https://github.com/maplibre/maplibre-gl-js/pull/4425))
- Fix vector tiles not loading when html is opened via "resource://android" (i.e., the assets folder) in GeckoView on Android ([#4451](https://github.com/maplibre/maplibre-gl-js/pull/4451))
- _...Add new stuff here..._

## 4.5.0
Expand Down
14 changes: 14 additions & 0 deletions src/util/actor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,18 @@ describe('Actor', () => {

expect(spy).toHaveBeenCalled();
});

test('should process a message when origin is "resource://android"', async () => {
const worker = workerFactory() as any as WorkerGlobalScopeInterface & ActorTarget;
const actor = new Actor(worker, '1');

const spy = jest.fn().mockReturnValue(Promise.resolve({}));
worker.worker.actor.registerMessageHandler(MessageType.getClusterExpansionZoom, spy);

actor.target.postMessage({type: MessageType.getClusterExpansionZoom, data: {} as any, origin: 'resource://android'});

await sleep(0);

expect(spy).toHaveBeenCalled();
});
});
2 changes: 1 addition & 1 deletion src/util/actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class Actor implements IActor {
receive(message: {data: MessageData}) {
const data = message.data;
const id = data.id;
if (data.origin !== 'file://' && location.origin !== 'file://' && data.origin !== location.origin) {
if (data.origin !== 'file://' && location.origin !== 'file://' && data.origin !== 'resource://android' && location.origin !== 'resource://android' && data.origin !== location.origin) {
return;
}
if (data.targetMapId && this.mapId !== data.targetMapId) {
Expand Down