Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove onLoadErrorFn/onPropertyErrorFn, or make them easier to disable #9967

Open
niloc132 opened this issue Jun 4, 2024 · 0 comments
Open

Comments

@niloc132
Copy link
Contributor

niloc132 commented Jun 4, 2024

There are two undocumented hooks in the built-in linkers, allowing meta tags to contribute JS snippets to be eval'd at runtime and provide error handling functions.

  • In CrossSiteIframeLinker and subtypes, users can disable this feature outright by specifying that processMetasNull.js should be loaded instead of processMetas.js by overriding getJsProcessMetas. A configuration property could be added to re-enable the old behavior - or even to specify the name of a global function to invoke, or to point at a js file to inline to define that function.
  • For the majority of other linkers, this property comes from SelectionScriptLinker.PROCESS_METAS_JS, a protected final field, but this could still have custom logic as described above added.
  • In both of the above cases, __PROCESS_METAS__ is the block to replace in the selection script template.
  • Finally, SingleScriptTemplate.js and HostedModeTemplate.js both include these directly, and they cannot be disabled without replacing those template scripts.

As discussed in the mailing list, CSP rules can prevent the eval() calls from running at all, but it should still be removed.

Additionally, HostedModeLinker is entirely unused (and not even registered as a linker that can be used in module files), and is probably safe to remove as part of #9923.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant