Closed Bug 1180861 Opened 9 years ago Closed 9 years ago

"Harness status: OK" + failing tests when running "registration.https.html" test

Categories

(Testing :: web-platform-tests, defect)

defect
Not set
normal

Tracking

(firefox42 affected, firefox43 fixed)

RESOLVED FIXED
mozilla43
Tracking Status
firefox42 --- affected
firefox43 --- fixed

People

(Reporter: noemi, Assigned: nsm)

References

Details

Attachments

(1 file)

Checked with 7/6 master build

Test run such as |./mach web-platform-tests _mozilla/service-workers/service-worker/registration.https.html|

Result:
* Harness status: OK
* Found 34 tests
* 17 Pass
* 17 Fail:
** Registering non-existent script
*** assert_throws: Registration of non-existent script should fail. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException NetworkError: property "code" is equal to 0, expected 19
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:89:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:85:1 
** Registering invalid chunked encoding script
*** assert_throws: Registration of invalid chunked encoding script should fail. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException NetworkError: property "code" is equal to 0, expected 19
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:98:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:94:1 
** Registering invalid chunked encoding script with flush
*** assert_throws: Registration of invalid chunked encoding script should fail. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException NetworkError: property "code" is equal to 0, expected 19
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:107:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:103:1 
** Registering script with no MIME type
*** assert_throws: Registration of no MIME type script should fail. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException SecurityError: property "code" is equal to 0, expected 18
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:116:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:112:1 
** Registering script with bad MIME type
*** assert_throws: Registration of plain text script should fail. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException SecurityError: property "code" is equal to 0, expected 18
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:125:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:121:1 
** Registering redirected script
*** assert_throws: Registration of redirected script should fail. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException SecurityError: property "code" is equal to 0, expected 18
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:135:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:130:1 
** Registering script including parse error
*** assert_throws: Registration of script including parse error should fail. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException AbortError: property "code" is equal to 0, expected 20
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:144:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:140:1 
** Registering script including undefined error
*** assert_throws: Registration of script including undefined error should fail. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException AbortError: property "code" is equal to 0, expected 20
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:153:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:149:1 
** Registering script including uncaught exception
*** assert_throws: Registration of script including uncaught exception should fail. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException AbortError: property "code" is equal to 0, expected 20
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:162:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:158:1 
** Registering script including caught exception
*** promise_test: Unhandled rejection with value: object "TypeError: The expression cannot be converted to return t..."
@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:167:1 
** Registering script importing malformed script
*** assert_throws: Registration of script importing malformed script should fail. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException AbortError: property "code" is equal to 0, expected 20
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:182:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:178:1 
** Registering script importing non-existent script
*** assert_throws: Registration of script importing non-existent script should fail. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException AbortError: property "code" is equal to 0, expected 20
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:191:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:187:1 
** Script URL including URL-encoded slash
*** assert_throws: URL-encoded slash in the script URL should be rejected. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException SecurityError: property "code" is equal to 0, expected 18
** URL-encoded slash
*** assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:230:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:226:1 
** Script URL including URL-encoded slash
*** assert_throws: URL-encoded slash in the script URL should be rejected. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException SecurityError: property "code" is equal to 0, expected 18
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:230:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:226:1 
** Scope including URL-encoded slash
*** promise_test: Unhandled rejection with value: "assert_promise_rejects: URL-encoded slash in the scope should be rejected. Promise did not reject."
@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:235:1 
** Script URL including URL-encoded backslash
*** assert_throws: URL-encoded backslash in the script URL should be rejected. function "function () { throw e; }" threw object "TypeError: The expression cannot be converted to return t..." that is not a DOMException SecurityError: property "code" is equal to 0, expected 18
assert_promise_rejects/<@https://web-platform.test:8443/_mozilla/service-workers/service-worker/resources/testharness-helpers.js:30:9 Promise*@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:248:1 Test.prototype.step@https://web-platform.test:8443/resources/testharness.js:1363:20 promise_test@https://web-platform.test:8443/resources/testharness.js:520:25 @https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:244:1 
** Scope including URL-encoded backslash
*** promise_test: Unhandled rejection with value: "assert_promise_rejects: URL-encoded backslash in the scope should be rejected. Promise did not reject."
@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:253:1 
** Script URL including parent-reference
*** promise_test: Unhandled rejection with value: object "TypeError: registration.installing is null"
@https://web-platform.test:8443/_mozilla/service-workers/service-worker/registration.https.html:288:1 
* Traces: https://pastebin.mozilla.org/8838626
Summary: "Harness status: OK" + failing tests when running wpt "registration.https.html" test → "Harness status: OK" + failing tests when running "registration.https.html" test
Component: DOM: Service Workers → web-platform-tests
Product: Core → Testing
Andrea, if the slashes patch failed due to some tests here, I can fold it into this bug.
Flags: needinfo?(amarchesini)
Bug 1180861 - Various ServiceWorker registration fixes to get test passing. r?bkelly,jgraham.

