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
|
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="http://mochi.test:8888/tests/SimpleTest/test.css?resource-timing-nocors"/>
<!--
This document has the origin http://mochi.test:8888.
The resource timing of any all sub-resources should be reported, except for
any sub-resources of any cross-origin resources that are loaded.
Note that the resource timing of the original cross-origin resource should
itself be reported. The goal here is to not reveal which sub-resources are
loaded by any cross-origin resources (the fact that any given cross-origin
resource itself is loaded is known to the original origin).
In the comments below, the following annotations apply:
[r] - this resource should be reported by performance.getEntries()
[!] - this resource should be excluded from performance.getEntries()
-->
<!-- 1. [r] http://mochi.test:8888 , generateCss.sjs?A
[r] http://mochi.test:8888 , generateCss.sjs?B
-->
<link rel="stylesheet" type="text/css" href="generateCss.sjs?A"/>
<!-- 2. [r] http://example.com , generateCss.sjs?C
[!] http://example.com , generateCss.sjs?D
-->
<link rel="stylesheet" type="text/css" href="http://example.com/tests/dom/tests/mochitest/general/generateCss.sjs?C"/>
<!-- 3. [r] http://example.com , generateCss.sjs?E
[!] http://mochi.test:8888 , generateCss.sjs?F
-->
<link rel="stylesheet" type="text/css" href="http://example.com/tests/dom/tests/mochitest/general/generateCss.sjs?E"/>
<!-- 4. [r] http://mochi.test:8888 , generateCss.sjs?G
[r] http://mochi.test:8888 , generateCss.sjs?H
[r] http://example.com , generateCss.sjs?I
[!] http://example.com , generateCss.sjs?J
[r] http://example.org , generateCss.sjs?K
[!] http://example.org , generateCss.sjs?L
[!] http://example.org , generateCss.sjs?M
-->
<link rel="stylesheet" type="text/css" href="generateCss.sjs?G"/>
<!-- 6. background-image: url()
[r] http://example.net , generateCss.sjs?O
[!] http://example.net , red.png
-->
<link rel="stylesheet" type="text/css" href="http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?O"/>
<!-- 7. @font-face
[r] http://example.net , generateCss.sjs?P
[!] http://example.net , Ahem.tff
-->
<link rel="stylesheet" type="text/css" href="http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?P"/>
<!-- 8. cursor: url()
[r] http://example.net , generateCss.sjs?Q
[!] http://example.net , over.png
-->
<link rel="stylesheet" type="text/css" href="http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?Q"/>
<!-- 9. mask: url(res.svg#mask)
TODO: I don't think this is working properly. Must fix.
[r] http://example.net , generateCss.sjs?R
[!] http://example.net , file_use_counter_svg_fill_pattern_data.svg
-->
<link rel="stylesheet" type="text/css" href="http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?R"/>
<!-- TODO: add test that we _do_ include subresources if the cross-origin sheet was fetched via CORS -->
<script type="application/javascript">
function ok(cond, message) {
window.opener.ok(cond, message)
}
function is(received, expected, message) {
window.opener.is(received, expected, message);
}
function isnot(received, notExpected, message) {
window.opener.isnot(received, notExpected, message);
}
var allResources = {
"http://mochi.test:8888/tests/SimpleTest/test.css?resource-timing-nocors" : "link",
// 1
"http://mochi.test:8888/tests/dom/tests/mochitest/general/generateCss.sjs?A" : "link",
"http://mochi.test:8888/tests/dom/tests/mochitest/general/generateCss.sjs?B" : "css",
// 2
"http://example.com/tests/dom/tests/mochitest/general/generateCss.sjs?C" : "link",
// 3
"http://example.com/tests/dom/tests/mochitest/general/generateCss.sjs?E" : "link",
// 4
"http://mochi.test:8888/tests/dom/tests/mochitest/general/generateCss.sjs?G" : "link",
"http://mochi.test:8888/tests/dom/tests/mochitest/general/generateCss.sjs?H" : "css",
"http://example.com/tests/dom/tests/mochitest/general/generateCss.sjs?I" : "css",
"http://example.org/tests/dom/tests/mochitest/general/generateCss.sjs?K" : "css",
// 6
"http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?O" : "link",
// 7
"http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?P" : "link",
// 8
"http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?Q" : "link",
// 9
"http://example.net/tests/dom/tests/mochitest/general/generateCss.sjs?R" : "link",
};
window.onload = function() {
let entries = performance.getEntriesByType('resource');
for (let entry of entries) {
//dump(entry.name + " || "+ entry.initiatorType+ "\n");
if (!(entry.name in allResources)) {
if (entry.name.substr(-4) == ".ttf") {
// TODO: fix hiding of font files
continue;
}
ok(false, "Did not expect timing for resource: " + entry.name);
continue;
}
let resType = allResources[entry.name];
is(entry.initiatorType, resType,
"Expected matching initiatorType for: " + entry.name);
delete allResources[entry.name];
}
for (let res in allResources) {
ok(false, "Expect timing for resource: " + res);
}
window.opener.finishTests();
}
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1180145"
title="Resource timing NO-CORS CSS">
Bug #1180145 - Resource Timing NO-CORS CSS
</a>
<p id="display"></p>
<div id="content">
</div>
<div class="c1"> BLUE </div>
<div class="c2"> RED </div>
<div class="c3"> Font </div>
<div class="c4"> CURSOR </div>
<div class="c5"> <img id="image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg=="> </div>
<div class="c6"> </div>
</body>
</html>
|