Skip to content

Commit 66bbe50

Browse files
committed
Some review fixes. Use the URI class for handling URI shortening.
1 parent 69745df commit 66bbe50

File tree

2 files changed

+14
-36
lines changed

2 files changed

+14
-36
lines changed

src/ecma-debugger/templates.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@
380380
case TYPE_NAN:
381381
case TYPE_PLUS_INFINITY:
382382
case TYPE_MINUS_INFINITY:
383-
value = names[retval.value.type];
383+
case TYPE_NUMBER:
384+
value = (retval.value.type == TYPE_NUMBER)
385+
? String(retval.value.number)
386+
: names[retval.value.type];
384387
if (value.toLowerCase().contains(search_term))
385388
{
386389
value_template.push(
@@ -394,21 +397,6 @@
394397
}
395398
break;
396399

397-
case TYPE_NUMBER:
398-
value = String(retval.value.number);
399-
if (value.toLowerCase().contains(search_term))
400-
{
401-
value_template.push(
402-
["item",
403-
["value",
404-
value,
405-
"class", type
406-
]
407-
]
408-
);
409-
}
410-
break;
411-
412400
case TYPE_STRING:
413401
value = retval.value.str;
414402
if (value.toLowerCase().contains(search_term))
@@ -475,9 +463,9 @@
475463
return [];
476464

477465
var from_uri = window.helpers.get_script_name(retval.positionFrom.scriptID);
478-
from_uri = from_uri ? window.helpers.basename(from_uri) : ui_strings.S_UNKNOWN_SCRIPT;
466+
from_uri = from_uri ? new URI(from_uri).basename : ui_strings.S_UNKNOWN_SCRIPT;
479467
var to_uri = window.helpers.get_script_name(retval.positionTo.scriptID);
480-
to_uri = to_uri ? window.helpers.basename(to_uri) : ui_strings.S_UNKNOWN_SCRIPT;
468+
to_uri = to_uri ? new URI(to_uri).basename : ui_strings.S_UNKNOWN_SCRIPT;
481469

482470
return [
483471
["li",

src/ecma-debugger/view_return_values.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,17 @@ cls.ReturnValuesView = function(id, name, container_class)
4444

4545
this._create_view = function(return_values)
4646
{
47+
this._text_search.setContainer(this._container);
48+
this._text_search.setFormInput(window.views[this.id].getToolbarControl(this._container,
49+
"return-values-text-search"));
4750
this._container.clearAndRender(templates.return_values(return_values, this._search_term));
4851
};
4952

53+
this.ondestroy = function()
54+
{
55+
this._text_search.cleanup();
56+
};
57+
5058
this._remove_bound_view = function()
5159
{
5260
this._create_view_bound = null;
@@ -71,22 +79,6 @@ cls.ReturnValuesView = function(id, name, container_class)
7179
}
7280
};
7381

74-
this._on_view_created = function(msg)
75-
{
76-
if (msg.id == "return-values")
77-
{
78-
this._text_search.setContainer(msg.container);
79-
this._text_search.setFormInput(window.views[this.id].getToolbarControl(msg.container,
80-
"return-values-text-search"));
81-
}
82-
};
83-
84-
this._on_view_destroyed = function(msg)
85-
{
86-
if (msg.id == "return-values")
87-
this._text_search.cleanup();
88-
};
89-
9082
this._init = function(id, name, container_class)
9183
{
9284
View.prototype.init.call(this, id, name, container_class);
@@ -97,8 +89,6 @@ cls.ReturnValuesView = function(id, name, container_class)
9789
this._text_search = new TextSearch(1);
9890
this._text_search.add_listener("onbeforesearch", this._onbeforesearch.bind(this));
9991

100-
window.messages.addListener("view-created", this._on_view_created.bind(this));
101-
window.messages.addListener("view-destroyed", this._on_view_destroyed.bind(this));
10292
window.messages.addListener("thread-continue-event", this._remove_bound_view.bind(this));
10393

10494
window.event_handlers.input["return-values-text-search"] = function(event, target)

0 commit comments

Comments
 (0)