On Wed, Apr 22, 2009 at 4:38 PM, Aaron Boodman <[email protected]> wrote:

>
> So Finnur is looking at the Page Actions API
> (
> http://dev.chromium.org/developers/design-documents/extensions/page-actions-api
> ).
> Right now, the proposed API for creating one of these bad boys is:
>
> create({string name, [string javascript], [string faviconUrl], [bool
> executeInPage]}, [function callback(PageAction new)])
>
>
> I would like to change two main things about this:
>
> a) Usually page actions are associated with a tab. When you switch
> tabs, they should automatically be switched. The extension developer
> shouldn't have to manually manage that. There are also page actions
> which apply to every page, but we could support that separately.
>
> b) I would like the callback to be in the form of a function, not a
> string of JavaScript. Functions are better because they can have
> closures that allow you to keep references to local state, and are
> just more JavaScripty in general.
>
>
> So I would change it to something like:
>
> create({string name, int tabId, string iconUrl, function onExecute()},
> [function callback(PageAction new)])
>
> Note that the second callback is just basically telling you "yes, it
> was registered!". There would eventually be a third optional callback
> for errors ("no, that tab id doesn't even exist!").
>
>
> Thoughts on these changes? It would require some changes to enable
> ExtensionFunctions to have lifetimes beyond the stack frame, but I
> think that is a good thing because we want to support this style of
> API for other things in the future, like navigation or history
> searches.
>

(sorry a bit late with this reply)

I think these changes are an improvement, however it does feel a bit weird
for it to be tab-based rather than URL based.  With only a tab id, I think
there will be some races.  So if an extension script realizes that this page
is special and should have a PageAction created, it calls the API, but as it
does that, the tab navigates.  Since all the API has is a tab id, there's no
way for the browser to know whether the request is still valid or not.
 We'll likely continue to need a tab id as well since you could have
multiple tabs open to the same URL.

Erik

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: [email protected] 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to