Firefox throws TypeError for invalid URLs #4595

Closed
filoozom opened this Issue Nov 21, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@filoozom

This issue only occurs on Firefox, and works as expected in all the other browsers I tried.
When you try to replicate to an invalid URL, you get an error on

err.message = reason;
:

TypeError: setting a property that has only a getter

console.log(err); gives something like :

Exception { message: "", result: 2152398858, name: "NS_ERROR_MALFORMED_URI", filename: "http://cdn.jsdelivr.net/pouchdb/lat…", lineNumber: 9, columnNumber: 0, inner: null, data: null, stack: "i@http://cdn.jsdelivr.net/pouchdb/l…" }

You can replicate the error on Firefox by providing an invalid URL, like :

PouchDB('test').replicate.to('http:///')

@filoozom filoozom referenced this issue in angular-pouchdb/angular-pouchdb Dec 3, 2015

Closed

Update PouchDB to ~5.1.0 #82

@nolanlawson nolanlawson changed the title from Firefox: TypeError on replication error to Firefox throws TypeError for invalid URLs Dec 13, 2015

@nolanlawson

This comment has been minimized.

Show comment
Hide comment
@nolanlawson

nolanlawson Dec 13, 2015

Member

This is a good first-timers bug, because it should be very very easy to reproduce since you kindly provided the one-liner test case:

new PouchDB('test').replicate.to('http:///')

If anybody wants to take this up, they are more than welcome. Presumably you would just need to add a test to one of our integration tests (I recommend test.basics.js), then follow the instructions in TESTING.md to run the tests, and then fix the issue. It should throw an error, but the error should be the same in all browsers and should be something useful to users (e.g. "Your URL is invalid").

Member

nolanlawson commented Dec 13, 2015

This is a good first-timers bug, because it should be very very easy to reproduce since you kindly provided the one-liner test case:

new PouchDB('test').replicate.to('http:///')

If anybody wants to take this up, they are more than welcome. Presumably you would just need to add a test to one of our integration tests (I recommend test.basics.js), then follow the instructions in TESTING.md to run the tests, and then fix the issue. It should throw an error, but the error should be the same in all browsers and should be something useful to users (e.g. "Your URL is invalid").

@daedlock

This comment has been minimized.

Show comment
Hide comment
@daedlock

daedlock Dec 26, 2015

Contributor

@nolanlawson, I am working on closing this issue. I added url validation in replicate.to and replicate.from that throws an error on invalid urls. The problem is some tests fail because they are using invalid urls for replication and yet the error gets thrown. Please advise

Contributor

daedlock commented Dec 26, 2015

@nolanlawson, I am working on closing this issue. I added url validation in replicate.to and replicate.from that throws an error on invalid urls. The problem is some tests fail because they are using invalid urls for replication and yet the error gets thrown. Please advise

daedlock added a commit to daedlock/pouchdb that referenced this issue Dec 26, 2015

daedlock added a commit to daedlock/pouchdb that referenced this issue Dec 26, 2015

daedlock added a commit to daedlock/pouchdb that referenced this issue Dec 26, 2015

daedlock added a commit to daedlock/pouchdb that referenced this issue Dec 30, 2015

(#4595) - Catch xhr errors and propagate
- Reject Promise
- Emit error event

daedlock added a commit to daedlock/pouchdb that referenced this issue Dec 30, 2015

(#4595) - Catch xhr errors and propagate
- Reject Promise
- Emit error event

nolanlawson added a commit that referenced this issue Dec 30, 2015

(#4595) - Catch xhr errors and propagate
- Reject Promise
- Emit error event
@nolanlawson

This comment has been minimized.

Show comment
Hide comment
@nolanlawson

nolanlawson Dec 30, 2015

Member

fixed by d3aa2c9

Member

nolanlawson commented Dec 30, 2015

fixed by d3aa2c9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment