Fixed an problem about invalid iframe contentWindow (iframe not be prepared as our expectation) #204
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
When I use this library in my complex network environment,
I found a tiny problem, bellow is the reproduce steps,
Set network connection to offline,
(unplug the network cable and disconnected the wireless network)
Try to use xdomain to retrieve something from internet,
(it should failed with timeout event, due to its created iframe cannot load the proxy.html page)
Problem phenomenon, There will be an error thrown with message "Invalid calling object" when we call
frame.postMessage
,(It should caused by the object frame is not prepared well or it is retired)
Thus, the next logic about timeout checking logic will be broken. So the whole timeout trigger logic will not work.
There is a rare situation, but it indeed exists when the network is offline.
I found I cannot reproduce above issue in Chrome and Safari, even in IE browser,
But I can reproduce it in a application hosted Web Browser control.
(I already set the Feature Control Key of the module to 11001, so it should simulate the IE11 Edge)
Solution:
I think this should be a tiny issue, and we could just wait the iframe be loaded in time.
We also have a timeout timer to check whether it is loaded in time, so I think we can just ignore this error,
In this PR, I just added a
try
to it, thus, the countdown timer of timeout can work, so its trigger logic will be corrected.@eligrey @mscdex @jpsirois @soncodi @NathanWalker , Could you have a look on this PR and review it?, thanks a lot,