Skip to content
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

Service worker: Tests for updateViaCache (previously useCache) #5515

Merged
merged 9 commits into from
Aug 2, 2017

Conversation

jakearchibald
Copy link
Contributor

@jakearchibald jakearchibald commented Apr 8, 2017

No description provided.

@wpt-pr-bot
Copy link
Collaborator

Notifying @ehsan, @mattto, and @mkruisselbrink. (Learn how reviewing works.)

@jakearchibald
Copy link
Contributor Author

+@wanderview

@jakearchibald
Copy link
Contributor Author

Generating the tests in a loop seemed like the simplest way forward here. Meant I could write the tests fairly linearly without abstracting a lot. But I can look at changing it if it's too confusing.

Also, yay async functions!

@w3c-bots
Copy link

w3c-bots commented Apr 8, 2017

View the complete job log.

Firefox (nightly channel)

Testing web-platform-tests at revision d5a1e32
Using browser at version BuildID 20170409194145; SourceStamp 45692c884fdd5136a64fb2f8a61a0c8183b69331
Starting 10 test iterations
All results were stable

All results

1 test ran
/service-workers/service-worker/registration-updateviacache.https.html
Subtest Results Messages
OK
register-with-updateViaCache-undefined FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-imports FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-all PASS
register-with-updateViaCache-never FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-undefined-then-undefined PASS
register-with-updateViaCache-undefined-then-imports PASS
register-with-updateViaCache-undefined-then-all FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-undefined-then-never FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-imports-then-undefined PASS
register-with-updateViaCache-imports-then-imports PASS
register-with-updateViaCache-imports-then-all FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-imports-then-never FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-all-then-undefined FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-all-then-imports FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-all-then-all PASS
register-with-updateViaCache-all-then-never FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-never-then-undefined FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-never-then-imports FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-never-then-all FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-never-then-never PASS

@w3c-bots
Copy link

w3c-bots commented Apr 8, 2017

View the complete job log.

Chrome (unstable channel)

Testing web-platform-tests at revision d5a1e32
Using browser at version 59.0.3063.4 dev
Starting 10 test iterations
All results were stable

All results

1 test ran
/service-workers/service-worker/registration-updateviacache.https.html
Subtest Results Messages
OK
register-with-updateViaCache-undefined FAIL assert_equals: Imported script should be the same expected 1491839494.75 but got 1491839494.65;assert_equals: Imported script should be the same expected 1491839491 but got 1491839490.9;assert_equals: Imported script should be the same expected 1491839480.29 but got 1491839480.2;assert_equals: Imported script should be the same expected 1491839472.81 but got 1491839472.71;assert_equals: Imported script should be the same expected 1491839487.31 but got 1491839487.21;assert_equals: Imported script should be the same expected 1491839505.95 but got 1491839505.84;assert_equals: Imported script should be the same expected 1491839498.43 but got 1491839498.33;assert_equals: Imported script should be the same expected 1491839476.5 but got 1491839476.4;assert_equals: Imported script should be the same expected 1491839502.23 but got 1491839502.14;assert_equals: Imported script should be the same expected 1491839483.59 but got 1491839483.5
register-with-updateViaCache-imports FAIL assert_equals: Imported script should be the same expected 1491839487.51 but got 1491839487.41;assert_equals: Imported script should be the same expected 1491839494.94 but got 1491839494.85;assert_equals: Imported script should be the same expected 1491839476.69 but got 1491839476.6;assert_equals: Imported script should be the same expected 1491839498.62 but got 1491839498.53;assert_equals: Imported script should be the same expected 1491839506.14 but got 1491839506.05;assert_equals: Imported script should be the same expected 1491839483.79 but got 1491839483.69;assert_equals: Imported script should be the same expected 1491839502.42 but got 1491839502.33;assert_equals: Imported script should be the same expected 1491839480.49 but got 1491839480.39;assert_equals: Imported script should be the same expected 1491839473.01 but got 1491839472.91;assert_equals: Imported script should be the same expected 1491839491.2 but got 1491839491.11
register-with-updateViaCache-all FAIL assert_equals: No new service worker expected null but got object "[object ServiceWorker]"
register-with-updateViaCache-never PASS
register-with-updateViaCache-undefined-then-undefined PASS
register-with-updateViaCache-undefined-then-imports PASS
register-with-updateViaCache-undefined-then-all FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-undefined-then-never FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-imports-then-undefined PASS
register-with-updateViaCache-imports-then-imports PASS
register-with-updateViaCache-imports-then-all FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-imports-then-never FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-all-then-undefined FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-all-then-imports FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-all-then-all PASS
register-with-updateViaCache-all-then-never FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-never-then-undefined FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-never-then-imports FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-never-then-all FAIL assert_true: New worker installing expected true got false
register-with-updateViaCache-never-then-never PASS

