Closed
Bug 927035
Opened 11 years ago
Closed 11 years ago
Don't use Date.now() as an ID
Categories
(DevTools :: Console, defect, P3)
DevTools
Console
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 28
People
(Reporter: Dolske, Assigned: lpy)
Details
(Whiteboard: [good first bug][lang=js][mentor=benvie][qa-])
Attachments
(1 file, 2 obsolete files)
1.73 KB,
patch
|
lpy
:
review+
|
Details | Diff | Splinter Review |
We've fixed a number of bugs (bug 925771, bug 586153, bug 578589) that were a result of using Date.now() as an identifier. The problem is that Date.now() can return the same value if called again in a sufficiently short period of time. [In the past Windows was the worst, as the result only changed ~60Hz]. I just noticed this is being used in devtools: browser/devtools/webconsole/hudservice.js 300 function WebConsole(aTarget, aIframeWindow, aChromeWindow) 301 { 302 this.iframeWindow = aIframeWindow; 303 this.chromeWindow = aChromeWindow; 304 this.hudId = "hud_" + Date.now(); Looks like this is a module, so should be trivial to change it to use a simple static counter. (Alternatively, something like nsIUUIDGenerator would be adequate overkill.)
Updated•11 years ago
|
Component: Developer Tools → Developer Tools: Console
Updated•11 years ago
|
Whiteboard: [good first bug][lang=js][mentor=benvie]
Updated•11 years ago
|
Priority: -- → P3
Assignee | ||
Comment 1•11 years ago
|
||
replace it with nsIUUIDGenerator
Assignee: nobody → pylaurent1314
Attachment #8336656 -
Flags: review?(bbenvie)
Comment 2•11 years ago
|
||
Can we please use a static counter? |hudId = "hud_" + (++gHudId)| where gHudId is a global variable. nsIUUIDGenerator is overkill for webconsole's needs.
Assignee | ||
Comment 3•11 years ago
|
||
Thank you msucan.
Attachment #8336656 -
Attachment is obsolete: true
Attachment #8336656 -
Flags: review?(bbenvie)
Assignee | ||
Updated•11 years ago
|
Attachment #8336786 -
Flags: review?(bbenvie)
Comment 4•11 years ago
|
||
Comment on attachment 8336786 [details] [diff] [review] bug927035.patch Review of attachment 8336786 [details] [diff] [review]: ----------------------------------------------------------------- Looks good, just one small nit. ::: browser/devtools/webconsole/hudservice.js @@ +302,5 @@ > function WebConsole(aTarget, aIframeWindow, aChromeWindow) > { > this.iframeWindow = aIframeWindow; > this.chromeWindow = aChromeWindow; > + this.hudId = "hud_" + (++gHudId); Nit: No need to parenthesize this.
Attachment #8336786 -
Flags: review?(bbenvie) → review+
Comment 5•11 years ago
|
||
For good measure: https://tbpl.mozilla.org/?tree=Try&rev=da5e3c671bd7
Assignee | ||
Comment 6•11 years ago
|
||
Attachment #8336786 -
Attachment is obsolete: true
Attachment #8338153 -
Flags: review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 7•11 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/0aeb98afb35d
Keywords: checkin-needed
Whiteboard: [good first bug][lang=js][mentor=benvie] → [good first bug][lang=js][mentor=benvie][fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/0aeb98afb35d
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [good first bug][lang=js][mentor=benvie][fixed-in-fx-team] → [good first bug][lang=js][mentor=benvie]
Target Milestone: --- → Firefox 28
Updated•10 years ago
|
Whiteboard: [good first bug][lang=js][mentor=benvie] → [good first bug][lang=js][mentor=benvie][qa-]
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•