Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FXIOS-8087 [v124] find in page web engine #18622

Conversation

lmarceau
Copy link
Contributor

@lmarceau lmarceau commented Feb 7, 2024

📜 Tickets

Jira ticket
Github issue

💡 Description

Add the Find in page functionality in the WebEngine, as it is working today in Firefox iOS.

  • This means new find in page calls on the EngineSession protocol, as well as a new delegate. Kept this separeted from the EngineSessionDelegate so we keep smaller responsibilities.
  • Added a FindInPageContentScript that communicates with the FindInPage.js and receive WebKit messages. Added tests for this content script.
  • Add missing Assets in the SampleBrowser app -> This means missing images and scripts that should be injected.
  • Add a find in page bar (copy pasted the one used in Firefox iOS) in the SampleBrowser app to test this feature, see video for result - focus is on testing the web engine, not UI perfection :)
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-02-07.at.11.57.46.mp4

📝 Checklist

You have to check all boxes before merging

  • Filled in the above information (tickets numbers and description of your work)
  • Updated the PR name to follow our PR naming guidelines
  • Wrote unit tests and/or ensured the tests suite is passing
  • When working on UI, I checked and implemented accessibility (minimum Dynamic Text and VoiceOver)
  • If needed I updated documentation / comments for complex code and public methods

@lmarceau lmarceau requested a review from a team as a code owner February 7, 2024 17:56
@@ -116,6 +125,15 @@ class WKEngineSession: NSObject,
webView.engineScrollView.setContentOffset(CGPoint.zero, animated: true)
}

func findInPage(text: String, function: FindInPageFunction) {
let sanitizedInput = text.replacingOccurrences(of: "\\", with: "\\\\").replacingOccurrences(of: "\"", with: "\\\"")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just OOC is this something being brought over from the existing client? Wondering if there is a more elegant way for us to avoid how we're escaping these slashes but I'm not super-familiar with this code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's brought from the existing code 🤔 It's from here exactly

@mobiletest-ci-bot
Copy link

mobiletest-ci-bot commented Feb 13, 2024

Messages
📖 Edited 13 files
📖 Created 15 files

Generated by 🚫 Danger Swift against 1dbaf6a

@lmarceau
Copy link
Contributor Author

Not sure what's happening here 👀

Screenshot 2024-02-14 at 11 04 27 AM

@lmarceau lmarceau force-pushed the lm/FXIOS-8087-#17999-find-in-page-web-engine branch from 5d749fe to 1dbaf6a Compare February 14, 2024 16:09
@lmarceau lmarceau merged commit 0fac7bc into mozilla-mobile:main Feb 14, 2024
10 checks passed
@lmarceau lmarceau deleted the lm/FXIOS-8087-#17999-find-in-page-web-engine branch February 14, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants