Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-request-redirect.https.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-request-redirect.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-request-redirect.https.html |
index 4cefad3a74b25982d672137a38bd571a249e2b1d..18bfa61e89f924355ecf3a821a4da49c1226eb03 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-request-redirect.https.html |
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-request-redirect.https.html |
@@ -34,10 +34,17 @@ function iframe_test(url, timeout_enabled) { |
frame.onload = function() { |
if (timeout_enabled) |
clearTimeout(timer); |
- if (frame.contentDocument.body.textContent == 'Hello world\n') |
- resolve(); |
- else |
- reject(new Error('content mismatch')); |
+ try { |
+ if (frame.contentDocument.body.textContent == 'Hello world\n') |
+ resolve(); |
+ else |
+ reject(new Error('content mismatch')); |
+ } catch (e) { |
+ // Chrome treats iframes that failed to load due to a network error as |
+ // having a different origin, so accessing contentDocument throws an |
+ // error. Other browsers might have different behavior. |
+ reject(new Error(e)); |
+ } |
frame.remove(); |
}; |
document.body.appendChild(frame); |