New issue
Advanced search Search tips

Issue 674370 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

LayoutTest failure: foreign-fetch-basics.html fails when running twice

Project Member Reported by shimazu@chromium.org, Dec 15 2016

Issue description

https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/http/tests/serviceworker/foreign-fetch-basics.html?q=http/tests/serviceworker/foreign-fetch-basics.html&sq=package:chromium&dr&l=232

"Service Worker does not intercept fetches with CORS preflight" test seems to fail when running the layout test as follows:

./third_party/WebKit/Tools/Scripts/run-webkit-tests  -t Master http/tests/serviceworker/foreign-fetch-basics.html --no-retry-failures --iterations=3 --exit-after-n-crashes-or-timeouts=1

Is this intended behavior?

 

Comment 1 by mek@chromium.org, Dec 15 2016

That would definitely not be intended behavior. Unfortunately I don't seem to be able to reproduce... How exactly is it failing for you? Is some assertion failing, or is it timing out, or something?

Comment 2 by falken@chromium.org, Dec 16 2016

I could repro this. There's a single assert failure:

FAIL Service Worker does not intercept fetches with CORS preflight assert_true: expected true got false

Full log:
CONSOLE ERROR: Fetch API cannot load https://localhost:8443/serviceworker/resources/foreign-fetch/scope/wildcard/foo?basic. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. The response had HTTP status code 404. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
CONSOLE ERROR: Fetch API cannot load https://localhost:8443/serviceworker/resources/foreign-fetch/scope/nomatch-origin/foo?basic. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. The response had HTTP status code 404. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
CONSOLE ERROR: Fetch API cannot load https://localhost:8443/serviceworker/resources/simple.txt?fallback. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
CONSOLE ERROR: Fetch API cannot load https://example.test:8443/serviceworker/resources/simple.txt?basic_insecure. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.test:8000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
This is a testharness.js-based test.
PASS Service Worker intercepts fetches in scope with wildcard origin. 
PASS Service Worker intercepts fetches in scope with explicit origin. 
PASS Service Worker doesn't intercept fetches with non matching origin. 
PASS Service Worker intercepts fetches in scope with explicit origin list. 
PASS Service Worker does not intercept same origin fetches. 
PASS Service Worker does not intercept navigations. 
PASS Service Worker that fallback to network should fallback to network. 
PASS Service Worker that fetch from the network should fallback to network. 
PASS Falling back to network should still respect CORS. 
PASS Foreign fetch can intercept fetch requests from SW controlled pages. 
PASS Foreign fetch can intercept resource requests from SW controlled pages. 
PASS Referrer and origin are set correctly in ForeignFetchEvent. 
PASS Service Worker does not intercept fetches from an insecure context. 
FAIL Service Worker does not intercept fetches with CORS preflight assert_true: expected true got false
PASS Foreign fetch rejects if resolved with a null response. 
Harness: the test ran to completion.


It failed 2/3 iterations on the first try.

Comment 3 by mek@chromium.org, Dec 16 2016

Status: Started (was: Assigned)
Hmm, with a release build I can in fact reproduce it, let me see if I can figure out what's going on...

Comment 4 by mek@chromium.org, Dec 20 2016

So what seems to be happening is that the CORS preflight cache somehow sometimes survives between test iterations, and the loading code doesn't skip foreign fetch service workers when a preflight response is found in that cache. I'm fixing that bug in the foreign fetch code, no idea if the preflight cache sometimes surviving is expected behavior or not.
Project Member

Comment 5 by bugdroid1@chromium.org, Dec 20 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6c2c67d53758fdae01937ae43b8e5a30ff9854ea

commit 6c2c67d53758fdae01937ae43b8e5a30ff9854ea
Author: mek <mek@chromium.org>
Date: Tue Dec 20 19:09:20 2016

Fix foreign fetch intercepting CORS preflighted requests if preflight was in cache.

This moves setting of the skip service worker flag on CORS preflighted requests
to happen earlier so that even non-simple requests for which we don't end up
sending a preflight request still skip any service workers.

BUG= 674370 

Review-Url: https://codereview.chromium.org/2582833002
Cr-Commit-Position: refs/heads/master@{#439863}

[modify] https://crrev.com/6c2c67d53758fdae01937ae43b8e5a30ff9854ea/third_party/WebKit/LayoutTests/http/tests/serviceworker/foreign-fetch-basics.html
[modify] https://crrev.com/6c2c67d53758fdae01937ae43b8e5a30ff9854ea/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp

Comment 6 by mek@chromium.org, Dec 20 2016

Status: Fixed (was: Started)

Sign in to add a comment