Hold back on installing OO 5.8.3?

A recent OmniOutliner update:

5.8.3 (v206.6.0)

seems to contain a regression which can cause crashes with some scripts.

Some JXA scripts accessing omniJS through the .evaluateJavascript method:

  1. Work fine on 5.8.2
  2. but are crashed by 5.8.3 (v206.6.0)

The regression in OmniOutliner 5.8.3 causes a crash

when a non-string value is returned from an application of the

.evaluateJavascript method.

The code in the following post, evaluated from Script Editor, for example,

crashes (on the return of a value) in OO 5.8.3,

but works fine in OO 5.8.2

This looks like a regression to a value return

crasher which had been fixed in earlier builds.

A JavaScript for Automation (JXA) script,

for evaluation by OmniOutliner.evaluateJavascript(…)

Adapted from test code helpfully submitted by

@unlocked2412

is pasted below:

1 Like

Test code:

JXA source – evaluating code through .evaluateJavascript
(() => {
    "use strict";

    // A regression in OmniOutliner 5.8.3 causes a crash
    // when a non-string value is returned from the
    // .evaluateJavascript method.

    // This code, evaluated from Script Editor, for example,
    // crashes (on the return of a  value) in OO 5.8.3,
    // but works fine in OO 5.8.2

    // This looks like a regression to a value return
    // crasher which had been fixed in earlier builds.

    // A JavaScript for Automation (JXA) script,
    // for evaluation by OmniOutliner.evaluateJavascript(...)

    // Adapted from test code helpfully submitted by
    // @unlocked2412
    const omnijsMain = () => {

        const main = () =>
            userDialog([
                new Form.Field.String(
                    "keyString",
                    "Display",
                    "Default"
                )
            ])(
                "Hello World"
            )(
                // This causes a crash in OO 5.8.3
                // but not in OO 5.82

                // returns an object, rather than
                // a string, to JXA.
                x => x

                // This is OK
                // x => ""
            );

        // --------------------- GENERIC ---------------------

        // FUNCTIONS --
        // userDialog :: [Form.Field] ->
        // String -> values -> () -> Promise
        const userDialog = fields =>
            // General constructor for omniJS dialogs,
            // where f is a continuation function
            // in which a dialog result
            // is bound to the function argument.
            prompt => f => fields.reduce(
                (form, field) => (
                    form.addField(field),
                    form
                ),

                // Seed value - a new black form.
                new Form()
            )
            .show(prompt, "OK")
            .then(f);

        return main();
    };

    const oo = Application("OmniOutliner");

    return (
        oo.activate(),
        oo.evaluateJavascript(
            `(${omnijsMain})()`
        )
    );
})();

(Also submitted to Omni with crash reports)

1 Like