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

Fix broken Firefox extension #3681

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

cmsetzer
Copy link
Contributor

@cmsetzer cmsetzer commented Jan 7, 2025

Before:

  • The Perma.cc extension for Firefox was broken. It would fail on every URL with an error like Firefox can’t find the file at moz-extension://5f641aec-6742-443d-b1c3-feeefc2e0419/https://perma.cc/service/bookmarklet-create/?v=1&url=https://example.com/.
  • The error happened because we pass the (absolute) target URL into getURL, which is only meant for relative paths (see [1], [2]). Seems like it only worked by accident before, or maybe they changed the API at some point.

After:

  • We no longer use getURL, so the extension now connects to Perma.cc as expected.

How to test

  1. In Firefox, go to about:debugging
  2. Click "This Firefox" at left
  3. Click the "Load Temporary Add-on…" button and select the extras/perma-firefox/src/manifest.json file from this branch
  4. Now the local extension should be loaded; navigate to a website and click the Perma.cc extension button to test it out

@cmsetzer cmsetzer requested a review from teovin January 7, 2025 02:01
Copy link

codecov bot commented Jan 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.67%. Comparing base (ffa57fa) to head (02b572c).
Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3681   +/-   ##
========================================
  Coverage    69.67%   69.67%           
========================================
  Files           54       54           
  Lines         7661     7661           
========================================
  Hits          5338     5338           
  Misses        2323     2323           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@teovin
Copy link
Contributor

teovin commented Jan 7, 2025

Looks good! I followed your instructions and was able to capture a couple of links as expected.

This was my first time playing with this extension, so I would like to confirm the flow quickly: When the extension is clicked, the user is asked to log in. After logging in, they are taken to manage/create, where they are expected to use the create perma link button with the URL prepopulated from the previous step.

@cmsetzer
Copy link
Contributor Author

cmsetzer commented Jan 7, 2025

Yes, that is the expected behavior. The extension is new to me too, but it's basically a quick way to populate Perma's URL field from the current site. It was created in 2016 and hasn't been touched since, so it's pretty simple.

Thanks for the review! I will look at getting this release published on addons.mozilla.org.

@cmsetzer cmsetzer merged commit aea54ec into harvard-lil:develop Jan 7, 2025
2 checks passed
@cmsetzer cmsetzer deleted the fix-firefox-extension branch January 7, 2025 16:25
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.

2 participants