Infinite ajax calls after selecting kontainer resource

Created on 29 January 2024, 5 months ago
Updated 12 February 2024, 5 months ago

Problem/Motivation

When adding a kontainer media in Drupal the infinite ajax calls start executing, with "Downloading media from Kontainer..." messages spammed and the page becomes unresponsive.

This happens with enabled browser plugins such as React Devtools.

Steps to reproduce

  1. Install React Devtools browser plugin
  2. Add a Kontainer media reference field to a content type
  3. Create a new content of that type
  4. In the form field for kontainer media reference click "Kontainer select" button
  5. The Kontainer website opens in a new tab
  6. Switch back to Drupal page and see the "Downloading media from Kontainer..." messages spams and page becomes unresponsive

Proposed resolution

The javascript of the module does not check the origin of the received message via iframe. React Devtools for example sends messages via postMessage every second, triggering ajax calls in the module.

The receiveMessage function should check that the message origin is kontainer url set in module settings.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇸🇮Slovenia bcizej

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024