Commits

Daniel Herzog committed 3cd9685 Draft Merge

Merged in dherzog/dragonfly-stp-1-network (pull request #64)

  • Participants
  • Parent commits 3d2c8f1, 30cd211

Comments (0)

Files changed (5)

File src/network/network_details_templates.js

       ["table",
         ["tbody",
           ["tr",
-            ["th", ui_strings.S_HTTP_LABEL_URL + ":"], ["td", entry.human_url]
+            ["th", ui_strings.S_HTTP_LABEL_URL + ":"], ["td", entry.url]
           ],
           ["tr",
             ["th", ui_strings.S_HTTP_LABEL_METHOD + ":"],

File src/network/network_style.css

 {
   display: table-cell;
   vertical-align: top;
+  white-space: nowrap;
 }
 
 .network-tooltip-container .gap_title

File src/network/network_templates.js

   return ["li",
            templates.network_request_icon(entry),
            ["span",
-             entry.short_distinguisher || entry.human_url,
+             (entry.short_distinguisher || entry.human_url).slice(0, 200),
              "class", "network-url",
              "data-tooltip", "network-url-list-tooltip"
            ],
     var event_rows = entry.event_sequence.map(templates.network_graph_tooltip_tr);
     event_rows.push(["tr",
                       ["td", duration.toFixed(2) + " ms", "class", "time_data"],
-                      ["td", ui_strings.S_HTTP_LABEL_DURATION], "class", "sum"]);
+                      ["td", ui_strings.S_HTTP_LABEL_DURATION, "class", "gap_title"],
+                     "class", "sum"]);
 
     if (!templates.network_tt_vert_padding)
     {

File src/scripts/uri.js

 {
   /*
     interface
-    
+
     hash
     host
-    pathname
+    pathname // for data: URIs, this is everything after "data:"
     protocol
     search
     filename
       if (!this._is_parsed)
         this._init();
 
-      return this["_" + prop];  
+      return this["_" + prop];
     });
     this.__defineSetter__(prop, function() {});
-    
   }, this);
 
   this.__defineGetter__("filename", function()
   {
-    if (!this._filename && (this._is_parsed || this[uri_prop_name]))
+    if (this._filename === undefined && (this._is_parsed || this[uri_prop_name]))
     {
-      var pos = this.pathname.lastIndexOf("/");
-      if (pos > -1)
-        this._filename = this.pathname.slice(pos + 1);
+      if (!this._is_data_uri)
+      {
+        var pos = this.pathname.lastIndexOf("/");
+        if (pos > -1)
+          this._filename = this.pathname.slice(pos + 1);
+        else
+          this._filename = this.pathname;
+      }
       else
-        this._filename = this.pathname;
+        this._filename = "";
     }
 
-    return this._filename;  
+    return this._filename;
   });
 
   this.__defineSetter__("filename", function() {});
 
   this.__defineGetter__("extension", function()
   {
-    if (!this._extension && (this._is_parsed || this[uri_prop_name]))
+    if (this._extension === undefined && (this._is_parsed || this[uri_prop_name]))
     {
-      var pos = this.filename.lastIndexOf(".");
-      if (pos > -1)
-        this._extension = this.filename.slice(pos + 1);
+      if (!this._is_data_uri)
+      {
+        var pos = this.filename.lastIndexOf(".");
+        if (pos > -1)
+          this._extension = this.filename.slice(pos + 1);
+        else
+          this._extension = "";
+      }
+      else
+        this._extension = "";
     }
 
-    return this._extension;  
+    return this._extension;
   });
 
   this.__defineSetter__("extension", function() {});
 
   this.__defineGetter__("dir_pathname", function()
   {
-    if (!this._dir_pathname && (this._is_parsed || this[uri_prop_name]))
+    if (this._dir_pathname === undefined && (this._is_parsed || this[uri_prop_name]))
     {
-      var pos = this.pathname.lastIndexOf("/");
-      if (pos > -1)
-        this._dir_pathname = this.pathname.slice(0, pos + 1);
+      if (!this._is_data_uri)
+      {
+        var pos = this.pathname.lastIndexOf("/");
+        if (pos > -1)
+          this._dir_pathname = this.pathname.slice(0, pos + 1);
+        else
+          this._dir_pathname = "";
+      }
       else
         this._dir_pathname = "";
     }
 
-    return this._dir_pathname;  
+    return this._dir_pathname;
   });
 
   this.__defineSetter__("dir_pathname", function() {});
 
   this.__defineGetter__("abs_dir", function()
   {
-    if (!this._abs_dir && (this._is_parsed || this[uri_prop_name]))
-      this._abs_dir = (this.protocol ? this.protocol + "//" : "") +
-                      this.host + this.dir_pathname;
+    if (this._abs_dir === undefined && (this._is_parsed || this[uri_prop_name]))
+    {
+      if (!this._is_data_uri)
+      {
+        this._abs_dir = (this.protocol ? this.protocol + "//" : "") +
+                        this.host + this.dir_pathname;
+      }
+      else
+        this._abs_dir = "";
+    }
 
-    return this._abs_dir;  
+    return this._abs_dir;
   });
 
   this.__defineSetter__("abs_dir", function() {});
 
   this.__defineGetter__("origin", function()
   {
-    if (!this._origin && (this._is_parsed || this[uri_prop_name]))
-      this._origin = this.protocol + "//" + this.host;
+    if (this._origin === undefined && (this._is_parsed || this[uri_prop_name]))
+    {
+      if (!this._is_data_uri)
+        this._origin = this.protocol + "//" + this.host;
+      else
+        this._origin = "";
+    }
 
-    return this._origin;  
+    return this._origin;
   });
-  
+
   this.__defineSetter__("origin", function() {});
 
   this.__defineGetter__("params", function()
   {
-    if (!this._params && (this._is_parsed || this[uri_prop_name]))
+    if (this._params === undefined && (this._is_parsed || this[uri_prop_name]))
     {
       this._params = [];
-      if (this._search[0] === "?")
+      if (!this._is_data_uri && this._search[0] === "?")
       {
         var pairs = this._search.slice(1).split("&");
         pairs.forEach(function(pair) {
         }, this);
       }
     }
-    return this._params;  
+    return this._params;
   });
 
   this.__defineSetter__("short_distinguisher", function() {});
 
   this.__defineGetter__("short_distinguisher", function()
   {
-    if (!this._short_distinguisher && (this._is_parsed || this[uri_prop_name]))
+    if (this._short_distinguisher === undefined && (this._is_parsed || this[uri_prop_name]))
     {
       // When pathname ends with "/", and there is search or hash,
       // the short_distinguisher is just search + hash
         var parts = this.path_parts;
         this._short_distinguisher = parts[parts.length - 1] + search_and_hash;
       }
+      else if (this._is_data_uri)
+      {
+        this._short_distinguisher = this._protocol + this._pathname + this._hash;
+      }
       else
         this._short_distinguisher = this.host;
     }
 
     if (uri)
     {
+      this._is_data_uri = uri.indexOf("data:") === 0;
       var val = uri;
 
       var pos = val.indexOf("#");
         this._hash = "";
 
       pos = val.indexOf("?");
-      if (pos > -1)
+      if (pos > -1 && !this._is_data_uri)
       {
         this._search = val.slice(pos);
         val = val.slice(0, pos);
         this._protocol = "";
 
       pos = val.indexOf("/");
-      if (pos > -1)
+      if (pos > -1 && !this._is_data_uri)
       {
         this._host = val.slice(0, pos);
         val = val.slice(pos);
       }
-      else if (this._protocol)
+      else if (this._protocol && !this._is_data_uri)
       {
-        this._host = val
+        this._host = val;
       }
       else
         this._host = "";
 
+      // pathname for a data: URI is everything after "data:" for consistency with
+      // some browsers
       if (val)
         this._pathname = val;
       else
         this._pathname = "";
 
-      if (this._pathname)
+      if (this._pathname && !this._is_data_uri)
         this._path_parts = this._pathname.split("/").filter(Boolean);
       else
         this._path_parts = [];

File tests/uri.qunit.html

   var uri = new URI("foo/bar/");
   equal(uri.short_distinguisher, "bar");
   
+  var uri = new URI("data:text/html,<p>?a=b#a");
+  equal(uri.protocol, "data:");
+  equal(uri.host, "");
+  equal(uri.pathname, "text/html,<p>?a=b");
+  equal(uri.search, "");
+  equal(uri.hash, "#a");
+  equal(uri.filename, "");
+  equal(uri.extension, "");
+  equal(uri.dir_pathname, "");
+  equal(uri.abs_dir, "");
+  deepEqual(uri.params, []);
+  deepEqual(uri.path_parts, []);
+  equal(uri.short_distinguisher, "data:text/html,<p>?a=b#a");
 });