I tried turning on AlertOnError, and nothing seems to appear in Firebug,
or elsewhere.
Here is what I trying to run:
CmdUtils.getURLSnapshot = function getURLSnapshot(url, options){
var win = CmdUtils.getHiddenWindow();
win.document.location.href = url;
win.document.addEventListener("load", function(){
return CmdUtils.getWindowSnapshot(win, options);
}, true);
}
CmdUtils.CreateCommand({
name: "back",
description: "Browser's Back Function",
takes: {"input": noun_arb_text},
preview: function( pblock, input ) {
var imgData = CmdUtils.getURLSnapshot( "http://mozilla.org",
{width:500} );
pblock.innerHTML = "Changes to <b style=\"color:yellow\">%s</b>
document.".replace(/%s/, "url");
pblock.innerHTML += "<br/><img src='%s'>".replace(/%s/, imgData );
},
execute: function(input) {
CmdUtils.getWindow().history.go(-1)
}
});
Everything works except that upper part, and have really no idea where
the problem is.
Braydon
Christian Sonne wrote:
>
>
> On Mon, Jan 5, 2009 at 11:38 AM, Braydon Fuller <[email protected]
> <mailto:[email protected]>> wrote:
>
> Do you know where error messages go? Errors seem to pass silently.
>
>
> That depends on a few things... if the error is an exception, ubiquity
> catches it and depending on the value of
> extensions.ubiquity.displayAlertOnError in about:config it will
> display the exception as a notification - regardless of it's value, it
> will be logged in the console. (At least, that's how I've understood it.)
>
> If the error is not an exception, or something before ubiquity catches
> it, you are hard pressed to figure out what has happened - you'll
> notice that my code for bookmark is a bit strange on that account - if
> you try to bookmark a chrome page, somethings errors out, but it
> doesn't throw an exception, or at least not one that reaches me
>
> While writing this email, I've just figured out that I cannot test the
> function as I do, as it seems to return false in any case, so that
> command will have to be altered:
> CmdUtils.CreateCommand({
> name: "bookmark",
> description: "Add current document to bookmarks",
> preview: function( pblock ) {pblock.innerHTML=this.description},
> execute: function() {
> var win = CmdUtils.getWindowInsecure();
> var doc = CmdUtils.getDocument();
> try {
> win.sidebar.addPanel(doc.title, win.location.href,"");
> } catch ( e ) { displayMessage("Page could not be bookmarked!" +
> ((e)?" - "+e:"")); }
> }
> });
>
> is probably better for now...
>
> -- cers / Christian Sonne
>
>
> Braydon
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ubiquity-firefox" 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/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---