Safari + Orbeon 2019.1.1 + iframe = java.lang.IllegalStateException: client state not found for form `xforms-form`

11 views
Skip to first unread message

Alexander Henket

unread,
Dec 19, 2019, 8:13:55 AM12/19/19
to Orbeon Forms
We are running orbeon-2019.1.0.201910220019-CE.

We have certain pages with an iframe that shows contents based on your selection in the form. This used to work until Orbeon 2019.1.1.

As of Orbeon 2019.1.1, when you visit the page using Apple Safari (macOS Catalina or older, doesn't really seem to matter) you will run into

[Error] java.lang.IllegalStateException: client state not found for form `xforms-form`
rn (orbeon-0b061cc5e595537168f1ee4e1e257234917e9092.js:250:290)
(anonieme functie) (orbeon-0b061cc5e595537168f1ee4e1e257234917e9092.js:251)
(anonieme functie) (orbeon-8cf12d7aec139ed223a6ee0a288f94f5fcb7f1bd.js:227:5371)
(anonieme functie) (orbeon-8cf12d7aec139ed223a6ee0a288f94f5fcb7f1bd.js:227:1539)

After clicking the second and further item. After that the form runs completely inoperable and only a page refresh will get you out of that.

This is not reproducible in FireFox or Chrome so it is browser specific.

I've attached a reproduction page and what it looks like for me as a screen movie.

Is there anything I can do to fix this?
iframe.xhtml
Schermopname 2019-12-19 om 14.09.01.mov

Alessandro Vernet

unread,
Dec 19, 2019, 7:28:37 PM12/19/19
to orb...@googlegroups.com
Hi Alexander,

We had a similar problem with the Test button in Form Builder, which uses an
iframe to show the form you're testing, and updating the `src` on the
`<iframe>` element. It seems to be related to Orbeon Forms now using the
history API (see 1st link below) to store some state about the form. When
the `src` on the `<iframe>` element is changed, Safari loads the new page,
but seems to incorrectly keep the information stored by the previous page.

So in our code for the Test button, we resorted to entirely recreating the
`<iframe>` element in the DOM with JavaScript, instead of just updating the
`src`, which is done in `<xf:action type="javascript"
ev:event="fb-test-form">` (see 2nd link below). I think you could do
something similar in your code, instead of just relying on an AVT for
`instance('class-navigation')`, you'd initially have an `<iframe
src="about:blank">`, and re-create it in a handler for `xforms-enabled
xforms-value-changed` on an `<xf:var value="instance('class-navigation')">`.

You'll let me know if this works for you.

https://developer.mozilla.org/en-US/docs/Web/API/History_API
https://github.com/orbeon/orbeon-forms/blob/tag-release-2019.1-ce/form-builder/jvm/src/main/resources/forms/orbeon/builder/form/model.xml#L652

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

Alessandro Vernet

unread,
Dec 19, 2019, 7:39:47 PM12/19/19
to orb...@googlegroups.com
For reference (mostly my own!), the relevant issues with the Test button
were:

https://github.com/orbeon/orbeon-forms/issues/3900
https://github.com/orbeon/orbeon-forms/issues/4172

ahenket

unread,
Dec 20, 2019, 8:55:38 AM12/20/19
to orb...@googlegroups.com
Interesting. So I’ll file a bug with Apple at least (I have the page online
for them to play with). Maybe it amounts to nothing but one has to try.
Secondly I’ll look into the workarounds over the weekend. Thanks as always!

Alessandro Vernet

unread,
Dec 20, 2019, 1:13:47 PM12/20/19
to orb...@googlegroups.com
Hi Alexander,

I suspect that the best place to file this bug would be
https://bugs.webkit.org. (And I imagine that it would be nice to create a
standalone example that shows this behavior without requiring Orbeon Forms,
in the sense that a simpler example would increase the likelihood that
someone on the WebKit team looks at it.)

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet

Alexander Henket

unread,
Dec 21, 2019, 3:37:26 AM12/21/19
to Orbeon Forms
I filed it with Apple. If it is really the History API in Safari, and since Chrome - also WebKit - works fine, there must be something in Safari itself.

I also tried to follow your workaround but I'm unable to. My first issue seems to be how to call an instance('....') from Javascript, but even then it triggers

Exception in client-side code.
  • Message: undefined is not an object (evaluating 'b.call')

            <xf:action type="javascript" ev:event="xxforms-value-changed" ev:observer="class-navigation">
                alert('Script fired for ' + ORBEON.xforms.Document.getValue("class-navigation"));
               
                var oldIFrame = ORBEON.jQuery('clamlframe');
               
                var newIFrame = document.createElement("IFRAME");
               
                newIFrame.id = oldIFrame.id;
                newIFrame.frameBorder = oldIFrame.frameBorder;
                newIFrame.width = oldIFrame.width;
                newIFrame.height = oldIFrame.height;
                newIFrame.src = "https://decor.nictiz.nl/terminology/claml/ViewClass?classificationId=2.16.840.1.113883.6.3.2&amp;statusCode=active&amp;code=R73.0";
               
                oldIFrame.replaceWith(newIFrame);
            </xf:action>


Any hints appreciated.

Alexander Henket

unread,
Dec 21, 2019, 3:48:26 AM12/21/19
to Orbeon Forms
Just in case, the updated source of the page
iframe2.xhtml

Alessandro Vernet

unread,
Jan 8, 2020, 7:42:55 PM1/8/20
to orb...@googlegroups.com
Hi Alexander,

Sorry for the late response! Regarding the "undefined is not an object"
JavaScript error, to get past this I think you need to attach your
`<xf:action type="javascript">` to a control in the view, hence my
suggestion to put it inside an `<xf:var>`, with the value pointing to what
you're interested, and this in the view.

And to pass a value to the JavaScript code, see the section "Passing
parameters" linked below.
https://doc.orbeon.com/xforms/actions/scripting#passing-parameters

You'll let me know if this works for you.

Alessandro Vernet

unread,
Jan 20, 2020, 2:52:20 PM1/20/20
to orb...@googlegroups.com
Hi Alexander, did you get a chance to try to call your JavaScript code,
passing a value from XPath, as suggested earlier? If so, you'll let me know
if it worked for you.

Alexander Henket

unread,
Jan 21, 2020, 12:40:01 AM1/21/20
to Orbeon Forms
Not yet Alessandro. Holiday and post-holiday other work prevented me from doing that. I'm looking into it this week though. The suggested solution is not compatible with Orbeon 3.9 and we have one code base for now. I'll also have to figure out how to implement a conversion switch. Isn't there anything that can be done in Orbeon itself? I.e. like a browser switch or try/catch so Safari doesn't kill the whole form behavior?

Alessandro Vernet

unread,
Jan 21, 2020, 1:44:29 PM1/21/20
to orb...@googlegroups.com
Hi Alexander,

So, time to upgrade Orbeon Forms ;), so you can leverage that `<xf:param>`,
and more. Regarding the Safari issue, at the time I looked at it in the
context of the Test button in Form Builder, I couldn't find a workaround
other than recreating the iframe when the page (or the URL) changed. And
since that was a pretty simple workaround, which also worked fine on all
other browsers, we just went ahead with it.
Reply all
Reply to author
Forward
0 new messages