Skip to content

Commit e240fd1

Browse files
author
p01
committed
Look for the appropriate runtime ( and window_id ) in the resource_display_broker
1 parent 99da2b6 commit e240fd1

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

src/resource-manager/resource_detail_view.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
123123

124124
this.go_to_line = function(container, data)
125125
{
126-
if (!data || !data.lines || !data.lines.length)
126+
if (!data || data.line == null)
127127
return;
128128

129129
this._root_ele = container.querySelector("." + RESOURCE_DETAIL_CONTAINER_CLASSNAME);
130130
if (this._root_ele)
131131
{
132132
this.clear_line_highlight(this._root_ele);
133-
this._target_line = Number(data.lines[0]);
133+
this._target_line = data.line;
134134
this._highlight_line(this._root_ele);
135135
}
136136
};
@@ -161,7 +161,7 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
161161

162162
var url = resource ? resource.url : key;
163163

164-
if (!this._show_resource(resource, data))
164+
if (!resource || !this._show_resource(resource, data))
165165
service.request_resource_data(url, this.show_resource.bind(this), data, resource);
166166
};
167167

src/resource-manager/resource_display_broker.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ cls.ResourceDisplayBroker = function()
99

1010
cls.ResourceDisplayBroker.instance = this;
1111

12-
this._show_resource = function(id_or_url, line)
12+
this._show_resource = function(id_or_url, data)
1313
{
14-
var data = {};
1514
var manager = window.services["resource-manager"];
1615
var view = window.views.resource_detail_view;
1716
if (manager && view)
1817
{
19-
if (line)
20-
data.lines = [line];
21-
2218
view.show_resource(id_or_url, data);
23-
2419
return true;
2520
}
2621
return false;
@@ -37,22 +32,26 @@ cls.ResourceDisplayBroker = function()
3732
var url = ele.getAttribute("data-resource-url");
3833
var line = ele.getAttribute("data-resource-line-number");
3934
var id_or_url = id;
40-
var rt_id;
35+
var runtime;
36+
var data = {};
37+
38+
runtime = runtimes.getRuntime(ele.get_attr("parent-node-chain", "rt-id"));
39+
if (runtime)
40+
data.window_id = runtime.window_id;
4141

4242
if (url)
4343
{
4444
// resolve the URL based on that of the runtime if we only have a relative path
45-
if (url.indexOf("://") == -1)
46-
{
47-
rt_id = ele.get_attr("parent-node-chain", "rt-id");
48-
if (rt_id)
49-
url = window.helpers.resolveURLS(runtimes.getURI(rt_id), url);
50-
}
45+
if (runtime && url.contains("://"))
46+
url = window.helpers.resolveURLS(runtime.uri, url);
5147

5248
id_or_url = url;
5349
}
5450

55-
if (!this._show_resource(id_or_url, line) && url)
51+
if(line)
52+
data.line = Number(line);
53+
54+
if (!this._show_resource(id_or_url, data) && url)
5655
window.open(url);
5756
};
5857

src/resource-manager/resource_service.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ cls.ResourceRequest = function(url, callback, data, resourceInfo)
385385
{
386386
this.url = url;
387387
this.resourceInfo = resourceInfo;
388-
this._callback_data = data;
388+
this._data = data;
389389
this._callback = callback;
390390
this._retries = 0;
391391

@@ -408,7 +408,7 @@ cls.ResourceRequest = function(url, callback, data, resourceInfo)
408408
{
409409
if (this._resource_manager.requestCreateRequest)
410410
{
411-
var windowID = window.window_manager_data.get_debug_context();
411+
var windowID = this._data.window_id || window.window_manager_data.get_debug_context();
412412
var tag = window.tag_manager.set_callback(this, this._on_request_resource_id);
413413
this._resource_manager.requestCreateRequest(tag, [windowID, this.url, "GET"]);
414414
}
@@ -463,7 +463,7 @@ cls.ResourceRequest = function(url, callback, data, resourceInfo)
463463
window.messages.post("resource-request-resource", {resource_id: this.resource_id});
464464

465465
// aaaand callback
466-
this._callback(this.resourceInfo, this._callback_data);
466+
this._callback(this.resourceInfo, this._data);
467467
}
468468
else
469469
{

0 commit comments

Comments
 (0)