View Javadoc
1   /*
2    * Copyright (c) 2002-2025 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit.javascript;
16  
17  import org.htmlunit.corejs.javascript.Context;
18  import org.htmlunit.corejs.javascript.debug.DebugFrame;
19  import org.htmlunit.corejs.javascript.debug.DebuggableScript;
20  
21  /**
22   * <p>
23   * HtmlUnit's implementation of the {@link org.htmlunit.corejs.javascript.debug.Debugger} interface,
24   * which registers {@link DebugFrameImpl} instances with Rhino for each new execution frame created.
25   * See <a href="http://www.mozilla.org/rhino/rhino15R4-debugger.html">the Rhino documentation</a> or
26   * <a href="http://lxr.mozilla.org/mozilla/source/js/rhino/src/org/mozilla/javascript/debug/Debugger.java">the
27   * interface source code</a> for more info on the {@link org.htmlunit.corejs.javascript.debug.Debugger}
28   * interface and its uses.
29   * </p>
30   *
31   * <p>
32   * Please note that this class is intended mainly to aid in the debugging and development of
33   * HtmlUnit itself, rather than the debugging and development of web applications.
34   * </p>
35   *
36   * <p>
37   * In order to enable the debugging output, call
38   * {@link HtmlUnitContextFactory#setDebugger(org.htmlunit.corejs.javascript.debug.Debugger)}, passing in
39   * an instance of this class, and make sure your loggers are configured to output <code>TRACE</code> level log messages.
40   * </p>
41   *
42   * @author Daniel Gredler
43   * @see DebugFrameImpl
44   * @see HtmlUnitContextFactory#setDebugger(org.htmlunit.corejs.javascript.debug.Debugger)
45   */
46  public class DebuggerImpl extends DebuggerAdapter {
47  
48      /**
49       * {@inheritDoc}
50       */
51      @Override
52      public DebugFrame getFrame(final Context cx, final DebuggableScript functionOrScript) {
53          return new DebugFrameImpl(functionOrScript);
54      }
55  
56  }