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

Feat/make safari extension great again #140

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Ldoppea
Copy link
Member

@Ldoppea Ldoppea commented Dec 2, 2021

⚠️ This PR is about experimenting fixes on Safari extension. None of the commits have been tested on Chrome and Firefox and some of them are not even complete to fix Safari extension (see commits prefixed by DO_NOT_MERGE).
So do not try to merge this PR without reworking and testing ALL existing commits.


Introduction

This PR's goal is to fix Safari extension. This consist of fixing the build process, the installation process, the extension's background worker, the extension's popup and the extension's in-app menu. We also may have to fix the store publish process.

Current status

This PR is in an idle state, no work is intended on it until we prioritise it again

Tasks:

  • build has to be improved
    • fix team ID is set (see e27fd12)
      • fix resulting Developer ID Application: Cozy Cloud (3AKXFMV43J): no identity found appearing in the npm run dist:safari's output
    • fix bundle identifier (see eedc0e7)
    • fix missing content scripts (see eedc0e7)
    • fix permissions (see eedc0e7 and 2d62946)
  • installer has to be improved
    • installer icon is from Bitwarden and should be from Cozy
    • installer window does not use Cozy's storyboard
    • installer window "quit and Open Safari Extension" button does nothing
    • installer name is desktop and should be Cozy Pass (or similar)
  • inPageMenu is not working
    • clicking on the cloud image in a field does not trigger the menu popover
      • it is possible to force it to be displayed by disabling transform: scale(0) from the iframe's .panel div
        image
      • this may be related with broken messaging features (see later)
    • the CSS is a bit broken
      image
    • Safari's keychain icon is displayed on top of cloud icon
      image
    • messages from background worker are not received by the content script (inPageMenu)
      • see loginMenu.js near line 120, console.log('Received message ', msg) is never called
      • attempt to fix it : 1a04afd
    • iFrame does not refresh correctly (see e27fd12)
  • Popup has some CSS problems
    • when opened from a blank tab, Profiles section is badly displayed (I did not reproduce the error on a website tab)
      image
  • Test all features
    • everything should work on Safari
    • everything should still work on Firefox and Chrome

More info

More info can be found on the team's paper Développement et publication - Pass (extension) in section 02/12/2021 : Exploration remise en marche de Safari

While Chrome and Firefox seems not to care about this permission,
Safari displays an error about missing `activeTab`

I'm not sure about the impact of this modification as the only observed
effect is the disappearing of the error message (app was still loading
without it)
`inPageMenu` was not present in the XCode project. This resulted on
folder not present in the extension package's content and the `in-page`
Cozy menu was not loaded by Safari
Previous `DEVELOPMENT_TEAM` was corresponding to Bitwarden's team id

Current corresponds to Cozy team and was taken from
https://developer.apple.com/account/resources/profiles/list
(displayed on top right, under account's name)

This edit seems not enough to make code signature correctly working
App is building but there are console warning during buid about missing
signatures
We wan't to adapt the BundleIdentifier to avoid conflict with Bitwarden
extension if installed in parallel of Cozy Pass extension
This entitlement was present on Bitwarden's project but not on Cozy's project
`chrome` api seems not to be correctly handled by Safari but `browser`
one should

I made the replacement on all `inPageMenu` related content scripts (so
not the entire code)

This fixes some behaviours (localization) but not all (messaging). So
I'm not sure that this is the correct thing to do
Previous code was using a pointer to `browser.i18n.getMessage` to
handle multiple calls to translation methods

This is not working on Safari, so we have to repeat
`browser.i18n.getMessage` each time we want to get translated messages
Previous implementation was generating urls in the form
`file.html?params=XXXX?123456789`

Problem is that is contains two `?` in the url, which should not be
valid

By inverting both variables we can generate urls in the form
`file.html?123456789&params=XXXX`

This is an attempt to fix a Safari error stating that resource is
missing on server side (when refreshing the extension's iframe)
This does not fix this issue, but I would say that the new form is more
correct
This is for a test while investigating error message when open/closing
the inPageMenu

When clicking the cloud image in a field, nothing happens expect having
an error message on the console stating
`Failed to load resource The requested URL was not found on this server`

This seems to be related to those line when changing the menuEl.src,
then iFrame's url is refreshed and this message appears

I still don't understand what prevents the iFrame to refresh, knowing
that the first display is based on the same URL (only args are changing)
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.

1 participant