diff --git a/dom/media/webspeech/synth/moz.build b/dom/media/webspeech/synth/moz.build index de03c2fc4a4a..4a2eae08e783 100644 --- a/dom/media/webspeech/synth/moz.build +++ b/dom/media/webspeech/synth/moz.build @@ -41,8 +41,6 @@ if CONFIG['MOZ_WEBSPEECH']: 'test/nsFakeSynthServices.cpp' ] - DIRS = [] - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': DIRS += ['windows'] diff --git a/python/mozbuild/mozbuild/frontend/sandbox.py b/python/mozbuild/mozbuild/frontend/sandbox.py index 0ae8e30daefb..9f2666f8c51b 100644 --- a/python/mozbuild/mozbuild/frontend/sandbox.py +++ b/python/mozbuild/mozbuild/frontend/sandbox.py @@ -286,6 +286,10 @@ class Sandbox(dict): if key in self._context and self._context[key] is not value: raise KeyError('global_ns', 'reassign', key) + if (key not in self._context and isinstance(value, (list, dict)) + and not value): + raise KeyError('Variable %s assigned an empty value.' % key) + self._context[key] = value else: dict.__setitem__(self, key, value) diff --git a/python/mozbuild/mozbuild/test/frontend/data/reader-error-empty-list/moz.build b/python/mozbuild/mozbuild/test/frontend/data/reader-error-empty-list/moz.build new file mode 100644 index 000000000000..fc4ce0217978 --- /dev/null +++ b/python/mozbuild/mozbuild/test/frontend/data/reader-error-empty-list/moz.build @@ -0,0 +1,5 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +DIRS = [] diff --git a/python/mozbuild/mozbuild/test/frontend/test_reader.py b/python/mozbuild/mozbuild/test/frontend/test_reader.py index 730588b71823..d50a0658354a 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_reader.py +++ b/python/mozbuild/mozbuild/test/frontend/test_reader.py @@ -11,8 +11,10 @@ import unittest from mozunit import main from mozbuild.frontend.context import BugzillaComponent -from mozbuild.frontend.reader import BuildReaderError -from mozbuild.frontend.reader import BuildReader +from mozbuild.frontend.reader import ( + BuildReaderError, + BuildReader, +) from mozbuild.test.common import MockConfig @@ -246,6 +248,15 @@ class TestBuildReader(unittest.TestCase): contexts = list(reader.read_topsrcdir()) + def test_error_empty_list(self): + reader = self.reader('reader-error-empty-list') + + with self.assertRaises(BuildReaderError) as bre: + list(reader.read_topsrcdir()) + + e = bre.exception + self.assertIn('Variable DIRS assigned an empty value.', str(e)) + def test_inheriting_variables(self): reader = self.reader('inheriting-variables')