Closed Bug 663500 Opened 13 years ago Closed 13 years ago

Consider using ECMAScript 5 strict mode

Categories

(Tree Management Graveyard :: TBPL, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mstange, Assigned: mstange)

References

Details

Attachments

(3 files)

This might catch some bugs faster (e.g. bug 663498).
Are there any arguments against using it?
Attached patch storage -> window.storage (deleted) — Splinter Review
We set storage without declaring it with "var". I'm not sure what's better, adding var or using window.storage to make it clear that we're adding a global variable... what do you think?
Attachment #538579 - Flags: review?(arpad.borsos)
Attached patch delete window.tinderbox_data (deleted) — Splinter Review
Attachment #538580 - Flags: review?(arpad.borsos)
Are there any arguments against using it?
Other than the fact that this might break something because I haven't tested all code paths, there are not many arguments against doing it :)
Attachment #538581 - Flags: review?(arpad.borsos)
Comment on attachment 538579 [details] [diff] [review] storage -> window.storage Review of attachment 538579 [details] [diff] [review]: ----------------------------------------------------------------- Using var makes it only valid in the containing .js file, right? I think window is the way forward. As it is a workaround for window.localStorage.
Attachment #538579 - Flags: review?(arpad.borsos) → review+
Comment on attachment 538581 [details] [diff] [review] add "use strict"; everywhere and move inTag function to top level I just realized that I didn't separate the inTag change. Strict mode only allows function definitions at the top (function) level, not nested in a loop.
Attachment #538581 - Attachment description: add "use strict"; everywhere → add "use strict"; everywhere and move inTag function to top level
Comment on attachment 538580 [details] [diff] [review] delete window.tinderbox_data Review of attachment 538580 [details] [diff] [review]: ----------------------------------------------------------------- Damn midair collisions :-D
Attachment #538580 - Flags: review?(arpad.borsos) → review+
Comment on attachment 538581 [details] [diff] [review] add "use strict"; everywhere and move inTag function to top level Review of attachment 538581 [details] [diff] [review]: -----------------------------------------------------------------
Attachment #538581 - Flags: review?(arpad.borsos) → review+
(In reply to comment #6) > Using var makes it only valid in the containing .js file, right? No, it's actually the same as setting the property on the global object (window), as far as I know. I don't have a JS spec link ready to prove it, though...
Depends on: 669062
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: Webtools → Tree Management
Product: Tree Management → Tree Management Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: