Appearance
How-to: Debug postMessage Traffic
Use this when a napplet appears loaded but no NAP request or response is visible.
Checklist
- Confirm the iframe uses
sandbox="allow-scripts"withoutallow-same-origin. - Confirm the shell registered the iframe source before message handling.
- Confirm messages are plain objects with a string
type. - Confirm
MessageEvent.sourcematches a registered iframe window. - Confirm ACL grants exist for the requested capability.
- Confirm the target service is registered.
Temporary trace
Add a temporary listener in a local debug branch:
ts
window.addEventListener('message', (event) => {
console.debug('[napplet message]', {
source: event.source,
origin: event.origin,
data: event.data,
});
});Remove debug traces before shipping. Source validation and ACL denial behavior should be tested, not bypassed.