@w3c-bots
Copy link

w3c-bots commented Apr 8, 2017

These tests are now available on w3c-test.org

@jakearchibald
Copy link
Contributor Author

The failing tests (in Chrome & Firefox) are as-expected.

@wanderview
Copy link
Member

We actually have a wpt for the cache changes written, but not uplifted yet. Sorry if there was duplicate work making this test. We can either keep both or just this one. I'll talk to Ho-Pang about it Monday.

@jakearchibald
Copy link
Contributor Author

Ah, sorry! Anyway, I'll let you pick whichever & I promise not to be offended. 😆

@wanderview
Copy link
Member

No problem! The test here has the benefit of being run against chrome to check for flakiness. Our wpt uplift process is lacking that step.

Copy link
Contributor

@hopanghsu hopanghsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jake,

The code is arranged elegantly! I left some questions in the comments. In addition to those, I think it might be a good idea to check whether updatefound is dispatched when there should be a new service worker, but I have no strong preference on this.

await reg.update();

if (updateViaCache == 'all') {
assert_equals(sw.installing, undefined, "No new service worker");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By sw.installing, are we referring to reg.installing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops! Good catch.

@jakearchibald
Copy link
Contributor Author

@hopanghsu what's the benefit of checking updatefound here? The test already checks if there's been an update.

@wanderview
Copy link
Member

what's the benefit of checking updatefound here?

Just because the spec requires firing one? Maybe that's covered by a different test.

@jakearchibald
Copy link
Contributor Author

@wanderview yeah, my feeling is it's unrelated to this test.

@jakearchibald
Copy link
Contributor Author

I've resolved the merge conflicts. Are we good to merge this?

@w3c-bots
Copy link

w3c-bots commented May 13, 2017

*This report has been truncated because the total content is 1004931 characters in length, which is in excess of github.com's limit for comments (65536 characters).

View the complete job log.

Firefox (nightly)

Testing web-platform-tests at revision d58ea82
Using browser at version BuildID 20170612100241; SourceStamp 27cad9749cddf68e11fdd4e5d73dad84a8f8cf23
Starting 10 test iterations
All results were stable

All results

2 tests ran
/html/dom/reflection-metadata.html
Subtest Results Messages
OK
head.title: typeof IDL attribute PASS
head.title: IDL get with DOM attribute unset PASS
head.title: setAttribute() to "" PASS
head.title: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.title: setAttribute() to undefined PASS
head.title: setAttribute() to 7 PASS
head.title: setAttribute() to 1.5 PASS
head.title: setAttribute() to true PASS
head.title: setAttribute() to false PASS
head.title: setAttribute() to object "[object Object]" PASS
head.title: setAttribute() to NaN PASS
head.title: setAttribute() to Infinity PASS
head.title: setAttribute() to -Infinity PASS
head.title: setAttribute() to "\0" PASS
head.title: setAttribute() to null PASS
head.title: setAttribute() to object "test-toString" PASS
head.title: setAttribute() to object "test-valueOf" PASS
head.title: IDL set to "" PASS
head.title: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.title: IDL set to undefined PASS
head.title: IDL set to 7 PASS
head.title: IDL set to 1.5 PASS
head.title: IDL set to true PASS
head.title: IDL set to false PASS
head.title: IDL set to object "[object Object]" PASS
head.title: IDL set to NaN PASS
head.title: IDL set to Infinity PASS
head.title: IDL set to -Infinity PASS
head.title: IDL set to "\0" PASS
head.title: IDL set to null PASS
head.title: IDL set to object "test-toString" PASS
head.title: IDL set to object "test-valueOf" PASS
head.lang: typeof IDL attribute PASS
head.lang: IDL get with DOM attribute unset PASS
head.lang: setAttribute() to "" PASS
head.lang: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.lang: setAttribute() to undefined PASS
head.lang: setAttribute() to 7 PASS
head.lang: setAttribute() to 1.5 PASS
head.lang: setAttribute() to true PASS
head.lang: setAttribute() to false PASS
head.lang: setAttribute() to object "[object Object]" PASS
head.lang: setAttribute() to NaN PASS
head.lang: setAttribute() to Infinity PASS
head.lang: setAttribute() to -Infinity PASS
head.lang: setAttribute() to "\0" PASS
head.lang: setAttribute() to null PASS
head.lang: setAttribute() to object "test-toString" PASS
head.lang: setAttribute() to object "test-valueOf" PASS
head.lang: IDL set to "" PASS
head.lang: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.lang: IDL set to undefined PASS
head.lang: IDL set to 7 PASS
head.lang: IDL set to 1.5 PASS
head.lang: IDL set to true PASS
head.lang: IDL set to false PASS
head.lang: IDL set to object "[object Object]" PASS
head.lang: IDL set to NaN PASS
head.lang: IDL set to Infinity PASS
head.lang: IDL set to -Infinity PASS
head.lang: IDL set to "\0" PASS
head.lang: IDL set to null PASS
head.lang: IDL set to object "test-toString" PASS
head.lang: IDL set to object "test-valueOf" PASS
head.dir: typeof IDL attribute PASS
head.dir: IDL get with DOM attribute unset PASS
head.dir: setAttribute() to "" PASS
head.dir: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.dir: setAttribute() to undefined PASS
head.dir: setAttribute() to 7 PASS
head.dir: setAttribute() to 1.5 PASS
head.dir: setAttribute() to true PASS
head.dir: setAttribute() to false PASS
head.dir: setAttribute() to object "[object Object]" PASS
head.dir: setAttribute() to NaN PASS
head.dir: setAttribute() to Infinity PASS
head.dir: setAttribute() to -Infinity PASS
head.dir: setAttribute() to "\0" PASS
head.dir: setAttribute() to null PASS
head.dir: setAttribute() to object "test-toString" PASS
head.dir: setAttribute() to object "test-valueOf" PASS
head.dir: setAttribute() to "ltr" PASS
head.dir: setAttribute() to "xltr" PASS
head.dir: setAttribute() to "ltr\0" PASS
head.dir: setAttribute() to "tr" PASS
head.dir: setAttribute() to "LTR" PASS
head.dir: setAttribute() to "rtl" PASS
head.dir: setAttribute() to "xrtl" PASS
head.dir: setAttribute() to "rtl\0" PASS
head.dir: setAttribute() to "tl" PASS
head.dir: setAttribute() to "RTL" PASS
head.dir: setAttribute() to "auto" PASS
head.dir: setAttribute() to "xauto" PASS
head.dir: setAttribute() to "auto\0" PASS
head.dir: setAttribute() to "uto" PASS
head.dir: setAttribute() to "AUTO" PASS
head.dir: IDL set to "" PASS
head.dir: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.dir: IDL set to undefined PASS
head.dir: IDL set to 7 PASS
head.dir: IDL set to 1.5 PASS
head.dir: IDL set to true PASS
head.dir: IDL set to false PASS
head.dir: IDL set to object "[object Object]" PASS
head.dir: IDL set to NaN PASS
head.dir: IDL set to Infinity PASS
head.dir: IDL set to -Infinity PASS
head.dir: IDL set to "\0" PASS
head.dir: IDL set to null PASS
head.dir: IDL set to object "test-toString" PASS
head.dir: IDL set to object "test-valueOf" PASS
head.dir: IDL set to "ltr" PASS
head.dir: IDL set to "xltr" PASS
head.dir: IDL set to "ltr\0" PASS
head.dir: IDL set to "tr" PASS
head.dir: IDL set to "LTR" PASS
head.dir: IDL set to "rtl" PASS
head.dir: IDL set to "xrtl" PASS
head.dir: IDL set to "rtl\0" PASS
head.dir: IDL set to "tl" PASS
head.dir: IDL set to "RTL" PASS
head.dir: IDL set to "auto" PASS
head.dir: IDL set to "xauto" PASS
head.dir: IDL set to "auto\0" PASS
head.dir: IDL set to "uto" PASS
head.dir: IDL set to "AUTO" PASS
head.className (<head class>): typeof IDL attribute PASS
head.className (<head class>): IDL get with DOM attribute unset PASS
head.className (<head class>): setAttribute() to "" PASS
head.className (<head class>): setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.className (<head class>): setAttribute() to undefined PASS
head.className (<head class>): setAttribute() to 7 PASS
head.className (<head class>): setAttribute() to 1.5 PASS
head.className (<head class>): setAttribute() to true PASS
head.className (<head class>): setAttribute() to false PASS
head.className (<head class>): setAttribute() to object "[object Object]" PASS
head.className (<head class>): setAttribute() to NaN PASS
head.className (<head class>): setAttribute() to Infinity PASS
head.className (<head class>): setAttribute() to -Infinity PASS
head.className (<head class>): setAttribute() to "\0" PASS
head.className (<head class>): setAttribute() to null PASS
head.className (<head class>): setAttribute() to object "test-toString" PASS
head.className (<head class>): setAttribute() to object "test-valueOf" PASS
head.className (<head class>): IDL set to "" PASS
head.className (<head class>): IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.className (<head class>): IDL set to undefined PASS
head.className (<head class>): IDL set to 7 PASS
head.className (<head class>): IDL set to 1.5 PASS
head.className (<head class>): IDL set to true PASS
head.className (<head class>): IDL set to false PASS
head.className (<head class>): IDL set to object "[object Object]" PASS
head.className (<head class>): IDL set to NaN PASS
head.className (<head class>): IDL set to Infinity PASS
head.className (<head class>): IDL set to -Infinity PASS
head.className (<head class>): IDL set to "\0" PASS
head.className (<head class>): IDL set to null PASS
head.className (<head class>): IDL set to object "test-toString" PASS
head.className (<head class>): IDL set to object "test-valueOf" PASS
head.hidden: typeof IDL attribute PASS
head.hidden: IDL get with DOM attribute unset

@w3c-bots
Copy link

w3c-bots commented May 13, 2017

*This report has been truncated because the total content is 1004862 characters in length, which is in excess of github.com's limit for comments (65536 characters).

View the complete job log.

Chrome (unstable)

Testing web-platform-tests at revision d58ea82
Using browser at version 61.0.3135.4 dev
Starting 10 test iterations
All results were stable

All results

2 tests ran
/html/dom/reflection-metadata.html
Subtest Results Messages
OK
head.title: typeof IDL attribute PASS
head.title: IDL get with DOM attribute unset PASS
head.title: setAttribute() to "" PASS
head.title: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.title: setAttribute() to undefined PASS
head.title: setAttribute() to 7 PASS
head.title: setAttribute() to 1.5 PASS
head.title: setAttribute() to true PASS
head.title: setAttribute() to false PASS
head.title: setAttribute() to object "[object Object]" PASS
head.title: setAttribute() to NaN PASS
head.title: setAttribute() to Infinity PASS
head.title: setAttribute() to -Infinity PASS
head.title: setAttribute() to "\0" PASS
head.title: setAttribute() to null PASS
head.title: setAttribute() to object "test-toString" PASS
head.title: setAttribute() to object "test-valueOf" PASS
head.title: IDL set to "" PASS
head.title: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.title: IDL set to undefined PASS
head.title: IDL set to 7 PASS
head.title: IDL set to 1.5 PASS
head.title: IDL set to true PASS
head.title: IDL set to false PASS
head.title: IDL set to object "[object Object]" PASS
head.title: IDL set to NaN PASS
head.title: IDL set to Infinity PASS
head.title: IDL set to -Infinity PASS
head.title: IDL set to "\0" PASS
head.title: IDL set to null PASS
head.title: IDL set to object "test-toString" PASS
head.title: IDL set to object "test-valueOf" PASS
head.lang: typeof IDL attribute PASS
head.lang: IDL get with DOM attribute unset PASS
head.lang: setAttribute() to "" PASS
head.lang: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.lang: setAttribute() to undefined PASS
head.lang: setAttribute() to 7 PASS
head.lang: setAttribute() to 1.5 PASS
head.lang: setAttribute() to true PASS
head.lang: setAttribute() to false PASS
head.lang: setAttribute() to object "[object Object]" PASS
head.lang: setAttribute() to NaN PASS
head.lang: setAttribute() to Infinity PASS
head.lang: setAttribute() to -Infinity PASS
head.lang: setAttribute() to "\0" PASS
head.lang: setAttribute() to null PASS
head.lang: setAttribute() to object "test-toString" PASS
head.lang: setAttribute() to object "test-valueOf" PASS
head.lang: IDL set to "" PASS
head.lang: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.lang: IDL set to undefined PASS
head.lang: IDL set to 7 PASS
head.lang: IDL set to 1.5 PASS
head.lang: IDL set to true PASS
head.lang: IDL set to false PASS
head.lang: IDL set to object "[object Object]" PASS
head.lang: IDL set to NaN PASS
head.lang: IDL set to Infinity PASS
head.lang: IDL set to -Infinity PASS
head.lang: IDL set to "\0" PASS
head.lang: IDL set to null PASS
head.lang: IDL set to object "test-toString" PASS
head.lang: IDL set to object "test-valueOf" PASS
head.dir: typeof IDL attribute PASS
head.dir: IDL get with DOM attribute unset PASS
head.dir: setAttribute() to "" PASS
head.dir: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.dir: setAttribute() to undefined PASS
head.dir: setAttribute() to 7 PASS
head.dir: setAttribute() to 1.5 PASS
head.dir: setAttribute() to true PASS
head.dir: setAttribute() to false PASS
head.dir: setAttribute() to object "[object Object]" PASS
head.dir: setAttribute() to NaN PASS
head.dir: setAttribute() to Infinity PASS
head.dir: setAttribute() to -Infinity PASS
head.dir: setAttribute() to "\0" PASS
head.dir: setAttribute() to null PASS
head.dir: setAttribute() to object "test-toString" PASS
head.dir: setAttribute() to object "test-valueOf" PASS
head.dir: setAttribute() to "ltr" PASS
head.dir: setAttribute() to "xltr" PASS
head.dir: setAttribute() to "ltr\0" PASS
head.dir: setAttribute() to "tr" PASS
head.dir: setAttribute() to "LTR" PASS
head.dir: setAttribute() to "rtl" PASS
head.dir: setAttribute() to "xrtl" PASS
head.dir: setAttribute() to "rtl\0" PASS
head.dir: setAttribute() to "tl" PASS
head.dir: setAttribute() to "RTL" PASS
head.dir: setAttribute() to "auto" PASS
head.dir: setAttribute() to "xauto" PASS
head.dir: setAttribute() to "auto\0" PASS
head.dir: setAttribute() to "uto" PASS
head.dir: setAttribute() to "AUTO" PASS
head.dir: IDL set to "" PASS
head.dir: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.dir: IDL set to undefined PASS
head.dir: IDL set to 7 PASS
head.dir: IDL set to 1.5 PASS
head.dir: IDL set to true PASS
head.dir: IDL set to false PASS
head.dir: IDL set to object "[object Object]" PASS
head.dir: IDL set to NaN PASS
head.dir: IDL set to Infinity PASS
head.dir: IDL set to -Infinity PASS
head.dir: IDL set to "\0" PASS
head.dir: IDL set to null PASS
head.dir: IDL set to object "test-toString" PASS
head.dir: IDL set to object "test-valueOf" PASS
head.dir: IDL set to "ltr" PASS
head.dir: IDL set to "xltr" PASS
head.dir: IDL set to "ltr\0" PASS
head.dir: IDL set to "tr" PASS
head.dir: IDL set to "LTR" PASS
head.dir: IDL set to "rtl" PASS
head.dir: IDL set to "xrtl" PASS
head.dir: IDL set to "rtl\0" PASS
head.dir: IDL set to "tl" PASS
head.dir: IDL set to "RTL" PASS
head.dir: IDL set to "auto" PASS
head.dir: IDL set to "xauto" PASS
head.dir: IDL set to "auto\0" PASS
head.dir: IDL set to "uto" PASS
head.dir: IDL set to "AUTO" PASS
head.className (<head class>): typeof IDL attribute PASS
head.className (<head class>): IDL get with DOM attribute unset PASS
head.className (<head class>): setAttribute() to "" PASS
head.className (<head class>): setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.className (<head class>): setAttribute() to undefined PASS
head.className (<head class>): setAttribute() to 7 PASS
head.className (<head class>): setAttribute() to 1.5 PASS
head.className (<head class>): setAttribute() to true PASS
head.className (<head class>): setAttribute() to false PASS
head.className (<head class>): setAttribute() to object "[object Object]" PASS
head.className (<head class>): setAttribute() to NaN PASS
head.className (<head class>): setAttribute() to Infinity PASS
head.className (<head class>): setAttribute() to -Infinity PASS
head.className (<head class>): setAttribute() to "\0" PASS
head.className (<head class>): setAttribute() to null PASS
head.className (<head class>): setAttribute() to object "test-toString" PASS
head.className (<head class>): setAttribute() to object "test-valueOf" PASS
head.className (<head class>): IDL set to "" PASS
head.className (<head class>): IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.className (<head class>): IDL set to undefined PASS
head.className (<head class>): IDL set to 7 PASS
head.className (<head class>): IDL set to 1.5 PASS
head.className (<head class>): IDL set to true PASS
head.className (<head class>): IDL set to false PASS
head.className (<head class>): IDL set to object "[object Object]" PASS
head.className (<head class>): IDL set to NaN PASS
head.className (<head class>): IDL set to Infinity PASS
head.className (<head class>): IDL set to -Infinity PASS
head.className (<head class>): IDL set to "\0" PASS
head.className (<head class>): IDL set to null PASS
head.className (<head class>): IDL set to object "test-toString" PASS
head.className (<head class>): IDL set to object "test-valueOf" PASS
head.hidden: typeof IDL attribute PASS
head.hidden: IDL get with DOM attribute unset PASS

@w3c-bots
Copy link

w3c-bots commented Jun 5, 2017

*This report has been truncated because the total content is 999898 characters in length, which is in excess of github.com's limit for comments (65536 characters).

View the complete job log.

Sauce (safari)

Testing web-platform-tests at revision d58ea82
Using browser at version 10.0
Starting 10 test iterations
All results were stable

All results

2 tests ran
/html/dom/reflection-metadata.html
Subtest Results Messages
OK
head.title: typeof IDL attribute PASS
head.title: IDL get with DOM attribute unset PASS
head.title: setAttribute() to "" PASS
head.title: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.title: setAttribute() to undefined PASS
head.title: setAttribute() to 7 PASS
head.title: setAttribute() to 1.5 PASS
head.title: setAttribute() to true PASS
head.title: setAttribute() to false PASS
head.title: setAttribute() to object "[object Object]" PASS
head.title: setAttribute() to NaN PASS
head.title: setAttribute() to Infinity PASS
head.title: setAttribute() to -Infinity PASS
head.title: setAttribute() to "\0" PASS
head.title: setAttribute() to null PASS
head.title: setAttribute() to object "test-toString" PASS
head.title: setAttribute() to object "test-valueOf" PASS
head.title: IDL set to "" PASS
head.title: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.title: IDL set to undefined PASS
head.title: IDL set to 7 PASS
head.title: IDL set to 1.5 PASS
head.title: IDL set to true PASS
head.title: IDL set to false PASS
head.title: IDL set to object "[object Object]" PASS
head.title: IDL set to NaN PASS
head.title: IDL set to Infinity PASS
head.title: IDL set to -Infinity PASS
head.title: IDL set to "\0" PASS
head.title: IDL set to null PASS
head.title: IDL set to object "test-toString" PASS
head.title: IDL set to object "test-valueOf" PASS
head.lang: typeof IDL attribute PASS
head.lang: IDL get with DOM attribute unset PASS
head.lang: setAttribute() to "" PASS
head.lang: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.lang: setAttribute() to undefined PASS
head.lang: setAttribute() to 7 PASS
head.lang: setAttribute() to 1.5 PASS
head.lang: setAttribute() to true PASS
head.lang: setAttribute() to false PASS
head.lang: setAttribute() to object "[object Object]" PASS
head.lang: setAttribute() to NaN PASS
head.lang: setAttribute() to Infinity PASS
head.lang: setAttribute() to -Infinity PASS
head.lang: setAttribute() to "\0" PASS
head.lang: setAttribute() to null PASS
head.lang: setAttribute() to object "test-toString" PASS
head.lang: setAttribute() to object "test-valueOf" PASS
head.lang: IDL set to "" PASS
head.lang: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.lang: IDL set to undefined PASS
head.lang: IDL set to 7 PASS
head.lang: IDL set to 1.5 PASS
head.lang: IDL set to true PASS
head.lang: IDL set to false PASS
head.lang: IDL set to object "[object Object]" PASS
head.lang: IDL set to NaN PASS
head.lang: IDL set to Infinity PASS
head.lang: IDL set to -Infinity PASS
head.lang: IDL set to "\0" PASS
head.lang: IDL set to null PASS
head.lang: IDL set to object "test-toString" PASS
head.lang: IDL set to object "test-valueOf" PASS
head.dir: typeof IDL attribute PASS
head.dir: IDL get with DOM attribute unset PASS
head.dir: setAttribute() to "" PASS
head.dir: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.dir: setAttribute() to undefined PASS
head.dir: setAttribute() to 7 PASS
head.dir: setAttribute() to 1.5 PASS
head.dir: setAttribute() to true PASS
head.dir: setAttribute() to false PASS
head.dir: setAttribute() to object "[object Object]" PASS
head.dir: setAttribute() to NaN PASS
head.dir: setAttribute() to Infinity PASS
head.dir: setAttribute() to -Infinity PASS
head.dir: setAttribute() to "\0" PASS
head.dir: setAttribute() to null PASS
head.dir: setAttribute() to object "test-toString" PASS
head.dir: setAttribute() to object "test-valueOf" PASS
head.dir: setAttribute() to "ltr" PASS
head.dir: setAttribute() to "xltr" PASS
head.dir: setAttribute() to "ltr\0" PASS
head.dir: setAttribute() to "tr" PASS
head.dir: setAttribute() to "LTR" PASS
head.dir: setAttribute() to "rtl" PASS
head.dir: setAttribute() to "xrtl" PASS
head.dir: setAttribute() to "rtl\0" PASS
head.dir: setAttribute() to "tl" PASS
head.dir: setAttribute() to "RTL" PASS
head.dir: setAttribute() to "auto" PASS
head.dir: setAttribute() to "xauto" PASS
head.dir: setAttribute() to "auto\0" PASS
head.dir: setAttribute() to "uto" PASS
head.dir: setAttribute() to "AUTO" PASS
head.dir: IDL set to "" PASS
head.dir: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.dir: IDL set to undefined PASS
head.dir: IDL set to 7 PASS
head.dir: IDL set to 1.5 PASS
head.dir: IDL set to true PASS
head.dir: IDL set to false PASS
head.dir: IDL set to object "[object Object]" PASS
head.dir: IDL set to NaN PASS
head.dir: IDL set to Infinity PASS
head.dir: IDL set to -Infinity PASS
head.dir: IDL set to "\0" PASS
head.dir: IDL set to null PASS
head.dir: IDL set to object "test-toString" PASS
head.dir: IDL set to object "test-valueOf" PASS
head.dir: IDL set to "ltr" PASS
head.dir: IDL set to "xltr" PASS
head.dir: IDL set to "ltr\0" PASS
head.dir: IDL set to "tr" PASS
head.dir: IDL set to "LTR" PASS
head.dir: IDL set to "rtl" PASS
head.dir: IDL set to "xrtl" PASS
head.dir: IDL set to "rtl\0" PASS
head.dir: IDL set to "tl" PASS
head.dir: IDL set to "RTL" PASS
head.dir: IDL set to "auto" PASS
head.dir: IDL set to "xauto" PASS
head.dir: IDL set to "auto\0" PASS
head.dir: IDL set to "uto" PASS
head.dir: IDL set to "AUTO" PASS
head.className (<head class>): typeof IDL attribute PASS
head.className (<head class>): IDL get with DOM attribute unset PASS
head.className (<head class>): setAttribute() to "" PASS
head.className (<head class>): setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.className (<head class>): setAttribute() to undefined PASS
head.className (<head class>): setAttribute() to 7 PASS
head.className (<head class>): setAttribute() to 1.5 PASS
head.className (<head class>): setAttribute() to true PASS
head.className (<head class>): setAttribute() to false PASS
head.className (<head class>): setAttribute() to object "[object Object]" PASS
head.className (<head class>): setAttribute() to NaN PASS
head.className (<head class>): setAttribute() to Infinity PASS
head.className (<head class>): setAttribute() to -Infinity PASS
head.className (<head class>): setAttribute() to "\0" PASS
head.className (<head class>): setAttribute() to null PASS
head.className (<head class>): setAttribute() to object "test-toString" PASS
head.className (<head class>): setAttribute() to object "test-valueOf" PASS
head.className (<head class>): IDL set to "" PASS
head.className (<head class>): IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " PASS
head.className (<head class>): IDL set to undefined PASS
head.className (<head class>): IDL set to 7 PASS
head.className (<head class>): IDL set to 1.5 PASS
head.className (<head class>): IDL set to true PASS
head.className (<head class>): IDL set to false PASS
head.className (<head class>): IDL set to object "[object Object]" PASS
head.className (<head class>): IDL set to NaN PASS
head.className (<head class>): IDL set to Infinity PASS
head.className (<head class>): IDL set to -Infinity PASS
head.className (<head class>): IDL set to "\0" PASS
head.className (<head class>): IDL set to null PASS
head.className (<head class>): IDL set to object "test-toString" PASS
head.className (<head class>): IDL set to object "test-valueOf" PASS
head.hidden: typeof IDL attribute PASS
head.hidden: IDL get with DOM attribute unset PASS

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather an implementer (like @mkruisselbrink?) review the actual processing model parts of the tests, but only one minor comment on the reflection part.

scope: "string",
updateViaCache: {
type: "enum",
keywords: ["imports", "all", "none"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll want to add defaultVal here too.

This is used by http://w3c-test.org/html/dom/reflection-metadata.html

jungkees pushed a commit to w3c/ServiceWorker that referenced this pull request Jun 7, 2017
 Changing useCache boolean to updateViaCache enum

Issue: #1104.
Tests: web-platform-tests/wpt#5515.
HTML change: whatwg/html@b5fcec0.
@domenic
Copy link
Member

domenic commented Jun 12, 2017

Reflection tests LGTM but would like LGTM from someone else on the actual semantics tests.

@mfalken
Copy link
Member

mfalken commented Jun 13, 2017

Thanks for the tests! The discussion here seems relevant: https://groups.google.com/a/chromium.org/d/msg/net-dev/wbhbSn9ICfc/XDmCkpboAAAJ

The conclusion there was that browser caching behaviors cannot be tested in WPTs, because caching is a SHOULD.

@wanderview
Copy link
Member

The conclusion there was that browser caching behaviors cannot be tested in WPTs, because caching is a SHOULD.

Is there an actual compat issue that we expect to prevent these tests passing in currently implementing browsers?

I would prefer to keep the tests and if a browser wants to deviate from the SHOULD language they can internally mark the test as disabled/expected-fail/etc.

@mfalken
Copy link
Member

mfalken commented Jun 14, 2017

OK. It makes sense to me that WPT tests can test SHOULDs. Sounds good.

return new Promise(r => setTimeout(r, ms));
}

function waitForActivated(sw) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use wait_for_state(t, sw, 'activated')

<script>
const updateViaCacheValues = [undefined, 'imports', 'all', 'none'];
const scriptUrl = 'resources/update-max-aged-worker.py';
const scope = 'resources/blank.html';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make clear they are global constants, could we name these globals like kUpdateViaCacheValues, kScope or else UPDATE_VIA_CACHE_VALUES, SCOPE, etc?

});
}

