Skip to content

Commit

Permalink
poc
Browse files Browse the repository at this point in the history
  • Loading branch information
weizman committed Oct 9, 2024
1 parent 6e6e212 commit 846894d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/core/src/lavadome.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ navigation.addEventListener('navigate', event => {

export function LavaDome(host, opts) {
opts = options(opts);

// make exported API tamper-proof
defineProperties(this, {text: {value: text}});

Expand All @@ -41,15 +41,16 @@ export function LavaDome(host, opts) {

// fire every time instance is reloaded and abort loading for non-top documents
const iframe = loadable();
addEventListener(iframe, 'load', () => {
iframe.setAttribute('srcdoc', '<script>frameElement.xxx()</script>');
defineProperties(iframe, { xxx: { value: () => {
const ownerDoc = ownerDocument(iframe);
if (ownerDoc !== document) {
replaceChildren(shadow);
throw new Error(`LavaDomeCore: ` +
`The document to which LavaDome was originally introduced ` +
`must be the same as the one this instance is inserted to`);
}
});
}}}}
);

// child of the shadow, where the secret is set, must be hardened
const child = hardened();
Expand Down

0 comments on commit 846894d

Please sign in to comment.