This commit makes editor-adapter use wrappedJSObject and
XPCNativeWrapper if available. These two functions are Firefox-only APIs
that enable manipulating the page's object from a webextension context
without having to insert script tags in the page. This circumvents
issues with websites where the CSP disallows injecting script tags.
This change is implemented by removing calls to executeInPage from
editors and making their functions (getContent, setContent,
getCursor...) context agnostics. The functions use a generic wrap and
unwrap function which will correspond to wrappedJSObject and
XPCNativeWrapper calls in firefox and will be polyfilled by the identity
functions when executed in the page.
This change made the API very ugly, so convenience proxys and
corresponding types that hide these changes were created.
This commit makes editor-adapter use wrappedJSObject and XPCNativeWrapper if available. These two functions are Firefox-only APIs that enable manipulating the page's object from a webextension context without having to insert script tags in the page. This circumvents issues with websites where the CSP disallows injecting script tags.
This change is implemented by removing calls to executeInPage from editors and making their functions (getContent, setContent, getCursor...) context agnostics. The functions use a generic
wrap
andunwrap
function which will correspond to wrappedJSObject and XPCNativeWrapper calls in firefox and will be polyfilled by the identity functions when executed in the page.This change made the API very ugly, so convenience proxys and corresponding types that hide these changes were created.
Closes #3.