This commit implements the following changes to get registration.https.html working.
1) Fail with NS_ERROR_DOM_SECURITY_ERR where the spec requires it.
2) Propagate JSExnType to ServiceWorkerManager::HandleError() so that a JS
   exception object with the correct .name can be created.
3) Fail with security error on redirect failure.
4) Check fetched script's mimetype.
5) Add missing python server files for web-platform-tests.
6) Update web-platform-tests expected data.
7) Several tests have been changed to use TypeError or more appropriate JS
   errors based on my reading of the spec.
Attachment #8650189 - Flags: review?(james)
Attachment #8650189 - Flags: review?(bkelly)
Comment on attachment 8650189 [details]
MozReview Request: Bug 1180861 - Various ServiceWorker registration fixes to get test passing. r?bkelly,jgraham.

https://reviewboard.mozilla.org/r/16567/#review14825

::: testing/web-platform/mozilla/tests/service-workers/service-worker/resources/mime-type-worker.py:1
(Diff revision 1)
> +# Based on Blink's mime-type-worker.php

This comment isn't really needed.

::: testing/web-platform/mozilla/tests/service-workers/service-worker/resources/redirect.py:2
(Diff revision 1)
> +    if 'Status' in request.GET:

"status" here, or "Status" below
Attachment #8650189 - Flags: review?(james)
(In reply to Nikhil Marathe [:nsm] (please needinfo?) from comment #1)
> Andrea, if the slashes patch failed due to some tests here, I can fold it
> into this bug.

Let's see how stable it is. I just pushed it to m-i.
Flags: needinfo?(amarchesini)
https://reviewboard.mozilla.org/r/16565/#review14969

::: dom/workers/ServiceWorkerContainer.cpp:113
(Diff revision 1)
> -    return NS_ERROR_FAILURE;
> +    return NS_ERROR_DOM_SECURITY_ERR;

I can't find where the spec says this.  In register() the spec says:

  1. Let scriptURL be the result of parsing scriptURL with entry settings object's API base URL.
  2. If scriptURL is failure, return a promise rejected with a TypeError.
  3. If any of the strings in scriptURL's path contains either ASCII case-insensitive "%2f" or ASCII case-insensitive "%5c", return a promise rejected with a TypeError.

Both parse and escaped slash errors result in TypeError.

::: testing/web-platform/mozilla/tests/service-workers/service-worker/registration.https.html:95
(Diff revision 1)
>      var script = 'resources/invalid-chunked-encoding.py';

Where is the invalid-chunked-encoding.py script?

::: testing/web-platform/mozilla/tests/service-workers/service-worker/registration.https.html:99
(Diff revision 1)
> -        'NetworkError',
> +        new TypeError(),

Can you point to the part of the spec that says chunked encoding is not allowed and what should be returned?  I can't find it.

::: testing/web-platform/mozilla/tests/service-workers/service-worker/registration.https.html:104
(Diff revision 1)
>      var script = 'resources/invalid-chunked-encoding-with-flush.py';

invalid-chuncked-encoding-with-flush.py is also missing.

::: testing/web-platform/mozilla/tests/service-workers/service-worker/registration.https.html:163
(Diff revision 1)
> -        'AbortError',
> +        new Error(),

You could fill in an Error() value in malformed-worker.py and then match it here.
Attachment #8650189 - Flags: review?(bkelly)
https://reviewboard.mozilla.org/r/16565/#review14969

> I can't find where the spec says this.  In register() the spec says:
> 
>   1. Let scriptURL be the result of parsing scriptURL with entry settings object's API base URL.
>   2. If scriptURL is failure, return a promise rejected with a TypeError.
>   3. If any of the strings in scriptURL's path contains either ASCII case-insensitive "%2f" or ASCII case-insensitive "%5c", return a promise rejected with a TypeError.
> 
> Both parse and escaped slash errors result in TypeError.

This is actually for the last two tests in registration.https.html where they pass invalid urls (same-origin filesystem urls). But reading the secure contexts spec (https://w3c.github.io/webappsec/specs/powerfulfeatures/#is-origin-trustworthy) I'm not confused about what to do here.

> Where is the invalid-chunked-encoding.py script?

right, will add this.

> invalid-chuncked-encoding-with-flush.py is also missing.

and this
https://reviewboard.mozilla.org/r/16565/#review14969

> Can you point to the part of the spec that says chunked encoding is not allowed and what should be returned?  I can't find it.

There is nothing explicitly forbidding it, but since the spec uses fetch() to retrieve SW scripts and fetch does not support chunked until we can have streams, it is impossible for a correct SW to be retrieved if a server sends chunked encoding.

That said, this test only passes for us because it sends an invalid script, so we could actually support it right now and have the test pass. How should we proceed? Explicitly disallow chunked on the channel or accept it for now and remove this test?
https://reviewboard.mozilla.org/r/16565/#review14969

> There is nothing explicitly forbidding it, but since the spec uses fetch() to retrieve SW scripts and fetch does not support chunked until we can have streams, it is impossible for a correct SW to be retrieved if a server sends chunked encoding.
> 
> That said, this test only passes for us because it sends an invalid script, so we could actually support it right now and have the test pass. How should we proceed? Explicitly disallow chunked on the channel or accept it for now and remove this test?

Ah... I was wrong. Neither the spec nor us preclude chunked scripts. What this is checking for is *invalid chunking*. The test script sends data that is not a valid HTTP/1.1 chunked encoding. So this test is correct and we should keep it.
(In reply to Nikhil Marathe [:nsm] (please needinfo?) from comment #8)
> https://reviewboard.mozilla.org/r/16565/#review14969
> 
> > I can't find where the spec says this.  In register() the spec says:
> > 
> >   1. Let scriptURL be the result of parsing scriptURL with entry settings object's API base URL.
> >   2. If scriptURL is failure, return a promise rejected with a TypeError.
> >   3. If any of the strings in scriptURL's path contains either ASCII case-insensitive "%2f" or ASCII case-insensitive "%5c", return a promise rejected with a TypeError.
> > 
> > Both parse and escaped slash errors result in TypeError.
> 
> This is actually for the last two tests in registration.https.html where
> they pass invalid urls (same-origin filesystem urls). But reading the secure
> contexts spec
> (https://w3c.github.io/webappsec/specs/powerfulfeatures/#is-origin-
> trustworthy) I'm not confused about what to do here.

I meant "I am confused" of course.
Patch provided by Nikhil so assigning this bug to him. Please feel free to change it if needed. Thanks!
Assignee: nobody → nsm.nikhil
Status: NEW → ASSIGNED
url:        https://hg.mozilla.org/integration/mozilla-inbound/rev/e1d8c2010f8346935cfcfc5b6c3586b4a3efe4c8
changeset:  e1d8c2010f8346935cfcfc5b6c3586b4a3efe4c8
user:       Nikhil Marathe <nsm.nikhil@gmail.com>
date:       Wed Aug 19 16:21:25 2015 -0700
description:
Bug 1180861 - Various ServiceWorker registration fixes to get test passing. r=bkelly,jgraham.

This commit implements the following changes to get registration.https.html working.
1) Fail with NS_ERROR_DOM_SECURITY_ERR where the spec requires it.
2) Propagate JSExnType to ServiceWorkerManager::HandleError() so that a JS
   exception object with the correct .name can be created.
3) Fail with security error on redirect failure.
4) Check fetched script's mimetype.
5) Add missing python server files for web-platform-tests.
6) Update web-platform-tests expected data.
7) Several tests have been changed to use TypeError or more appropriate JS
   errors based on my reading of the spec.
