最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What does :-infinity mean in Initiator column of Chrome dev tools - Stack Overflow

programmeradmin3浏览0评论

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?

Share Improve this question edited Mar 1, 2020 at 6:20 Boaventura 1,4091 gold badge12 silver badges31 bronze badges asked Oct 13, 2017 at 14:18 BitterjugBitterjug 4694 silver badges9 bronze badges 2
  • 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
Add a ment  | 

3 Answers 3

Reset to default 2

I 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.

发布评论

评论列表(0)

  1. 暂无评论