Debian Codegraph @

js/src/doc/Debugger/Debugger.md

raw
1 # The Debugger Object
2
3 When called as a constructor, the `Debugger` object creates a new
4 `Debugger` instance.
5
6 ## `new Debugger([global, ...])`
7 Create a debugger object, and apply its [`addDebuggee`][add] method to
8 each of the given <i>global</i> objects to add them as the initial
9 debuggees.
10
11 ## Accessor Properties of the Debugger Prototype Object
12
13 A `Debugger` instance inherits the following accessor properties from
14 its prototype:
15
16 ### `allowUnobservedAsmJS`
17 A boolean value indicating whether asm.js code running inside this
18 `Debugger` instance's debuggee globals is invisible to Debugger API
19 handlers and breakpoints. Setting this to `false` inhibits the
20 ahead-of-time asm.js compiler and forces asm.js code to run as normal
21 JavaScript. This is an accessor property with a getter and setter. It is
22 initially `false` in a freshly created `Debugger` instance.
23
24 Setting this flag to `true` is intended for uses of subsystems of the
25 Debugger API (e.g, [`Debugger.Source`][source]) for purposes other than
26 step debugging a target JavaScript program.
27
28 ### `collectCoverageInfo`
29 A boolean value indicating whether code coverage should be enabled inside
30 each debuggee of this `Debugger` instance. Changing this flag value will
31 recompile all JIT code to add or remove code coverage
32 instrumentation. Changing this flag when any frame of the debuggee is
33 currently active on the stack will produce an exception.
34
35 Setting this to `true` enables code coverage instrumentation, which can be
36 accessed via the [`Debugger.Script`][script] `getOffsetsCoverage`
37 function. In some cases, the code coverage might expose information which
38 pre-date the modification of this flag. Code coverage reports are monotone,
39 thus one can take a snapshot when coverage first is enabled, and output the
40 difference.
41
42 Setting this to `false` prevents this `Debugger` instance from requiring any
43 code coverage instrumentation, but it does not guarantee that the
44 instrumentation is not present.
45
46 ### `exclusiveDebuggerOnEval`
47 A boolean value indicating whether other Debugger instances should
48 have their hook functions called when this instance uses:
49 * Debugger.Frame.evalWithBindings,
50 * Debugger.Object.executeInGlobalWithBindings
51 * Debugger.Object.call
52 When set to true, other Debugger instances are not notified.
53
54 ### `inspectNativeCallArguments`
55 A boolean value, to be set to true in order to pass the two last
56 arguments of `onNativeCall` hook.
57
58 ### `uncaughtExceptionHook`
59 Either `null` or a function that SpiderMonkey calls when a call to a
60 debug event handler, breakpoint handler, or similar
61 function throws some exception, which we refer to as
62 <i>debugger-exception</i> here. Exceptions thrown in the debugger are
63 not propagated to debuggee code; instead, SpiderMonkey calls this
64 function, passing <i>debugger-exception</i> as its sole argument and
65 the `Debugger` instance as the `this` value. This function should
66 return a [resumption value][rv], which determines how the debuggee
67 should continue.
68
69 If the uncaught exception hook itself throws an exception,
70 <i>uncaught-hook-exception</i>, SpiderMonkey throws a new error object,
71 <i>confess-to-debuggee-exception</i>, to the debuggee whose message
72 blames the debugger, and includes textual descriptions of
73 <i>uncaught-hook-exception</i> and the original
74 <i>debugger-exception</i>.
75
76 If `uncaughtExceptionHook`'s value is `null`, SpiderMonkey throws an
77 exception to the debuggee whose message blames the debugger, and
78 includes a textual description of <i>debugger-exception</i>.
79
80 Assigning anything other than a callable value or `null` to this
81 property throws a `TypeError` exception.
82
83 (This is not an ideal way to handle debugger bugs, but the hope here is
84 that some sort of backstop, even if imperfect, will make life easier for
85 debugger developers. For example, an uncaught exception hook may have
86 access to browser-level features like the `alert` function, which this
87 API's implementation does not, making it possible to present debugger
88 errors to the developer in a way suited to the context.)
89
90 ### `shouldAvoidSideEffects`
91 A boolean value used to ask a side-effectful native code to abort.
92
93 If set to true, `JS::dbg::ShouldAvoidSideEffects(cx)` returns true.
94 Native code can opt into this to support debugger who wants to perform
95 side-effect-free evaluation.
96
97
98 ## Debugger Handler Functions
99
100 Each `Debugger` instance inherits accessor properties with which you can
101 store handler functions for SpiderMonkey to call when given events occur
102 in debuggee code.
103
104 When one of the events described below occurs in debuggee code, the engine
105 pauses the debuggee and calls the corresponding debugging handler on each
106 `Debugger` instance that is observing the debuggee. The handler functions
107 receive the `Debugger` instance as their `this` value. Most handler
108 functions can return a [resumption value][rv] indicating how the debuggee's
109 execution should proceed.
110
111 On a new `Debugger` instance, each of these properties is initially
112 `undefined`. Any value assigned to a debugging handler must be either a
113 function or `undefined`; otherwise a `TypeError` is thrown.
114
115 Handler functions run in the same thread in which the event occurred.
116 They run in the compartment to which they belong, not in a debuggee
117 compartment.
118
119 ### `onNewScript(script, global)`
120 New code, represented by the [`Debugger.Script`][script] instance
121 <i>script</i>, has been loaded in the scope of the debuggees.
122
123 Since each function has its own [`Debugger.Script`][script], separate from
124 the top-level code or function that encloses it, loading JavaScript code
125 typically introduces not just a single script, but a tree of scripts
126 representing the top-level code and any functions it includes. The
127 `onNewScript` hook reports only the root script of such a tree. If
128 necessary, the handler function can use the scripts' `getChildScripts`
129 method to walk the tree and obtain all the newly introduced scripts.
130
131 This method's return value is ignored.
132
133 ### `onNewPromise(promise)`
134 A new Promise object, referenced by the [`Debugger.Object`][object] instance
135 *promise*, has been allocated in the scope of the debuggees. The Promise's
136 allocation stack can be obtained using the *promiseAllocationStack*
137 accessor property of the [`Debugger.Object`][object] instance *promise*.
138
139 This handler method should return a [resumption value][rv] specifying how
140 the debuggee's execution should proceed. However, note that a <code>{
141 return: <i>value</i> }</code> resumption value is treated like `undefined`
142 ("continue normally"); <i>value</i> is ignored.
143
144 ### `onPromiseSettled(promise)`
145 A Promise object, referenced by the [`Debugger.Object`][object] instance
146 *promise* that was allocated within a debuggee scope, has settled (either
147 fulfilled or rejected). The Promise's state, fulfillment or rejection
148 value, and the allocation and resolution stacks can be obtained using the
149 Promise-related accessor properties of the [`Debugger.Object`][object]
150 instance *promise*.
151
152 This handler method should return a [resumption value][rv] specifying how
153 the debuggee's execution should proceed. However, note that a <code>{
154 return: <i>value</i> }</code> resumption value is treated like `undefined`
155 ("continue normally"); <i>value</i> is ignored.
156
157 ### `onDebuggerStatement(frame)`
158 Debuggee code has executed a <i>debugger</i> statement in <i>frame</i>.
159 This method should return a [resumption value][rv] specifying how the
160 debuggee's execution should proceed.
161
162 ### `onEnterFrame(frame)`
163 The stack frame <i>frame</i> is about to begin executing code.
164 (Naturally, <i>frame</i> is currently the youngest
165 [visible frame][vf].) This method should return
166 a [resumption value][rv] specifying how the debuggee's execution should
167 proceed.
168
169 SpiderMonkey only calls `onEnterFrame` to report
170 [visible][vf], non-`"debugger"` frames.
171
172 ### `onNativeCall(callee, reason)`
173 A call to a native function is being made from a debuggee realm.
174 <i>callee</i> is a [`Debugger.Object`] for the function being called, and
175 <i>reason</i> is a string describing the reason the call was made, and
176 has one of the following values:
177
178 `get`: The native is the getter for a property which is being accessed.
179 `set`: The native is the setter for a property being written to.
180 `call`: Any call not fitting into the above categories.
181
182 <i>object</i> is a [`Debugger.Object`][object] reference to the object
183 onto which the native method is called, if any.
184 <i>args</i> is a [`Debugger.Object`][object] for the array of arguments
185 being passed to the native function.
186
187 The two last arguments, <i>object</i> and <i>args</i> are only passed
188 if `Debugger.inspectNativeCallArguments` is set to true.
189
190 This method should return a [resumption value][rv] specifying how the debuggee's
191 execution should proceed. If a return value is overridden for a constructor
192 call, it must be an object.
193
194 SpiderMonkey only calls `onNativeCall` hooks when execution is inside a
195 debugger evaluation associated with the debugger that has the `onNativeCall`
196 hook. Such evaluation methods include `Debugger.Object.apply`, `Debugger.Object.call`,
197 `Debugger.Object.executeInGlobal`, `Debugger.Frame.eval`, and associated methods.
198
199 Separately, any Debugger hooks triggered during calls to `Debugger.Object.apply`, `Debugger.Object.call`,
200 `Debugger.Object.executeInGlobal`, `Debugger.Frame.eval`, and associated methods
201 will only be triggered on Debugger objects owned by the Debugger performing
202 the evaluation.
203
204 ### `onExceptionUnwind(frame, value)`
205 The exception <i>value</i> has been thrown, and has propagated to
206 <i>frame</i>; <i>frame</i> is the youngest remaining stack frame, and is a
207 debuggee frame. This method should return a [resumption value][rv]
208 specifying how the debuggee's execution should proceed. If it returns
209 `undefined`, the exception continues to propagate as normal: if control in
210 `frame` is in a `try` block, control jumps to the corresponding `catch` or
211 `finally` block; otherwise, <i>frame</i> is popped, and the exception
212 propagates to <i>frame</i>'s caller.
213
214 When an exception's propagation causes control to enter a `finally`
215 block, the exception is temporarily set aside. If the `finally` block
216 finishes normally, the exception resumes propagation, and the debugger's
217 `onExceptionUnwind` handler is called again, in the same frame. (The
218 other possibility is for the `finally` block to exit due to a `return`,
219 `continue`, or `break` statement, or a new exception. In those cases the
220 old exception does not continue to propagate; it is discarded.)
221
222 This handler is not called when unwinding a frame due to an over-recursion
223 or out-of-memory exception.
224
225 ### `sourceHandler(ASuffusionOfYellow)`
226 This method is never called. If it is ever called, a contradiction has
227 been proven, and the debugger is free to assume that everything is true.
228
229 ### `onError(frame, report)`
230 SpiderMonkey is about to report an error in <i>frame</i>. <i>Report</i>
231 is an object describing the error, with the following properties:
232
233 * `message`
234 The fully formatted error message.
235
236 * `file`
237 If present, the source file name, URL, etc. (If this property is
238 present, the <i>line</i> property will be too, and vice versa.)
239
240 * `line`
241 If present, the source line number at which the error occurred.
242
243 * `lineText`
244 If present, this is the source code of the offending line.
245
246 * `offset`
247 The index of the character within lineText at which the error occurred.
248
249 * `warning`
250 Present and true if this is a warning; absent otherwise.
251
252 * `strict`
253 Present and true if this error or warning is due to the strict option
254 (not to be confused with ES strict mode)
255
256 * `exception`
257 Present and true if an exception will be thrown; absent otherwise.
258
259 * `arguments`
260 An array of strings, representing the arguments substituted into the
261 error message.
262
263 This method's return value is ignored.
264
265 ### `onNewGlobalObject(global)`
266 A new global object, <i>global</i>, has been created.
267
268 This handler method should return a [resumption value][rv] specifying how
269 the debuggee's execution should proceed. However, note that a <code>{ return:
270 <i>value</i> }</code> resumption value is treated like `undefined` ("continue
271 normally"); <i>value</i> is ignored. (Allowing the handler to substitute
272 its own value for the new global object doesn't seem useful.)
273
274 This handler method is only available to debuggers running in privileged
275 code ("chrome", in Firefox). Most functions provided by this `Debugger`
276 API observe activity in only those globals that are reachable by the
277 API's user, thus imposing capability-based restrictions on a
278 `Debugger`'s reach. However, the `onNewGlobalObject` method allows the
279 API user to monitor all global object creation that occurs anywhere
280 within the JavaScript system (the "JSRuntime", in SpiderMonkey terms),
281 thereby escaping the capability-based limits. For this reason,
282 `onNewGlobalObject` is only available to privileged code.
283
284 Note that, even though the presence of a `Debugger`'s `onNewGlobalObject`
285 hook can have arbitrary side effects, the garbage collector does not
286 consider the presence of the hook sufficient reason to keep the `Debugger`
287 alive. Thus, the behavior of code that uses `onNewGlobalObject` on unrooted
288 `Debugger`s may be affected by the garbage collector's activity, and
289 is not entirely deterministic.
290
291
292 ## Function Properties of the Debugger Prototype Object
293
294 The functions described below may only be called with a `this` value
295 referring to a `Debugger` instance; they may not be used as methods of
296 other kinds of objects.
297
298 ### `addDebuggee(global)`
299 Add the global object designated by <i>global</i> to the set of global
300 objects this `Debugger` instance is debugging. If the designated global
301 is already a debuggee, this has no effect. Return this `Debugger`'s
302 [`Debugger.Object`][object] instance referring to the designated global.
303
304 The value <i>global</i> may be any of the following:
305
306 * A global object.
307
308 * An HTML5 `WindowProxy` object (an "outer window", in Firefox
309 terminology), which is treated as if the `Window` object of the
310 browsing context's active document (the "inner window") were passed.
311
312 * A cross-compartment wrapper of an object; we apply the prior rules to
313 the wrapped object.
314
315 * A [`Debugger.Object`][object] instance belonging to this `Debugger` instance;
316 we apply the prior rules to the referent.
317
318 * Any other sort of value is treated as a `TypeError`. (Note that each
319 rule is only applied once in the process of resolving a given
320 <i>global</i> argument. Thus, for example, a [`Debugger.Object`][object]
321 referring to a second [`Debugger.Object`][object] which refers to a global does
322 not designate that global for the purposes of this function.)
323
324 The global designated by <i>global</i> must be in a different
325 compartment than this `Debugger` instance itself. If adding the
326 designated global's compartment would create a cycle of debugger and
327 debuggee compartments, this method throws an error.
328
329 This method returns the [`Debugger.Object`][object] instance whose referent is
330 the designated global object.
331
332 The `Debugger` instance does not hold a strong reference to its
333 debuggee globals: if a debuggee global is not otherwise reachable, then
334 it is dropped from the `Debugger`'s set of debuggees. (Naturally, the
335 [`Debugger.Object`][object] instance this method returns does hold a strong
336 reference to the added global.)
337
338 If this debugger is [tracking allocation sites][tracking-allocs] and cannot
339 track allocation sites for <i>global</i>, this method throws an `Error`.
340
341 ### `addAllGlobalsAsDebuggees()`
342 This method is like [`addDebuggee`][add], but adds all the global
343 objects from all compartments to this `Debugger` instance's set of
344 debuggees. Note that it skips this debugger's compartment.
345
346 If this debugger is [tracking allocation sites][tracking-allocs] and cannot
347 track allocation sites for some global, this method throws an `Error`.
348 Otherwise this method returns `undefined`.
349
350 This method is only available to debuggers running in privileged
351 code ("chrome", in Firefox). Most functions provided by this `Debugger`
352 API observe activity in only those globals that are reachable by the
353 API's user, thus imposing capability-based restrictions on a
354 `Debugger`'s reach. However, the `addAllGlobalsAsDebuggees` method
355 allows the API user to monitor all global object creation that
356 occurs anywhere within the JavaScript system (the "JSRuntime", in
357 SpiderMonkey terms), thereby escaping the capability-based
358 limits. For this reason, `addAllGlobalsAsDebuggees` is only
359 available to privileged code.
360
361 ### `removeDebuggee(global)`
362 Remove the global object designated by <i>global</i> from this
363 `Debugger` instance's set of debuggees. Return `undefined`.
364
365 This method interprets <i>global</i> using the same rules that
366 [`addDebuggee`][add] does.
367
368 Removing a global as a debuggee from this `Debugger` clears all breakpoints
369 that belong to that `Debugger` in that global.
370
371 ### `removeAllDebuggees()`
372 Remove all the global objects from this `Debugger` instance's set
373 of debuggees. Return `undefined`.
374
375 ### `hasDebuggee(global)`
376 Return `true` if the global object designated by <i>global</i> is a
377 debuggee of this `Debugger` instance.
378
379 This method interprets <i>global</i> using the same rules that
380 [`addDebuggee`][add] does.
381
382 ### `getDebuggees()`
383 Return an array of distinct [`Debugger.Object`][object] instances whose referents
384 are all the global objects this `Debugger` instance is debugging.
385
386 Since `Debugger` instances don't hold strong references to their
387 debuggee globals, if a debuggee global is otherwise unreachable, it may
388 be dropped at any moment from the array this method returns.
389
390 ### `getNewestFrame()`
391 Return a [`Debugger.Frame`][frame] instance referring to the youngest
392 [visible frame][vf] currently on the calling thread's stack, or `null`
393 if there are no visible frames on the stack.
394
395 ### `findSources()`
396 Return an array of all [`Debugger.Source`][source] instances of all debuggee
397 scripts.
398
399 Note that the result may include sources that can no longer ever be
400 used by the debuggee: say, eval code that has finished running, or
401 source for unreachable functions. Whether such sources appear can be
402 affected by the garbage collector's behavior, so this function's result
403 is not entirely deterministic.
404
405 ### `findScripts([query])`
406 Return an array of [`Debugger.Script`][script] instances for all debuggee scripts
407 matching <i>query</i>. Each instance appears only once in the array.
408 <i>Query</i> is an object whose properties restrict which scripts are
409 returned; a script must meet all the criteria given by <i>query</i> to
410 be returned. If <i>query</i> is omitted, we return the [`Debugger.Script`][script]
411 instances for all debuggee scripts.
412
413 <i>Query</i> may have the following properties:
414
415 * `url`
416
417 The script's `url` property must be equal to this value.
418
419 * `source`
420
421 The script's `source` property must be equal to this value.
422
423 * `line`
424
425 The script must at least partially overlap the given source line. If this
426 property is present, the `url`, `source`, or `displayURL` property must be present as well.
427
428 * `start` and `end`
429
430 These properties define a target range of source that the script must at least partially overlap. Their value must be an object with a `line` property and an optional, 1-based `column` property. The script must at least partially overlap the range [`start.line`, `end.line`] to be included in the results.
431
432 If the `start.column` property is provided, the target range's start line only includes the columns [`start.column`, Infinity). If the `end.column` property is provided, the target range's end line only includes the [1, `end.column`] columns.
433
434 Example <i>query</i>: `{ start: { line: 7, column: 11 }, end: { line: 13, column: 5} }`
435
436 If these properties are present, they take precedence over `line`.
437
438 These properties must be present together. If they are present, the `url`, `source`, or `displayURL` property must be present as well.
439
440 * `innermost`
441
442 If this property is present and true, the script must be the innermost
443 script overlapping the target source range; scripts of enclosing code are
444 omitted.
445
446 * `global`
447
448 The script must be in the scope of the given global object. If this
449 property's value is a [`Debugger.Object`][object] instance belonging to this
450 `Debugger` instance, then its referent is used. If the object is not a
451 global object, then the global in whose scope it was allocated is used.
452
453 All properties of <i>query</i> are optional. Passing an empty object
454 returns all debuggee code scripts.
455
456 Note that the result may include [`Debugger.Script`][script] instances for
457 scripts that can no longer ever be used by the debuggee, say, those for
458 eval code that has finished running, or unreachable functions. Whether
459 such scripts appear can be affected by the garbage collector's
460 behavior, so this function's behavior is not entirely deterministic.
461
462 ### `findSourceURLs()`
463
464 Return an array of strings containing the URLs of all known sources that
465 have been created in any debuggee realm. The array will have one entry for
466 each source, so may have duplicates. The URLs for the realms are
467 occasionally purged and the returned array might not be complete.
468
469 ### `findObjects([query])`
470 Return an array of [`Debugger.Object`][object] instances referring to each
471 live object allocated in the scope of the debuggee globals that matches
472 *query*. Each instance appears only once in the array. *Query* is an object
473 whose properties restrict which objects are returned; an object must meet
474 all the criteria given by *query* to be returned. If *query* is omitted, we
475 return the [`Debugger.Object`][object] instances for all objects allocated
476 in the scope of debuggee globals.
477
478 The *query* object may have the following properties:
479
480 * `class`
481
482 If present with a string value, only return objects whose internal
483 `[[Class]]`'s name matches the given string. Note that in some cases,
484 the prototype object for a given constructor has the same `[[Class]]` as
485 the instances that refer to it, but cannot itself be used as a valid instance
486 of the class. Code gathering objects by class name may need to examine them
487 further before trying to use them.
488
489 If present with a [`Debugger.Object`][object] value, only return objects
490 which has given object as constructor or prototype in the prototype chain.
491 Note that objects with dynamic prototype (e.g. `Proxy`) cannot be matched with
492 this query, given accessing the prototype for such object can have some
493 side effects. Also note that, currently an object with `null` prototype
494 cannot be matched with this query.
495
496 All properties of *query* are optional. Passing an empty object returns all
497 objects in debuggee globals.
498
499 Unlike `findScripts`, this function is deterministic and will never return
500 [`Debugger.Object`s][object] referring to previously unreachable objects
501 that had not been collected yet.
502
503 ### `clearBreakpoint(handler)`
504 Remove all breakpoints set in this `Debugger` instance that use
505 <i>handler</i> as their handler. Note that, if breakpoints using other
506 handler objects are set at the same location(s) as <i>handler</i>, they
507 remain in place.
508
509 ### `clearAllBreakpoints()`
510 Remove all breakpoints set using this `Debugger` instance.
511
512 ### `findAllGlobals()`
513 Return an array of [`Debugger.Object`][object] instances referring to all the
514 global objects present in this JavaScript instance.
515
516 The results of this call can be affected in non-deterministic ways by
517 the details of the JavaScript implementation. The array may include
518 [`Debugger.Object`][object] instances referring to global objects that are not
519 actually reachable by the debuggee or any other code in the system.
520 (Naturally, once the function has returned, the array's
521 [`Debugger.Object`][object] instances strongly reference the globals they refer
522 to.)
523
524 This handler method is only available to debuggers running in privileged
525 code ("chrome", in Firefox). Most functions provided by this `Debugger`
526 API observe activity in only those globals that are reachable by the
527 API's user, thus imposing capability-based restrictions on a
528 `Debugger`'s reach. However, `findAllGlobals` allows the API user to
529 find all global objects anywhere within the JavaScript system (the
530 "JSRuntime", in SpiderMonkey terms), thereby escaping the
531 capability-based limits. For this reason, `findAllGlobals` is only
532 available to privileged code.
533
534 ### `makeGlobalObjectReference(global)`
535 Return the [`Debugger.Object`][object] whose referent is the global object
536 designated by <i>global</i>, without adding the designated global as a
537 debuggee. If <i>global</i> does not designate a global object, throw a
538 `TypeError`. Determine which global is designated by <i>global</i>
539 using the same rules as [`Debugger.prototype.addDebuggee`][add].
540
541 ### `adoptDebuggeeValue(value)`
542 Given a debuggee value `value` owned by an arbitrary `Debugger`, return an
543 equivalent debuggee value owned by this `Debugger`.
544
545 If `value` is a primitive value, return it unchanged. If `value` is a
546 `Debugger.Object` owned by an arbitrary `Debugger`, return an equivalent
547 `Debugger.Object` owned by this `Debugger`. Otherwise, if `value` is some
548 other kind of object, and hence not a proper debuggee value, throw a
549 TypeError instead.
550
551 ### `adoptFrame(frame)`
552 Given `frame` of type `Debugger.Frame` which is owned by an arbitrary
553 `Debugger`, return an equivalent `Debugger.Frame` owned by this `Debugger`.
554 If the `frame` is associated with a debuggee that is _not_ a debuggee of
555 the adopting debugger, this method will throw.
556
557 ### `adoptSource(source)`
558 Given `source` of type `Debugger.Source` which is owned by an arbitrary
559 `Debugger`, return an equivalent `Debugger.Source` owned by this `Debugger`.
560
561 ### `enableAsyncStack(global)`
562 Enable async stack capturing for the realm for the global object designated by
563 <i>global</i>.
564
565 ### `disableAsyncStack(global)`
566 Disable async stack capturing for the realm for the global object designated by
567 <i>global</i>.
568
569 ### `enableUnlimitedStacksCapturing(global)`
570 Allow to capture more than 50 stacktraces for the realm for the global object
571 designated by <i>global</i>, even if it is not a debuggee.
572
573 ### `disableUnlimitedStacksCapturing(global)`
574 Disallow to capture more than 50 stacktraces for the realm for the global object
575 designated by <i>global</i>, unless it is a debuggee.
576
577 ## Static methods of the Debugger Object
578
579 The functions described below are not called with a `this` value.
580
581 ### `isCompilableUnit(source)`
582 : Given a string of source code, designated by <i>source</i>, return false if
583 the string might become a valid JavaScript statement with the addition of
584 more lines. Otherwise return true. The intent is to support interactive
585 compilation - accumulate lines in a buffer until isCompilableUnit is true,
586 then pass it to the compiler.
587
588 [add]: #adddebuggee-global
589 [source]: Debugger.Source.md
590 [script]: Debugger.Script.md
591 [rv]: Conventions.md#resumption-values
592 [object]: Debugger.Object.md
593 [vf]: Debugger.Frame.md#visible-frames
594 [tracking-allocs]: Debugger.Memory.md#trackingallocationsites
595 [frame]: Debugger.Frame.md