Skip to content

Commit c6269c3

Browse files
bobowenmoz-wptsync-bot
authored andcommitted
Add Ahem font to allow list when installed by wptrunner.
This also renames the white list variables in the associated test files to allow list. The pref name is not so straight forward to change. Differential Revision: https://phabricator.services.mozilla.com/D207962 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1892399 gecko-commit: c889e3972268157ead34b8a9af88bd8e95b2ea74 gecko-reviewers: jgraham
1 parent 528d480 commit c6269c3

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

tools/wptrunner/wptrunner/browsers/firefox.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ def browser_kwargs(logger, test_type, run_info_data, config, subsuite, **kwargs)
132132
"headless": kwargs["headless"],
133133
"preload_browser": kwargs["preload_browser"] and not kwargs["pause_after_test"] and not kwargs["num_test_groups"] == 1,
134134
"specialpowers_path": kwargs["specialpowers_path"],
135+
"allow_list_paths": kwargs["allow_list_paths"],
135136
"debug_test": kwargs["debug_test"]}
136137
if test_type == "wdspec" and kwargs["binary"]:
137138
browser_kwargs["webdriver_args"].extend(["--binary", kwargs["binary"]])
@@ -644,7 +645,8 @@ def __call__(self, line):
644645
class ProfileCreator:
645646
def __init__(self, logger, prefs_root, config, test_type, extra_prefs,
646647
disable_fission, debug_test, browser_channel, binary,
647-
package_name, certutil_binary, ca_certificate_path):
648+
package_name, certutil_binary, ca_certificate_path,
649+
allow_list_paths):
648650
self.logger = logger
649651
self.prefs_root = prefs_root
650652
self.config = config
@@ -658,6 +660,7 @@ def __init__(self, logger, prefs_root, config, test_type, extra_prefs,
658660
self.package_name = package_name
659661
self.certutil_binary = certutil_binary
660662
self.ca_certificate_path = ca_certificate_path
663+
self.allow_list_paths = allow_list_paths
661664

662665
def create(self, **kwargs):
663666
"""Create a Firefox profile and return the mozprofile Profile object pointing at that
@@ -669,6 +672,7 @@ def create(self, **kwargs):
669672

670673
profile = FirefoxProfile(preferences=preferences,
671674
restore=False,
675+
allowlistpaths=self.allow_list_paths,
672676
**kwargs)
673677
self._set_required_prefs(profile)
674678
if self.ca_certificate_path is not None:
@@ -795,7 +799,7 @@ def __init__(self, logger, binary, package_name, prefs_root, test_type,
795799
stackfix_dir=None, binary_args=None, timeout_multiplier=None, leak_check=False,
796800
asan=False, chaos_mode_flags=None, config=None,
797801
browser_channel="nightly", headless=None, preload_browser=False,
798-
specialpowers_path=None, debug_test=False, **kwargs):
802+
specialpowers_path=None, debug_test=False, allow_list_paths=None, **kwargs):
799803
Browser.__init__(self, logger)
800804

801805
self.logger = logger
@@ -826,7 +830,8 @@ def __init__(self, logger, binary, package_name, prefs_root, test_type,
826830
binary,
827831
package_name,
828832
certutil_binary,
829-
ca_certificate_path)
833+
ca_certificate_path,
834+
allow_list_paths)
830835

831836
if preload_browser:
832837
instance_manager_cls = PreloadInstanceManager
@@ -899,7 +904,7 @@ def __init__(self, logger, binary, package_name, prefs_root, webdriver_binary, w
899904
disable_fission=False, stackfix_dir=None, leak_check=False,
900905
asan=False, chaos_mode_flags=None, config=None, browser_channel="nightly",
901906
headless=None, debug_test=False, profile_creator_cls=ProfileCreator,
902-
**kwargs):
907+
allow_list_paths=None, **kwargs):
903908

904909
super().__init__(logger, binary, webdriver_binary, webdriver_args)
905910
self.binary = binary
@@ -927,7 +932,8 @@ def __init__(self, logger, binary, package_name, prefs_root, webdriver_binary, w
927932
binary,
928933
package_name,
929934
certutil_binary,
930-
ca_certificate_path)
935+
ca_certificate_path,
936+
allow_list_paths)
931937

932938
self.profile = profile_creator.create()
933939
self.marionette_port = None

tools/wptrunner/wptrunner/browsers/firefox_android.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,13 @@ def get_environ(chaos_mode_flags, env_extras=None):
148148
class ProfileCreator(FirefoxProfileCreator):
149149
def __init__(self, logger, prefs_root, config, test_type, extra_prefs,
150150
disable_fission, debug_test, browser_channel, binary,
151-
package_name, certutil_binary, ca_certificate_path):
151+
package_name, certutil_binary, ca_certificate_path,
152+
allow_list_paths=None):
152153

153154
super().__init__(logger, prefs_root, config, test_type, extra_prefs,
154155
disable_fission, debug_test, browser_channel, None,
155-
package_name, certutil_binary, ca_certificate_path)
156+
package_name, certutil_binary, ca_certificate_path,
157+
allow_list_paths)
156158

157159
def _set_required_prefs(self, profile):
158160
profile.set_preferences({

tools/wptrunner/wptrunner/wptrunner.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,16 @@ def run_tests(config, product, test_paths, **kwargs):
396396

397397
product.check_args(**kwargs)
398398

399+
kwargs["allow_list_paths"] = []
399400
if kwargs["install_fonts"]:
401+
# Add test font to allow list for sandbox to ensure that the content
402+
# processes will have read access.
403+
ahem_path = os.path.join(test_paths["/"].tests_path, "fonts/Ahem.ttf")
404+
kwargs["allow_list_paths"].append(ahem_path)
400405
env_extras.append(FontInstaller(
401406
logger,
402407
font_dir=kwargs["font_dir"],
403-
ahem=os.path.join(test_paths["/"].tests_path, "fonts/Ahem.ttf")
408+
ahem=ahem_path
404409
))
405410

406411
recording.set(["startup", "load_tests"])

0 commit comments

Comments
 (0)