Skip to content

Commit e41567e

Browse files
author
p01
committed
Removed some dead code
1 parent ccf7e51 commit e41567e

File tree

1 file changed

+0
-279
lines changed

1 file changed

+0
-279
lines changed

src/resource-manager/resource_service.js

Lines changed: 0 additions & 279 deletions
Original file line numberDiff line numberDiff line change
@@ -143,85 +143,10 @@ cls.ResourceManagerService = function(view, network_logger)
143143
this._documentList = [];
144144
this._collapsedHash = {};
145145

146-
// if (this._context)
147146
delete this._context;
148147
this._view.update();
149148
}.bind(this);
150149

151-
/*
152-
this._on_abouttoloaddocument_bound = function(msg)
153-
{
154-
var data = new cls.DocumentManager["1.0"].AboutToLoadDocument(msg);
155-
156-
if (!data.parentFrameID)
157-
{
158-
if(this._context)
159-
delete this._context;
160-
this._context = new cls.ResourceContext(data);
161-
}
162-
163-
if (this._context)
164-
this._context.update("abouttoloaddocument", data);
165-
}.bind(this);
166-
167-
this._on_urlload_bound = function(msg)
168-
{
169-
if (!this._context)
170-
return;
171-
172-
var data = new cls.ResourceManager["1.2"].UrlLoad(msg);
173-
//bail if we get dupes. Why do we get dupes? fixme
174-
//if (data.resourceID in this._current_document.resourcemap) { return }
175-
176-
this._context.update("urlload", data);
177-
this._view.update();
178-
179-
}.bind(this);
180-
181-
this._on_urlredirect_bound = function(msg)
182-
{
183-
if (!this._context)
184-
return;
185-
186-
var data = new cls.ResourceManager["1.0"].UrlRedirect(msg);
187-
// a bit of cheating since further down we use .resouceID to determine
188-
// what resource the event applies to:
189-
data.resourceID = data.fromResourceID;
190-
this._context.update("urlredirect", data);
191-
}.bind(this);
192-
193-
this._on_urlfinished_bound = function(msg)
194-
{
195-
if (!this._context)
196-
return;
197-
198-
var data = new cls.ResourceManager["1.0"].UrlFinished(msg);
199-
var r = this._context.update("urlfinished", data);
200-
201-
if (r && !r.data)
202-
{
203-
r.fetch_data();
204-
}
205-
206-
}.bind(this);
207-
208-
this._on_response_bound = function(msg)
209-
{
210-
if (!this._context)
211-
return;
212-
213-
var data = new cls.ResourceManager["1.0"].Response(msg);
214-
this._context.update("response", data);
215-
}.bind(this);
216-
217-
this._on_debug_context_selected_bound = function()
218-
{
219-
if (this._context)
220-
delete this._context;
221-
this._view.update();
222-
}.bind(this);
223-
*/
224-
225150

226151
this._handle_expand_collapse_bound = function(event, target)
227152
{
@@ -245,36 +170,6 @@ cls.ResourceManagerService = function(view, network_logger)
245170
pivot.classList.add('close');
246171
}
247172
}
248-
/*
249-
do
250-
{
251-
if (target)
252-
p.push()
253-
254-
var target = target.parentNode;
255-
256-
var frameID = target.getAttribute('data-frame-id');
257-
var data = this._context.frames[ frameID ];
258-
259-
if (!data)
260-
return;
261-
262-
var groupName = target.getAttribute('data-resource-group');
263-
if (groupName){ data = data.groups[ groupName ]; }
264-
265-
if (!data)
266-
return;
267-
268-
data.closed = !data.closed;
269-
if (data.closed)
270-
{
271-
target.addClass('collapsed');
272-
}
273-
else
274-
{
275-
target.removeClass('collapsed');
276-
}
277-
*/
278173
}.bind(this);
279174

280175

@@ -324,8 +219,6 @@ cls.ResourceManagerService = function(view, network_logger)
324219
cls.ResourceDetailView.instance.show_resource_group(group);
325220
}.bind(this);
326221

327-
328-
329222
this._init = function()
330223
{
331224
var eh = window.eventHandlers;
@@ -340,23 +233,13 @@ cls.ResourceManagerService = function(view, network_logger)
340233
}
341234

342235
this._res_service = window.services['resource-manager'];
343-
/*
344-
this._res_service.addListener("urlload", this._update_bound);
345-
this._res_service.addListener("response", this._update_bound);
346-
this._res_service.addListener("urlredirect", this._update_bound);
347-
this._res_service.addListener("urlfinished", this._update_bound);
348-
349-
this._doc_service = window.services['document-manager'];
350-
this._doc_service.addListener("abouttoloaddocument", this._update_bound);
351-
*/
352236
window.messages.addListener('debug-context-selected', this._on_debug_context_selected_bound);
353237
this._network_logger.addListener("resource-update", this._update_bound);
354238
this._network_logger.addListener("window-context-added", this._update_bound);
355239
this._network_logger.addListener("window-context-removed", this._update_bound);
356240

357241
};
358242

