mdn / webextensions-examples

Example Firefox add-ons created using the WebExtensions API
https://developer.mozilla.org/en-US/Add-ons/WebExtensions
Mozilla Public License 2.0
4.12k stars 2.63k forks source link

Firefox Load temporary addon not working #538

Open stzdzyhs opened 1 year ago

stzdzyhs commented 1 year ago

Firefox version: 116.0.3 Ubuntu 22.04 the standard borderify addon is not working.

Reproduce steps:

  1. git clone borderify code
  2. in Firefox, select menu "Add-ons and Themes" >> "Debug Add-ons" >> "Load Temporary Add-on...", then select the borderify manifest.json,
  3. after install the addon, no any mozilla.org page is borderified. e.g: a page with url: https://www.mozilla.org/en-US/
  4. further more, when refresh the tab https://www.mozilla.org/en-US/, in debug console, it will show a log "undefined: undefined", I am certain that if no install the borderify addon, this log will not be printed. however, no sure if this should be reported to Firefox or not. Thanks!
github-actions[bot] commented 1 year ago

It looks like this is your first issue. Welcome! 👋 One of the project maintainers will be with you as soon as possible. We appreciate your patience. To safeguard the health of the project, please take a moment to read our code of conduct.

Rob--W commented 1 year ago

I cannot reproduce your problem (I haven't tried it on Ubuntu though).

The borderify extension works, as described at https://github.com/mdn/webextensions-examples/tree/main/borderify

Can you show the output of the global Browser Console (https://firefox-source-docs.mozilla.org/devtools-user/browser_console/index.html)?

stzdzyhs commented 1 year ago

Thanks! I started Firefox by command: "firefox -jsconsole", and noticed some existing error log printed as the attached screen shot. (Please note that at this time, the add-on borderify is not installed. After install the add-on borderify by clicking "Load Temporary add-on", no any other log printed, (I cleared the log before installation, after add-on installation, the output was still empty) s1

Rob--W commented 1 year ago

For context, his "bug report" was cross-posted to https://bugzilla.mozilla.org/show_bug.cgi?id=1850464

stzdzyhs commented 1 year ago

Sorry cross-posted because I suspect this is also related to Firefox. I tried the Firefox version 117, same problem. and follow your suggestion, I tried to run borderify in "Private Window". steps:

  1. install the borderify addon
  2. on Firefox about:addons page, select the "Manage" menu item for borderify addon.
  3. on the manage page, enable "Run in Private Windows" in the Details tab (there are 2 tabs, one is Details, the other is "Permissions" tab. Testing Result: the existing mozilla.org tab is not borderifed.
  4. I also tried enable "Access your data for sites in the *://mozilla.org domain" in the Permissions tab. same result.

the issue is : when the add-on installing, there is not option to allow it run in the Private Window or not, and may be some issue on Reload, this add-on doesn'tt work when enable those options after it has installed.

Rob--W commented 1 year ago
  1. Did you make any changes to the Borderify source code?
  2. If you try another sample, e.g. Beastify, does that work?
stzdzyhs commented 1 year ago

Beastify is also not work. and, I did not change code of Borderify or Beastify, I noticed a msg when I clicking the "Extension" tool bar on the top right of Firefox, it showed: Can not read or change data on this site" Please see the screen shot.
222

stzdzyhs commented 1 year ago

To exclude influence of customized settings, tomorrow, I will test this in a clean VM.

stzdzyhs commented 1 year ago

At last, I found the cause of this issue is Snap (A tool to manage app installation on Ubuntu) On Ubuntu 22.04, Firefox is installed by Snap, However, if app is installed by Snap, app will have some read/write problem to mounted NTFS partition. I also encountered read problem , maybe Inkscape (If I remember right) that can not read mounted NTFS partition, only the native EXT4 partition.

If I moved the borderify code to $HOME dir(that's a directory in EXT4 partition), it works fine ! in previous testing, the borderify code was stored in a NTFS parition. I must clarify that this is not a problem of disk, I can display bordefify code without any error (linux cmd: cat), I also checked that the NTFS parition is good.

stzdzyhs commented 1 year ago

and this can be reproduced in a clean VM. steps:

  1. download ubuntu-22.04.3-desktop-amd64.iso from ubuntu.com
  2. when installing Ubuntu in VirtualBox, create 2 partitions, one is Ubuntu root partition(partition1, EXT4 format), the other is reserved for NTFS. (partition2, NTFS format)
  3. install Ubuntu on the partition1.
  4. login into Ubuntu and in Terminal, run: sudo apt update; sudo apt upgrade;
  5. use gparted to format partition2 to NTFS. (if gparted is not installed, run: sudo apt install gparted ) sudo gparted /dev/sda
  6. mount the partition2 on mount-point: /windows/c/ , in Terminal, run: sudo mkdir -p /windows/c; sudo mount /dev/sda4 /windows/c/ -o uid=1000;
    the -o option is to allow the current user can full control the partition2. (the device name: /dev/sda4 can be different).
  7. git clone code into partition2. run: cd /windows/c/; git clone https://github.com/mdn/webextensions-examples.git
  8. In Firefox, try to install the debug add-on borderify, then, the add-on is NOT work. same problem as my first post.
  9. copy the borderify code to $HOME, run: cp -R webextensions-examples ~
  10. In Firefox, try to install the debug add-on borderify from $HOME/webextensions-examples/borderify/manifest.json, this time, it works fine !
achangofpace commented 1 year ago

At last, I found the cause of this issue is Snap (A tool to manage app installation on Ubuntu) On Ubuntu 22.04, Firefox is installed by Snap, However, if app is installed by Snap, app will have some read/write problem to mounted NTFS partition. I also encountered read problem , maybe Inkscape (If I remember right) that can not read mounted NTFS partition, only the native EXT4 partition.

If I moved the borderify code to $HOME dir(that's a directory in EXT4 partition), it works fine ! in previous testing, the borderify code was stored in a NTFS parition. I must clarify that this is not a problem of disk, I can display bordefify code without any error (linux cmd: cat), I also checked that the NTFS parition is good.

does this mean that there's no issue in this repo but rather in Snap?

aug-dev commented 7 months ago

Hey there!

Just coming here to say that I had the same problem with the official Firefox Flatpak (another technology used to distribute Linux applications in a containerized environment).

Changing the app's permission through Flatseal (an app to manage Flatpak permissions) and restarting the browser solved the issue:

image

Now borderify works properly.

This is clearly something to do with sandboxing of these technologies. If I had to guess, it is probably because the "Open file" dialog opens one specific file (the manifest.json), and does not give the application permission to look through the other files in the directory.