Re: XMLHttpRequest Priority Proposal

2010-04-14 Thread Olli Pettay

Hi Mike,

FYI,
I wrote a wip patch for Gecko.
https://bugzilla.mozilla.org/show_bug.cgi?id=559092
Test builds will be here:
https://build.mozilla.org/tryserver-builds/opet...@mozilla.com-xhr_priority/



-Olli

On 4/13/10 8:36 PM, Mike Belshe wrote:

On Tue, Apr 13, 2010 at 9:36 AM, Olli Pettay olli.pet...@helsinki.fi
mailto:olli.pet...@helsinki.fi wrote:

Hi,


Thanks for the comments.

this seems like a pretty useful, yet reasonable easily implementable
feature.


Good to hear.

I'd add 5th value NORMAL, which would be the default value.

   const unsigned short CRITICAL = 0;
   const unsigned short HIGH = 1;
   const unsigned short NORMAL = 2
   const unsigned short LOW = 3;
   const unsigned short LOWEST = 4;

Not sure if we need all the values, or would
HIGH, NORMAL, LOW be enough?



  I'm not fussy about what priorities are exposed or what we call them -
so long as they are relatively few in number to avoid unnecessary
complexity.  (e.g. 3-5 priority buckets seems fine)

Mike



-Olli



On 4/13/10 7:13 PM, Mike Belshe wrote:

Hi,

I'm a developer on the chrome team, and also working on SPDY.

Others here at Google have requested that we expose some of the
priority-based resource loading mechanics to applications so that
applications can hint to the browser more information about which
resources are critical and which are not.  Some of the Google
Apps teams
have already implemented their own, manual priority-based resource
fetchers, and our maps team saw a huge latency reduction as a
result of
doing so.  Internally to chromium and webkit, resource loading
is also
priority-aware today.  Finally, in SPDY, we've observed good
improvements by exposing priorities all the way across the
protocol.  We
believe exposing priority on the XHR object may benefit many
applications manage their resource loads.

Here is a quick writeup of one proposal which we think would work in
browsers.  We believe it is backward compatible with existing
XHR, and
can be optionally implemented.  It also leaves a fair amount of the
tuning at the discretion of the browser, so it does not create a
long-term liability in the browser.  We hope that these
considerations
make it an easy choice to approve.

I'm wondering if the XMLHttpRequest group would be interested in
taking
this on?

Thanks,
Mike


  XMLHttpRequest Priority Fetching

Every performant web browser implementation today implements various
heuristics for resource loading prioritization internally.  The
notion
is simple, that loading some resources, such as images, are less
performance critical than loading other resources, such as external
style sheets.  By implementing basic priorities, browsers achieve
substantially better performance loading web pages.  Today,
however, web
applications have no way of giving hints to the browser about
what may
be high or low priority.

Because complex applications heavily rely on resource loading by
way of
XmlHttpRequest, we propose a simple, backward compatible, and
optional
mechanism whereby application developers can hint to a browser
how to
load a XmlHttpRequest.

Proposed API:
interface XMLHttpRequest {
  // XMLHttpRequest Priorities.
  const unsigned short CRITICAL = 0;
  const unsigned short HIGH = 1;
  const unsigned short LOW = 2;
  const unsigned short LOWEST = 3;

  // Set the load priority for this request.
  void setPriority(unsigned short priority);
}



Example Usage:
var client = new XMLHttprequest;
client.setPriority(HIGH);
client.open(’GET’, ‘demo.cgi’);
client.send();



Description:
When a new XMLHttpRequest object is created, it contains a notion of
priority.  Browsers which schedule resource fetches may
optionally use
this priority to determine in which order resources are fetched.

4 priorities are provided.  By keeping the number of different
priorities small, we keep browser and XMLHttpRequest priority
implementations simple.

By default, all XMLHttpRequest objects have a priority ‘LOW’.

Applications may alter the priority by calling the setPriority()
method
on the XMLHttpRequest object.  The priority set on the object at the
time the applicaiton calls the XMLHttpRequest.send() method
determines
the priority the browser should use when fetching this resource.
  Calling setPriority() after the send() method will have no

