Commits

Mathieu Henri committed 04e33a0

':\'

Comments (0)

Files changed (1)

diff.diff

-diff -r 7e58b19c05d0 src/build-application/build_resource_manager_1_0.js
---- a/src/build-application/build_resource_manager_1_0.js	Wed Jun 13 16:24:51 2012 +0200
-+++ b/src/build-application/build_resource_manager_1_0.js	Wed Jun 13 16:25:03 2012 +0200
-@@ -7,6 +7,8 @@
-   new cls.ResourceDetailView('resource_detail_view', 'Detail');
- 
- 
-+cls.ResourceDetailView.create_ui_widgets();
-+
- //  new cls.ResourceManagerAllView('resource_all', ui_strings.M_VIEW_LABEL_ALL_RESOURCES, 'scroll resource-manager', '', '');
- 
-   //new cls.ResourceManagerFontView('resource_fonts', "Fonts", 'scroll', '', '');
-diff -r 7e58b19c05d0 src/client-en.xml
---- a/src/client-en.xml	Wed Jun 13 16:24:51 2012 +0200
-+++ b/src/client-en.xml	Wed Jun 13 16:25:03 2012 +0200
-@@ -459,14 +459,9 @@
- 
- 
- <script src="./resource-manager/resource_service.js"/>
--
--<script src="./resource-manager/resource_all_view.js"/>
- <script src="./resource-manager/resource_templates.js"/>
- <script src="./resource-manager/resource_util.js"/>
--<script src="./resource-manager/resource_base.js"/>
--<script src="./ui-scripts/metadata_drawer/metadata_drawer.js"/>
- <script src="./resource-manager/resource_display_broker.js"/>
--<script src="./resource-manager/opensingleresource.js"/>
- <script src="./resource-manager/resourcemanager.1.0.events.onurlload.js"/>
- <script src="./resource-manager/resourcemanager.1.0.events.onurlredirect.js"/>
- <script src="./resource-manager/resourcemanager.1.0.events.onurlfinished.js"/>
-diff -r 7e58b19c05d0 src/resource-manager/resource_detail_view.js
---- a/src/resource-manager/resource_detail_view.js	Wed Jun 13 16:24:51 2012 +0200
-+++ b/src/resource-manager/resource_detail_view.js	Wed Jun 13 16:25:03 2012 +0200
-@@ -15,76 +15,22 @@
-   this._service = new cls.ResourceManagerService(this);
- 
- 
-+//  this.create_ui_widgets
-+
-+
-+
- 	this.createView = function(container)
- 	{
--		if (this.resource )
--		{
--			if (this.resource.data)
--			{
--				container.innerHTML = 'Data available for the resource '+this.resource.id+' '+Date.now();	// to get a visual that something is happening in case the resource is heavy to render
--				var toto=Date.now();
--				container.clearAndRender( templates.resource_detail.update(this.resource, this.resource.data) );
--				container.title = (Date.now()-toto)+'ms';
--				this.go_to_line(container,this.data);
--			}
--			else
--			{
--				container.innerHTML = 'No data available for the resource '+this.resource.id+' '+Date.now()+'<p>'+JSON.stringify(this.resource)+'</p>';
--			}
--		}
--		else
--		{
--			container.innerHTML = 'No resource selected'+Date.now();
--		}
-+		if (this.resource && this.resource.data)
-+      container.clearAndRender( templates.resource_detail.formatting_data(this.resource) );
-+
-+    container.clearAndRender( templates.resource_detail.update(this.resource) );
-+    if(this.data)
-+      this.go_to_line(container,this.data);
-+
- 		this.data = null;
- 	}
- 
--	this.on_resource_data_bound = function(type, data)
--	{
--		//if(this.resource && this.resource.id==data[0])
--		var id = data[0];
--		var resource = this._service.get_resource(id);
--		if(resource)
--		{
--/*			
--			resource.data =
--			{
--				mimeType:data[2],
--				characterEncoding:data[3],
--				contentLength:data[4],
--				length:data[5][0],
--				content:data[5][2]||data[5][3]
--			};
--*/
--			resource.data = new cls.ResourceManager["1.0"].ResourceData( data );
--			if(resource.type=='image')
--			{
--				var i=new Image();
--				i.src=resource.data.content.stringData;
--				resource.data.meta = i.naturalWidth+'x'+i.naturalHeight;
--			}
--			if (this.resourceId==id){ this.resource = resource; }
--		}
--		this.update();
--	}.bind(this);
--/*
--	this.__open_resource = function(resource)
--	{
--		var id = resource.id;
--		this.resourceId = id;
--		if (!resource.data)
--		{
--			var responseType = cls.ResourceUtil.type_to_content_mode(resource.type);
--			this._service.fetch_resource_data( this.on_resource_data_bound, id, responseType );
--		}
--		else
--		{
--			this.update();
--		}
--	}
--	*/
--
--
-   const HIGHLIGHTED_LINE_CLASSNAME = 'highlighted-line';
-   const RESOURCE_DETAIL_CONTAINER_CLASSNAME = 'resource-detail-container';
-   const TEXT = document.TEXT_NODE;
-@@ -186,32 +132,68 @@
-       this._target_line = parseInt(data.lines[0]);
-       this._highlight_line(this._root_ele);
-     }
-+  }
-+/*
-+  this.on_resource_data_open_resource_bound = function(type,data)
-+  {
-+  	var resource = this.on_resource_data_bound(type,data);
-+		if (this.resourceId==resource.id){ this.resource = resource; }
-+		this.update();
-+  }.bind(this);
-+*/
-+	this.on_resource_data_bound = function(type, data)
-+	{
-+		var id = data[0];
-+		var resource = this._service.get_resource(id);
-+		if(resource)
-+		{
-+			resource.data = new cls.ResourceManager["1.0"].ResourceData( data );
-+		}
-+		return resource;
-+	}.bind(this);
- 
-+  this._show_resource_by_instance = function(resource)
-+  {
-+      this.resource = resource;
-+      if (resource && !resource.data)
-+        resource.fetch_data(cls.ResourceDetailView.instance.update);
-   }
- 
--	this.open_resource_tab = function(resource, data)
-+  this._show_resource_by_id = function(id)
-+  {
-+    var resource = this._service.get_resource(resource);
-+    this._show_resource_by_instance(resource);
-+  }
-+
-+  this._show_resource_url = function(url)
-+  {
-+    var resource = this._service.get_resource_for_url(url);
-+    if (resource)
-+      this._show_resource_by_instance(resource);
-+    else
-+      new cls.ResourceRequest(url, this.show_resource.bind(this), this.data);
-+  }
-+
-+  this.show_resource = function(resource, data)
-+  {
-+    this.data = data;
-+
-+    if(resource instanceof cls.Resource)
-+      this._show_resource_by_instance(resource);
-+    else if (resource==Number(resource))
-+      this._show_resource_by_id(resource);
-+    else if (resource==String(resource))
-+      this._show_resource_url(resource);
-+
-+    this.update();
-+    window.UI.instance.show_view( window.views.resource_detail_view.id );
-+  }
-+
-+	this.show_resource_group = function(resourceGroup)
- 	{
--		this.resource = resource;
--		this.data = data;
--		this.update();
--	}
-+    alert(resourceGroup.name+'\n'+resourceGroup.ids+'\n\n');
-+    return;
- 
--
--
--	this.open_resource = function(id)
--	{
--		this.resourceId = id;
--		var resource = this.resource = this._service.get_resource(id);
--		this.update();
--		if (resource && !resource.data)
--		{
--			var responseType = cls.ResourceUtil.type_to_content_mode(resource.type);
--			this._service.fetch_resource_data( this.on_resource_data_bound, id, responseType );
--		}
--	}
--
--	this.open_resource_group = function(group)
--	{
- 		this.resources = [];
- 		for( var i=0; i<group.ids.length; i++)
- 		{
-@@ -233,4 +215,120 @@
-   this.init(id, name, container_class, html, default_handler);
- };
- 
--cls.ResourceDetailView.prototype = ViewBase;
-\ No newline at end of file
-+cls.ResourceDetailView.prototype = ViewBase;
-+
-+cls.ResourceDetailView.create_ui_widgets = function()
-+{
-+    new ToolbarConfig(
-+  {
-+    view:'resource_detail_view',
-+
-+groups: [
-+/*        {
-+          type: UI.TYPE_BUTTONS,
-+          items: [
-+            {
-+              handler: "clear-log-network-view",
-+              icon: "clear-log-network-view",
-+              title: ui_strings.S_CLEAR_NETWORK_LOG
-+            }
-+          ]
-+        },
-+        {
-+          type: UI.TYPE_SWITCH,
-+          items: [
-+            {
-+              key: "network_logger.pause",
-+              icon: "pause-network-view"
-+            }
-+          ]
-+        },
-+        {
-+          type: UI.TYPE_SINGLE_SELECT,
-+          name: "selected-viewmode",
-+          default_value: window.settings.network_logger.get("selected-viewmode"),
-+          items: [
-+            {
-+              value: "graphs",
-+              title: ui_strings.S_HTTP_LABEL_GRAPH_VIEW,
-+              icon: "network-view-toggle-graphs"
-+            },
-+            {
-+              value: "data",
-+              title: ui_strings.S_HTTP_LABEL_DATA_VIEW,
-+              icon: "network-view-toggle-data"
-+            }
-+          ]
-+        },
-+        {
-+          type: UI.TYPE_SINGLE_SELECT,
-+          name: "type-filter",
-+          allow_multiple_select: true,
-+          items: [
-+            {
-+              text: ui_strings.S_HTTP_LABEL_FILTER_ALL,
-+              title: ui_strings.S_HTTP_TOOLTIP_FILTER_ALL,
-+              value: "all"
-+            },
-+            {
-+              text: ui_strings.S_HTTP_LABEL_FILTER_MARKUP,
-+              title: ui_strings.S_HTTP_TOOLTIP_FILTER_MARKUP,
-+              value: "markup"
-+            },
-+            {
-+              text: ui_strings.S_HTTP_LABEL_FILTER_STYLESHEETS,
-+              title: ui_strings.S_HTTP_TOOLTIP_FILTER_STYLESHEETS,
-+              value: "css"
-+            },
-+            {
-+              text: ui_strings.S_HTTP_LABEL_FILTER_SCRIPTS,
-+              title: ui_strings.S_HTTP_TOOLTIP_FILTER_SCRIPTS,
-+              value: "script"
-+            },
-+            {
-+              text: ui_strings.S_HTTP_LABEL_FILTER_IMAGES,
-+              title: ui_strings.S_HTTP_TOOLTIP_FILTER_IMAGES,
-+              value: "image"
-+            },
-+            {
-+              text: ui_strings.S_HTTP_LABEL_FILTER_OTHER,
-+              title: ui_strings.S_HTTP_TOOLTIP_FILTER_OTHER,
-+              value: "other_types"
-+            },
-+            {
-+              text: ui_strings.S_HTTP_LABEL_FILTER_XHR,
-+              title: ui_strings.S_HTTP_TOOLTIP_FILTER_XHR,
-+              value: "xhr"
-+            }
-+          ]
-+        },
-+ */
-+        {
-+          type: UI.TYPE_INPUT,
-+          items: [
-+            {
-+              handler: "network-text-search",
-+              shortcuts: "network-text-search",
-+              title: ui_strings.S_SEARCH_INPUT_TOOLTIP,
-+              label: ui_strings.S_INPUT_DEFAULT_TEXT_SEARCH
-+            }
-+          ]
-+        }
-+      ]
-+            /*
-+      {
-+        type: UI.TYPE_INPUT,
-+        items:
-+        [
-+          {
-+            handler: "resource-text-search",
-+            shortcuts: "resource-text-search",
-+            title: ui_strings.S_SEARCH_INPUT_TOOLTIP,
-+            label: ui_strings.S_INPUT_DEFAULT_TEXT_SEARCH
-+          }
-+        ]
-+      }
-+      */
-+//    ]
-+  });
-+}
-\ No newline at end of file
-diff -r 7e58b19c05d0 src/resource-manager/resource_display_broker.js
---- a/src/resource-manager/resource_display_broker.js	Wed Jun 13 16:24:51 2012 +0200
-+++ b/src/resource-manager/resource_display_broker.js	Wed Jun 13 16:25:03 2012 +0200
-@@ -9,53 +9,32 @@
-   cls.ResourceDisplayBroker.instance = this;
- 
- 
--  this._check = function(line)
-+  this._show_resource = function(resource, line)
-   {
-     var data = {};
-     var manager = window.services["resource-manager"];
-     var view = window.views.resource_detail_view;
--    if (line){ data.lines=[line]; }
--    if (manager && view){ return {view:view,data:data}; }
--    return null;
-+    if (manager && view)
-+    {
-+      if (line)
-+        data.lines=[line];
-+
-+      view.show_resource(resource, data);
-+
-+      return true;
-+    }
-+    return false;
-   }
- 
-   this.show_resource_for_id = function(id, line)
-   {
--    var foo = this._check(line);
--    if (foo){ foo.view.show_resource_for_id(id, foo.data); }
--/*
--    var data = this._get_data(line);
--    var view = window.views.resource_detail_view; //resource_all;
--    if (window.services["resource-manager"] && view)
--    {
--      view.show_resource_for_id(id, data);
--    }
--*/
-+    this._show_resource(id, line);
-   }
- 
-   this.show_resource_for_url = function(url, line)
-   {
--    var foo = this._check(line);
--    if (foo)
--    {
--      new cls.OpenSingleResource(foo.view, cls.ResourceManagerService.instance, url, foo.data);
--    }
--    else
--    {
-+    if (!this._show_resource(url, line))
-       window.open(url);
--    }
--/*
--    var data = this._get_data(line);
--    var view = window.views.resource_detail_view; //resource_all;
--    if (window.services["resource-manager"] && view)
--    {
--      new cls.OpenSingleResource(view, cls.ResourceManagerService.instance, url, data);
--    }
--    else
--    {
--      window.open(url);
--    }
--*/
-   }
- 
-   /**
-@@ -65,10 +44,24 @@
-    */
-   this.show_resource_for_ele = function(ele)
-   {
--    var rid, url;
-+    var id = Number( ele.getAttribute("data-resource-id") );
-+    var url = ele.getAttribute("data-resource-url");
-     var line = ele.getAttribute('data-resource-line-number');
--    if (rid = ele.getAttribute("data-resource-id")) { this.show_resource_for_id(rid, line) }
--    else if (url = ele.getAttribute("data-resource-url")) { this.show_resource_for_url(url, line) }
-+    var rt_id;
-+
-+    if (id)
-+      this.show_resource_for_id(id, line);
-+    else if (url)
-+    {
-+      //  resolve the URL based on that of the runtime if we only have a relative path
-+      if (url[0].indexOf('://') == -1)
-+      {
-+        rt_id = ele.get_attr('parent-node-chain', 'rt-id');
-+        if(rt_id)
-+          url = window.helpers.resolveURLS(runtimes.getURI(rt_id), url);
-+      }
-+      this.show_resource_for_url(url, line);
-+    }
-   }
- 
- }
-diff -r 7e58b19c05d0 src/resource-manager/resource_service.js
---- a/src/resource-manager/resource_service.js	Wed Jun 13 16:24:51 2012 +0200
-+++ b/src/resource-manager/resource_service.js	Wed Jun 13 16:25:03 2012 +0200
-@@ -1,4 +1,4 @@
--window.cls || (window.cls = {});
-+window.cls || (window.cls = {});
- 
- /**
-  *
-@@ -7,9 +7,8 @@
- cls.ResourceManagerService = function(view)
- {
-   if (cls.ResourceManagerService.instance)
--  {
-     return cls.ResourceManagerService.instance;
--  }
-+
-   cls.ResourceManagerService.instance = this;
- 
-   this._view = view;
-@@ -23,19 +22,19 @@
-   this._on_abouttoloaddocument_bound = function(msg)
-   {
-     var data = new cls.DocumentManager["1.0"].AboutToLoadDocument(msg);
-+
-     if (!data.parentFrameID)
--    {
-       this._context = new cls.ResourceContext(data);
--    }
-+
-     if (this._context)
--    {
-       this._context.update("abouttoloaddocument", data);
--    }
-+
-   }.bind(this);
- 
-   this._on_urlload_bound = function(msg)
-   {
--    if (!this._context){ return; }
-+    if (!this._context)
-+      return;
- 
-     var data = new cls.ResourceManager["1.0"].UrlLoad(msg);
-       //bail if we get dupes. Why do we get dupes? fixme
-@@ -43,11 +42,13 @@
- 
-     this._context.update("urlload", data);
-     this._view.update();
-+
-   }.bind(this);
- 
-   this._on_urlredirect_bound = function(msg)
-   {
--    if (!this._context){ return; }
-+    if (!this._context)
-+      return;
- 
-     var data = new cls.ResourceManager["1.0"].UrlRedirect(msg);
-     // a bit of cheating since further down we use .resouceID to determine
-@@ -58,15 +59,23 @@
- 
-   this._on_urlfinished_bound = function(msg)
-   {
--    if (!this._context){ return; }
-+    if (!this._context)
-+      return;
- 
-     var data = new cls.ResourceManager["1.0"].UrlFinished(msg);
--    this._context.update("urlfinished", data);
-+    var r = this._context.update("urlfinished", data);
-+
-+    if (r && !r.data)
-+    {
-+        r.fetch_data();
-+    }
-+
-   }.bind(this);
- 
-   this._on_response_bound = function(msg)
-   {
--    if (!this._context){ return; }
-+    if (!this._context)
-+      return;
- 
-     var data = new cls.ResourceManager["1.0"].Response(msg);
-     this._context.update("response", data);
-@@ -81,7 +90,8 @@
- 
-   this._handle_expand_collapse_bound = function(event, target)
-   {
--    if (!this._context){ return; }
-+    if (!this._context)
-+      return;
- 
-     var button = target.querySelector('.button-expand-collapse');
-     var target = target.parentNode;
-@@ -103,6 +113,7 @@
-     }
-   }.bind(this);
- 
-+
-   this._handle_resource_detail_bound = function(event, target)
-   {
-     if (!this._context){ return; }
-@@ -110,14 +121,16 @@
-     var parent = target.get_ancestor('[data-resource-id]');
-     if (!parent){ console.log('no parent with data-resource-id for '+target.outerHTML); return; }
-   
--    var rid = Number( parent.getAttribute('data-resource-id') );
--    var r = this.get_resource(rid);
-+    var id = Number( parent.getAttribute('data-resource-id') );
-+    var resource = this.get_resource(id);
- 
--    if (!r){ console.log('resource '+rid+' not found'); return; }
-+    if (!resource){ console.log('resource '+id+' not found'); return; }
- 
--    cls.ResourceDetailView.instance.open_resource(rid);
-+    cls.ResourceDetailView.instance.show_resource(resource);
-+
-   }.bind(this);
- 
-+  /*  WIP */
-   this._handle_resource_group_bound = function(event, target)
-   {
-     var parent = target.get_ancestor('[data-frame-id]');
-@@ -125,17 +138,15 @@
-     var frameID = parent.getAttribute('data-frame-id');
-     var groupName = parent.getAttribute('data-resource-group');
- 
--    var data = this._context.frames[ frameID ].groups[ groupName ];
--alert(data.name+' '+data.ids)
-+    var group = this._context.frames[ frameID ].groups[ groupName ];
- 
--    debugger;
-+    cls.ResourceDetailView.instance.show_resource_group(group);
-   }.bind(this);
- 
- 
- 
-   this._init = function()
-   {
--
-     var eh = window.eventHandlers;
-     eh.click["resources-expand-collapse"] = this._handle_expand_collapse_bound;
-     eh.click["resource-detail"] = this._handle_resource_detail_bound;
-@@ -147,7 +158,6 @@
-       broker.show_resource_for_ele(target);
-     }
- 
--
-     this._res_service = window.services['resource-manager'];
-     
-     this._res_service.addListener("urlload", this._on_urlload_bound);
-@@ -159,22 +169,13 @@
-     messages.addListener('debug-context-selected', this._on_debug_context_selected_bound);
-   };
- 
-+
-   this.get_resource_context = function()
-   {
-     return this._context;
-   };
- 
--  /**
--   * Returns an array of resource objects. The internal representation is to
--   * keep separate lists of seen resources and a map of id/resource.
--   */
--/*
--  this.get_resource_list = function()
--  {
--    if (! this._current_context) { return []; }
--    return this._current_context.resources;
--  };
--*/
-+
-   this.get_resource = function(id)
-   {
-     if (!this._context){ return null; }
-@@ -182,9 +183,9 @@
-     return this._context.resourcesDict[id];
-   };
- 
-+
-   this.get_resource_for_url = function(url)
-   {
--    //
-     if (!this._context){ return null; }
- 
-     var id = this._context.resourcesUrlDict[url];
-@@ -193,23 +194,145 @@
-     return this.get_resource(id);
-   };
- 
--  this.fetch_resource_data = function(callback, rid, type)
-+  this._fetch_resource_data = function(callback, id, type)
-   {
--    var resource = this.get_resource(rid);
--    if (resource)
-+    var resource = this.get_resource(id);
-+
-     var typecode = {datauri: 3, string: 1}[type] || 1;
-     var tag = window.tagManager.set_callback(null, callback);
-     const MAX_PAYLOAD_SIZE = 10 * 1000 * 1000; // allow payloads of about 10 mb.
--    this._res_service.requestGetResource(tag, [rid, [typecode, 1, MAX_PAYLOAD_SIZE]]);
-+    this._res_service.requestGetResource(tag, [id, [typecode, 1, MAX_PAYLOAD_SIZE]]);
-+  };
-+//*
-+  this._on_resource_data_bound = function(type, data)
-+  {
-+    var id = data[0];
-+    var resource = this.get_resource(id);
-+    if(resource)
-+    {
-+      resource.data = new cls.ResourceManager["1.0"].ResourceData( data );
-+      if(resource.type=='image')
-+      {
-+        var i=new Image();
-+        i.src=resource.data.content.stringData;
-+        resource.data.meta = i.naturalWidth+'x'+i.naturalHeight;
-+      }
-+    }
-+    this._view.update();
-+  }.bind(this);
- 
--  };
- 
- 
-+  this.request_resource_for_url = function(url,callback)
-+  {
-+    cls.ResourceRequest(url, callback, data);
-+  }
- 
- 
-   this._init();
- };
- 
-+cls.ResourceRequest = function(url, callback,data)
-+{
-+  const
-+  TRANSPORT_STRING = 1,
-+  TRANSPORT_DATA_URI = 3,
-+  TRANSPORT_OFF = 4,
-+  DECODE_TRUE = 1,
-+  SIZE_LIMIT = 1e7;
-+
-+  this._init = function(url, callback, data)
-+  {
-+    this._url = url;
-+    this._callback = callback;
-+    this._data = data;
-+    this._initialized = false;
-+
-+    if (!this._resource_manager)
-+    {
-+      this._resource_manager = window.services['resource-manager'];
-+      this._tag_manager =  window.tagManager;
-+      this._ResourceData = cls.ResourceManager["1.0"].ResourceData;
-+      this._initialized = true;
-+    }
-+  }
-+
-+  this._fallback = function()
-+  {
-+    window.open(this._url);
-+  }
-+
-+  this._request_resource = function(url,callback)
-+  {
-+    if (this._resource_manager.requestGetResourceID)
-+    {
-+      var tag = window.tagManager.set_callback(this, this._on_request_resource_id_bound);
-+      this._resource_manager.requestGetResourceID(tag, [this._url]);
-+    }
-+    else
-+      this._fallback();
-+  }
-+
-+  this._on_request_resource_id_bound = function(status, message)
-+  {
-+    if (status && this._resource_manager.requestCreateRequest)
-+    {
-+      alert( 'request failed, time to craft a GET request' );
-+//      debugger;
-+      var debugContext = window.window_manager_data.get_debug_context();
-+      var tag = this._tag_manager.set_callback(this, this._on_request_create_request_bound);
-+      this._resource_manager.requestCreateRequest(tag, [debugContext, this._url, 'GET']);
-+    }
-+    else if(!status && this._resource_manager.requestGetResource)
-+    {
-+      const RESOURCE_ID = 0;
-+      this._resource_id = message[RESOURCE_ID];
-+      var tag = this._tag_manager.set_callback(this, this._on_request_get_resource_bound);
-+      this._resource_manager.requestGetResource(tag, [this._resource_id, [TRANSPORT_OFF]]);
-+    }
-+    else
-+      this._fallback();
-+
-+  }.bind(this);
-+
-+  this._on_request_create_request_bound = function(status, message)
-+  {
-+      debugger;
-+  }
-+
-+  this._on_request_get_resource_bound = function(status, message)
-+  {
-+    if (!status)
-+    {
-+      this._resource = new cls.Resource(this._resource_id);
-+      this._resource.update("urlfinished", new this._ResourceData(message));
-+      this._resource.fetch_data(this._on_fetch_data_bound);
-+/*
-+      var resptype = this._utils.mime_to_content_mode(this._res.mime);
-+      var tag = this._tag_manager.set_callback(this, this._on_resource);
-+      var transportType = {datauri:TRANSPORT_DATA_URI}[resptype]||TRANSPORT_STRING;
-+
-+      this._resource_manager.requestGetResource(tag, [this._resource_id, [transportType, DECODE_TRUE, SIZE_LIMIT]]);
-+*/
-+    }
-+    else
-+      debugger;
-+
-+
-+  }.bind(this);
-+
-+  this._on_fetch_data_bound = function()
-+  {
-+    this._callback(this._resource,this._data);
-+  }.bind(this);
-+
-+
-+  this._init(url, callback, data);
-+  if (this._initialized)
-+    this._request_resource();
-+}
-+
-+
- cls.ResourceContext = function(data)
- {
-   this.resourcesDict = {};
-@@ -224,12 +347,12 @@
-       frame.closed = !!event.parentFrameID;
-       frame.groups =
-       {
--        markup: new cls.ResourceGroup('markup'),
--        css: new cls.ResourceGroup('stylesheets'),
--        script: new cls.ResourceGroup('scripts'),
--        image: new cls.ResourceGroup('images'),
--        font: new cls.ResourceGroup('fonts'),
--        other: new cls.ResourceGroup('other')
-+        markup: new cls.ResourceGroup('markup','markup'),
-+        css: new cls.ResourceGroup('stylesheets','css'),
-+        script: new cls.ResourceGroup('scripts','script'),
-+        image: new cls.ResourceGroup('images','image'),
-+        font: new cls.ResourceGroup('fonts','font'),
-+        other: new cls.ResourceGroup('other','other')
-       }
- 
-       this.frames[ event.frameID ] = frame;
-@@ -254,7 +377,6 @@
-     if (res.invalid)
-     {
-       delete this.resourcesDict[ res.id ];
--//      this.resources.splice(this.resources.indexOf(res), 1);
-     }
-     else if (eventname == "urlfinished")
-     {
-@@ -265,67 +387,28 @@
- 
-       frame.groups[type].push( res.id );
-       this.resourcesUrlDict[ res.url ] = res.id;
--/*
--      if (!res.data)
--      {
--        var responseType = cls.ResourceUtil.type_to_content_mode(resource.type);
--        cls.ResourceManager.instance.fetch_resource_data
--      }
--/**/
-+
-+      return res;
-     }
-   }
- 
-   this.get_resource = function(id)
-   {
-     return this.resourcesDict[ id ];
--//    return this.resources.filter(function(e) { return e.id == id; })[0];
-   };
--/*
--  this.get_resources_for_types = function()
--  {
--    var types = Array.prototype.slice.call(arguments, 0);
--    var filterfun = function(e) { return types.indexOf(e.type) > -1;};
--    return this.resources.filter(filterfun);
--  };
--
--  this.get_resources_for_mimes = function()
--  {
--    var mimes = Array.prototype.slice.call(arguments, 0);
--    var filterfun = function(e) { return mimes.indexOf(e.mime) > -1; };
--    return this.resources.filter(filterfun);
--  };
--/*
--  this.get_resource_groups = function()
--  {
--    return this._groups;
--    var imgs = this.get_resources_for_types("image");
--    var stylesheets = this.get_resources_for_mimes("text/css");
--    var markup = this.get_resources_for_mimes("text/html",
--                                             "application/xhtml+xml");
--    var scripts = this.get_resources_for_mimes("application/javascript",
--                                              "text/javascript");
--
--    var known = [].concat(imgs, stylesheets, markup, scripts);
--    var other = this.resources.filter(function(e) {
--      return known.indexOf(e) == -1;
--    });
--    return {
--      markup: markup, images: imgs, stylesheets: stylesheets, 
--      scripts: scripts, other: other
--    }
--  }
--*/
- }
- 
--cls.ResourceGroup = function(name)
-+cls.ResourceGroup = function(name,type)
- {
-   this.ids = [];
-   this.name = null;
-+  this.type = null;
-   this.closed = true;
- 
--  this._init = function(name)
-+  this._init = function(name,type)
-   {
-     this.name = name;
-+    this.type = type;
-     this.ids.length = 0;
-   }
-   this.push = function( id )
-@@ -345,16 +428,10 @@
- 
- cls.ResourcePrototype = function()
- {
--  this._super_init = this._init;
-   this._init = function(id)
-   {
--    this._super_init();
--
-     this.id = id;
-     this.finished = false;
--//    debugger;
--//    this.url = 'http://localhost:8002/dragonfly-stp-1-work/src/client-en.xml';
--    //this.url = null;
-     this.location = "No URL";
-     this.result = null;
-     this.mime = null;
-@@ -363,7 +440,6 @@
-     this.type = null;
-     this.urltype = null;
-     this.invalid = false;
--
-   }
- 
-   this.update = function(eventname, eventdata)
-@@ -386,15 +462,14 @@
-       this.mime = eventdata.mimeType;
-       this.encoding = eventdata.characterEncoding;
-       this.size = eventdata.contentLength || 0;
--
--      if(eventdata.content)
--      {
--        this.data = new cls.ResourceManager["1.0"].ResourceData( eventdata );
--      }
--
-       this.finished = true;
-       this._guess_type();
-       this._humanize_url();
-+
-+      if (eventdata.content)
-+      {
-+        this.update("responsefinished", eventdata);
-+      }
-     }
-     else if (eventname == "response")
-     {
-@@ -406,13 +481,13 @@
-     }
-     else if (eventname == "urlredirect")
-     {
-+      debugger;
-       this.invalid = true;
-     }
-     else if (eventname == "responsefinished")
-     {
-       this.data = new cls.ResourceManager["1.0"].ResourceData( eventdata );
--
--      console.log(eventdata);
-+      this._get_meta_data();
-     }
-     else
-     {
-@@ -420,6 +495,22 @@
-     }
-   }
- 
-+  this._get_meta_data = function()
-+  {
-+    if (this.type == 'image')
-+    {
-+      var i=new Image();
-+      i.src=this.data.content.stringData;
-+      if(i.naturalWidth)
-+      {
-+        this.data.meta = i.naturalWidth+'x'+i.naturalHeight;
-+      }
-+      else
-+      {
-+        this.data.meta = 'vectorial image';
-+      }
-+    }
-+  }
- 
-   this._guess_type = function()
-   {
-@@ -431,7 +522,7 @@
-     {
-       if (this.mime.toLowerCase() == "application/octet-stream")
-       {
--        this.type = cls.ResourceUtil.extension_type_map/*path_to_type*/[this.url.filename.slice(this.url.filename.lastIndexOf('.')+1)];
-+        this.type = cls.ResourceUtil.extension_type_map[this.url.extension];
-       }
-       if (!this.type)
-       {
-@@ -458,6 +549,40 @@
-       this.human_url = this.url;
-     }
-   }
-+
-+  this._on_fetch_data_bound = function(callback)
-+  {
-+    return function(status,message)
-+    {
-+      if(!status){ this.update("responsefinished", message); }
-+      if(callback){ callback(this); }
-+    }.bind(this);
-+  }
-+
-+  this.fetch_data = function(callback)
-+  {
-+    const
-+    TRANSPORT_STRING = 1,
-+    TRANSPORT_DATA_URI = 3,
-+    TRANSPORT_OFF = 4,
-+    DECODE_TRUE = 1,
-+    SIZE_LIMIT = 1e7;
-+
-+    if (!this.data)
-+    {
-+      var tag = window.tagManager.set_callback(null, this._on_fetch_data_bound(callback));
-+      var responseType = cls.ResourceUtil.type_to_content_mode(this.type);
-+      var transportType = {datauri: TRANSPORT_DATA_URI}[responseType]||TRANSPORT_STRING;
-+
-+      window.services['resource-manager'].requestGetResource(tag, [this.id, [transportType, DECODE_TRUE, SIZE_LIMIT]]);
-+    }
-+    else if(callback)
-+    {
-+      callback(this);
-+    }
-+  };
-+
-+
- }
- 
- window.cls.ResourcePrototype.prototype = new URIPrototype("url");
-diff -r 7e58b19c05d0 src/resource-manager/resource_style.css
---- a/src/resource-manager/resource_style.css	Wed Jun 13 16:24:51 2012 +0200
-+++ b/src/resource-manager/resource_style.css	Wed Jun 13 16:25:03 2012 +0200
-@@ -97,17 +97,6 @@
-   background-image: url(../ui-images/type_storage.png);
- }
- 
--.--resource-detail-container
--{
--  display: block;
--  box-sizing: border-box;
--  height: 100%;
--  overflow: auto;
--  border-top: 100px solid #ccc;
--  /* is currently needed due to a bug. otherwise the scroll height is bigger than the height. */
--  position: relative;
--}
--
- .line-numbered-resource
- {
-   position: relative;
-@@ -146,6 +135,8 @@
- .resource-image
- {
-   display: block;
-+  min-width:64px;
-+  min-height:64px;
-   max-height: 100%;
-   max-width: 100%;
-   margin: 10px auto;
-@@ -225,6 +216,17 @@
- */
- 
- /* resource detail view */
-+.resource-detail-container,
-+.resource-detail-container-empty
-+{
-+  height:100%;
-+  overflow:auto;
-+}
-+.resource-detail-container-empty
-+{
-+  padding:8px;
-+  background:url("../ui-images/disabled_stripe_tile.png");
-+}
- .resource-detail-overview
- {
-   padding:8px;
-@@ -234,12 +236,23 @@
- .resource-detail-overview-url
- {
-   display:block;
--  font-weight:bold;
-   white-space:nowrap;
-   overflow:hidden;
-   text-overflow:ellipsis;
-   color:#000;
- }
-+a.external
-+{
-+  cursor: pointer;
-+  color:inherit;
-+  text-decoration:none;
-+  padding-left:17px;
-+  background:url("../ui-images/icons/icon_export.png") center left no-repeat;
-+}
-+a.external:hover
-+{
-+  text-decoration:underline;
-+}
- .resource-detail-overview-type
- {
-   display:block;
-@@ -251,7 +264,6 @@
-   overflow:auto;
-   display:inline-block;
-   width:100%;
--/*  height:100%;*/
-   box-sizing:border-box;
- }
- .resource-detail-font
-@@ -262,13 +274,15 @@
- .resource-detail-image
- {
-   -o-object-fit:contain;
-+  min-width:64px;
-+  min-height:64px;
-   max-width:300px;
-   max-height:300px;
-   margin:1em;
-   box-sizing:border-box;
-   background:url("../ui-images/grid_checkers_black.png") top left repeat;
-   box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
--  svertical-align:middle;
-+  vertical-align:middle;
- }
- 
- 
-diff -r 7e58b19c05d0 src/resource-manager/resource_templates.js
---- a/src/resource-manager/resource_templates.js	Wed Jun 13 16:24:51 2012 +0200
-+++ b/src/resource-manager/resource_templates.js	Wed Jun 13 16:25:03 2012 +0200
-@@ -26,6 +26,9 @@
- 			if( frame.parentFrameID != parentFrameID ){ continue; }
- 			
- 			var r = context.get_resource( frame.resourceID );
-+			if(!r)
-+				continue;
-+			
- 			var className = '-expand-collapse';
- 			var tmp = 
- 			{
-@@ -40,7 +43,7 @@
- 						' ',
- 						[
- 							'span',
--							((r?r.filename||r.human_url:'')||'resource information not fully available yet'),
-+							(r.filename||r.human_url),
- 							[],
- 							'data-tooltip',(r&&'js-script-select'),
- 							'data-tooltip-text',(r&&'frame: '+r.human_url)
-@@ -133,7 +136,7 @@
- 				['li',
- 					[
- 						'span',
--						(r.filename||r.human_url||'resource information not fully available yet'),
-+						(r.filename||r.human_url),
- 						[],
- 						'data-tooltip',(r&&'js-script-select'),
- 						'data-tooltip-text',(r&&groupName+': '+r.human_url)
-@@ -149,13 +152,19 @@
- 
- templates.resource_detail =
- {
--	update:function(resource, resourceData)
-+	update:function(resource)
- 	{
-+		if (!resource)
-+			return this.no_resource_selected();
-+
-+		if (!resource.data)
-+			return this.no_data_available(resource);
-+
- 		var specificTemplate = this[resource.type]?resource.type:'text';
- 
- 		return(
- 		['div',
--			this.overview(resource, resourceData),	// overview
-+			this.overview(resource),	// overview
- 			['div',	// specific template
- 				this[specificTemplate](resource, resource.data),		
- 				'title',specificTemplate,
-@@ -166,7 +175,40 @@
- 		]);
- 	},
- 
--	overview:function(resource, resourceData)
-+	no_resource_selected:function()
-+	{
-+		return(
-+		['div',
-+      'No resource selected',
-+      'class','resource-detail-container-empty'
-+    ]);
-+	},
-+
-+	no_data_available:function(resource)
-+	{
-+		return(
-+		['div',
-+      'No data available for the resource '+ resource.url,
-+      'class','resource-detail-container-empty'
-+    ]);
-+	},
-+
-+	formatting_data:function(resource)
-+	{
-+		if(!resource)
-+			return this.no_resource_selected();
-+
-+		if (!resource.data)
-+			return this.no_data_available(resource);
-+
-+		return(
-+		['div',
-+      'Formatting the resource '+ resource.url +'&hellip;',
-+      'class','resource-detail-container-empty'
-+    ]);
-+	},
-+
-+	overview:function(resource)
- 	{
- 		var info =
- 		{
-@@ -180,7 +222,13 @@
- 		return (
- 		['div',
- 			['span',
--				info.human_url,
-+				[
-+					'a',
-+					info.human_url,
-+					'href',resource.url,
-+					'target','_blank',
-+					'class','external'
-+				],
- 				'class','resource-detail-overview-url'
- 			],
- 			['span',
-@@ -188,25 +236,26 @@
- 				'class','resource-detail-overview-type'
- 			],
- 			['span',
--				info.size+' bytes'+(info.characterEncoding&&(' in '+info.characterEncoding)),
-+				cls.ResourceUtil.bytes_to_human_readable(info.size)+(info.characterEncoding&&(' in '+info.characterEncoding)),
-+				'data-tooltip','js-script-select',
-+				'data-tooltip-text',info.size+' bytes',
- 				'class','resource-detail-overview-size'
- 			],
- 			'class','resource-detail-overview'
- 		]);
- 	},
- 
--	text:function(resource, resourceData)
-+	text:function(resource)
- 	{
- 		this.name = 'text';
- 		return (
- 		[
- 			['pre',resource.data.content.stringData],
--			['p',new Option(JSON.stringify(resource)).innerHTML],
--			['p',new Option(JSON.stringify(resource.data)).innerHTML]
-+			['ptr',new Option(JSON.stringify(resource)).innerHTML]
- 		]);
- 	},
- 
--	markup:function(resource, resourceData)
-+	markup:function(resource)
- 	{
- 		var line_count = 0;
- 		var lines = [++line_count];
-@@ -221,7 +270,7 @@
- 
- 	},
- 
--	script:function(resource, resourceData)
-+	script:function(resource)
- 	{
- 		var line_count = 0;
- 		var lines = [++line_count];
-@@ -235,7 +284,7 @@
- 		]);
- 	},
- 
--	css:function(resource, resourceData)
-+	css:function(resource)
- 	{
- 		var line_count = 0;
- 		var lines = [++line_count];
-@@ -249,7 +298,7 @@
- 		]);
- 	},
- 
--	font:function(resource, resourceData)
-+	font:function(resource)
- 	{
- 		this.name = 'font';
- 
-@@ -267,7 +316,7 @@
- 		]);
- 	},
- 
--	image:function(resource, resourceData)
-+	image:function(resource)
- 	{
- 		this.name = 'image';
- 		return (
-diff -r 7e58b19c05d0 src/resource-manager/resource_test_view.js
---- a/src/resource-manager/resource_test_view.js	Wed Jun 13 16:24:51 2012 +0200
-+++ b/src/resource-manager/resource_test_view.js	Wed Jun 13 16:25:03 2012 +0200
-@@ -118,19 +118,7 @@
-   }
- 
- 
--	var eh = window.eventHandlers;
--  // fixme: this is in the wrong place! Doesn't belong in UI and even if it
--  // did, the event handler doesn't get added until the view is created
--  // which means you can't open tabs from elsewhere if you haven't opened
--  // the resources view first
--/*
--  eh.click["resources-all-open"] = this._handle_open_resource_bound;
--  eh.click['open-resource-tab'] = function(event, target)
--  {
--    var broker = cls.ResourceDisplayBroker.get_instance();
--    broker.show_resource_for_ele(target);
--  }
--*/
-+
-   var doc_service = window.services['document-manager'];
-   doc_service.addListener("abouttoloaddocument", this._on_abouttoloaddocument_bound);
-   doc_service.addListener("documentloaded", this._on_documentloaded_bound);