Skip to content

Instantly share code, notes, and snippets.

View annevk's full-sized avatar

Anne van Kesteren annevk

View GitHub Profile
@annevk
annevk / gist:6295844
Last active December 21, 2015 10:59
zip fragments

Overview

This is a revision of https://gist.github.com/annevk/6174119 focusing on putting the semantics in the fragment identifier instead. The fragment identifier would follow http://www.w3.org/TR/media-frags/ (media-frags) and we'd introduce a new keyword http://www.w3.org/TR/media-frags/#processing-name-value-lists "path":

The general structure would be:

{URL-to-zip}#{media-frags}

http://fetch.spec.whatwg.org/ would be modified to support sub-responses for zip resources. First the resource would be fetched and then if it's a zip resource (signature sniffing) the fragment identifier would be processed per media-frags. The "path" keyword would be used to locate the sub-resource.

@annevk
annevk / gist:6174119
Created August 7, 2013 13:38
zip URLs

Overview

There's an idea floating around of introducing a zip URL for resources. The general structure would be:

zip:{URL-to-zip}!{relative-URL-inside-zip}

Lack of ! is a parsing failure.

The zip URL works by (URL) parsing everything between zip: and ! against a base URL (if any).

@annevk
annevk / gist:5496188
Created May 1, 2013 16:00
bz describing fetching in Gecko.
[12:47] <annevk> bz: So now I've got http://fetch.spec.whatwg.org/#requests as architecture for fetching, mostly based on Hixie's work in HTML and my work in CORS. However, I've gotten the impression that browsers have a slightly different architecture. One that involves at least a global object of sorts.
[12:48] <annevk> bz: I'm wondering if I should attempt to reconcile the two. E.g. once a global object dies (removal of an <iframe>) we might want to kill all associated fetches as happens now.
[12:52] <annevk> The global object (or browsing context or whatever we use) can also be used to find out some information, such as the origin, CSP policy, and maybe referrer?
[13:45] <bz> annevk: good morning
[13:45] * bz reads up
[13:45] <annevk> bz: good afternoon ;)
[13:48] <bz> hmm
[13:48] <bz> So I can describe the setup in Gecko if you want
[13:48] <bz> Note that I'm not sure it's a great setup
[13:48] <bz> In fact, it has some crappy bits. ;)
@annevk
annevk / gist:5238964
Last active December 15, 2015 09:29
on() / off() sketch.
Using some experimental JS IDL syntax:
augment EventTarget {
EventTarget on(String type, EventListener callback,
{boolean ignoreBubbles?,
String? filter = null,
enum("capturing", "target", "bubbling") phase = "bubbling",
String? marker = null});
EventTarget off(String type, EventListener callback);
EventTarget off({ String? type = null, String? marker = null });
callback EventCallback = void (Event event);
dictionary EventOptions {
DOMString filter; // selector (only useful if target is an element)
boolean capture = false; // (!capture && !bubble) target
boolean bubble; // (capture && !bubble) capture + target
// (capture && bubble) capture + target + bubble
boolean ignoreBubbles = true; // ignore bubbles attribute
}
partial interface EventTarget {