Re: CORS Last Call status/plans? [Was: Re: [UMP] Request for Last Call]

2010-04-14 Thread Tyler Close
I have been studying CORS ISSUE-90
http://www.w3.org/2008/webapps/track/issues/90, so as to bring UMP
into line with this part of CORS. I can't find any pattern or
rationale to the selection of headers on the whitelist versus those
not on the whitelist. Does anyone know where this list came from and
how it was produced?

If I produce a more comprehensive whitelist for UMP will CORS follow my lead?

--Tyler

-- 
Waterken News: Capability security on the Web
http://waterken.sourceforge.net/recent.html



Re: Websockets API / CloseEvent and readyState

2010-04-14 Thread Olli Pettay

No comments to this?

I wish the API will be changed and the awkward CloseEvent
interface will be removed.

-Olli

On 3/18/10 12:15 AM, Olli Pettay wrote:

Hi all,

I was wondering why to have .wasClean in
close event. Is there really need for adding
yet another event interface. Especially in this case
when there are other quite simple options.
For example:
WebSocket could have state ERROR and then
in the close event listener the script could check
whether connection was closed normally, or whether the
state is ERROR and based on that try to reconnect.

In the script the change would be from
function closelistener(e) {
if (e.wasClean) {
dosomething();
} else {
reconnect();
}
}


to
function closelistener(e) {
if (this.readyState == this.CLOSED) {
dosomething();
} else {
reconnect();
}
}

.wasClean feels and sounds bad :/

-Olli









Re: CORS Last Call status/plans? [Was: Re: [UMP] Request for Last Call]

2010-04-14 Thread Tyler Close
On Wed, Apr 14, 2010 at 9:41 AM, Tyler Close tyler.cl...@gmail.com wrote:
 I have been studying CORS ISSUE-90
 http://www.w3.org/2008/webapps/track/issues/90, so as to bring UMP
 into line with this part of CORS. I can't find any pattern or
 rationale to the selection of headers on the whitelist versus those
 not on the whitelist. Does anyone know where this list came from and
 how it was produced?

 If I produce a more comprehensive whitelist for UMP will CORS follow my lead?

The following whitelist includes all end-to-end response headers
defined by HTTP, unless there is a specific security risk:

# Age
# Allow
# Cache-Control
# Content-Disposition
# Content-Encoding
# Content-Language
# Content-Length
# Content-Location
# Content-MD5
# Content-Range
# Content-Type
# Date
# ETag
# Expires
# Last-Modified
# Location
# MIME-Version
# Pragma
# Retry-After
# Server
# Vary
# Warning

Does anyone object to making this the new whitelist for both CORS and UMP?

--Tyler



Re: FormData and BlobBuilder - duplication of functionality?

2010-04-14 Thread Michael Nordman
On Tue, Apr 13, 2010 at 9:01 PM, Jonas Sicking jo...@sicking.cc wrote:

 On Tue, Apr 13, 2010 at 7:35 PM, Michael Nordman micha...@google.com
 wrote:
  Good question. Let me ask you one. What value should you use for the
  content-type header? That value needs to contain the boundary string. You
  need to know that to xhr.send the data in a way that looks like a form
  submission. Just sending the blob will be off by one and the server
 side
  won't understand it.

 There seems to be general agreement (based on various discussions here
 and on whatwg) that the .type property should be moved to the Blob
 interface. So Blobs will have a content-type. So this problem should
 be taken care of.

 / Jonas


Yes indeed!

So are we saying that FormData.toBlob() produces a blob representing the
encoded
results and having a .type property of the form...
 multipart/form-data; boundary=xxx

[Constructor] interface FormData { Blob toBlob (); void append(DOMString
name, Blob value); void append(DOMString name, DOMString value); };

Also it looks like BlobBuilder (in the draft dimich linked to) is lacking a
means for the caller to set the type attribute of the blob being built.
A couple ways that could be provided...

[Constructor] interface BlobBuilder { attribute DOMString endings;
attribute DOMString type; // option a
Blob getBlob (in DOMString type); // option b void append (in DOMString
text) raises (FileException); void append (in Blob data); };