function registerViaApi(scriptUrl, opts) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little confusing that this param is the same name as the global |scriptUrl|.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was fixed by renaming the global

);

const sw = reg.installing || reg.waiting || reg.active;
if (!sw) console.log(reg);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this console.log()? It tends to pollute test results. Should it just be an assert() instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops!

assert_not_equals(values.mainTime, newValues.mainTime, "Main script should have updated");
assert_equals(values.importTime, newValues.importTime, "Imported script should be the same");
}
else { // 'none'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be more clear: // updateViaCache == 'none'

assert_not_equals(values.mainTime, newValues.mainTime, "Main script should have updated");
assert_equals(values.importTime, newValues.importTime, "Imported script should be the same");
}
else { // 'none'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as line 167

return reg;
}

await wait(100);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The polling with timeout is a bit unfortunate, it puts a bound on how fast the test can run (100ms per test adds up for hundreds of tests). A similar test, register-link-element.https.html, just waits for link.onload. Could we just do that here?

return reg;
}

await wait(100);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

register-link-header.https.html uses an iframe and navigator.serviceWorker.ready. Could we do that here instead?


await navigator.serviceWorker.register(fullScriptUrl, opts);

// If there's no change, register should be a no-op.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bit subtle for me. Recommend saying "If there's no change to the updateViaCache value"

}
}

