tosdr/browser-extensions

Extension crashes Firefox when trying to find ToS;DR for tosdr.org

Closed this issue · 5 comments

When I attempt to open the extension while on tosdr.org, Firefox crashes.

Hm, which version of Firefox do you have?
I use Firefox 63 on Ubuntu, and I didn't see it crash, but I did see a spinnner that did not disappear like it should:
screenshot from 2018-12-10 09-51-34

I'm using Firefox 63.0.3 on Mac. I also get the spinner, but once I click off or close the pop-up, it instantly crashes.

I also just updated to Firefox 64 to check if that fixed the issue, but it still crashes.

This is caused by invoking an invalid CSS selector due to the semicolon in the ToS;DR service name concatenated in the query selector expressions used with jQuery in popup.js

I encounter this on the Chrome extension on this page: https://edit.tosdr.org/
It's likely the same issue with Firefox.

Screen Shot 2019-06-08 at 14 50 27


As an example: try to run this query selector command in plain JS in any page to observe the error.

document.querySelector('#popup-point-ToS;DR-4518')

// VM26:1 Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '#popup-point-ToS;DR-4518' is not a valid selector.
//    at <anonymous>:1:10

The getServiceDetails() promise does not catch the error thrown by tosdrPoint(), so the popup document remains stuck in the "loading" state.

Perhaps the serviceName should be sanitized when generating the element ID & querying for it. Or maybe dropping the serviceName altogether from the element ID if there's no real need for that distinction in the popup.html. The dataPoint.id should suffice to serve as a unique ID that's unique per service and services shown one at a time in the popup, right?

Fixed in 89e5689