Closed
Bug 1490448
Opened 6 years ago
Closed 6 years ago
make Thunderbird's mozmill tests run in JS strict mode
Categories
(Thunderbird :: Testing Infrastructure, enhancement)
Thunderbird
Testing Infrastructure
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 64.0
People
(Reporter: aceman, Assigned: aceman)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
142.62 KB,
patch
|
jorgk-bmo
:
review+
|
Details | Diff | Splinter Review |
53.63 KB,
patch
|
jorgk-bmo
:
review+
|
Details | Diff | Splinter Review |
It was found in bug 1474219 that Thunderbird's mozmill tests do not run in Javascript strict mode so there is less code checking by the JS engine. Let's see if it is possible to enable strict mode to catch more problems in future, like changed interfaces and calls to no longer existing objects.
This adds the "use strict" directive into all test files so that they run in JS strict mode. Probably not much to see here.
Attachment #9009719 -
Flags: review?(jorgk)
Comment 2•6 years ago
|
||
Comment on attachment 9009719 [details] [diff] [review] 1490448-strict.patch Indeed, not terribly good reading.
Attachment #9009719 -
Flags: review?(jorgk) → review+
This fixes problems found by the strict mode, without which the tests would be aborted due to JS TypeErrors and similar. Mostly just undeclared variables. The "var global = this" playes are discussed with arai. It is interesting that non-strict mode didn't warn about the assignment to a read-only crashreporter.enabled. This is probably the only real bug that the strict mode has found. Both patches must be landed together, the "fixes" on top of "strict". Successful try run here: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=56d76e12648d1cd1e4e2d04d3152b6d4467c5005
Attachment #9009722 -
Flags: review?(jorgk)
Comment 5•6 years ago
|
||
Comment on attachment 9009722 [details] [diff] [review] 1490448-fixes.patch Review of attachment 9009722 [details] [diff] [review]: ----------------------------------------------------------------- Not so exiting and quite a bit of boy-scout clean-up ;-) The change you discussed with Tooru (:arai) isn't immediately obvious, what were the errors? ::: mail/test/mozmill/folder-display/test-right-click-middle-click-folders.js @@ -237,2 @@ > function _generate_background_foreground_tests(aTests) { > - let self = this; That's the normal way to do these things, no? Were there strict errors that mandated the change? I don't think it's much more legible now. What did the helperFunc.apply() do?
Attachment #9009722 -
Flags: review?(jorgk) → review+
(In reply to Jorg K (GMT+2) from comment #5) > Comment on attachment 9009722 [details] [diff] [review] > 1490448-fixes.patch > > Review of attachment 9009722 [details] [diff] [review]: > ----------------------------------------------------------------- > > Not so exiting and quite a bit of boy-scout clean-up ;-) Not that much, only at places which already had an error. E.g. sometimes instead of declaring a variable I chose to remove it (or rename it), which could cause some churn. > ::: mail/test/mozmill/folder-display/test-right-click-middle-click-folders.js > @@ -237,2 @@ > > function _generate_background_foreground_tests(aTests) { > > - let self = this; > > That's the normal way to do these things, no? Were there strict errors that > mandated the change? I don't think it's much more legible now. What did the > helperFunc.apply() do? Yes, error "this is undefined; can't access its "_middle_click_folder_with_nothing_selected_helper" property at: nonesuch line 240", seen e.g. at https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&selectedJob=199581192&revision=d8f9c93e5dedc6678ede26c8955df4dc03f122c2 From arai: arai: `this` inside a function is the value that is used when calling the function arai: `this` at the toplevel is the global object We weren't passing anything into the function so 'this' was undefined. Another way to fix this would be to call the generating function with .apply(this); (the top level 'this'). .apply() calls the function by specifying this and arguments (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply). I removed that as it seems we do not need 'this' inside the generated functions, so it could be simplified.
Pushed by mozilla@jorgk.com: https://hg.mozilla.org/comm-central/rev/2977f7b7b8d6 force strict JS mode in MozMill tests. r=jorgk https://hg.mozilla.org/comm-central/rev/4769902c580e fix problems found by JS strict mode in MozMill tests. r=jorgk CLOSED TREE
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Target Milestone: --- → Thunderbird 64.0
You need to log in
before you can comment on or make changes to this bug.
Description
•