forked from w3c/webrtc-pc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webrtc.js
288 lines (268 loc) · 11.7 KB
/
webrtc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
function markTestableAssertions() {
const sectionsToIgnore=["#abstract", "#sotd", "#conformance", ".informative", ".appendix"];
const contentToIgnore = [".untestable", ".issue", ".example", ".note", ".informative", ".has-tests", ".needs-tests", ".no-test-needed"];
const contentToIgnoreSelector = contentToIgnore.map(sel => `:not(${sel})`).join('');
[...document.querySelector("body").querySelectorAll(sectionsToIgnore.map(sel => `section:not(${sel})`).join(","))].forEach(
section => {
[...section.querySelectorAll(`p${contentToIgnoreSelector}, ol > li${contentToIgnoreSelector}`)].forEach(
el => {
let parent = el.parentNode;
do {
if (parent.matches(contentToIgnore.join(','))) return;
parent = parent.parentNode;
} while (parent.tagName !== 'SECTION' && parent.matches);
if (el.tagName === "P" && (el.textContent.match(/MUST/) || el.textContent.match(/SHALL/))) {
if (!((el.parentNode.tagName === "DD" && el.parentNode.previousElementSibling.getAttribute("data-tests") && !el.nextElementSibling) || (el.nextElementSibling && el.nextElementSibling.tagName === "OL"))) {
el.classList.add("needs-tests");
}
} else if (el.tagName === "LI" && !el.querySelector('ol')) { // Detect argument assignment cases?
el.classList.add("needs-tests");
}
})
}
);
}
function highlightTests() {
[...document.querySelectorAll("[data-tests]")].forEach(el => {
if (el.dataset['tests'])
el.classList.add("has-tests")
else
el.classList.add("needs-tests");
});
}
var respecConfig = {
// specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
specStatus: "ED",
// the specification's short name, as in http://www.w3.org/TR/short-name/
shortName: "webrtc",
useExperimentalStyles: true,
// if your specification has a subtitle that goes below the main
// formal title, define it here
// subtitle : "an excellent document",
// if you wish the publication date to be other than today, set this
// publishDate: "2014-01-27",
// if the specification's copyright date is a range of years, specify
// the start date here:
// copyrightStart: "2005",
// if there is a previously published draft, uncomment this and set its YYYY-MM-DD
prevED: "https://w3c.github.io/webrtc-pc/archives/20171002/webrtc.html",
// if this is a LCWD, uncomment and set the end of its review period
// lcEnd: "2009-08-05",
// if you want to have extra CSS, append them to this list
// it is RECOMMENDED that the respec.css stylesheet be kept
// extraCSS: ["ReSpec.js/css/respec.css"],
// extraCSS: ["../../../2009/dap/ReSpec.js/css/respec.css"],
// editors, add as many as you like
// only "name" is REQUIRED
editors: [
// { name: "Your Name", url: "http://example.org/",
// company: "Your Company", companyURL: "http://example.com/" },
{ name: "Cullen Jennings", company: "Cisco",
w3cid: "25254"
},
{ name: "Henrik Boström", company: "Google",
w3cid: "96936"
},
{ name: "Jan-Ivar Bruaroey", company: "Mozilla",
w3cid: "79152"
}
],
formerEditors: [
{ name: "Adam Bergkvist", company: "Ericsson",
w3cid: "45507", retiredDate: "2018-06-01"
},
{ name: "Daniel C. Burnett", company: "Invited Expert",
w3cid: "85118", retiredDate: "2018-06-01"
},
{ name: "Anant Narayanan", company: "Mozilla",
w3cid: "47326", retiredDate: "2012-11-01"
},
{ name: "Bernard Aboba", company: "Microsoft Corporation",
w3cid: "65611", retiredDate: "2017-03-01"
},
{ name: "Taylor Brandstetter", company: "Google",
w3cid: "82908", retiredDate: "2018-06-01"
},
],
// authors, add as many as you like.
// This is optional, uncomment if you have authors as well as editors.
// only "name" is REQUIRED. Same format as editors.
//authors: [
// { name: "Your Name", url: "http://example.org/",
// company: "Your Company", companyURL: "http://example.com/" }
//],
// name of the WG
wg: "Web Real-Time Communications Working Group",
// URI of the public WG page
wgURI: "https://www.w3.org/2011/04/webrtc/",
// name (without the @w3c.org) of the public mailing to which comments are due
wgPublicList: "public-webrtc",
// URI of the patent status for this WG, for Rec-track documents
// !!!! IMPORTANT !!!!
// This is important for Rec-track documents, do not copy a patent URI from a random
// document unless you know what you're doing. If in doubt ask your friendly neighbourhood
// Team Contact.
wgPatentURI: "https://www.w3.org/2004/01/pp-impl/47318/status",
testSuiteURI: "https://github.com/web-platform-tests/wpt/tree/master/webrtc/",
implementationReportURI: "https://wpt.fyi/webrtc",
previousMaturity: "CR",
previousPublishDate: "2018-09-27",
lint: {
"wpt-tests-exist": true
},
github: {
repoURL: "https://github.com/w3c/webrtc-pc/",
branch: "master"
},
otherLinks: [
{
key: "Participate",
data: [
{
value: "Mailing list",
href: "https://lists.w3.org/Archives/Public/public-webrtc/"
},
{
value: "IETF RTCWEB Working Group",
href: "https://tools.ietf.org/wg/rtcweb/"
}
],
}
],
xref: ["dom", "hr-time", "webidl", "html", "mediacapture-streams", "fileapi", "webrtc-stats"],
preProcess: [
highlightTests,
markTestableAssertions,
function linkToJsep() {
require(["core/pubsubhub"], function(pubsubhub){
var xhr = new XMLHttpRequest();
xhr.open('GET', 'jsep-mapping/map.json');
xhr.onload = function(e) {
var data = JSON.parse(this.responseText);
if (respecConfig.localBiblio.JSEP.date !== data.metadata.date) {
pubsubhub.pub("warn", "Date of JSEP draft in localBiblio (" + respecConfig.localBiblio.date + ") does not match date of JSEP draft used in map.json (" + data.metadata.date + ").");
}
// Replace all
// <span data-jsep="foo">[[!JSEP]]</a>
// with
// <span>[[!JSEP]] (<a href="...#X.Y">section X.Y.</a>)
// based on mapping maintained in jsep-mapping/map.json
Array.prototype.forEach.call(
document.querySelectorAll("*[data-jsep]"),
function (el) {
var jsepAnchors = el.dataset.jsep.split(" ");
var jsepSections = jsepAnchors.map(function (s) { return data.sections["sec." + s] || data.sections["sec-" + s];});
if (jsepSections.indexOf(undefined) !== -1) {
pubsubhub.pub("warn", "Reference to inexistent JSEP section in '" + el.dataset.jsep + "': unrecognized anchor #" + jsepSections.indexOf(undefined) + " 'sec." + jsepAnchors[jsepSections.indexOf(undefined)] + "'.");
return;
}
el.removeAttribute("data-jsep");
el.appendChild(document.createTextNode(" ("));
jsepSections.forEach(function (s, i) {
var sectionLink = document.createElement("a");
sectionLink.href = "https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-" + data.metadata.version + "#section-" + s.slice(0, s.length - 1);
sectionLink.textContent = "section " + s;
if (i > 0) {
if (i == jsepSections.length - 1) {
el.appendChild(document.createTextNode(" and "));
} else {
el.appendChild(document.createTextNode(", "));
}
}
el.appendChild(sectionLink);
});
el.appendChild(document.createTextNode(")"));
});
};
xhr.send();
});
}
],
postProcess: [
function showTestAnnotations() {
if (location.search.match(/viewTests/)) {
toggleTestAnnotations();
}
}
],
afterEnd: function markFingerprinting () {
Array.prototype.forEach.call(
document.querySelectorAll(".fingerprint"),
function (el) {
var img = new Image();
img.src = "images/fingerprint.png";
img.alt = "(This is a fingerprinting vector.)";
img.width = 15;
img.height = 21;
el.appendChild(img);
});
},
localBiblio: {
"JSEP": {
"authors":["Justin Uberti","Cullen Jennings","Eric Rescorla"],
"href": "https://tools.ietf.org/html/draft-ietf-rtcweb-jsep/",
"publisher": "IETF",
"status": "Active Internet-Draft",
"title": "Javascript Session Establishment Protocol",
"date": "22 October 2018"
},
"MMUSIC-RID": {
"authors":["Adam Roach"],
"href": "https://tools.ietf.org/html/draft-ietf-mmusic-rid/",
"publisher": "IETF",
"status": "Active Internet-Draft",
"title": "RTP Payload Format Restrictions",
"date": "15 May 2018"
},
"MMUSIC-SIMULCAST": {
"authors":["Bo Burman","Magnus Westerlund","Suhas Nandakumar", "Mo Zanaty"],
"href": "https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast/",
"publisher": "IETF",
"status": "Active Internet-Draft",
"title": "Using Simulcast in SDP and RTP Sessions",
"date": "27 June 2018"
},
"STUN-PARAMETERS": {
"authors":["IETF"],
"href": "https://www.iana.org/assignments/stun-parameters/stun-parameters.xhtml#stun-parameters-6",
"publisher": "IANA",
"status": "IANA Parameter Assignment",
"title": "STUN Error Codes",
"date": "April 2011"
},
"IANA-HASH-FUNCTION": {
"href": "https://www.iana.org/assignments/hash-function-text-names/hash-function-text-names.xml",
"publisher": "IANA",
"title": "Hash Function Textual Names"
},
"WEBRTC-IDENTITY": {
"authors": [
"Adam Bergkvist",
"Daniel Burnett",
"Cullen Jennings",
"Anant Narayanan",
"Bernard Aboba",
"Taylor Brandstetter"
],
"href": "https://w3c.github.io/webrtc-identity/identity.html",
"title": "Identity for WebRTC 1.0",
"status": "CR",
"publisher": "W3C",
"deliveredBy": [
"https://www.w3.org/2011/04/webrtc/"
],
"rawDate": "2018-06-21",
"edDraft": "https://w3c.github.io/webrtc-pc/identity.html"
}
}
};
function toggleTestAnnotations() {
if (!document.querySelector("[data-navigable-selector]")) {
const navigationScript = document.createElement("script");
navigationScript.setAttribute("data-navigable-selector", ".needs-tests");
navigationScript.setAttribute("src", "https://w3c.github.io/htmldiff-nav/index.js");
document.querySelector("head").appendChild(navigationScript);
}
document.querySelector("body").classList.toggle("testcoverage");
}
window.respecUI.addCommand("Toggle test annotations", toggleTestAnnotations);