Skip to content

Commit

Permalink
refactor(config): always enable extension
Browse files Browse the repository at this point in the history
  • Loading branch information
vringar committed Aug 6, 2024
1 parent 5e77c98 commit b50226e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 32 deletions.
5 changes: 1 addition & 4 deletions openwpm/browser_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,10 +739,7 @@ def run(self) -> None:
self.crash_recovery,
)

extension_socket: Optional[ClientSocket] = None

if self.browser_params.extension_enabled:
extension_socket = self._start_extension(browser_profile_path)
extension_socket = self._start_extension(browser_profile_path)

self.logger.debug(
"BROWSER %i: BrowserManager ready." % self.browser_params.browser_id
Expand Down
1 change: 0 additions & 1 deletion openwpm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class BrowserParams(DataClassJsonMixin):
to customize behaviour of an individual browser
"""

extension_enabled: bool = True
cookie_instrument: bool = True
js_instrument: bool = False
js_instrument_settings: List[Union[str, dict]] = field(
Expand Down
51 changes: 24 additions & 27 deletions openwpm/deploy_browsers/deploy_firefox.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,24 @@ def deploy_firefox(
# because status_queue is read off no matter what.
status_queue.put(("STATUS", "Display", (display_pid, display_port)))

if browser_params.extension_enabled:
# Write config file
extension_config: Dict[str, Any] = dict()
extension_config.update(browser_params.to_dict())
extension_config["logger_address"] = manager_params.logger_address
extension_config["storage_controller_address"] = (
manager_params.storage_controller_address
)
extension_config["testing"] = manager_params.testing
ext_config_file = browser_profile_path / "browser_params.json"
with open(ext_config_file, "w") as f:
json.dump(extension_config, f, cls=ConfigEncoder)
logger.debug(
"BROWSER %i: Saved extension config file to: %s"
% (browser_params.browser_id, ext_config_file)
)
# Write config file
extension_config: Dict[str, Any] = dict()
extension_config.update(browser_params.to_dict())
extension_config["logger_address"] = manager_params.logger_address
extension_config["storage_controller_address"] = (
manager_params.storage_controller_address
)
extension_config["testing"] = manager_params.testing
ext_config_file = browser_profile_path / "browser_params.json"
with open(ext_config_file, "w") as f:
json.dump(extension_config, f, cls=ConfigEncoder)
logger.debug(
"BROWSER %i: Saved extension config file to: %s"
% (browser_params.browser_id, ext_config_file)
)

# TODO restore detailed logging
# fo.set_preference("[email protected]", "all")
# TODO restore detailed logging
# fo.set_preference("[email protected]", "all")

# Configure privacy settings
configure_firefox.privacy(browser_params, fo)
Expand Down Expand Up @@ -153,15 +152,13 @@ def deploy_firefox(
),
)

# Add extension
if browser_params.extension_enabled:
# Install extension
ext_loc = os.path.join(root_dir, "../../Extension/openwpm.xpi")
ext_loc = os.path.normpath(ext_loc)
driver.install_addon(ext_loc, temporary=True)
logger.debug(
"BROWSER %i: OpenWPM Firefox extension loaded" % browser_params.browser_id
)
# Install extension
ext_loc = os.path.join(root_dir, "../../Extension/openwpm.xpi")
ext_loc = os.path.normpath(ext_loc)
driver.install_addon(ext_loc, temporary=True)
logger.debug(
"BROWSER %i: OpenWPM Firefox extension loaded" % browser_params.browser_id
)

# set window size
driver.set_window_size(*DEFAULT_SCREEN_RES)
Expand Down

0 comments on commit b50226e

Please sign in to comment.