-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
spec a way to determine when an iframe fails to load #125
Comments
This could be covered as part of #127. |
I'm having a bit of trouble reading the specification. Navigate has "If the resource's out-of-band metadata (e.g. HTTP headers), not counting any type information (such as the Content-Type HTTP header), requires some sort of processing that will not affect the browsing context, then perform that processing and abort these steps." which a note below it suggests that includes network errors. However, you suggest browsers do render an "error page" of sorts. HTML also makes mention of "error page" or do nothing in a few places. None of that is particularly great. So I guess navigate should catch "network error" somehow and then load that in a browsing context. Perhaps explicit marking the document as cross-origin since same-origin doesn't seem super helpful. If that leaks data about the specifics that might even be a security issue. |
@annevk what's the security issue? |
@igrigorik say you load |
@annevk I see. FWIW, feels that we keep circling around w3c/resource-timing#12 -- we need to come on a resolution on that. I'll try to nudge it next week. |
From talking with @bzbarsky one problem here is that in Gecko there's no load/error event for network errors. You sorta have to wait an unspecified amount of time before error pages are a thing. It's not entirely clear why that is the case. |
@annevk Is that because we treat the net error as cross-origin? |
@wanderview no, that's unrelated to that (cross-origin loads normally would give an event). |
It's due to the implementation details of how error page loads happen... I don't recall what the exact reasoning was, but maybe @smaug---- does? |
I don't recall, sorry. Would need to look at the blame. |
@smaug---- could you look at blame? I'd be interested in requiring all browsers to dispatch an error event for network failures (and make the error document cross-origin). |
well, UA could just dispatch error event when error document is loaded, whenever that happens. |
@smaug---- okay, if that's possible I'll see about writing tests and updating the standard. I think that'd be very useful. |
So looking into this there are a couple of difficulties:
|
Poking at this a bit more there's also quite a variety in how errors are handled (I think we might have issues on that already), such as |
Invalid URL schemes are #1446. |
Having just come across this same issue (again) I wondered if any progress has being made on this? In our case we are embedding external content (that uses a postMessage API to communicate with the host page) in our page but want to be able give our users a nicer experience than a 'browser broken page' if the external server is down. Currently we are relying on a setTimeout that is triggered if we don't receive a message from the IFRAME in a reasonable amount of time but this is far from ideal. An 'onerror' would seem like an ideal companion to 'onload'. |
Given the discussion at #1230 (comment) I don't think this can be fixed. At best we could create a special LoadEvent class that indicates the distinction between successful load and failure load, but I don't think dispatching a separate event is web compatible, however weird that is given other fetch contexts. |
Thanks for the update :) It seems crazy that we have to rely on a horrible setTimeout hack to handle this, adding some way to do it in a non-fragile manner would be really useful. |
I will hide the Iframe from UI and use Window.postMessage() and send a message from the iframe to the main page. When the listener in the parent gets that message from the iframe, I'll make the iframe visible. This is the best I could think of. 😐 Advantage: This works even if the parent domains and iframe domain are different Limitations: U should have permission to modify code on the page embedded in the iframe. |
In the various tests, there are up to 8 <iframe> navigating concurrently. There are no ways to detect an <iframe> fails to load other than using a timeout. See whatwg/html#125. The 3000ms timeout was sometimes too short. This cause flakes. To reduce the rate of false positive, the timeout has been increased to 6000ms. R:[email protected] CC:[email protected] Fixed:1215956 Bug:1175099 Change-Id: I7bedccb351ff62d55b6020403aac5457608e5497
In the various tests, there are up to 8 <iframe> navigating concurrently. There are no ways to detect an <iframe> fails to load other than using a timeout. See whatwg/html#125. The 3000ms timeout was sometimes too short. This cause flakes. To reduce the rate of false positive, the timeout has been increased to 6000ms. R: [email protected] CC: [email protected] Fixed: 1215956 Bug: 1175099 Change-Id: I7bedccb351ff62d55b6020403aac5457608e5497 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2944929 Reviewed-by: Titouan Rigoudy <[email protected]> Commit-Queue: Arthur Sonzogni <[email protected]> Cr-Commit-Position: refs/heads/master@{#890171}
In the various tests, there are up to 8 <iframe> navigating concurrently. There are no ways to detect an <iframe> fails to load other than using a timeout. See whatwg/html#125. The 3000ms timeout was sometimes too short. This cause flakes. To reduce the rate of false positive, the timeout has been increased to 6000ms. R: [email protected] CC: [email protected] Fixed: 1215956 Bug: 1175099 Change-Id: I7bedccb351ff62d55b6020403aac5457608e5497 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2944929 Reviewed-by: Titouan Rigoudy <[email protected]> Commit-Queue: Arthur Sonzogni <[email protected]> Cr-Commit-Position: refs/heads/master@{#890171}
This reverts commit cad80cd. Reason for revert: crbug.com/1217587 Original change's description: > [Credentialless] Fix flakes about iframeTest.js > > In the various tests, there are up to 8 <iframe> navigating concurrently. > > There are no ways to detect an <iframe> fails to load other than using > a timeout. See whatwg/html#125. > > The 3000ms timeout was sometimes too short. This cause flakes. > To reduce the rate of false positive, the timeout has been increased to > 6000ms. > > R: [email protected] > CC: [email protected] > Fixed: 1215956 > Bug: 1175099 > Change-Id: I7bedccb351ff62d55b6020403aac5457608e5497 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2944929 > Reviewed-by: Titouan Rigoudy <[email protected]> > Commit-Queue: Arthur Sonzogni <[email protected]> > Cr-Commit-Position: refs/heads/master@{#890171} Bug: 1175099 Change-Id: I258c8e9219c708f22e6d14d2648e6e588a410b99 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2944393 Owners-Override: Saurabh Nijhara <[email protected]> Bot-Commit: Rubber Stamper <[email protected]> Commit-Queue: Saurabh Nijhara <[email protected]> Cr-Commit-Position: refs/heads/master@{#890202}
In the various tests, there are up to 8 <iframe> navigating concurrently. There are no ways to detect an <iframe> fails to load other than using a timeout. See whatwg/html#125. The 3000ms timeout was sometimes too short. This cause flakes. To reduce the rate of false positive, the timeout has been increased to 6000ms. R: [email protected] CC: [email protected] Fixed: 1215956 Bug: 1175099 Change-Id: I7bedccb351ff62d55b6020403aac5457608e5497 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2944929 Reviewed-by: Titouan Rigoudy <[email protected]> Commit-Queue: Arthur Sonzogni <[email protected]> Cr-Commit-Position: refs/heads/master@{#890171} NOKEYCHECK=True GitOrigin-RevId: cad80cd16f74475116e60b568f0fce785fb50f99
This reverts commit cad80cd16f74475116e60b568f0fce785fb50f99. Reason for revert: crbug.com/1217587 Original change's description: > [Credentialless] Fix flakes about iframeTest.js > > In the various tests, there are up to 8 <iframe> navigating concurrently. > > There are no ways to detect an <iframe> fails to load other than using > a timeout. See whatwg/html#125. > > The 3000ms timeout was sometimes too short. This cause flakes. > To reduce the rate of false positive, the timeout has been increased to > 6000ms. > > R: [email protected] > CC: [email protected] > Fixed: 1215956 > Bug: 1175099 > Change-Id: I7bedccb351ff62d55b6020403aac5457608e5497 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2944929 > Reviewed-by: Titouan Rigoudy <[email protected]> > Commit-Queue: Arthur Sonzogni <[email protected]> > Cr-Commit-Position: refs/heads/master@{#890171} Bug: 1175099 Change-Id: I258c8e9219c708f22e6d14d2648e6e588a410b99 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2944393 Owners-Override: Saurabh Nijhara <[email protected]> Bot-Commit: Rubber Stamper <[email protected]> Commit-Queue: Saurabh Nijhara <[email protected]> Cr-Commit-Position: refs/heads/master@{#890202} NOKEYCHECK=True GitOrigin-RevId: cd1ffb10d85a122bfbe7747a4411eaff45f9c751
It currently seems there is no good way to determine if an iframe fails to load due to a network failure. In these cases the frame ends up at a browser-specific "network failure" page. As an extra complication these network pages are considered same-origin in some browsers (blink) and cross-origin in others (gecko).
This leads us to do evil timing things in the wpt tests to try to detect failed loads:
https://dxr.mozilla.org/mozilla-central/source/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-frame-resource.https.html#34
it would be nice if we could spec an onerror for iframe in these cases. Extra bonus points for solving this problem for window.open() as well.
The text was updated successfully, but these errors were encountered: