using a relative or invalid path in clients.openWindow() should throw a TypeError

RESOLVED INVALID

Status

()

defect
RESOLVED INVALID
4 years ago
3 years ago

People

(Reporter: edwong, Assigned: wchen)

Tracking

(Blocks 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

Reporter

Description

4 years ago
1. go here: https://people.mozilla.org/~ewong2/push-notification-test/
2. unregister if SW already exists and refresh
3. select sw-focus-bug.js then install, subscribe, then xhr
4. click on the notification

actual: you should see a TypeError caught or printed to browser console.

expected: no exception
Reporter

Comment 1

4 years ago
spec says:
https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#clients

Let url be the result of parsing url with entry settings object's API base URL.
If url is failure, return a promise rejected with a TypeError.
If url is about:blank, return a promise rejected with a TypeError.
If this algorithm is not allowed to show a popup, return a promise rejected with an "InvalidAccessError" exception.
William said he'd get to this so assigning to him.
Assignee: nobody → wchen
Assignee

Comment 3

4 years ago
This bug looks invalid. The test script has a couple bugs, I get a reference error after clicking on the notification and the script also calls client.focus with a URL argument, but that function doesn't take a URL argument. The steps you have listed in comment 1 are from the openWindow algorithm but the script doesn't call that anywhere.

We do return TypeError for invalid URLs:

http://hg.mozilla.org/mozilla-central/file/c5cb194cc9cb/dom/workers/ServiceWorkerClients.cpp#l733
http://hg.mozilla.org/mozilla-central/file/c5cb194cc9cb/dom/workers/ServiceWorkerClients.cpp#l582

I tested this by trying to openWindow on "about:blank" and an invalid URL ("http://[invalid"), in both cases I got TypeError.

Updated

3 years ago
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.