On Jul 29, 5:55 am, Olivier Cornu <[email protected]> wrote:
...
> As it seems a Sandbox is not a "supported" scope, i tried this

Yes, you are on the the right track....

> quick-&-dirty-hack(TM) in getFrameScopeWindowAncestor():
>
> --- firebug-service.js~ 2009-07-29 13:25:51.913450368 +0200
> +++ firebug-service.js  2009-07-29 13:26:42.293449931 +0200
> @@ -2573,7 +2573,7 @@
>          while(scope.jsParent)
>              scope = scope.jsParent;
>
> -        if (scope.jsClassName == "Window" || scope.jsClassName ==
> "ChromeWindow")
> +        if (scope.jsClassName == "Window" || scope.jsClassName ==
> "ChromeWindow" || scope.jsClassName == "Sandbox")
>              return  scope.getWrappedValue();

While Chromebug can with with non-window scopes, Firebug cannot.

>
>          if (FBTrace.DBG_FBS_FINDDEBUGGER)
>
> Apart of the fact that this throws "too much recursion" errors at
> firebug-service:2559 (hook()), webmonkey.js (the add-on XPCOM, not the
> script unfortunately) appears in FB scripts tab. Nevertheless, it's a
> tiny progress. :-p

I don't understand "the addon XPCOM".

>
> > Once you figure out what jsd things of the GM scripts, you need to
> > convince Firebug to add them to the context for  the web page. After
> > that I guess Firebug will work for you.
>
> I'm not there yet! I guess i'll have to keep on working in this
> direction... Any hint will be much appreciated. :-)
>
> I guess one of my problems at this stage will be that
> getFrameScopeWindowAncestor() is expected to return an object that is
> _both_ a Window and a JS scope: in the context of a GM script, these
> are two different things (the scope is the Sandbox).

Well getFrameScopeWindowAncestor() must return a nsIDOMWindow for
Firebug. In particular it needs to return the window that the GM
script was applied to. But I think you want to know that the compile
was in a Sandbox.

I think that at this stage in the processing the only thing we are
trying to do is create a "SourceFile", that is Firebug's metadata for
a compilation unit, and put that SourceFile in the correct context.
The scope analysis is only a means to that end. Firefox mixes up all
of the scripts from web pages and xul: we are just trying to sort out
where this particular script belongs.  For that we need the window
then we can use getContextByWindow() to get the context we want to
attach to.

But we also need to know that the compile was in a Sandbox so we can
create a SandboxSourceFile (which by the way is not defined yet ;-).
This would be returned from onTopLevelScriptCreated. You don't need
the sandbox itself, just a way to know that you need to get the source
from GM (well I assume you have a way to get the source...).

With a SandboxSourceFile and the correct context, I guess the rest
will come together.

You won't see any of the GM script's top level objects this way, I
suppose they are in the sandbox object. But you can't reach them from
the web page anyway. You will see stuff when you hit a breakpoint in a
GM script.

(Chromebug creates new contexts for every sandbox, but I don't think
that is very helpful, you want the GM script to appear with the rest
of the page stuff.)


Does this give you enough hints?

jjb
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Firebug" 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/firebug?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to