is it possible to call browser api's from an iframe injected via webextension?

227 Views Asked by At

I am working on a webextension that will inject some ui in some pages. this ui will mostly be inside an iframe to better isolate css.

the problem I have is that I can do browser calls from inside the iframe scripts on chrome (I am also using webextension-polyfill) but in firefox I get browser is not defined error.

Am I missing something?

1

There are 1 best solutions below

0
bboydflo On

it seems like the errors I get are a firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1443253

a relevant comment on the bug page says

Chrome supports out-of-process frames, so Chrome is able to render an extension frame in an extension process (and the iframe can safely be granted access to extension APIs - https://bugs.chromium.org/p/chromium/issues/detail?id=550151 ). In contrast, Firefox does not support out-of-process frames, so the iframe is handled by a non-extension process (with only limited access to extension APIs).