-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into sparaipan/fxios-8029-Firefox-Suggest-settings
- Loading branch information
Showing
126 changed files
with
2,451 additions
and
372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,43 +20,64 @@ jobs: | |
with: | ||
persist-credentials: false | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r ./test-fixtures/requirements.txt | ||
- name: Modifing Swift Package dependencies | ||
run: | | ||
python ./test-fixtures/update-rust-component-version.py | ||
- name: Get new A-S tag to be used in the PR info | ||
run: | | ||
cd test-fixtures/ | ||
chmod u+x read-rust-component-tag.sh | ||
echo "version=$(./read-rust-component-tag.sh)" >> $GITHUB_ENV | ||
echo "rust_version=$(./read-rust-component-tag.sh)" >> $GITHUB_ENV | ||
- name: Remove temp file created to store the tag info | ||
run: | | ||
cd test-fixtures/ | ||
[ ! -e newest_tag.txt ] || rm newest_tag.txt | ||
- name: Script to check if branch exists to not commit again | ||
run: |- | ||
branch=$(curl -X GET -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/mozilla-mobile/firefox-ios/branches?per_page=100 | jq -r '.[].name | select(contains("update-spm-new-rust-component-tag-${{ env.version }}"))') | ||
branch=$(curl -X GET -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/mozilla-mobile/firefox-ios/branches?per_page=100 | jq -r '.[].name | select(contains("update-spm-new-rust-component-tag-${{ env.rust_version }}"))') | ||
echo $branch | ||
if [ -z "$branch" ]; then echo "BRANCH_CREATED=false" >> $GITHUB_ENV; else echo "BRANCH_CREATED=true" >> $GITHUB_ENV;fi | ||
- name: Determine PR Version Number | ||
id: versioning | ||
run: | | ||
# This step is used to determine the next version number for the PR title | ||
# The output includes debugging for the piped commands that generate | ||
# the version number and the last line is the version number itself | ||
output=$(bash test-fixtures/ci/get-next-pr-version) | ||
echo "$output" | ||
next_version=$(echo "$output" | tail -n 1) # get the last line of the output | ||
echo "Next Firefox iOS version is: v${next_version}" | ||
echo "next_app_version=${next_version}" >> $GITHUB_ENV | ||
- name: Update rust-component version | ||
if: env.BRANCH_CREATED == 'false' | ||
run: |- | ||
git diff | ||
git diff --quiet || (git add firefox-ios/Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved firefox-ios/Client.xcodeproj/project.pbxproj) | ||
git diff --quiet || (git add firefox-ios/Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved firefox-ios/Client.xcodeproj/project.pbxproj) | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v3 | ||
if: env.BRANCH_CREATED == 'false' | ||
with: | ||
commit-message: Auto update SPM with latest rust-component release ${{ env.version }} | ||
commit-message: Auto update SPM with latest rust-component release ${{ env.rust_version }} | ||
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
committer: GitHub <[email protected]> | ||
title: Refactor [vXXX] Auto update SPM with latest rust-component ${{ env.version }} | ||
branch: update-spm-new-rust-component-tag-${{ env.version }} | ||
title: Refactor [v${{ env.next_app_version }}] Auto update SPM with latest rust-component ${{ env.rust_version }} | ||
branch: update-spm-new-rust-component-tag-${{ env.rust_version }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,12 +22,28 @@ jobs: | |
persist-credentials: false | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ref: ${{ github.event.inputs.branchName }} | ||
|
||
- name: Select Xcode ${{ matrix.xcode }} | ||
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Determine PR Version Number | ||
id: versioning | ||
run: | | ||
# This step is used to determine the next version number for the PR title | ||
# The output includes debugging for the piped commands that generate | ||
# the version number and the last line is the version number itself | ||
output=$(bash test-fixtures/ci/get-next-pr-version) | ||
echo "$output" | ||
next_version=$(echo "$output" | tail -n 1) # get the last line of the output | ||
echo "Next version is: v${next_version}" | ||
echo "next_version=${next_version}" >> $GITHUB_ENV | ||
- name: Get PR info | ||
run: | | ||
current_date=$(date +"%Y-%m-%d") | ||
|
@@ -36,7 +52,7 @@ jobs: | |
echo "current_date=$current_date" >> $GITHUB_ENV | ||
if [[ $current_branch == 'main' ]]; then | ||
echo "branch_name=string-import-$current_date" >> $GITHUB_ENV | ||
echo "pr_title=Localize [ver] String import $current_date" >> $GITHUB_ENV | ||
echo "pr_title=Localize [v${{ env.next_version }}] String import $current_date" >> $GITHUB_ENV | ||
echo "pr_body=This automated PR imports string changes" >> $GITHUB_ENV | ||
else | ||
# version: v105.0 -> v105 | ||
|
@@ -45,19 +61,22 @@ jobs: | |
echo "pr_title=Localize [$version] String import $current_date" >> $GITHUB_ENV | ||
echo "pr_body=This automated PR imports string changes into branch '$current_branch'" >> $GITHUB_ENV | ||
fi | ||
- name: Run script to import strings | ||
run: sh ./bootstrap.sh --importLocales | ||
|
||
- name: Update new strings | ||
run: |- | ||
git diff || (git add firefox-ios/Shared/*/*.lproj/* firefox-ios/Shared/*.lproj/* firefox-ios/WidgetKit/*.lproj/* firefox-ios/Client/*/*.lproj/* firefox-ios/Client/*.lproj/*) | ||
git restore firefox-ios/Client.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
committer: GitHub <[email protected]> | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: ${{ env.pr_title }} | ||
title: ${{ env.pr_title }} | ||
title: "Localize [v${{ env.next_version }}] String import ${{ env.current_date }}" | ||
branch: ${{ env.branch_name }} | ||
body: ${{ env.pr_body }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,14 +43,28 @@ jobs: | |
echo "create_pr=true" >> $GITHUB_ENV | ||
cp tmp.dat firefox-ios/Shared/effective_tld_names.dat | ||
echo "branch_name=refactor-update-effective-tld-names" >> $GITHUB_ENV | ||
echo "pr_title=Refactor [vXXX] Update effective_tld_names file $current_date" >> $GITHUB_ENV | ||
echo "pr_body=This automated PR updates the effective_tld_names file" >> $GITHUB_ENV | ||
rm tmp.dat | ||
fi | ||
- name: Determine PR Version Number | ||
id: versioning | ||
run: | | ||
# This step is used to determine the next version number for the PR title | ||
# The output includes debugging for the piped commands that generate | ||
# the version number and the last line is the version number itself | ||
output=$(bash test-fixtures/ci/get-next-pr-version) | ||
echo "$output" | ||
next_version=$(echo "$output" | tail -n 1) # get the last line of the output | ||
echo "Next version is: v${next_version}" | ||
echo "next_version=${next_version}" >> $GITHUB_ENV | ||
- name: Add Modified File to PR | ||
if: ${{ env.create_pr }} | ||
run: |- | ||
git diff || (git add firefox-ios/Shared/effective_tld_names.dat) | ||
- name: Create Pull Request | ||
if: ${{ env.create_pr }} | ||
uses: peter-evans/create-pull-request@v3 | ||
|
@@ -59,6 +73,6 @@ jobs: | |
committer: GitHub <[email protected]> | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: ${{ env.pr_title }} | ||
title: ${{ env.pr_title }} | ||
title: "Refactor [v${{ env.next_version }}] Update effective_tld_names file ${{ env.current_date }}" | ||
branch: ${{ env.branch_name }} | ||
body: ${{ env.pr_body }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Update URIs and Create PR | ||
on: | ||
schedule: | ||
- cron: '0 0 1 * *' # Runs at 00:00 on the first day of every month | ||
workflow_dispatch: | ||
inputs: | ||
branchName: | ||
description: 'Branch used as target for automation' | ||
required: true | ||
default: 'main' | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest # using ubuntu as a lightweight environment | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ref: ${{ github.event.inputs.branchName }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
# include pyarrow for pandas 3.0 compatibility | ||
pip install pandas pyarrow requests | ||
- name: Run URI update script | ||
run: python test-fixtures/ci/uri_update.py | ||
|
||
- name: Check for changes | ||
id: git-check | ||
run: | | ||
if git diff --quiet; then | ||
echo "No changes detected, skipping PR creation." | ||
echo "changes_detected=false" >> $GITHUB_ENV | ||
else | ||
echo "Changes detected, proceeding to create PR." | ||
git diff | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | ||
git commit --allow-empty -m "empty commit" # add empty commit so when squashed the history will show PR title | ||
git add firefox-ios/Shared/Extensions/URLExtensions.swift | ||
echo "changes_detected=true" >> $GITHUB_ENV | ||
datetime=$(date +%Y%m%d%H%M%S) | ||
echo "date=$datetime" >> $GITHUB_ENV | ||
fi | ||
- name: Determine PR Version Number | ||
id: versioning | ||
run: | | ||
# This step is used to determine the next version number for the PR title | ||
# The output includes debugging for the piped commands that generate | ||
# the version number and the last line is the version number itself | ||
output=$(bash test-fixtures/ci/get-next-pr-version) | ||
echo "$output" | ||
next_version=$(echo "$output" | tail -n 1) # get the last line of the output | ||
echo "Next version is: v${next_version}" | ||
echo "next_version=${next_version}" >> $GITHUB_ENV | ||
- name: Create Pull Request | ||
if: env.changes_detected == 'true' | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: Automated URI update on ${{ github.event.inputs.branchName || 'main' }} ${{ env.date }} | ||
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
committer: GitHub <[email protected]> | ||
title: Refactor [v${{ env.next_version }}] Automated URI update on ${{ github.event.inputs.branchName || 'main' }} ${{ env.date }} | ||
branch: update-uri-schemes-${{ env.date }} | ||
body: This automated PR updates the URIs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
BrowserKit/Sources/WebEngine/WKWebview/Scripts/FindInPageContentScript.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// 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 Common | ||
import Foundation | ||
import WebKit | ||
|
||
public enum FindInPageFunction: String { | ||
/// Find all the occurences of this text in the page | ||
case find | ||
|
||
/// Find the next occurence of this text in the page | ||
case findNext | ||
|
||
/// Find the previous occurence of this text in the page | ||
case findPrevious | ||
} | ||
|
||
public protocol FindInPageHelperDelegate: AnyObject { | ||
func findInPageHelper(didUpdateCurrentResult currentResult: Int) | ||
func findInPageHelper(didUpdateTotalResults totalResults: Int) | ||
} | ||
|
||
class FindInPageContentScript: WKContentScript { | ||
weak var delegate: FindInPageHelperDelegate? | ||
private var logger: Logger | ||
|
||
init(logger: Logger = DefaultLogger.shared) { | ||
self.logger = logger | ||
} | ||
|
||
class func name() -> String { | ||
return "FindInPage" | ||
} | ||
|
||
func scriptMessageHandlerNames() -> [String] { | ||
return ["findInPageHandler"] | ||
} | ||
|
||
func userContentController( | ||
didReceiveMessage message: Any | ||
) { | ||
guard let parameters = message as? [String: Int] else { | ||
// TODO: FXIOS-6463 - Integrate message handler check | ||
logger.log("FindInPage.js sent wrong type of message", | ||
level: .warning, | ||
category: .webview) | ||
return | ||
} | ||
|
||
if let currentResult = parameters["currentResult"] { | ||
delegate?.findInPageHelper(didUpdateCurrentResult: currentResult) | ||
} | ||
|
||
if let totalResults = parameters["totalResults"] { | ||
delegate?.findInPageHelper(didUpdateTotalResults: totalResults) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.