diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ec51b6a9e..3db96a5980 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/util/actor.test.ts b/src/util/actor.test.ts index 4b2d1dc347..72bc9157b2 100644 --- a/src/util/actor.test.ts +++ b/src/util/actor.test.ts @@ -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(); + }); }); diff --git a/src/util/actor.ts b/src/util/actor.ts index a144c99444..50d4fc703e 100644 --- a/src/util/actor.ts +++ b/src/util/actor.ts @@ -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) {