jhen0409 / react-chrome-extension-boilerplate

Boilerplate for Chrome Extension React.js project
MIT License
2.14k stars 388 forks source link

Fix matching urls to inject #11

Closed zalmoxisus closed 8 years ago

zalmoxisus commented 8 years ago

The previous condition impose that the tab.url matches all the urls, which will never be true if we have more than one value in arrowUrls.

jhen0409 commented 8 years ago

Thanks! but it will match example http://example.com/#https://github.com URL.

I think use new RegExp('^(' + arrowURLs.join('|') + ')') will be better, can you update it? :D

zalmoxisus commented 8 years ago

Yes, I missed that, and \., otherwise it would match, for example https://github-com.com. Wouldn't it be better to ad ^ in the arrowURLs to be more flexible? Like const arrowURLs = [ '^https://github\\.com' ].

And I guess new RegExp could be removed as it was before. From match documentation:

If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj).

jhen0409 commented 8 years ago

@zalmoxisus ok! :) We can use regex in arrowURLs.