359-
360243
this.get_resource_context = function()
361244
{
362245
return this._context;
@@ -515,168 +398,6 @@ cls.ResourceRequest = function(url, callback,data)
515398
this._request_resource();
516399
}
517400

518-
cls.ResourceFrame = function( data )
519-
{
520-
this._init( data );
521-
}
522-
cls.ResourceFramePrototype = function()
523-
{
524-
this._init = function(data)
525-
{
526-
this.id = data.frameID;
527-
this.resourceID = data.resourceID;
528-
this.parentFrameID = data.parentFrameID;
529-
this.windowID = data.windowID;
530-
this.closed = !!data.parentFrameID;
531-
this.groups =
532-
{
533-
markup: new cls.ResourceGroup('markup','markup'),
534-
css: new cls.ResourceGroup('stylesheets','css'),
535-
script: new cls.ResourceGroup('scripts','script'),
536-
image: new cls.ResourceGroup('images','image'),
537-
font: new cls.ResourceGroup('fonts','font'),
538-
other: new cls.ResourceGroup('other','other')
539-
}
540-
}
541-
}
542-
543-
window.cls.ResourceFrame.prototype = new window.cls.ResourceFramePrototype();
544-
545-
546-
cls.ResourceContext = function(data)
547-
{
548-
this.resourcesDict = {};
549-
this.resourcesUrlDict = {};
550-
this.frames = {};
551-
552-
this.update = function(eventname, event)
553-
{
554-
var frame;
555-
if (eventname == "abouttoloaddocument")
556-
{
557-
frame = new cls.ResourceFrame(event);
558-
this.frames[ frame.id ] = frame;
559-
return;
560-
}
561-
562-
563-
var res = this.get_resource(event.resourceID);
564-
if (eventname == "urlload" && !res)
565-
{
566-
res = new cls.Resource(event.resourceID);
567-
res.frameID = event.frameID;
568-
this.resourcesDict[ res.id ] = res;
569-
}
570-
571-
if (res)
572-
{
573-
res.update(eventname, event);
574-
575-
frame = this.frames[res.frameID];
576-
if(!frame)
577-
res.invalid = true;
578-
else
579-
{
580-
if (eventname == "urlload")
581-
{
582-
if (res.id == frame.resourceID)
583-
{
584-
frame.resource = res;
585-
if (frame.parentFrameID )
586-
{
587-
var parentFrame = this.frames[frame.parentFrameID];
588-
if (parentFrame && parentFrame.resource)
589-
frame.sameOrigin = cls.ResourceUtil.sameOrigin(parentFrame.resource, frame.resource);
590-
else
591-
frame.sameOrigin = false;
592-
}
593-
}
594-
}
595-
596-
else if (eventname == "urlfinished")
597-
{
598-
// push the resourceID into the proper group
599-
if (frame && frame.resource)
600-
{
601-
var type = res.type;
602-
if (!frame.groups[type]){ type='other'; }
603-
604-
frame.groups[type].push( res.id );
605-
this.resourcesUrlDict[ res.url ] = res.id;
606-
607-
// sameOrigin check
608-
res.sameOrigin = cls.ResourceUtil.sameOrigin(frame.resource, res);
609-
}
610-
else
611-
{
612-
opera.postError(ui_strings.S_DRAGONFLY_INFO_MESSAGE +
613-
'Invalidating the resource '+ res.id +': '+ (frame?'Unkown top level resource '+frame.resourceId +' for the frame '+frame.id:'Unknown frameID '+ res.frameID));
614-
res.invalid = true;
615-
}
616-
}
617-
618-
else if (eventname == "urlredirect")
619-
{
620-
// Adjust the frame if its top resource is redirected
621-
if (frame && frame.resourceID == res.id)
622-
{
623-
frame.resourceID = event.toResourceID;
624-
delete frame.resource;
625-
}
626-
}
627-
}
628-
629-
if (res.invalid)
630-
{
631-
// delete the frame and all its resources if the top resource of a frame is invalid
632-
if (frame && frame.resource && frame.resource.id==res.id)
633-
{
634-
delete this.frames[frame.id];
635-
for(var rid in this.resourcesDict)
636-
{
637-
var r = this.resourcesDict[ rid ];
638-
if(r.frameID == frame.id)
639-
delete this.resourcesDict[ rid ];
640-
}
641-
}
642-
delete this.resourcesDict[ res.id ];
643-
}
644-
else
645-
{
646-
return res;
647-
}
648-
}
649-
650-
}
651-
652-
this.get_resource = function(id)
653-
{
654-
return this.resourcesDict[ id ];
655-
};
656-
}
657-
658-
cls.ResourceGroup = function(name,type)
659-
{
660-
this.ids = [];
661-
this.name = null;
662-
this.type = null;
663-
this.closed = true;
664-
665-
this._init = function(name,type)
666-
{
667-
this.name = name;
668-
this.type = type;
669-
this.ids.length = 0;
670-
}
671-
this.push = function( id )
672-
{
673-
if( this.ids.indexOf(id)===-1 )
674-
this.ids.push(id);
675-
}
676-
677-
this._init(name);
678-
}
679-
680401

681402
cls.Resource = function(id)
682403
{

0 commit comments

Comments
 (0)