The extension name field in package.json cannot contain periods



Add-on SDK
7 years ago
7 years ago


(Reporter: Jeff Griffiths, Assigned: Jeff Griffiths)



Firefox Tracking Flags

(Not tracked)



(1 attachment, 2 obsolete attachments)



7 years ago
User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24
Build Identifier: 

If the extension name in package.json contains a period character ( eg '' ) cfx run crashes.

Reproducible: Always

Steps to Reproduce:
1. mkdir && cd ./
2. cfx init
3. cfx run

Actual Results:  
Traceback (most recent call last):
  File "/Users/jeff/code/moz/jetpack/addon-sdk-1.0b5/bin/cfx", line 29, in <module>
  File "/Users/jeff/code/moz/jetpack/addon-sdk-1.0b5/python-lib/cuddlefish/", line 636, in run
  File "/Users/jeff/code/moz/jetpack/addon-sdk-1.0b5/python-lib/cuddlefish/", line 283, in generate_build_for_target
    add_section_to_build(target_cfg, "tests", is_code=True)
  File "/Users/jeff/code/moz/jetpack/addon-sdk-1.0b5/python-lib/cuddlefish/", line 258, in add_section_to_build
  File "/Users/jeff/code/moz/jetpack/addon-sdk-1.0b5/python-lib/cuddlefish/", line 82, in validate_resource_hostname
    raise ValueError('invalid resource hostname: %s' % name)
ValueError: invalid resource hostname: jid1-gwb55aaeefl6yq-goo.gl_shortener-test

Expected Results:  
Firefox starts up with the extension enabled.

Comment 1

7 years ago
This is either a docs bug or a pretty quick regex fix. Possible patches to follow.

Comment 2

7 years ago
Created attachment 533535 [details] [diff] [review]
Patch to the docs stating the name field should not contain periods.

Just patch the docs to clarify that the field in question cannot contain periods.

Comment 3

7 years ago
Created attachment 533536 [details] [diff] [review]
Alternate patch that actually adds periods to the regex.

Dashes and underscores are already there, periods seem innocuous but I'm unsure what larger spec governs these values in install.rdf. With this patch applied, a simple extension with a period in the name field seems to work correctly.

Comment 4

7 years ago
It's conceivable that a developer just starting with Jetpack could create a folder with a dot in it, follow the tutorial and then get an obscure error message when running the example extension - admittedly an edge case ;).
This sounds like a bug we already have filed, although I wasn't able to find it in a quick search.

Irakli, Brian: do you know if this is a duplicate of another bug?
Whiteboard: [triage:followup]

Comment 6

7 years ago
It's similar to this one, but not exactly the same:

I searched first! Really! I also did a quick look for a spec on what should or shouldn't be allowed in that field and didn't see any comments on whether periods are inherently bad - not an exhaustive search though, there was a hockey game on.
At this point, I'm in favor of adding docs and assertions rather than allowing more characters (and being surprised by something that doesn't like them). Addon names (and package names) turn into resource: URI fields that are treated like DNS names, so I wouldn't be surprised that periods cause trouble. So I'll go for the docs patch rather than the regex one (which, incidentally, appears to be reversed).

If folks agree I'll land it tomorrow morning.
Assignee: nobody → warner-bugzilla
Ever confirmed: true

Comment 8

7 years ago
If you're going to dis-allow periods, it might be better to provide a better error message? I've got a new patch that a) reverses the last diff ( d'oh ) and b) detect periods and spaces in the same statement and return a better error message for that case.

Comment 9

7 years ago
Created attachment 533888 [details] [diff] [review]
Patch to fix the docs ( as previous ) and improve error messages from
Attachment #533535 - Attachment is obsolete: true
Attachment #533536 - Attachment is obsolete: true

Comment 10

7 years ago
ps This is all committed to my fork:

Let me know if you want a pull request, or further changes.
Landed in . I made a few small changes to fix one of the doctests (use "cfx testcfx" to run those).

Thanks for the patch!
Last Resolved: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.0
Changing assignee to Jeff, as he contributed most of the patch, even though it was landed with some modifications by Brian.
Assignee: warner-bugzilla → jeff
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: [triage:followup]
You need to log in before you can comment on or make changes to this bug.