// Testing changing registration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Test changing the updateViaCache value of an existing registration.

[registerViaLinkHeader, 'via-link-header']
];

// Testing creating registrations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

service worker WPT tests tend to follow Chromium Style Guide for comments, so this would take the form:
// Test creating registrations.
(imperative form + full stop)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL, thanks!

@mfalken
Copy link
Member

mfalken commented Jun 21, 2017

Jake do you want to continue with this PR? Is it ok if we take what's here now and work on it in a Chromium codereview as we're trying to implement?

@jakearchibald
Copy link
Contributor Author

@mattto I'll address your comments now. Apologies for the (usual) slowness, was out conferencing last week.

@jakearchibald
Copy link
Contributor Author

jakearchibald commented Jun 21, 2017

@mattto Done! Thanks for the feedback

Copy link
Member

@mfalken mfalken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test! lgtm, thanks!

const fullScope = new URL(opts.scope, window.location).href;
scriptUrl = new URL(scriptUrl, location).href;

// Assuming that if this isn't supported, the header isn't
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Sort of looks like the sentence got cut-off mid-sentence. "Assume that if the link element doesn't support serviceworker, the header doesn't either." ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow, now you point it out, that comment was really badly written. Fixed with your suggestion.

@mfalken
Copy link
Member

mfalken commented Jun 22, 2017

