Skip to content

Latest commit

 

History

History
78 lines (59 loc) · 3.01 KB

File metadata and controls

78 lines (59 loc) · 3.01 KB

Firefox for iOS

This is the subdirectory that contains the Firefox for iOS application.

For details on compatible Xcode and Swift versions used to build this project, as well as the minimum iOS version, refer to the root README.

Getting Involved

For information on how to contribute to this project, including communication channels, coding style, PR naming guidelines and more, visit the Contribution guidelines.

Building the code

  1. Install the version of Xcode from Apple that matches what this project uses, as listed in the root README.
  2. Install, Brew, Node, and a Python3 virtualenv for localization scripts:
    brew update
    brew install node
  3. Clone the repository:
    git clone https://github.com/mozilla-mobile/firefox-ios
  4. Change directories to the project root:
    cd firefox-ios
  5. From the project root, install Node.js dependencies, build user scripts and update content blocker:
    sh ./bootstrap.sh
  6. Open the Client.xcodeproj under the firefox-ios folder in Xcode.
  7. Make sure to select the Fennec scheme in Xcode.
  8. Select the destination device you want to build on.
  9. Run the app with Cmd + R or by pressing the build and run button.

⚠️ Important: In case you have dependencies issues with SPM, please try the following:

  • Xcode -> File -> Packages -> Reset Package Caches

Building User Scripts

User Scripts (JavaScript injected into the WKWebView) are compiled, concatenated, and minified using webpack. User Scripts to be aggregated are placed in the following directories:

/Client
|-- /Frontend
    |-- /UserContent
        |-- /UserScripts
            |-- /AllFrames
            |   |-- /AtDocumentEnd
            |   |-- /AtDocumentStart
            |-- /MainFrame
                |-- /AtDocumentEnd
                |-- /AtDocumentStart

This reduces the total possible number of User Scripts down to four. The compiled output from concatenating and minifying the User Scripts placed in these folders resides in /Client/Assets and is named accordingly:

  • AllFramesAtDocumentEnd.js
  • AllFramesAtDocumentStart.js
  • MainFrameAtDocumentEnd.js
  • MainFrameAtDocumentStart.js

To simplify the build process, these compiled files are checked-in to this repository.

To start a watcher that will compile the User Scripts on save, run the following npm command in the root directory of the project:

npm run dev

⚠️ Note: npm run dev will build the JS bundles in development mode with source maps, which allows tracking down lines in the source code for debugging.

To create a production build of the User Scripts, run the following npm command in the root directory of the project:

npm run build