Skip to content

Commit

Permalink
refactor(daemon): Make web-page-js formula numbered
Browse files Browse the repository at this point in the history
Converts the `web-page-js` formula to a numbered, id512 equivalent.
The formula number used will always be the zero id512, but this can
be changed in the future.
  • Loading branch information
rekmarks committed Feb 13, 2024
1 parent 45bae19 commit 3e1c61c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions packages/daemon/src/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,15 @@ const makeEndoBootstrap = (
return { external: endoBootstrap, internal: undefined };
} else if (formulaType === 'least-authority-id512') {
return { external: leastAuthority, internal: undefined };
} else if (formulaIdentifier === 'web-page-js') {
} else if (formulaType === 'web-page-js-id512') {
if (persistencePowers.webPageBundlerFormula === undefined) {
throw Error('No web-page-js formula provided.');
throw Error('No web-page-js-id512 formula provided.');
}
if (formulaNumber !== zero512) {
throw Error('Invalid web-page-js-id512 formula number.');
}
return makeControllerForFormula(
'web-page-js',
formulaIdentifier,
zero512,
persistencePowers.webPageBundlerFormula,
terminator,
Expand Down Expand Up @@ -762,7 +765,8 @@ const makeEndoBootstrap = (

leastAuthority: () => leastAuthority,

webPageJs: () => provideValueForFormulaIdentifier('web-page-js'),
webPageJs: () =>
provideValueForFormulaIdentifier(`web-page-js-id512:${zero512}`),

importAndEndowInWebPage: async (webPageP, webPageNumber) => {
const { bundle: bundleBlob, powers: endowedPowers } =
Expand Down
2 changes: 1 addition & 1 deletion packages/daemon/src/formula-identifier.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { quote: q } = assert;

const numberlessFormulasIdentifiers = new Set(['endo', 'web-page-js']);
const numberlessFormulasIdentifiers = new Set(['endo']);

/**
* @param {string} formulaIdentifier
Expand Down
2 changes: 1 addition & 1 deletion packages/daemon/src/web-page-bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// This is a built-in unconfined plugin for lazily constructing the web-page.js
// bundle for booting up web caplets.
// The hard-coded 'web-page-js' formula is a hard-coded 'make-unconfined' formula
// The hard-coded 'web-page-js-id512' formula is a hard-coded 'make-unconfined' formula
// that runs this program in worker 0.
// It does not accept its endowed powers.

Expand Down

0 comments on commit 3e1c61c

Please sign in to comment.