Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for posting results using cross-origin communication. #3

Closed
wants to merge 11 commits into from

Conversation

tobie
Copy link
Contributor

@tobie tobie commented Oct 6, 2012

Where supported, the test harness will now also send messages using
cross-document messaging to each ancestor browsing context. Since it
uses the wildcard keyword (*), cross-origin communication is enabled and
script on different origins can collect the results.

This API follows similar conventions as those described above only slightly
modified to accommodate message event API. Each message is sent by the harness
is passed a single vanilla object, available as the data property of the
event object. These objects are structures as follows:

start - { type: "start" }
result - { type: "result", test: Test }
complete - { type: "complete", tests: [Test, ...], status: TestsStatus }

Where supported, the test harness will now also send messages using
cross-document messaging to each ancestor browsing context. Since it
uses the wildcard keyword (*), cross-origin communication is enabled and
script on different origins can collect the results.

This API follows similar conventions as those described above only slightly
modified to accommodate message event API. Each message is sent by the harness
is passed a single vanilla object, available as the `data` property of the
event object. These objects are structures as follows:

start - { type: "start" }
result - { type: "result", test: Test }
complete - { type: "complete", tests: [Test, ...], status: TestsStatus }
@tobie
Copy link
Contributor Author

tobie commented Oct 6, 2012

/cc @darobin

@tobie
Copy link
Contributor Author

tobie commented Oct 7, 2012

Solved the pending WebKit issue (pollution of the console by error messages). This is ready to go. Happy to answer questions you might have, @jgraham, and/or revise commits.

var msg = this.message;
msg = msg ? String(msg) : msg;
this._structured_clone = {
PASS:0,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could move these constants out into a seperate object so they are only defined in one place and write a merge function to copy the properties over, so that this code would look like

this._structured_clone = merge({name:String(this.name), status:this.status, message:message}, test_statuses)

and something similar when they are put on the Test prototype object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WFM. What about as a prop of the constructor?

Test.statuses = {...};

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that sounds OK.

@tobie
Copy link
Contributor Author

tobie commented Oct 15, 2012

Hi James,

Is there anything that still needs work on my side before this makes it in?

If so, please LMK.

Thanks,

--tobie

* == External API through cross-document messaging ==
*
* Where supported, the test harness will also send messages using
* cross-document messaging to each ancestor browsing context. Since it
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this should be ancestor and opener

@jgraham
Copy link
Owner

jgraham commented Oct 15, 2012

This is OK now, I think; I will assume that you fix the docs without needing another review cycle. Are you OK to push it to mercurial?

@jgraham jgraham closed this Oct 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants