Strict warnings as errors has been a continuous source of pain for the
devtools team. Substantial areas of our code area currently not strict
warning free.
The reason this leads to problems is that the way the werror flag is
propagated makes no sense: it is a context wide flag, which individual
scripts inherit from the context in which they are first compiled. To
give you an idea how this leads to problems: werror is enabled by
default for the main context in xpcshell tests, but disabled for the
context used to JSMs. As a result, a single line patch like this:
https://pastebin.mozilla.org/5084279
causes strict warnings as errors to be enabled for the entire debugger
server: the "devtools/server/actors/script" module depends on the
"devtools/server/main" module which is also loaded by dbg-server.jsm in
the line below. But since our CommonJS loader caches modules, the JSM
now gets the cached version of "devtools/server/main" which was loaded
in the main context, instead of the version loaded in the JSM's context,
which is what happened before this patch.
Needless to say, it's often impossible to predict what changes to the
code cause strict warnings as errors to be enabled, and when it does
happen, it's often very hard to ascertain what change caused it.
One could argue that we should simply fix all strict errors as we run
into them, but this is a huge time drain in and of itself. For instance,
it turns out that all the xpcshell tests for the debugger server are
broken in the sense that they pass a string representing an error
message as the last argument to the the testing functions, whereas
xpcshell expects this to be a stack object. Because the tests are
broken, if you accidentally turn on strict warnings as errors, this
breaks error reporting in xpcshell itself, because it's trying to use a
string as a stack object.
I would like to propose that we get rid of strict warnings as errors for
xpcshell tests. To quote Nick Fitzgerald: "The
strict-warnings-as-an-error feels like having some arbitrary linter
forced upon our development that isn't very useful.". Achieving strict
warning free code is not a goal for us, and I doubt it is for anyone else.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform