Skip to content

Conversation

@dmethvin
Copy link
Member

@dmethvin dmethvin commented Apr 8, 2016

Ref gh-3040

Not really happy with this solution for the long term, it seems like should be
having the iframe code signal when it's done. The old code would have broken for
any use of Deferred or setTimeout in the iframe, and it's likely this will break
too.
See below.

Ref jquerygh-3040

Not really happy with this solution for the long term, it seems like should be
having the iframe code signal when it's done. The old code would have broken for
any use of Deferred or setTimeout in the iframe, and it's likely this will break
too.
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @timmywil, @markelog and @gibson042 to be potential reviewers

@mgol
Copy link
Member

mgol commented Apr 8, 2016

This seems pretty fragile...

@dmethvin
Copy link
Member Author

dmethvin commented Apr 8, 2016

Completely agree. The better solution is to have the iframe call back to let the parent know it's done. That requires some (simple I think) changes to all the tests run via testIframe but I didn't have the time to think through and test that.

We can either merge this to make the problem go away now or someone can do the right thing when they get a chance. (Or revert the async ready code I guess.)

@gibson042
Copy link
Member

There are only four uses of testIframe, and one of them is in documentation:

Especially considering that ready is an excludable module, I'd like to do things the right way and drop all four, replacing testIframe with testIframeWithCallback (which is almost identical anyway). Of those tests, only the first even plausibly cares about document readiness.

@dmethvin
Copy link
Member Author

dmethvin commented Apr 8, 2016

Okay, since @gibson042 did the searching and I have about 90 minutes now, imma try to get this fixed the right way. Hold my coat I'm going in!

@dmethvin dmethvin self-assigned this Apr 8, 2016
@timmywil
Copy link
Member

timmywil commented Apr 8, 2016

@dmethvin I assume someone got your coat. Are you taking anything else off?

@dmethvin
Copy link
Member Author

dmethvin commented Apr 8, 2016

WHY ARE THE FIRST TWO ARGS REVERSED FOR THESE GUYS???!

@dmethvin
Copy link
Member Author

dmethvin commented Apr 8, 2016

WHY DOES testIframe add the .html but testIframeWithCallback NOT????

@dmethvin
Copy link
Member Author

dmethvin commented Apr 8, 2016

What a mess! There were a bunch of other testIframe() tests in offset.js but I think I got everything.

@timmywil
Copy link
Member

timmywil commented Apr 8, 2016

/play rollout

@gibson042
Copy link
Member

Huh, I don't know how I missed those. At any rate, thanks @dmethvin. You are a gentleman and a scholar.

README.md Outdated
```js
callback( jQueryFromIFrame, iFrameWindow, iFrameDocument );
testIframeWithCallback( testName, fileName,
function callback( arg1, arg2, ... assert ) {
Copy link
Member

Choose a reason for hiding this comment

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

This syntax looks weird to me. Did you mean:

function callback( arg1, arg2, ..., assert ) {
    ...
} );

?

@mgol
Copy link
Member

mgol commented Apr 9, 2016

That's great! 👏

@dmethvin
Copy link
Member Author

I added another commit to clean up a bunch of things. Now each iframe page includes a file that defines startIframeTest() which is what the iframe calls to get the test started. The callback function gets assert as its first arg rather than it being tacked onto the end, that matches QUnit.test() conventions and may be a little less error prone. If this looks good to everyone I'd like to land it tomorrow before it has to be rebased.

@dmethvin dmethvin changed the title Tests: Make iframe tests wait after checking isReady Tests: Refactor iframe tests for async ready event Apr 10, 2016
@@ -0,0 +1,9 @@
// Just used in iframed html tests which jshint doesn't see
// jshint unused: false
Copy link
Member

Choose a reason for hiding this comment

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

window.startIframeTest = function() {} should help with jshint?

@dmethvin dmethvin closed this in e5ffcb0 Apr 11, 2016
@dmethvin dmethvin deleted the async-ready-units branch May 24, 2016 19:07
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

7 participants