Write a greasemonkey porting guide

RESOLVED INCOMPLETE

Status

Add-on SDK
Documentation
P2
normal
RESOLVED INCOMPLETE
6 years ago
a month ago

People

(Reporter: wbamberg, Assigned: wbamberg)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

6 years ago
We should have a guide for people who want to port user scripts to SDK add-ons.

It should cover:
- how page-mod is the equivalent of the GM framework for injecting user scripts
- how the GM_* APIs map on to SDK APIs
- any differences in the objects available to content scripts versus user scripts
- a worked example

Updated

6 years ago
Priority: -- → P2

Comment 1

6 years ago
FWIW there is a 3rd party addon sdk package that can be used to convert 1 or more userscripts into a addon with the addon sdk. 

https://github.com/scriptish/userscripts-jetpack-package

I will make sure that it is tightly integrated with page-mods code in the future too.
Status: NEW → ASSIGNED

Updated

6 years ago
Hardware: x86 → All
(Assignee)

Comment 2

6 years ago
(In reply to Erik Vold from comment #1)
> FWIW there is a 3rd party addon sdk package that can be used to convert 1 or
> more userscripts into a addon with the addon sdk. 
> 
> https://github.com/scriptish/userscripts-jetpack-package
> 
> I will make sure that it is tightly integrated with page-mods code in the
> future too.

Yes, I'd seen this, and meant to talk about it in this guide, so thanks for pointing it out. I think it's an incredibly valuable package. I guess it's still somewhat worthwhile porting a user script to the SDK, because:
- you get to use the other SDK APIs
- you get streamlined AMO review (if you use only addon-kit APIs)

What do you think?

Comment 3

6 years ago
> I guess it's
> still somewhat worthwhile porting a user script to the SDK, because:
> - you get to use the other SDK APIs
> - you get streamlined AMO review (if you use only addon-kit APIs)
> 
> What do you think?

It would not be hard to give user scripts access to more features (including a message manager), and I do plan to build an API for injecting new features in to user script sandboxes so that 3rd part module devs can add new APIs; and the GM_* api is meant to provide a user friendly API that allows authors to do what they want quickly and easily.  So the point about using other SDK APIs is moot imo.

afaict the only advantage to porting to a page-mod would be for the streamlined AMO review, which would be a hard sell if there isn't some tool that would automate this process.

The disadvantages to porting to a page-mod is that a author has to do a bunch of work, and maintain two code bases.

Comment 4

6 years ago
(In reply to Will Bamberg [:wbamberg] from comment #0)
> We should have a guide for people who want to port user scripts to SDK
> add-ons.
> 
> It should cover:
> - how page-mod is the equivalent of the GM framework for injecting user
> scripts
> - how the GM_* APIs map on to SDK APIs
> - any differences in the objects available to content scripts versus user
> scripts
> - a worked example

page-mod is not equvlant because page-mod has no way of excluding urls like greasemonkey's @include / "@exclude" and specfiying regex seems to be broken and dosn't allow for not's.

Comment 5

3 years ago
Since Firefox 32 the exclude property has been added to Page-Mod.  Will do you have any work on this yet? I wouldn't mind helping make the doc.
(Assignee)

Comment 6

3 years ago
Hi Jared

(In reply to Jared Null from comment #5)
> Since Firefox 32 the exclude property has been added to Page-Mod.  Will do
> you have any work on this yet? I wouldn't mind helping make the doc.

No, I've done nothing on this. From Erik's comment 3, it seemed like the motivation to port to the SDK from GM just wasn't there. But I'd be very happy for you to write up something for this if you wanted to, and I can review it if you'd like.

Comment 7

3 years ago
Great!  Ha, I haven't touched GM scripts in at least a year mainly because, i love writing add-ons now and i would never go back!  I have no problem writing something up. 

I think its a great idea for people to get more involved in development, it could really draw more people to building add-ons and maybe even Firefox development, maybe Erik is right about lack of interest, and the added AMO review process would deter people, ever since the Add-on Builder (Web Based) has been retired the learning curve does jump a bit higher. 

I'll compare to GM and see if i can't draft something up and would be grateful if you reviewed it.

Comment 8

2 years ago
(In reply to Will Bamberg [:wbamberg] from comment #6)
> Hi Jared
> 
> (In reply to Jared Null from comment #5)
> > Since Firefox 32 the exclude property has been added to Page-Mod.  Will do
> > you have any work on this yet? I wouldn't mind helping make the doc.
> 
> No, I've done nothing on this. From Erik's comment 3, it seemed like the
> motivation to port to the SDK from GM just wasn't there. 

There is motivation, GM is not available on Fennec while SDK is.
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: ASSIGNED → RESOLVED
Last Resolved: a month ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.