Skip to content

Commit

Permalink
Bug 1523562 [wpt PR 15047] - Reland add tentative WPT tests for stale…
Browse files Browse the repository at this point in the history
… while revalidate handling., a=testonly

Automatic update from web-platform-tests
Reland add tentative WPT tests for stale while revalidate handling.

Add test to ensure that handling the fetch doesn't trigger stale
while revalidate loading.

Add test to ensure that scripts and css loaded trigger a stale
while revalidate cache hit.

The PR for the spec changes is here:
whatwg/fetch#853

This reland removes the resource timing and moves to css (instead of
images) which were both unreliable.

BUG=348877

Change-Id: Ibabd8d3fd0295bedc8259594fc926da6ab5cfc43
Reviewed-on: https://chromium-review.googlesource.com/c/1434776
Commit-Queue: Dave Tapuska <dtapuskachromium.org>
Reviewed-by: Ben Kelly <wanderviewchromium.org>
Cr-Commit-Position: refs/heads/master{#626264}

--

wpt-commits: f8a34bc8fa3a9451717c974108d677e319243ded
wpt-pr: 15047

UltraBlame original commit: 53cc2cd5c20c298cc1d7b855d0053fe58856bc10
  • Loading branch information
marco-c committed Oct 3, 2019
1 parent 5b345c9 commit 932865b
Show file tree
Hide file tree
Showing 7 changed files with 2,170 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<
!
DOCTYPE
html
>
<
!
-
-
-
Tentative
test
against
:
https
:
/
/
github
.
com
/
whatwg
/
fetch
/
pull
/
853
-
-
>
<
meta
charset
=
"
utf
-
8
"
>
<
title
>
Tests
Stale
While
Revalidate
is
not
executed
for
fetch
API
<
/
title
>
<
script
src
=
"
/
resources
/
testharness
.
js
"
>
<
/
script
>
<
script
src
=
"
/
resources
/
testharnessreport
.
js
"
>
<
/
script
>
<
script
>
promise_test
(
async
(
test
)
=
>
{
const
response
=
await
fetch
(
stale
-
script
.
py
)
;
const
response2
=
await
fetch
(
stale
-
script
.
py
)
;
assert_not_equals
(
response
.
headers
.
get
(
'
Token
'
)
response2
.
headers
.
get
(
'
Token
'
)
)
;
}
'
Second
fetch
does
not
return
same
response
'
)
;
<
/
script
>
192 changes: 192 additions & 0 deletions testing/web-platform/tests/fetch/stale-while-revalidate/stale-css.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
def
main
(
request
response
)
:

cookie
=
request
.
cookies
.
first
(
"
Count
"
None
)

count
=
0

if
cookie
!
=
None
:

count
=
int
(
cookie
.
value
)

if
request
.
GET
.
first
(
"
query
"
None
)
!
=
None
:

headers
=
[
(
"
Count
"
count
)
]

content
=
"
"

return
200
headers
content

else
:

count
=
count
+
1

content
=
"
body
{
background
:
rgb
(
0
128
0
)
;
}
"

if
count
>
1
:

content
=
"
body
{
background
:
rgb
(
255
0
0
)
;
}
"

headers
=
[
(
"
Content
-
Type
"
"
text
/
css
"
)

(
"
Set
-
Cookie
"
"
Count
=
{
}
"
.
format
(
count
)
)

(
"
Cache
-
Control
"
"
private
max
-
age
=
0
stale
-
while
-
revalidate
=
10
"
)
]

return
200
headers
content
Loading

0 comments on commit 932865b

Please sign in to comment.