kenobi

    • Apr 6, 2022
    • Joined Apr 5, 2022
    • 0 discussions
    • 1 post
    • 0 best answers
    • 1 point
    • I was curious how safari handles extensions so I starting looking around. Not sure if any of this info is helpful:

      From lapcatsoftware.com
      --
      A modern "Safari app extension" has several parts, including the following:

      1. An app, distributed as an .app bundle. The app contains native Mac executable code inside the Contents/MacOS folder of its bundle.

      2. An app extension, distributed as an .appex bundle inside the Contents/PlugIns folder of the .app bundle. The app extension also contains native Mac executable code in the Contents/MacOS folder of its bundle.

      3. JavaScript and CSS, distributed as .js and .css files inside the Contents/Resources folder of the .appex bundle.

      On every launch, Safari runs 2, the native Mac executable code of the .appex bundle, regardless of whether the extension is enabled in Safari's Extensions Preferences. Safari does not load 3, the JavaScript and CSS, unless the extension is enabled.

      --

      It looks like the only extension data that safari store is in ~/Library/Containers/com.apple.Safari/Data/Library/Safari/AppExtensions/Extensions.plist which stores enabled status, allowed domains, etc.

      All extensions are read from the individual host app that wraps the safari extension .appex. Looking at what files safari access It looks like it access the extensions using the Mac binary file in XXX.appex/Contents/MacOS/XXX rather than its resources folder that contains all the js/html.

      Since it's calling Mac binary I'm not sure how safari is loading in its data and it might not be possible to load them into Orion. I haven't seen another browser not made by apple attempt such a thing. There is a Mac binary reader on GitHub that might provide some clues but I have get to look into it.

      There is also a tool in Xcode for converting Web Extension to safari. I haven't look into it much but it might provide some clues on how safari interacts with extensions.