Rob--W / browser-action-jplib

Jetpack module to add a Browser action badge to the toolbar, using the chrome.browserAction syntax from Chromium
21 stars 9 forks source link

cfx run works fine, cfx xpi results in broken add-on: "Error opening input stream (invalid filename?)" #1

Closed Rob--W closed 11 years ago

Rob--W commented 11 years ago

The same add-on (for code, see README.md), functions correctly when run using cfx run or cfx test, but after packaging it using cfx xpi, the icons (and probably other button resources) are missing.

Expected appearance (cfx run) expected

Actual appearance (installed addon created using cfx xpi): wrong

Steps to reproduce

First, create an add-on:

addon-sdk
cfx init ffadd
cd ffadd
vim ffadd/lib/main.js
# Paste the code from README.md and save, :wq
cfx xpi

Then, create a temporary Firefox profile and launch it:

mkdir /tmp/ffprof
firefox -profile /tmp/ffprof --no-remote

Enable logging by visiting about:config and setting extensions.logging.enabled to true.

Observe the following log in stdout (the last errors are also found in the JSconsole):

*** LOG addons.xpi: Starting install of file:///tmp/ffadd/ffadd.xpi
*** LOG addons.xpi: Addon jid1-QJo2LCHzub4rHw@jetpack will be installed as a packed xpi
*** LOG addons.xpi: Loading bootstrap scope from /tmp/ffprof/extensions/jid1-QJo2LCHzub4rHw@jetpack.xpi
*** LOG addons.xpi: Calling bootstrap method install on jid1-QJo2LCHzub4rHw@jetpack version 0.1
*** LOG addons.xpi: Install of file:///tmp/ffadd/ffadd.xpi completed.
*** LOG addons.xpi: Calling bootstrap method startup on jid1-QJo2LCHzub4rHw@jetpack version 0.1
error: ffadd: An exception occurred.
Error opening input stream (invalid filename?)
Traceback (most recent call last):
error: ffadd: An exception occurred.
Error opening input stream (invalid filename?)
Traceback (most recent call last):
Rob--W commented 11 years ago

It turns out that the data directory is empty.. Hmmm.

$ cfx --version
Add-on SDK 1.14 (39467a307f58b63c1907c8d383e48475c98b0624)
$ 7z l ffadd.xpi |grep data
1979-12-31 23:00:00 D....            0            0  resources/addon-sdk/data
2013-04-15 18:28:06 .....         2608         1044  resources/addon-sdk/lib/sdk/io/data.js
1979-12-31 23:00:00 D....            0            0  resources/browser-action/data
2013-07-12 15:02:40 .....          545          338  resources/browser-action/lib/self-data.js
1979-12-31 23:00:00 D....            0            0  resources/ffadd/data
Rob--W commented 11 years ago

Depends on https://bugzilla.mozilla.org/show_bug.cgi?id=892977

Rob--W commented 11 years ago

Before implementing the solution, I chatted with an engineer from the Add-on SDK at #jetpack. Here's a transcript, for future reference: http://pastebin.com/raw.php?i=J1mnhYUw

Rob--W commented 10 years ago

Noteworthy: Comment 2 at https://bugzilla.mozilla.org/show_bug.cgi?id=892977 says:

In bug 915376 we will drop our traditional third-party packages support in favor of npm style 3rd party packages, so even if this bug is real I don't think that we should bother fixing it at this point.