Closed Bug 1901883 Opened 8 months ago Closed 7 months ago

iframe is not work for background script

Categories

(WebExtensions :: Untriaged, defect)

Firefox 125
defect

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: robert, Unassigned, NeedInfo)

Details

Attachments

(1 file)

Attached image 2024-06-12_00-26.png

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0

Steps to reproduce:

  • create addon with manifest v3
  • create and insert iframe element in background script. I've tested with a HTML page included in addon bundle

Actual results:

  • iframe created, but are empty. No any scripts and elements there

Expected results:

  • iframe created with all content of HTML page
  • it is possible to message iframe with postMessage

The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Product: Firefox → WebExtensions

This problem may be solved if you will append iframe into document first and then set src:

const iframe = document.createElement('iframe', {});
iframe.setAttribute(
  'sandbox',
  'allow-same-origin allow-scripts allow-popups allow-forms',
);
document.body.appendChild(iframe);
iframe.src = '/offscreen-documents/translator/translator.html';

But problem still exists if you will set src and then will append iframe into document:

const iframe = document.createElement('iframe', {});
iframe.src = '/offscreen-documents/translator/translator.html';
iframe.setAttribute(
  'sandbox',
  'allow-same-origin allow-scripts allow-popups allow-forms',
);
document.body.appendChild(iframe);

Hello,

Would you be so kind and attach a test extension showcasing the behavior you mentioned?

Thank you !

Flags: needinfo?(robert)

We haven't received a test case, so I'm closing the bug because it is not actionable.

We'll re-open if there is a test case that demonstrates a bug.

Status: UNCONFIRMED → RESOLVED
Closed: 7 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: