While debugging why my service worker (sw.js
) gets loaded twice when I reload the page that registered it (that's background, not the question) I notice in the 'Initiator' column in Chrome dev tools the initiator is given as: sw.js:-infinity
.
What does :-infinity
mean in this context?
While debugging why my service worker (sw.js
) gets loaded twice when I reload the page that registered it (that's background, not the question) I notice in the 'Initiator' column in Chrome dev tools the initiator is given as: sw.js:-infinity
.
What does :-infinity
mean in this context?
- 7 Looks like a bug. It's a line number. – woxxom Commented Oct 13, 2017 at 14:26
- 1 Regarding why the services loaded twice, It has to do with Chrome Bug which still exist as of now. Experiencing the same Source – Savano Miatama Commented Feb 14, 2020 at 4:35
3 Answers
Reset to default 2I think this is a Chrome bug because:
Infinity is a numerical value representing positive infinity. -Infinity is a numeric value that represents negative infinity. Infinity is displayed when the number exceeds the upper limit of floating point numbers, which is equal to 1,779693134862315E + 308.
Likely a bug with Chrome. Some potential reasons(?):
- Web Workers (Which service workers are a subset of) run on a different thread, so it may cause issues when Chrome tries to get the line number.
infinity
is a JavaScript keyword, so Chrome Developer tools may be written in HTML/CSS/JS, and JS is weird to begin with.
I had this issue when I had set the css property 'background-image' to 'url("#")' (via a js variable). To fix it, I changed the js code so that the variable holds the whole css property, rather than just the URL - so it is initialised to 'none' (rather than '#'), and set to 'url(...)' when there is a valid URL to set it to.