Thanks! Can we get this reviewed and committed so our implementation can use it (@mkruisselbrink)?

There is a linter error above:
service-workers/service-worker/registration-updateviacache.https.html:21: setTimeout used; step_timeout should typically be used instead (SET TIMEOUT)

Copy link
Contributor

@hopanghsu hopanghsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi all, and sorry for jumping in here. I am currently working on the related implementation, and I found something we might want to change.


// If there's no change to the updateViaCache value, register should be a no-op.
// The default value should behave as 'imports'.
if ((updateViaCache1 || 'imports') == (updateViaCache2 || 'imports')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we want to do this when (updateViaCache2 == 'all'), since it cannot pass the byte-check and thus there won't be a new service worker in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, good catch. Because we ignore the byte-check when the script URL changes, I thought we'd do the same here. But it doesn't make sense to, and we don't 😄

assert_equals(values.mainTime, newValues.mainTime, "Main script should be the same");
assert_equals(values.importTime, newValues.importTime, "Imported script should be the same");
}
else if (updateViaCache2 == 'imports') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should explicitly handle the default case, updateViaCache2 == undefined. Otherwise, it goes to the else branch.

assert_true(!!newWorker, "New worker installing");
const newValues = await getScriptTimes(newWorker, testName);

if (updateViaCache2 == 'all') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there shouldn't be a newly created service worker, we don't have to check anything here.

@jakearchibald
Copy link
Contributor Author

@hopanghsu Don't apologise, thanks for the great feedback! Should be addressed now.

@mattto I've addressed that linting issue (the setTimeout was in a no-longer-used function anyway)

I've also added tests for reg.updateViaCache.

Copy link
Member

@wanderview wanderview left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rs+ based on previous review comments being addressed.

@jgraham jgraham merged commit 7bc0d47 into web-platform-tests:master Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants