Merge branch 'dev' into test/5880

This commit is contained in:
mr. m
2025-12-15 11:49:43 +01:00
committed by GitHub
533 changed files with 18643 additions and 12943 deletions

View File

@@ -0,0 +1,15 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
from typing import Any
class JSONWithCommentsDecoder(json.JSONDecoder):
def __init__(self, **kw):
super().__init__(**kw)
def decode(self, s: str) -> Any:
s = '\n'.join(l for l in s.split('\n') if not l.lstrip(' ').startswith('//'))
return super().decode(s)

View File

@@ -3,6 +3,11 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
set -e
# FIrst check if importing the patches succeeds
npm run import
IGNORE_FILES=(
"shared.nsh"
"ignorePrefs.json"

View File

@@ -6,7 +6,7 @@ import os
import sys
import json
from pathlib import Path
from typing import Any
from json_with_comments import JSONWithCommentsDecoder
IGNORE_PREFS_FILE_IN = os.path.join(
'src', 'zen', 'tests', 'ignorePrefs.json'
@@ -17,15 +17,6 @@ IGNORE_PREFS_FILE_OUT = os.path.join(
MOCHITEST_NAME = "mochitests"
class JSONWithCommentsDecoder(json.JSONDecoder):
def __init__(self, **kw):
super().__init__(**kw)
def decode(self, s: str) -> Any:
s = '\n'.join(l for l in s.split('\n') if not l.lstrip(' ').startswith('//'))
return super().decode(s)
def copy_ignore_prefs():
print("Copying ignorePrefs.json from src/zen/tests to engine/testing/mochitest...")
# if there are prefs that dont exist on output file, copy them from input file

View File

@@ -29,12 +29,12 @@ def update_rc(last_version: str):
def update_ff(is_rc: bool = False, last_version: str = ""):
"""Runs the npm command to update the 'ff' component."""
"""Runs the npm command to sync Firefox."""
if is_rc:
return update_rc(last_version)
result = os.system("npm run update-ff:raw")
result = os.system("npm run sync:raw")
if result != 0:
raise RuntimeError("Failed to update 'ff' component.")
raise RuntimeError("Failed to sync Firefox.")
def get_version_from_file(filename, is_rc):

View File

@@ -0,0 +1,63 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import json
from json_with_comments import JSONWithCommentsDecoder
DUMPS_FOLDER = os.path.join(
'configs', 'dumps'
)
ENGINE_DUMPS_FOLDER = os.path.join(
'engine', 'services', 'settings', 'dumps', 'main'
)
def merge_dumps(original, updates):
"""Filters entries from the original dump, removing those whose identifiers are specified in the updates removal list."""
remove_ids = updates.get('remove', {"identifiers": []}).get('identifiers', [])
# Filter out entries in original that are in remove_ids.
#  We may find example-* patterns, so we need to handle that as well.
merged_data = [
entry for entry in original.get('data', [])
if not any(
entry.get('identifier', '') == rid or
(rid.endswith('*') and entry.get('identifier', '').startswith(rid[:-1]))
for rid in remove_ids
)
]
return {
'data': merged_data,
**{k: v for k, v in original.items() if k != 'data'},
'timestamp': updates.get('timestamp', original.get('timestamp'))
}
def main():
for filename in os.listdir(DUMPS_FOLDER):
if filename.endswith('.json'):
#  parse json with comments
with open(os.path.join(DUMPS_FOLDER, filename), 'r') as f:
data = json.load(f, cls=JSONWithCommentsDecoder)
original_path = os.path.join(ENGINE_DUMPS_FOLDER, filename)
if os.path.exists(original_path):
with open(original_path, 'r', encoding='utf-8') as f:
original_content = f.read()
original_content = '\n'.join(
line for line in original_content.split('\n') if not line.lstrip(' ').startswith('//')
)
original_data = json.loads(original_content)
merged_data = merge_dumps(original_data, data)
with open(original_path, 'w', encoding='utf-8') as f:
json.dump(merged_data, f, indent=2, ensure_ascii=False)
print(f"Updated dump: {filename}")
else:
print(f"Original dump file not found: {original_path}")
exit(1)
if __name__ == "__main__":
main()