https://hg.mozilla.org/mozilla-central/rev/e1d8c2010f83
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Hi,

just checked on m-c (fea87cbeaa6b revision) and the tests successfully run. Thanks for fixing it!.

Summary

Harness status: OK

Found 34 tests
34 Pass
Details
Result	Test Name
Pass	Registering normal scope	
Pass	Registering scope with fragment	
Pass	Registering same scope as the script directory	
Pass	Registering same scope as the script directory without the last slash	
Pass	Registration scope outside the script directory	
Pass	Registering scope outside domain	
Pass	Registering script outside domain	
Pass	Registering non-existent script	
Pass	Registering invalid chunked encoding script	
Pass	Registering invalid chunked encoding script with flush	
Pass	Registering script with no MIME type	
Pass	Registering script with bad MIME type	
Pass	Registering redirected script	
Pass	Registering script including parse error	
Pass	Registering script including undefined error	
Pass	Registering script including uncaught exception	
Pass	Registering script including caught exception	
Pass	Registering script importing malformed script	
Pass	Registering script importing non-existent script	
Pass	Scope including URL-encoded multibyte characters	
Pass	Scope including non-escaped multibyte characters	
Pass	Script URL including URL-encoded slash	
Pass	Scope including URL-encoded slash	
Pass	Script URL including URL-encoded backslash	
Pass	Scope including URL-encoded backslash	
Pass	Script URL including self-reference	
Pass	Scope including self-reference	
Pass	Script URL including parent-reference	
Pass	Scope including parent-reference	
Pass	Scope including parent-reference and not under the script directory	
Pass	Script URL including consecutive slashes	
Pass	Scope including consecutive slashes	
Pass	Script URL is same-origin filesystem: URL	
Pass	Scope URL is same-origin filesystem: URL
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: