Граф коммитов

2979 Коммитов

Автор SHA1 Сообщение Дата
waldemar%netscape.com d7f7cfe179 Simplified use-name-patterns 2001-01-10 02:50:13 +00:00
nboyd%atg.com b8ac59c406 Subject:
Re: Debugger problem
        Date:
             Mon, 08 Jan 2001 14:16:30 -0800
       From:
             Christopher Oliver <coliver@mminternet.com>
 Organization:
             Primary Interface LLC
         To:
             Kurt Westerfeld <kurt@ManagedObjects.com>
         CC:
             Norris Boyd <nboyd@atg.com>
  References:
             1 , 2 , 3




Kurt, Norris,

Yes, with the change to the shell this should be possible.  The problem before
was that if you loaded the same file with different relative path names, two
different windows in the debugger were created because everything (windows,
breakpoints, etc) is keyed off the source name.

The attached file contains the fix (and includes the workaround for
Desktop.getSelectedFrame).

There are still some bugs in transferring focus between the windows in the
Desktop.  I haven't had time to track down the problem or a solution.

Chris

Kurt Westerfeld wrote:

> I would point out that "Source Name" of a script isn't necessarily a
> filename.  In our system, scripts are run remotely from a script library
> that has no file system backing.  Canonicalizing the file names is really
> unnecessary.
>
> Can't you just modify JSDebugger to not care what the name of the file is?
> If access to the original script is unavailable except through the file
> system, I'd be surprised.
>
> ----- Original Message -----
> From: Christopher Oliver <coliver@mminternet.com>
> To: Kurt Westerfeld <kurt@ManagedObjects.com>
> Cc: Norris Boyd <nboyd@atg.com>
> Sent: Sunday, January 07, 2001 2:23 AM
> Subject: Re: Debugger problem
>
> > Hi Kurt,
> >
> > I rather would say that it is a problem with the processFile method in the
> > shell's Main class.  If you change the current working directory or the
> value
> > of the System property "user.dir" after compiling a script, relative path
> names
> > can become ambiguous.  Norris, would it be ok to modify the shell to
> > "canonicalize" the names of files it compiles?  That way the source name
> that
> > shows up in the stack and in DebuggableScript will always be unique.  For
> > example:
> >
> > public static void processFile(Context cx, Scriptable scope,
> >                                    String filename)
> >     {
> >             Reader in = null;
> >             try {
> >                 in = new PushbackReader(new FileReader(filename));
> >                 int c = in.read();
> >                 // Support the executable script #! syntax:  If
> >                 // the first line begins with a '#', treat the whole
> >                 // line as a comment.
> >                 if (c == '#') {
> >                     while ((c = in.read()) != -1) {
> >                         if (c == '\n' || c == '\r')
> >                             break;
> >                     }
> >                     ((PushbackReader) in).unread(c);
> >                 } else {
> >                     // No '#' line, just reopen the file and forget it
> >                     // ever happened.  OPT closing and reopening
> >                     // undoubtedly carries some cost.  Is this faster
> >                     // or slower than leaving the PushbackReader
> >                     // around?
> >                     in.close();
> >                     in = new FileReader(filename);
> >                 }
> >                 filename = new java.io.File(filename).getCanonicalPath();
> > <<<====== Add this
> >             }
> >             catch (FileNotFoundException ex) {
> >                 Context.reportError(ToolErrorReporter.getMessage(
> >                     "msg.couldnt.open",
> >                     filename));
> >                 exitCode = EXITCODE_FILE_NOT_FOUND;
> >                 return;
> >             } catch (IOException ioe) {
> >                 globalState.getErr().println(ioe.toString());
> >             }
> >
> >             // Here we evalute the entire contents of the file as
> >             // a script. Text is printed only if the print() function
> >             // is called.
> >             evaluateReader(cx, scope, in, filename, 1);
> >     }
> >
> >
> > Attached is *my* latest version of the debugger code.  Norris, have you
> made
> > any progress on cvs commit priveledges?  The attached version fixes a
> number of
> > GUI bugs:
> >
> > 1) If you undocked the Variables window and popped up the Context
> combo-box and
> > then closed the window with the system menu, the Context pop-up was not
> cleaned
> > up properly.
> > 2) The first time you minimize a file window it appeared to dissappear
> when you
> > tried to restore it.  This was due to the fact that I forgot to "pack" its
> > contents and as a result its requested size was 0x0.
> >
> > I also added a menu item to toggle whether to break on exceptions and one
> which
> > allows you to open (and compile) a JavaScript file without actually
> executing
> > it.
> >
> > I have also attached a Word document with some basic documentation for the
> > Debugger.
> >
> > Note that this version also includes all the changes to support debugging
> > scripts in the AWT dispatch thread.
> >
> > Chris
> >
> > Kurt Westerfeld wrote:
> >
> > > Hello.  I ran into a null pointer exception in JSDebugger tonight, and I
> > > thought I'd drop you a note.
> > >
> > > The problem line is 2336, where a breakpoint is hit.  To simulate, load
> the
> > > debugger using the command line syntax on a file that has not been
> resolved
> > > to cannonical path.
> > >
> > > Example,
> > >
> > >      jshell -debug -f \myfile.fs
> > >
> > > At any rate, the "handleCompilationDone" routine takes \myfile.fs and
> turns
> > > it into a canonical path.  If you hit a breakpoint in this file and say
> > > "go", when the breakpoint hits the file is not found, because the same
> > > canonical path resolution is not done.  The resolution seems dubious,
> since
> > > it is only done in the compilation done callback, but I don't know the
> best
> > > way to suggest a fix since it seems that code had some purpose.
> > >
> > > Anyway, thought you'd wanna know.
> > >
> > > ________________________________________________________________________
> > >   Kurt Westerfeld
> > >   Senior Software Architect
> > >   Managed Objects
> > >   mailto:kwester@ManagedObjects.com
> > >   703.770.7225
> > >   http://www.ManagedObjects.com
> > >
> > >   Managed Objects: manage technology > rule business
> >



   JSDebugger.java

                    Name:
                          JSDebugger.java
                    Type:
                          Java Class File (java/*)
                 Encoding:
                          base64
2001-01-09 14:10:40 +00:00
nboyd%atg.com 864bb13d47 Missed checkin of new file. 2001-01-09 13:39:22 +00:00
nboyd%atg.com cbf2c6d0b4 Clean up debug APIs.
* Make use of DebuggableEngine interface to keep Context API smaller
* Change org.mozilla.javascript.debug.Frame to DebugFrame to avoid
  confusion with java.awt.Frame
2001-01-08 21:41:25 +00:00
nboyd%atg.com 05afc92b5d Fix for 1.1 compatibility. 2001-01-08 14:34:21 +00:00
nboyd%atg.com db930451b8 Fix classloader problem from last checkin. 2001-01-08 02:13:28 +00:00
nboyd%atg.com 1de208b764 Canonicalize file names to help debugger. 2001-01-08 02:12:52 +00:00
nboyd%atg.com 59adb03eb5 Latest changes from Chris Oliver. 2001-01-08 01:43:28 +00:00
nboyd%atg.com cb3ce5e5aa Revert to old object identity for equality per ECMA. 2001-01-08 01:03:23 +00:00
nboyd%atg.com 0298ab90eb For == use .equals after unwrapping. 2001-01-05 20:00:47 +00:00
nboyd%atg.com 07b81a65d3 Fix bug 64397. 2001-01-05 19:15:59 +00:00
nboyd%atg.com 0e1266c7d4 Email thread describing change:
Subject:
             Re: Rhino bug - Wrapper ??
        Date:
             Fri, 05 Jan 2001 03:46:11 +0530
       From:
             Mukund Balasubramanian <mukund@cs.stanford.edu>
 Organization:
             Another Netscape Collabra Server User
 Newsgroups:
             netscape.public.mozilla.jseng
  References:
             1 , 2 , 3 , 4 , 5 , 6




That works too,
    Should I assume that this would be a part of the next tip ? I agree with the
part about
overloading code too.

    Anyways, thanks a load for your help and just tell me if I could be of any
help in any other
respects of the rhino project.

ThanX,

Mukund Balasubaramanian

Norris Boyd wrote:

> Actually, I was considering removing the unwrapping code from
NativeJavaConstructor. I was
> suprised that it was there. The code dates from before we implemented proper
method and
> constructor overloading in Rhino. It's the overloading code that should have
the responsibility
> for unwrapping.
>
> Does this patch work for you:
>
> Index: NativeJavaObject.java
> ===================================================================
> RCS file:
/cvsroot/mozilla/js/rhino/org/mozilla/javascript/NativeJavaObject.java
> ,v
> retrieving revision 1.29
> diff -u -r1.29 NativeJavaObject.java
> --- NativeJavaObject.java       2000/11/13 22:10:32     1.29
> +++ NativeJavaObject.java       2001/01/04 21:33:55
> @@ -673,6 +673,12 @@
>
>                  return Result;
>              }
> +            else if (value instanceof Wrapper) {
> +                value = ((Wrapper)value).unwrap();
> +                if (type.isInstance(value))
> +                    return value;
> +                reportConversionError(value, type);
> +            }
>              else {
>                  reportConversionError(value, type);
>              }
>
> This handles the case where the object is both a Scriptable and a Wrapper.
>
> --N
>
> Mukund Balasubramanian wrote:
>
> > Yes they do implement Scriptable.
> >     From my preliminary inspection of the code, findFunction seems to be
preceediong the
> > coerceType call and I presume findFunction call is going to fail if the
arguments are
> > wrapped (bad types mismatching signature).
> >     The constructor case DOES go through an explicit unwrapping stage as
shown by the cut
> > and paste code. My question is whether the same preamble in NativeJavaMethod
is a valid bug
> > fix.
> >
> > ThanX,
> >
> > Mukund Balasubramanian
> >
> > Norris Boyd wrote:
> >
> > > Do your objects that implement Wrapper also implement Scriptable? From
simple inspection
> > > of the code I'd think that both the constructor and method cases would go
through
> > > NativeJavaMethod.coerceType, which should unwrap. However, Scriptable
objects are picked
> > > off and handled before any unwrapping is considered.
> > >
> > > --N
> > >
> > > Mukund Balasubramanian wrote:
> > >
> > > > Yup,
> > > >     Here it is - Line numbers 173-178 are cut and paste from
> > > > NativeJavaConstructor.java inside NativeJavaMethod.java
> > > >
> > > > /*** Call in NativeJavaMethod.java
> > > >     public Object call(Context cx, Scriptable scope, Scriptable thisObj,
> > > >                        Object[] args)
> > > >         throws JavaScriptException
> > > >     {
> > > >         // Eliminate useless args[0] and unwrap if required
> > > >         for (int i = 0; i < args.length; i++) {
> > > >             if (args[i] instanceof Wrapper) {
> > > >                 args[i] = ((Wrapper)args[i]).unwrap();
> > > >             }
> > > >         }
> > > >
> > > >   // Find a method that matches the types given.
> > > >         if (methods.length == 0) {
> > > > ****/
> > > >
> > > > Is this correct ? I presume it is because of the fact that the
constructor
> > > > does this.
> > > >
> > > > Any luck with my other question regarding generalizing the WrapHandler
to all
> > > > objects (including those returned by scriptable) and not only those
returned
> > > > through nativeJava***
> > > >
> > > > ThanX,
> > > >
> > > > Mukund Balasubramanian
> > > >
> > > > Norris Boyd wrote:
> > > >
> > > > > Could you post your proposed patch?
> > > > >
> > > > > Thanks,
> > > > > Norris
> > > > >
> > > > > Mukund Balasubramanian wrote:
> > > > >
> > > > > > Hi all,
> > > > > >     I am trying to play around with writing a custom WrapHandler for
my
> > > > > > Java objects in Rhino. I found WrapHandler very useful.
> > > > > >     Now I am stuck at a point where, even though my wrappers
implement
> > > > > > "Wrapper", they get unwrapped only on calles to Constructors using
> > > > > > Liveconnect. Normal methods dont seem to be doing any unwrapping.
> > > > > > Managed to build rhino with a bug fix (cut and paste code from
> > > > > > NativeJavaConstructor to NativeJavamethod), and it works.
> > > > > >     Just wanted to verify if it is a known bug (while I wait for
> > > > > > bugzilla to mail me a passwd).
> > > > > >
> > > > > > BTW, also found something interesting, WrapHandler gets called only
when
> > > > > > the object is returned from NativeJava***, not ANY Object. Is that
the
> > > > > > way it is supposed to work ??
> > > > > >
> > > > > > ThanX for any help,
> > > > > >
> > > > > > Mukund Balasubramanian
2001-01-05 01:17:51 +00:00
brendan%mozilla.org 39ed395c58 Speed up js_qsort_r a bit (64065, r=mccabe, sr=jband). 2001-01-04 10:13:18 +00:00
mccabe%netscape.com ce1033908e Oops. Removing unneeded 'System.err.println("foo")'. 2001-01-04 00:03:00 +00:00
mccabe%netscape.com 9f3e15aaf5 Fix to 64149.
Propagate lexer fixes from Monkey to accept (and warn) about 008 as well as just 08.
2001-01-03 23:36:33 +00:00
nboyd%atg.com 2e691de2e6 Get rid of BSF file in Rhino code. Just rely upon building BSF ourselves for now. 2001-01-03 20:54:37 +00:00
bryner%uiuc.edu 69e9b90bc6 Removing dead .toc files. Not part of build. a=sfraser. 2001-01-03 01:32:06 +00:00
rogerl%netscape.com 2c115aa7b4 Fix for VC++ compile. 2001-01-02 19:49:16 +00:00
pschwartau%netscape.com bc3b1264b8 Correcting bug that cropped up when system clock was set to GMT Standard Time 2001-01-01 02:40:28 +00:00
beard%netscape.com 4ca46948df another pass over LexUtils::cmp_nocase(). 2000-12-30 08:08:12 +00:00
beard%netscape.com 41d32a622f fix unsigned/signed comparison warnings 2000-12-30 07:55:01 +00:00
beard%netscape.com 2d8bdb7992 Use GC-safe vector of JSFunction* to hold getters/setters. 2000-12-30 07:46:18 +00:00
beard%netscape.com 661e422910 no need to copy JSString values into String values. 2000-12-30 07:06:03 +00:00
rogerl%netscape.com 61eb9f446d Fixed bit-rot in exception handling, removed unused locals. 2000-12-30 01:13:06 +00:00
rogerl%netscape.com 6676b0784f re-ordered members wrt init sequence. 2000-12-30 01:08:31 +00:00
mccabe%netscape.com a8ec7cd47b Add emacs makefile modeline.
Not part of the Mozilla build.
2000-12-29 23:23:52 +00:00
rogerl%netscape.com f27ea7e548 Fix for #60164, more failure testing during exception processing.
r=mccabe, a=brendan
2000-12-29 22:19:09 +00:00
pschwartau%netscape.com 5abaf0cf2b Initial add - 2000-12-29 02:46:32 +00:00
pschwartau%netscape.com 4d301707dd Adjusting hard-coded Pacific timezone date testcases to work in any tester's timezone - 2000-12-26 20:02:04 +00:00
pschwartau%netscape.com 0398d7bee8 Adding functionality to adjust hard-coded date tests (written for Pacific timezone) for the tester's own timezone 2000-12-26 19:55:05 +00:00
pschwartau%netscape.com bfb589f60d Modifiying one line that was failing in GMT+ timezones (i.e. east of Greenwich) 2000-12-26 19:34:07 +00:00
waldemar%netscape.com 3e8e4d48fc Revamped the syntax for calling superconstructors and tightened up the syntax for the super operator 2000-12-22 02:02:14 +00:00
mccabe%netscape.com b8e8f4bb95 Fix courtesy jband to quiet unused variable warning.
Move 'dlsoffset' to the block where it's used, inside #ifdef XP_MAC.

r=mccabe
2000-12-21 04:32:13 +00:00
waldemar%netscape.com f11df45168 Simplified postfix-expressions and use-exclude-include 2000-12-21 00:04:52 +00:00
brendan%mozilla.org 7b1d57a4dc Don't fatten a flyweight lock unnecessarily in JS_SetPrototype; misc. cleanups (63097, r=mccabe, sr=jband). 2000-12-20 22:36:01 +00:00
nboyd%atg.com e86e0fd5b5 Nope, 8 was right. 2000-12-20 13:31:59 +00:00
waldemar%netscape.com 664c11c819 Changed 'operator' from a keyword to an attribute. 2000-12-19 01:57:13 +00:00
waldemar%netscape.com 666b8c7b81 Removed 'operator' non-reserved word 2000-12-19 01:56:36 +00:00
nboyd%atg.com 4674ece3c9 Off by one error fixed. 2000-12-18 19:32:00 +00:00
nboyd%atg.com cdc056a04a Add ContextListener to API classes. 2000-12-18 19:30:26 +00:00
beard%netscape.com 048ef40a40 added newest source files, to use the icode assembler. (Pro6 update) 2000-12-16 07:01:50 +00:00
beard%netscape.com da3f96b69c added newest source files, to use the icode assembler. 2000-12-16 07:01:22 +00:00
beard%netscape.com 23425c7dea use string8::difference_type rather than uint for difference between iterators, cast uint32 to int32 to remove warnings. 2000-12-16 06:57:58 +00:00
beard%netscape.com 50f3452e77 fixed return value warning by moving return statement. 2000-12-16 06:56:37 +00:00
beard%netscape.com 27888b7f72 warnings, explicit use of JSValue constructor. 2000-12-16 06:54:40 +00:00
waldemar%netscape.com 157324e348 Converted to CodeWarrior 6 and fixed errors 2000-12-16 01:14:55 +00:00
waldemar%netscape.com a86b8ebf19 Fixed C++ errors 2000-12-16 01:14:36 +00:00
jeff.dyer%compilercompany.com 80b7ec4f9f Revised readme and removed CommandLine parser (for now). 2000-12-16 00:50:25 +00:00
jeff.dyer%compilercompany.com 9f31ccbf60 Removing Util.java. 2000-12-16 00:43:05 +00:00
jeff.dyer%compilercompany.com 144aa7a24d Removed dependency on sun.tools packages. 2000-12-16 00:42:16 +00:00