Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TRUST-059

The page accepts only registered host messages addressed to its render

When the page receives a window message event, it SHALL hand its value to the host message filter only if the event comes from the frame that hosts the page, from another frame with the page's own origin that is not the window that opened it, from the page's own window with its own origin, or is dispatched inside the page without a sender; a message posted by any other window or frame SHALL be dropped. When the page receives a value from the host, it SHALL treat it as a host message only if it is an object whose type is an own key of the table of host message rules and it is addressed to the page by that rule, which names the document, revision and request of the render the page shows, or the document alone, or no render identity but an identifier of its own, and whose payload is within the bounds of its type (table of the payload checks).

Step 1 of path 2 in StRS-MDOKFSTUDIO-TRUST-009: from “The page receives a message from the host” to “The page accepts a host message”.

Part of StRS-MDOKFSTUDIO-BLOCK-025, outside the paths drawn on its map.

Part of StRS-MDOKFSTUDIO-TOOLBAR-011, outside the paths drawn on its map.

Part of StRS-MDOKFSTUDIO-BLOCK-006, outside the paths drawn on its map.

Scenarios 6

The situations the tests check; open one to read it.

nominalRegistered type, current render
Givena page that shows revision 2, request 5 of a document and a themeChanged message that names them
Whenthe message arrives
Thenit is accepted and reaches its handler
refusalA message from another window or frame
Givena page in a webview whose parent frame hosts it, a message event sent by the parent frame, one sent by another frame of the webview host with the page's origin, one sent by another window, one sent by a window with a foreign origin, and one sent by the opener
Wheneach event arrives
Thenonly the ones from the parent frame and from the same-origin host frame (and one dispatched in the page without a sender) reach the host message filter; the others are dropped
refusalValues that are not host messages
Givena string, null, an unknown type and the types __proto__ and constructor
Wheneach is checked
Thennone is accepted
refusalA render that is not the shown one
Giventhe same page and a message that names revision 1 and request 4, and a page whose render identity moved to revision 3 by a content patch
Whenthe messages arrive
Thenthe older ones go to unhandled and a message for revision 3 reaches its handler
boundaryAddressing by the rule of the type
AddressingMessage must nameTypes
renderthe document id, revision and request id of the render the page showspreviewEditSource, previewBlockMoveResult and previewBlocksResult (another requestId, or another document or revision: the page ignores it; an answer for the page's render: the page handles it), themeChanged, previewPropertiesTable, previewContentPatch, previewLinkTargets and the other render-addressed types
documentthe document id only; the render may differpreviewPlantUmlIncludesChanged
own-idno render identity; matched by an identifier of its own (editId, flushId), because the host may already follow the next document or renderthe results of the host round trips, previewFlushEdit and previewEditorWatch
refusalThe payload of a type is within its bounds
MessageAccepted only ifOtherwise
previewContentPatchnext holds integer revision and requestId, a finite initialAnchor if present, an initialPin with finite line and viewportTop if present, a contentHtml string of at most 20 MiB, a known status (pending, success, stale, error, missing-source or recovery), a label string of at most 500 characters, an optional message string of at most 20 000 characters, and at most 500 diagnostics, each with a severity of at most 50 characters, a text of at most 20 000 characters and, when present, a code of at most 100 charactersrefused, not applied: 501 diagnostics, a content over 20 MiB, an unknown status, a non-finite anchor, a diagnostic code of 101 characters; a valid patch is applied and each status line keeps its code attribute
previewPropertiesTableits markup is a stringgoes to unhandled (markup null)
previewLinkTargetsits targets are an array and it names the render of the pagegoes to unhandled (an object, or the previous request id: no link changes)
previewFlushEdit, previewEditorWatchits flushId or its editId is a string, whatever the document the message names (own-id addressing)goes to unhandled and the page ignores it; a watch naming the next document is answered

Implemented in 2

Tested by 6

Replaces

SwRS-MDOKFSTUDIO-TRUST-061A content patch message is applied only within its bounds superseded superseded by SwRS-MDOKFSTUDIO-TRUST-059 Markdown file
SwRS-MDOKFSTUDIO-TRUST-062A properties table message needs string markup superseded superseded by SwRS-MDOKFSTUDIO-TRUST-059 Markdown file
SwRS-MDOKFSTUDIO-TRUST-063A link targets message needs an array of the current render superseded superseded by SwRS-MDOKFSTUDIO-TRUST-059 Markdown file
SwRS-MDOKFSTUDIO-TRUST-064Flush and editor watch messages are addressed by their own id superseded superseded by SwRS-MDOKFSTUDIO-TRUST-059 Markdown file