Closed Bug 1183162 Opened 10 years ago Closed 10 years ago

Promise has inaccessible .then() after window.open() with failed interception

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1187722

People

(Reporter: bkelly, Unassigned)

References

Details

Bug 1173934 changed failures in network interception to return new, different nsresult values like NS_ERROR_INTERCEPTION_FAILED. This seems to have broken the fetch-frame-resources.https.html test in a strange way. In particular, this: async_test(function(t) { var scope = 'resources/fetch-frame-resource/window-cors'; service_worker_unregister_and_register(t, worker, scope) .then(function(reg) { return wait_for_state(t, reg.installing, 'activated'); }) .then(function() { var win = window.open( scope + '?mode=cors&url=' + encodeURIComponent(host_info['HTTP_REMOTE_ORIGIN'] + path + '?ACAOrigin=' + host_info['HTTP_ORIGIN'])); // We can't catch the network error on window. So we use the timer. return new Promise(function(resolve) { setTimeout(function() { resolve(win); }, 1000); }); }) .then(function(win) { assert_equals( win.document.body.textContent, '', 'CORS type response could not be loaded in the new window.'); win.close(); return service_worker_unregister_and_done(t, scope); }) .catch(unreached_rejection(t)); }, 'CORS type response could not be loaded in the new window.'); Fails with: assert_unreached: unexpected rejection: Permission denied to access property "then" Reached unreachable code unreached_rejection/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/test-helpers.sub.js:42:7 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 Test.prototype.step_func/<@https://web-platform.test:8443/resources/testharness.js:1387:1 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/fetch-frame-resource.https.html:123:5 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 async_test@https://web-platform.test:8443/resources/testharness.js:513:13 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/fetch-frame-resource.https.html:121:1 I'm disabling the two failing test cases for now until we can figure out what is going on here.
Boris figured this one out. The problem is the resolve(win). Promise.resolve() always looks for a .then property to determine if the argument is a Promise. In this case that throws because win is cross-origin when it contains an error page.
I'm just going to fix this in bug 1187722 with the rest of the file.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.