Re: CanExecuteScripts's context doesn't have a JSScript*?

Doug Turner <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <47c64534-2f31-4e76-8e82-b6fc0470194b@f24g2000prh.googlegroups.com>
On May 5, 12:02 pm, Doug Turner <[email protected]> wrote:
> If the JSContext* passed into  
> nsScriptSecurityManager::CanExecuteScripts does not have a JSScript*  
> when walking the frames, what could that mean?
>
> In CanExecuteScripts(), i am doing something like this:
>
>      JSStackFrame* frame = nsnull;
>      JSScript* script = nsnull;
>      do {
>          frame = ::JS_FrameIterator(cx, &frame);
>
>          if (frame) {
>              script = ::JS_GetFrameScript(cx, frame);
>          }
>      } while (frame && !script);
>
>      if (script) {
>          const char* filename = ::JS_GetScriptFilename(cx, script);
>          printf("--> filename: %s\n", filename);  //check for null?
>      }
>      else
>      {
>          printf("--> no script?\n");
>      }
>
>    cx is passed into the function.
>
> I would have thought that we would have a non-null JSScript* even for  
> inlince script.
>
> Doug Turner


An answer to my question is that this method is probably called to
early for any frames to be on the stack.  If that is the case, is
there a way to get the file name associated with the JSContext in this
method -- or are too early?  Basically, what I want to know is "where
did the script that this method get call about come from?"

Doug
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.