Closed Bug 1230624 Opened 9 years ago Closed 8 years ago

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

Categories

(Core :: DOM: Push Subscriptions, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: edwong, Assigned: wchen)

References

(Blocks 1 open bug)

Details

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
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
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.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.