Skip to content

Commit 85492c7

Browse files
author
p01
committed
Let the TaskManager bind the callbacks. Added call to requestGetResource in _on_request_create_request
1 parent ac4a491 commit 85492c7

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

src/resource-manager/resource_service.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -266,48 +266,52 @@ cls.ResourceRequest = function(url, callback,data)
266266
{
267267
if (this._resource_manager.requestGetResourceID)
268268
{
269-
var tag = window.tagManager.set_callback(this, this._on_request_resource_id_bound);
269+
var tag = window.tagManager.set_callback(this, this._on_request_resource_id);
270270
this._resource_manager.requestGetResourceID(tag, [this._url]);
271271
}
272272
else
273273
this._fallback();
274274
}
275275

276-
this._on_request_resource_id_bound = function(status, message)
276+
this._on_request_resource_id = function(status, message)
277277
{
278278
if (status && this._resource_manager.requestCreateRequest)
279279
{
280280
var debugContext = window.window_manager_data.get_debug_context();
281-
var tag = this._tag_manager.set_callback(this, this._on_request_create_request_bound);
281+
var tag = this._tag_manager.set_callback(this, this._on_request_create_request);
282282
this._resource_manager.requestCreateRequest(tag, [debugContext, this._url, 'GET']);
283283
}
284284
else if(!status && this._resource_manager.requestGetResource)
285285
{
286286
const RESOURCE_ID = 0;
287287
this._resource_id = message[RESOURCE_ID];
288-
var tag = this._tag_manager.set_callback(this, this._on_request_get_resource_bound);
288+
var tag = this._tag_manager.set_callback(this, this._on_request_get_resource);
289289
this._resource_manager.requestGetResource(tag, [this._resource_id, [TRANSPORT_OFF]]);
290290
}
291291
else
292292
this._fallback();
293+
}
293294

294-
}.bind(this);
295-
296-
this._on_request_create_request_bound = function(status, message)
295+
this._on_request_create_request = function(status, message)
297296
{
297+
if(!status && this._resource_manager.requestGetResource)
298+
{
299+
const RESOURCE_ID = 0;
300+
this._resource_id = message[RESOURCE_ID];
301+
var tag = this._tag_manager.set_callback(this, this._on_request_get_resource);
302+
this._resource_manager.requestGetResource(tag, [this._resource_id, [TRANSPORT_OFF]]);
303+
}
298304
}
299305

300-
this._on_request_get_resource_bound = function(status, message)
306+
this._on_request_get_resource = function(status, message)
301307
{
302308
if (!status)
303309
{
304310
this._resource = new cls.Resource(this._resource_id);
305311
this._resource.update("urlfinished", new this._ResourceData(message));
306312
this._resource.fetch_data(this._on_fetch_data_bound);
307313
}
308-
309-
310-
}.bind(this);
314+
}
311315

312316
this._on_fetch_data_bound = function()
313317
{
@@ -373,17 +377,21 @@ cls.ResourceContext = function(data)
373377
}
374378
else
375379
{
380+
opera.postError(ui_strings.S_DRAGONFLY_INFO_MESSAGE +
381+
"Unknown frameID for the resource "+ res.id);
382+
console.log([event,res].map(JSON.stringify).join('\n\n'));
376383
res.invalid = true;
377384
}
378385
}
379386

380387
if (res.invalid)
381388
{
382389
delete this.resourcesDict[ res.id ];
383-
return;
384390
}
385-
386-
return res;
391+
else
392+
{
393+
return res;
394+
}
387395
}
388396

389397
}

0 commit comments

Comments
 (0)