Hi Mohamed,
Thank you for your reply! Yes, when I tapped the single line in
console it works just fine. Sorry for my misleading, it does not crash
chrome, it crashes the extension itself. I eventually found out that
this happens only on MY extension. And I checked the document without
finding any mistake of my syntax, would you please be more specific
about what part was wrong?
And I've tried:
chrome.bookmarks.update('53',{title:'shinikami'},function(r)
{console.dir(r)});
in the console(of another extension), it works fine. Then I load my
extension, do the same thing, it crashes.
I'm wondering whether I should file this as a bug, or would you be
kind enough to take a look at my extension?
Sincerely,
Bei
P.S.
I'm sorry I was delayed. I've got a flu for a few days. But i'm okay
now :-).
On Dec 14, 2:58 pm, Mohamed Mansour <[email protected]> wrote:
> Hi Bei,
>
> I believe the syntax is incorrect. Either way, that shouldn't crash chrome
> :x
>
> Please follow the docs
> here:http://code.google.com/chrome/extensions/bookmarks.html#method-update
>
> <http://code.google.com/chrome/extensions/bookmarks.html#method-update>First
> of all, your parameters are incorrect. It should be something like this:
>
> > chrome.bookmarks.update(id, data, function(result) {
>
> // the callback when it updated, returning back the bookmark node
>
> > itself.
>
> });
>
> id: is the bookmark node id.
> data: currently you can only support "title", so it should be something like
> this: {"title": "hello world"}
>
> When you placed id = 1, that doesn't necessarily mean its the first
> bookmark. As the docs state:
> "Bookmarks are organized in a tree, where each node in the tree is either a
> bookmark or a group (a folder that can contain nodes). Each node in the tree
> is represented by a
> BookmarkTreeNode<http://code.google.com/chrome/extensions/bookmarks.html#type-Bookmark...>
> object."
>
> I will give you the initial post to help you get running :) First, lets find
> a bookmark that its title is "Gmail" and lets rename it to "hello gmail". To
> do this, we need to use the "get" api
> (http://code.google.com/chrome/extensions/bookmarks.html#method-get) to
> retrieve the id for the bookmark found. We use that id to update it
> (http://code.google.com/chrome/extensions/bookmarks.html#method-update).
>
> chrome.bookmarks.search("Gmail", function(results) {
>
> for (var r = 0; r < results.length; r++) {
>
> var result = results[r];
>
> console.log("Bookmark ID: " + result.id)
>
> chrome.bookmarks.update(result.id, {"title": "hello gmail"},
>
> > function(result) {
>
> console.log("updated!")
>
> });
>
> }
>
> });
>
> I hope the above helps! Remember the docs is your best friend!
>
> -Mohamed Mansour
>
> On Sun, Dec 13, 2009 at 4:05 AM, shinjikun <[email protected]>wrote:
>
>
>
> > I tried the chrome.bookmarks.update api in different ways about
> > 30~40time, every time it crashes. It's supposed to be like:
>
> > chrome.bookmarks.update(id,{title:'xxx'},function(){});
>
> > but this won't work, and any of these won't work either:
>
> > chrome.bookmarks.update(id,{title:'xxx'});
> > chrome.bookmarks.update('1',{});
> > chrome.bookmarks.update('1');
>
> > Is there anything wrong with the extension system or it's my bad?
>
> > Thanks,
> > Bei
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Chromium-extensions" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<chromium-extensions%2Bunsu
> > [email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/chromium-extensions?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Chromium-extensions" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/chromium-extensions?hl=en.