You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
Our tests use some parent.postMessage which usually points to ourselves (since we are the topmost)
However, in an iFrame scenario, that postMessage will post to TestSwarm. In this case, TestSwarm is configured to send anything to the server; on success, it kills the iFrame.
This causes the test to never resolve as it never posts its result back.
I agree my test should not post to a parent that it is not aware of, but at least, my test could fail instead of silently be stopped.
A mechanism should be in place to listen to a specific set of message such as
__TESTSWARM__restOfMessage
When run.js reads the message, if the first bytes don't start with that string constant, you could ignore the message.
The text was updated successfully, but these errors were encountered:
Thanks for posting this issue @jsgoupil. I can confirm this as responsible for my own Testswarm failures to save results: any non-Testswarm postMessage requests will kill off the iFrame, which cancels the load of additional resources and stops testing. I resolved this for my own needs using a namespacing approach.
I would recommend two updates:
Namespace the postMessage request per @jsgoupil's suggestion
Thanks @jsgoupil and @editor. Those are excellent suggestions.
How would the following changes sound?
Namespace the message (or leave some other kind of signature of property to identify itself) to avoid acting on unknown data.
When encountering any foreign data, treat it as a bad thing by aborting the test marking the test as failed (similarly to other meta-level errors such as "Uncaught Exception" and "Timed-out").
Those changes, together, seem great @Krinkle. What we have today, more or less, is piece two without piece one.
These two changes wouldn't account for the sending of postMessage requests to anything else that iFrames a page with inject.js on it (https://github.com/jquery/testswarm/blob/master/js/inject.js#L130), but the "fix" of restricting messages to the Testswarm domain isn't strictly necessary to resolve this issue anyways (just seems to me like a courteous thing to do).
I'd be beyond happy to contribute any or all these two changes via pull request. Just let me know how I can help.
Restricting the target origin by using the swarmURL parameter sounds good as well, I have no opposition to that. It isn't strictly necessary, but it's a good habit.
I'd love to get a pull request for this. Let me know if you need any pointers.
Our tests use some parent.postMessage which usually points to ourselves (since we are the topmost)
However, in an iFrame scenario, that postMessage will post to TestSwarm. In this case, TestSwarm is configured to send anything to the server; on success, it kills the iFrame.
This causes the test to never resolve as it never posts its result back.
I agree my test should not post to a parent that it is not aware of, but at least, my test could fail instead of silently be stopped.
A mechanism should be in place to listen to a specific set of message such as
__TESTSWARM__restOfMessage
When run.js reads the message, if the first bytes don't start with that string constant, you could ignore the message.
The text was updated successfully, but these errors were encountered: