Skip to content

Commit ad6ba7c

Browse files
author
Chris K
committed
Fix for DFL-3317, Stop on error doesn't work on remote debugging.
1 parent 5e26ee3 commit ad6ba7c

File tree

1 file changed

+34
-24
lines changed

1 file changed

+34
-24
lines changed

src/ecma-debugger/stop_at.js

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
3838
use_reformat_condition: 7,
3939
}
4040

41-
var reformat_condition =
41+
var requires_version_map =
42+
{
43+
"6": [6, 13],
44+
"7": [6, 13],
45+
};
46+
47+
var reformat_condition =
4248
[
4349
"var MAX_SLICE = 5000;",
4450
"var LIMIT = 11;",
@@ -105,6 +111,10 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
105111
for (var prop in stop_at_settings)
106112
{
107113
var index = stop_at_id_map[prop];
114+
var depending = requires_version_map[index];
115+
if (depending && !ecma_debugger.satisfies_version.apply(ecma_debugger, depending))
116+
continue;
117+
108118
if (prop == "script")
109119
config_arr[index] = 1;
110120
else if (prop == "use_reformat_condition")
@@ -120,17 +130,17 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
120130
return runtime_id;
121131
}
122132

123-
133+
124134
this.getControlsEnabled = function()
125135
{
126136
return __controls_enabled;
127137
}
128-
138+
129139
this.__defineGetter__("is_stopped", function()
130140
{
131141
return __is_stopped;
132142
});
133-
143+
134144
this.__defineSetter__("is_stopped", function(){});
135145

136146
this.getFrames = function()
@@ -205,7 +215,7 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
205215
SCOPE_LIST = 7,
206216
ARGUMENT_VALUE = 8,
207217
THIS_VALUE = 9;
208-
218+
209219
if (status)
210220
{
211221
opera.postError("parseBacktrace failed scope message: " + message);
@@ -222,13 +232,13 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
222232
for( ; frame = _frames[i]; i++ )
223233
{
224234
line_number = frame[LINE_NUMBER];
225-
// workaround for CORE-37771 and CORE-37798
235+
// workaround for CORE-37771 and CORE-37798
226236
// line number of the top frame is sometime off by one or two lines
227-
if (!i && typeof stop_at.line_number == 'number' &&
237+
if (!i && typeof stop_at.line_number == 'number' &&
228238
Math.abs(line_number - stop_at.line_number) < 3)
229239
{
230240
line_number = stop_at.line_number;
231-
}
241+
}
232242
callstack[i] =
233243
{
234244
fn_name : is_all_frames && i == _frames_length - 1
@@ -248,7 +258,7 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
248258
}
249259
__script_ids_in_callstack[i] = frame[SCRIPT_ID];
250260
}
251-
261+
252262
if( cur_inspection_type != 'frame' )
253263
{
254264
messages.post('active-inspection-type', {inspection_type: 'frame'});
@@ -290,21 +300,21 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
290300

291301
this.__continue = function (mode, clear_disabled_state) //
292302
{
293-
var tag = tag_manager.set_callback(this,
303+
var tag = tag_manager.set_callback(this,
294304
this._handle_continue,
295305
[mode, clear_disabled_state]);
296306
var msg = [stopAt.runtime_id, stopAt.thread_id, mode];
297307
services['ecmascript-debugger'].requestContinueThread(tag, msg);
298308
}
299-
309+
300310
this.continue_thread = function (mode) //
301311
{
302312
if (__controls_enabled)
303313
{
304314
this.__continue(mode, true);
305315
}
306316
}
307-
317+
308318
this._handle_continue = function(status, message, mode, clear_disabled_state)
309319
{
310320
this._clear_stop_at_error();
@@ -364,7 +374,7 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
364374
if (message[EXCEPTION_VALUE])
365375
{
366376
var error_obj_id = message[EXCEPTION_VALUE] &&
367-
message[EXCEPTION_VALUE][OBJECT_VALUE] &&
377+
message[EXCEPTION_VALUE][OBJECT_VALUE] &&
368378
message[EXCEPTION_VALUE][OBJECT_VALUE][OBJECT_ID];
369379
if (error_obj_id)
370380
{
@@ -404,7 +414,7 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
404414
}
405415
else
406416
{
407-
/*
417+
/*
408418
example
409419
410420
"runtime_id":2,
@@ -418,13 +428,13 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
418428
var condition = this._bps.get_condition(stopAt.breakpoint_id);
419429
if (condition)
420430
{
421-
var tag = tagManager.set_callback(this,
431+
var tag = tagManager.set_callback(this,
422432
this._handle_condition,
423433
[stopAt]);
424-
var msg = [stopAt.runtime_id,
425-
stopAt.thread_id,
426-
0,
427-
"Boolean(" + condition + ")",
434+
var msg = [stopAt.runtime_id,
435+
stopAt.thread_id,
436+
0,
437+
"Boolean(" + condition + ")",
428438
[['dummy', 0]]];
429439
services['ecmascript-debugger'].requestEval(tag, msg);
430440
}
@@ -436,7 +446,7 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
436446
}
437447
else
438448
{
439-
opera.postError('not a line number: ' + stopAt.line_number + '\n' +
449+
opera.postError('not a line number: ' + stopAt.line_number + '\n' +
440450
JSON.stringify(stopAt))
441451
}
442452
}
@@ -450,7 +460,7 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
450460
this.__continue('run');
451461
}
452462
else if(message[STATUS] == "completed" &&
453-
message[TYPE] == "boolean" &&
463+
message[TYPE] == "boolean" &&
454464
message[VALUE] == "true")
455465
{
456466
this._stop_in_script(stop_at);
@@ -528,10 +538,10 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
528538
var msg = [stop_at.runtime_id, stop_at.thread_id, ini.max_frames];
529539
services['ecmascript-debugger'].requestGetBacktrace(tag, msg);
530540
if (stop_at.error)
531-
{
541+
{
532542
var tag = tagManager.set_callback(this, this._handle_error, [stop_at]);
533543
var msg = [stop_at.runtime_id, [stop_at.error_obj_id], 0, 0, 0];
534-
window.services['ecmascript-debugger'].requestExamineObjects(tag, msg);
544+
window.services['ecmascript-debugger'].requestExamineObjects(tag, msg);
535545
}
536546
}
537547

@@ -559,7 +569,7 @@ cls.EcmascriptDebugger["6.0"].StopAt = function()
559569
}
560570

561571
this._bps = cls.Breakpoints.get_instance();
562-
572+
563573
messages.addListener('active-inspection-type', onActiveInspectionType);
564574

565575

0 commit comments

Comments
 (0)