Right now extensions can only really contain content scripts, so that is all this doc covers. But we'll be expanding it over time as more features develop.
On Mon, Mar 16, 2009 at 4:46 PM, Aaron Boodman <a...@chromium.org> wrote: > I've created a starter document for people wanting to create Chromium > extensions:
> Right now extensions can only really contain content scripts, so that > is all this doc covers. But we'll be expanding it over time as more > features develop.
I created a content script this evening. If it helps you refine the
doc, here are the things I ran into. I was using a nightly build
(11818):
- I didn't expect, and was thankful for the manifest validation error
messages. I wonder where these should go.
- Sometimes the script seemed to fail to load - particularly after
hitting reload.
- Couldn't see JS errors for the extension in the inspector, but I
think the inspector is pretty hosed regardless.
- Because of both of the above, I always just restarted Chrome
whenever I made any changes, setting my homepage to my test page.
- I missed the bit about the ID being a 40-digit hex number and spent
a long time trying all sorts of stuff with my name in it.
- I also missed the bit about Python 2.6 and spent a reasonable amount
of time figuring out how to install the non-default dep (SimpleJSON)
in my Python 2.5, as the ez_setup only pretended to work.
- I put chromium_extension.py in the same dir as the files. It then
included itself in the CRX.
- The doc isn't clear about what to do with the CRX. Dragging it onto
Chrome downloads it, and setting Chrome as the default opener for the
filetype results in an infinite tab-spawning download loop (opening it
downloads it again, after which it autoopens : repeat). If it's not
implemented, can we say so?
- Either way, you may find it here:
<http://glenmurphy.com/tmp/portal.crx> OR
<http://glenmurphy.com/tmp/portal.zip> (5KB) - it's a version of that
content-clipping script we wrote a few years ago. alt+drag to create,
double-click to spawn.
- I was worried that all of the content-scripting I'd forgotten would
come and bite me, but apart from brief confusion over scope
('document' working, but 'window' requiring 'contentWindow'), writing
the code itself was easy as pie.
On Mon, Mar 16, 2009 at 4:50 PM, Aaron Boodman <a...@chromium.org> wrote:
> PS, there are also some sample extensions as attachments at the bottom
> of the doc.
> - a
> On Mon, Mar 16, 2009 at 4:46 PM, Aaron Boodman <a...@chromium.org> wrote:
>> I've created a starter document for people wanting to create Chromium
>> extensions:
>> Right now extensions can only really contain content scripts, so that
>> is all this doc covers. But we'll be expanding it over time as more
>> features develop.
On Mon, Mar 16, 2009 at 10:52 PM, Glen Murphy <g...@chromium.org> wrote: > I created a content script this evening. If it helps you refine the > doc, here are the things I ran into. I was using a nightly build > (11818):
Thanks a lot for the feedback!
> - I didn't expect, and was thankful for the manifest validation error > messages. I wonder where these should go.
Whee. I love error messages and am glad you found them helpful. I also don't know where they should go yet, but I don't want to remove them until we have a better place because they are so useful.
> - Sometimes the script seemed to fail to load - particularly after > hitting reload.
That is weird, I've never noticed that. The only thing that I can imagine is that because the reload is asynchronous, you were beating it, but that seems hard to believe. Did you notice that the second time you refreshed you'd see your changes?
> - Couldn't see JS errors for the extension in the inspector, but I > think the inspector is pretty hosed regardless.
What do you mean? JavaScript errors from content scripts? Or other types of extension errors? You should definitely see errors, and I know I've seen them before.
> - Because of both of the above, I always just restarted Chrome > whenever I made any changes, setting my homepage to my test page.
That sucks, I really want a edit-reload development experience.
> - I missed the bit about the ID being a 40-digit hex number and spent > a long time trying all sorts of stuff with my name in it.
Yeah, we should just remove the requirement for the ID altogether from the development mode.
> - I also missed the bit about Python 2.6 and spent a reasonable amount > of time figuring out how to install the non-default dep (SimpleJSON) > in my Python 2.5, as the ez_setup only pretended to work. > - I put chromium_extension.py in the same dir as the files. It then > included itself in the CRX.
We want to add a feature to Chrome itself where you can just use it to create the package.
> - The doc isn't clear about what to do with the CRX. Dragging it onto > Chrome downloads it, and setting Chrome as the default opener for the > filetype results in an infinite tab-spawning download loop (opening it > downloads it again, after which it autoopens : repeat). If it's not > implemented, can we say so?
Dragging it onto Chrome should download it, then install it, but there is no UI letting you know that anything happened right now, and it also doesn't work correctly when you're using a Chrome that isn't your default installation.
I will update the doc and try and fix these issues.
> - I was worried that all of the content-scripting I'd forgotten would > come and bite me, but apart from brief confusion over scope > ('document' working, but 'window' requiring 'contentWindow'), writing > the code itself was easy as pie.
'window' shouldn't require contentWindow, unless you want to access the content window's global scope, which doesn't seem necessary for what you're trying to do (but I can't remember exactly what feature you're talking about).
Here are my takeaways on what we can improve based on Glen's experience:
* Make the id field optional for development mode * We should add a temporary alert box saying "success" after installation of a crx file, until we have a proper install UI * We should reuse the current process when a crx file is opened by a chrome instance (we talked about this today) * We should add some easy way to create a crx file using chrome.exe or a website or something
On Mon, Mar 16, 2009 at 11:54 PM, Aaron Boodman <a...@chromium.org> wrote: > On Mon, Mar 16, 2009 at 10:52 PM, Glen Murphy <g...@chromium.org> wrote: >> I created a content script this evening. If it helps you refine the >> doc, here are the things I ran into. I was using a nightly build >> (11818):
> Thanks a lot for the feedback!
>> - I didn't expect, and was thankful for the manifest validation error >> messages. I wonder where these should go.
> Whee. I love error messages and am glad you found them helpful. I also > don't know where they should go yet, but I don't want to remove them > until we have a better place because they are so useful.
>> - Sometimes the script seemed to fail to load - particularly after >> hitting reload.
> That is weird, I've never noticed that. The only thing that I can > imagine is that because the reload is asynchronous, you were beating > it, but that seems hard to believe. Did you notice that the second > time you refreshed you'd see your changes?
>> - Couldn't see JS errors for the extension in the inspector, but I >> think the inspector is pretty hosed regardless.
> What do you mean? JavaScript errors from content scripts? Or other > types of extension errors? You should definitely see errors, and I > know I've seen them before.
>> - Because of both of the above, I always just restarted Chrome >> whenever I made any changes, setting my homepage to my test page.
> That sucks, I really want a edit-reload development experience.
>> - I missed the bit about the ID being a 40-digit hex number and spent >> a long time trying all sorts of stuff with my name in it.
> Yeah, we should just remove the requirement for the ID altogether from > the development mode.
>> - I also missed the bit about Python 2.6 and spent a reasonable amount >> of time figuring out how to install the non-default dep (SimpleJSON) >> in my Python 2.5, as the ez_setup only pretended to work. >> - I put chromium_extension.py in the same dir as the files. It then >> included itself in the CRX.
> We want to add a feature to Chrome itself where you can just use it to > create the package.
>> - The doc isn't clear about what to do with the CRX. Dragging it onto >> Chrome downloads it, and setting Chrome as the default opener for the >> filetype results in an infinite tab-spawning download loop (opening it >> downloads it again, after which it autoopens : repeat). If it's not >> implemented, can we say so?
> Dragging it onto Chrome should download it, then install it, but there > is no UI letting you know that anything happened right now, and it > also doesn't work correctly when you're using a Chrome that isn't your > default installation.
> I will update the doc and try and fix these issues.
>> - I was worried that all of the content-scripting I'd forgotten would >> come and bite me, but apart from brief confusion over scope >> ('document' working, but 'window' requiring 'contentWindow'), writing >> the code itself was easy as pie.
> 'window' shouldn't require contentWindow, unless you want to access > the content window's global scope, which doesn't seem necessary for > what you're trying to do (but I can't remember exactly what feature > you're talking about).
On Tue, Mar 17, 2009 at 1:00 AM, Aaron Boodman <a...@chromium.org> wrote:
> Extensions comrades,
> Here are my takeaways on what we can improve based on Glen's experience:
> * Make the id field optional for development mode
> * We should add a temporary alert box saying "success" after
> installation of a crx file, until we have a proper install UI
> * We should reuse the current process when a crx file is opened by a
> chrome instance (we talked about this today)
> * We should add some easy way to create a crx file using chrome.exe or
> a website or something
Agree with these points, but here's a slightly less annoying cheat for the
install UI:
- open up raf's extension ui page in a tab and highlight the newly installed
extension
> On Mon, Mar 16, 2009 at 11:54 PM, Aaron Boodman <a...@chromium.org> wrote:
> > On Mon, Mar 16, 2009 at 10:52 PM, Glen Murphy <g...@chromium.org> wrote:
> >> I created a content script this evening. If it helps you refine the
> >> doc, here are the things I ran into. I was using a nightly build
> >> (11818):
> > Thanks a lot for the feedback!
> >> - I didn't expect, and was thankful for the manifest validation error
> >> messages. I wonder where these should go.
> > Whee. I love error messages and am glad you found them helpful. I also
> > don't know where they should go yet, but I don't want to remove them
> > until we have a better place because they are so useful.
> >> - Sometimes the script seemed to fail to load - particularly after
> >> hitting reload.
> > That is weird, I've never noticed that. The only thing that I can
> > imagine is that because the reload is asynchronous, you were beating
> > it, but that seems hard to believe. Did you notice that the second
> > time you refreshed you'd see your changes?
> >> - Couldn't see JS errors for the extension in the inspector, but I
> >> think the inspector is pretty hosed regardless.
> > What do you mean? JavaScript errors from content scripts? Or other
> > types of extension errors? You should definitely see errors, and I
> > know I've seen them before.
> >> - Because of both of the above, I always just restarted Chrome
> >> whenever I made any changes, setting my homepage to my test page.
> > That sucks, I really want a edit-reload development experience.
> >> - I missed the bit about the ID being a 40-digit hex number and spent
> >> a long time trying all sorts of stuff with my name in it.
> > Yeah, we should just remove the requirement for the ID altogether from
> > the development mode.
> >> - I also missed the bit about Python 2.6 and spent a reasonable amount
> >> of time figuring out how to install the non-default dep (SimpleJSON)
> >> in my Python 2.5, as the ez_setup only pretended to work.
> >> - I put chromium_extension.py in the same dir as the files. It then
> >> included itself in the CRX.
> > We want to add a feature to Chrome itself where you can just use it to
> > create the package.
> >> - The doc isn't clear about what to do with the CRX. Dragging it onto
> >> Chrome downloads it, and setting Chrome as the default opener for the
> >> filetype results in an infinite tab-spawning download loop (opening it
> >> downloads it again, after which it autoopens : repeat). If it's not
> >> implemented, can we say so?
> > Dragging it onto Chrome should download it, then install it, but there
> > is no UI letting you know that anything happened right now, and it
> > also doesn't work correctly when you're using a Chrome that isn't your
> > default installation.
> > I will update the doc and try and fix these issues.
> >> - I was worried that all of the content-scripting I'd forgotten would
> >> come and bite me, but apart from brief confusion over scope
> >> ('document' working, but 'window' requiring 'contentWindow'), writing
> >> the code itself was easy as pie.
> > 'window' shouldn't require contentWindow, unless you want to access
> > the content window's global scope, which doesn't seem necessary for
> > what you're trying to do (but I can't remember exactly what feature
> > you're talking about).
>> - Sometimes the script seemed to fail to load - particularly after >> hitting reload.
> That is weird, I've never noticed that ... Did you notice that the second > time you refreshed you'd see your changes?
After hitting reload, the script just appeared to not run (I had a bunch of contentWindow.console.log messages to let me know if it did). Very occasionally it would load, and I would see my changes.
I could never get an alert() to work, either alert, window.alert, or contentWindow.alert(); though I'll admit that I didn't try very hard, and the times I tried it may have overlapped with the times where the script failed to load.
>> - Couldn't see JS errors for the extension in the inspector, but I >> think the inspector is pretty hosed regardless.
> What do you mean? JavaScript errors from content scripts? Or other > types of extension errors? You should definitely see errors, and I > know I've seen them before.
In that case, I blame the nightly I was using - it wasn't doing a very good job of showing errors from webpages either. Maybe this explains the load-fail error as well.
>> - The doc isn't clear about what to do with the CRX. Dragging it onto >> Chrome downloads it, and ...
> Dragging it onto Chrome should download it, then install it, ... and it > also doesn't work correctly when you're using a Chrome that isn't your > default installation.
Ah, this was a nightly that was not my default Chrome - dragging it onto that nightly Chrome gave me a "Windows doesn't know what to do with this file" after it 'downloaded', so I guess I missed an associations step.
> Both files appear to be invalid??
The .zip was the .crx renamed to .zip. I have manually created a new .zip and uploaded it over the old one. Not sure why the .crx was invalid - I didn't get any error messages when I created it, and both files opened fine in 7-zip; maybe this explains why it didn't install, either.